[Gmsh] Point In Edge - a workaround with issues

Christophe Geuzaine cgeuzaine at uliege.be
Fri Apr 24 13:51:54 CEST 2020


Dear Mathias,

Just add the point in the fragment as well:

// 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};

// Add point on edge that should be vertex of mesh
crit_pt_id = newp;
Point(crit_pt_id) = {0, -0.5*box_w, 0};

BooleanFragments{Volume{3}; Delete;} {Volume{boxes()}; Point{crit_pt_id}; Delete;}

// 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;

Christophe



> On 24 Apr 2020, at 11:49, Mathias Scheunert <ms79vary at mailserver.tu-freiberg.de> wrote:
> 
> 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
> 
> <MWE_point_on_edge.geo>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine






More information about the gmsh mailing list