Skip to content
Snippets Groups Projects
Commit abf1bf29 authored by Gaetan Bricteux's avatar Gaetan Bricteux
Browse files

tests

parent a3c77b7e
No related branches found
No related tags found
No related merge requests found
lc = 0.1; lc = 0.1;
Point(1) = {0.0,0.0,0.0,lc}; Point(1) = {0.0,0.0,0.0,lc};
Point(2) = {1,0.0,0.0,lc}; Point(2) = {1,0.0,0.0,lc};
...@@ -12,25 +13,11 @@ Plane Surface(6) = {5}; ...@@ -12,25 +13,11 @@ Plane Surface(6) = {5};
Extrude {0,0.0,1} { Extrude {0,0.0,1} {
Surface{6}; Surface{6};
} }
Physical Surface("back") = {6};
Mesh 3; Physical Surface("right") = {15};
Levelset Plane (1) = {0,-1,0,0.5}; Physical Surface("bottom") = {19};
Levelset Plane (2) = {-1,0,0,0.5}; Physical Surface("left") = {23};
Levelset Sphere (3) = {{0.75,0.5,0.5},0.5}; Physical Surface("top") = {27};
Levelset Ellipsoid (4) = { {0,0,0}, {1,0,0}, 0.45, 0.25, 0.75 }; Physical Surface("front") = {28};
Levelset MathEval (5) = "(x-0.5)^2+(y-0.5)^2+(z-0.5)^2-0.5^2"; Physical Volume("vol")={1};
Levelset MathEval (6) = "-((x-0.5)^2+(y-0.5)^2+(z-0.5)^2-0.4^2)";
Levelset Sphere (7) = {{0.75,0.5,0.5},0.4};
Levelset Intersection (10) = {1,2,3};
Levelset Intersection (11) = {5,6};
Levelset Cut (12) = {3,7};
Levelset Point(13)={{0.5,0,0},{0.5,0.5,0.},{0.5,1,0},{0.5,0,0.5},{0.5,0,0.8},{0.5,0.5,0.5},{0.5,0.5,1},{0.5,1,0.5},{1.5,1,1}};
Levelset CutMeshTri {5};
Print "cube_cut.msh";
lc = 0.1;
Point(1) = {0.0,0.0,0.0,lc};
Point(2) = {1,0.0,0.0,lc};
Point(3) = {1,1,0.0,lc};
Point(4) = {0,1,0.0,lc};
Line(1) = {4,3};
Line(2) = {3,2};
Line(3) = {2,1};
Line(4) = {1,4};
Line Loop(5) = {2,3,4,1};
Plane Surface(6) = {5};
Extrude {0,0.0,1} {
Surface{6};
}
Physical Point (1) = {1};
Physical Point (2) = {2};
Physical Point (3) = {3};
Physical Point (4) = {4};
Physical Line (1) = {1};
Physical Line (2) = {2};
Physical Line (3) = {3};
Physical Line (4) = {4};
Physical Surface("back") = {6};
Physical Surface("right") = {15};
Physical Surface("bottom") = {19};
Physical Surface("left") = {23};
Physical Surface("top") = {27};
Physical Surface("front") = {28};
Physical Volume("vol") = {1};
Mesh 3;
// Definition of the levelsets
Levelset MathEval (1) = "x^2+y^2-0.8";
Levelset Plane (2) = {0,0,1,-0.5};
Levelset Union (3) = {1,2};
Levelset CutMesh {3};
from gmshpy import *
import math
#Define levelset
ls1 = gLevelsetMathEval('x^2+y^2-0.8',1)
ls2 = gLevelsetPlane(0,0,1,-0.5,2)
ls3 = gLevelsetUnion([ls1,ls2])
#Mesh geometry
mesh = GModel()
mesh.load("cube.geo")
mesh.mesh(3)
#Cut mesh
model1 = GModel()
model1 = mesh.buildCutGModel(ls3, True, False) # ls, cutElements?, write triangles?
model1.save("cube2.msh")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment