Dear developers and users,

**** The goal*

We want to create a checkerboard model to run some resolution studies with our FE software.

For that, we construct a geometry consisting of a large box which includes an arbitrary amount of small boxes at an arbitrary position using the OpenCascade kernel features.

Subsequently, we add some arbitrary points to that geometry which we need to be part of the 3D mesh, i.e. which should be contained in mesh as mesh vertices.

In case of these points are located within any face or volume of the geometry, `|Point | Curve { expression-list } In Surface { expression };`| or `|Point | Curve { expression-list } In Volume { expression };` |does it's job very well!

However, if points are accidentally located on edges, making them part of the mesh vertex list is not possible as unfortunately there is no `|Point | Curve { expression-list } In Line { expression };` | so far.


**** The workaround*

We tried to force Gmsh adding that points to the edges by defining small lines which we add to the surface that belongs to the respective edges.

-> Please have a look on the attached MWE, that illustrates our approach.


**** The problem
*

We are controlling the cell sizes by using a combination of filter.

When changing the scales of our geometry or changing the parameter set of our filters, meshing sometimes fails without any - at least for us - understandable reason.

-> Please try using line 6 instead of line 5 in the MWE.


Does somebody have a hint how to fix that?

Or, does somebody have an even better workaround for subsequently adding points to edges?
**


Best regards,
Mathias

ps: We are using Gmsh 4.5.6.

--
Dr. Mathias Scheunert
Institute of Geophysics and Geoinformatics, TU Bergakademie Freiberg
Gustav-Zeuner-Str. 12, D-09596 Freiberg
Tel.: +493731393630

// Gmsh project, tested with Gmsh 4.5.6
SetFactory("OpenCASCADE");

// Problem parameter
size_at_point = 1;  // fails!
//size_at_point = 10; // works!
domain_w = 1e6;
box_w = 1e2;

// Set Volumes
Box(1) = {-box_w, -box_w, -box_w, box_w, box_w, box_w};
Box(2) = {0, -box_w, -box_w, box_w, box_w, box_w};
boxes() = {1, 2};
Box(3) = {-domain_w, -domain_w, -domain_w, 2*domain_w, 2*domain_w, domain_w};
BooleanFragments{Volume{3}; Delete;} {Volume{boxes()}; Delete;}

// Add point on edge that should be vertex of mesh
crit_pt_id = newp;
Point(crit_pt_id) = {0, -0.5*box_w, 0};
tmp_coo() =  Point{crit_pt_id};
tmp_pt_id = newp;
tmp_pts() = {tmp_pt_id, crit_pt_id};
Point(tmp_pt_id) = {tmp_coo(0), tmp_coo(1), tmp_coo(2)-size_at_point};          
// add dummy point
tmp_ln_id = newl;
Line(tmp_ln_id) = {crit_pt_id, tmp_pt_id};                                      
// add dummy line
For v In {0:#boxes()-1}
        tmp_surfs() = Abs(Boundary{Volume{boxes(v)};});
        // Search those box faces, which include the point AND the dummy point
        For s In {0:#tmp_surfs()-1}
                tmp_bb() = BoundingBox Surface{tmp_surfs(s)};
                pt_in_bb() = Point In BoundingBox{tmp_bb(0), tmp_bb(1), 
tmp_bb(2), tmp_bb(3), tmp_bb(4), tmp_bb(5)};
                        If (#pt_in_bb() > 5)
                                Line{tmp_ln_id} In Surface{tmp_surfs(s)};       
// add dummy line to resp. face
                        EndIf
        EndFor
EndFor

// Cell sizes at point
pad = 0.5;
Field[1] = Distance;
Field[1].NodesList = {crit_pt_id};
Field[10] = Threshold;
Field[10].IField = 1;
Field[10].LcMin = size_at_point;
Field[10].DistMin = 2*size_at_point;
Field[10].LcMax = pad*domain_w;
Field[10].DistMax = pad*domain_w;
// Set background field
Field[100] = Min;
Field[100].FieldsList = {10};
Background Field = {100};
Mesh.CharacteristicLengthFromPoints = 0;
Mesh.CharacteristicLengthFromCurvature = 0;
Mesh.CharacteristicLengthExtendFromBoundary = 0;

Mesh 3;
_______________________________________________
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh

Reply via email to