|
| 1 | +// Geometry file for the turek.py example. |
| 2 | +// |
| 3 | +// This is a generalized description of the setup defined by Turek and Hron, |
| 4 | +// which requires the following lenghts to be supplied externally, using the |
| 5 | +// numbers argument of mesh.gmsh or the -setnumber switch when invoking the |
| 6 | +// gmsh application directly: |
| 7 | +// |
| 8 | +// - channel_length: length of the fluid domain |
| 9 | +// - channel_height: height of the fluid domain |
| 10 | +// - x_center: horizontal position of the cylinder measured from the left edge |
| 11 | +// - y_center: vertical position of the cylinder measured from the bottom edge |
| 12 | +// - cylinder_radius: radius of the cylinder |
| 13 | +// - structure_length: length of the elastic structure measured from the cylinder wall |
| 14 | +// - structure_thickness: thickness of the elastic structure |
| 15 | +// - min_elemsize: mesh element size at the solid/fluid interface |
| 16 | +// - max_elemsize: mesh element size at the channel wall and far field |
| 17 | +// |
| 18 | +// The parameterization matches largely that of Table 1 of Turek and Hron 2006, |
| 19 | +// with the main difference that reference points A and B cannot be |
| 20 | +// independently placed but are always located at the tip of the elastic |
| 21 | +// structure and the leading edge of the cylinder, respectively. |
| 22 | + |
| 23 | +SetFactory("OpenCASCADE"); |
| 24 | + |
| 25 | +Rectangle(1) = {0, 0, 0, channel_length, channel_height}; |
| 26 | +Rectangle(2) = {x_center, y_center - structure_thickness/2, 0, cylinder_radius + structure_length, structure_thickness, 0}; |
| 27 | +Disk(3) = {x_center, y_center, 0, cylinder_radius}; |
| 28 | +BooleanDifference(4) = { Surface{2}; }{ Surface{3}; }; |
| 29 | +BooleanDifference(5) = { Surface{1}; }{ Surface{2,3}; }; |
| 30 | +A = newp; Point(A) = {x_center + cylinder_radius + structure_length, y_center, 0}; |
| 31 | +B = newp; Point(B) = {x_center - cylinder_radius, y_center, 0}; |
| 32 | + |
| 33 | +// At this point surface 3 (cylinder), 4 (solid domain) and 5 (fluid domain) are |
| 34 | +// non-overlapping. Gmsh promises that the boolean fragments operation with |
| 35 | +// deletion will reuse the surface IDs for the new objects. |
| 36 | + |
| 37 | +_() = BooleanFragments{ Surface{3,4,5}; Point{A,B}; Delete; }{}; |
| 38 | + |
| 39 | +// Fragments deduplicates boundary segments, which means that we can now |
| 40 | +// perform boolean operations on the index sets. |
| 41 | + |
| 42 | +bnd_cylinder() = Abs(Boundary{ Surface{3}; }); |
| 43 | +bnd_structure() = Abs(Boundary{ Surface{4}; }); |
| 44 | +tmp = bnd_structure(); |
| 45 | +bnd_structure -= bnd_cylinder(); |
| 46 | +bnd_cylinder -= tmp(); |
| 47 | +bnd_fluid() = Abs(Boundary{ Surface{5}; }); |
| 48 | +bnd_fluid -= bnd_structure(); |
| 49 | +bnd_fluid -= bnd_cylinder(); |
| 50 | + |
| 51 | +// After subtracting the inner boundaries, only the four boundary segments of |
| 52 | +// rectangle 1 remain in bnd_fluid, and we are going to assume that they are |
| 53 | +// ordered bottom, right, top, left. |
| 54 | + |
| 55 | +Physical Surface("fluid") = {5}; |
| 56 | +Physical Line("inlet") = {bnd_fluid(3)}; |
| 57 | +Physical Line("outlet") = {bnd_fluid(1)}; |
| 58 | +Physical Line("wall") = {bnd_fluid(0), bnd_fluid(2)}; |
| 59 | +Physical Line("cylinder") = {bnd_cylinder()}; |
| 60 | +Physical Line("structure") = {bnd_structure()}; |
| 61 | +Physical Point("A") = {A}; |
| 62 | +Physical Point("B") = {B}; |
| 63 | + |
| 64 | +// The element size is set to be uniformly min_elemsize inside the elastic |
| 65 | +// structure, and grow linearly to max_elemsize in the fluid domain over a |
| 66 | +// distance of half the channel height. |
| 67 | + |
| 68 | +Mesh.MeshSizeFromPoints = 0; |
| 69 | +Mesh.MeshSizeFromCurvature = 0; |
| 70 | +Mesh.MeshSizeExtendFromBoundary = 0; |
| 71 | +Field[1] = Distance; |
| 72 | +Field[1].SurfacesList = {3,4}; |
| 73 | +Field[2] = Threshold; |
| 74 | +Field[2].InField = 1; |
| 75 | +Field[2].DistMin = 0; |
| 76 | +Field[2].DistMax = channel_height/2; |
| 77 | +Field[2].SizeMin = min_elemsize; |
| 78 | +Field[2].SizeMax = max_elemsize; |
| 79 | +Background Field = 2; |
0 commit comments