<div dir="auto">Christophe, you are reading my mind! I was looking at this solution using fields but I couldn't find an example. <div dir="auto">Thanks</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 3 juil. 2019 20:16, Christophe Geuzaine <<a href="mailto:cgeuzaine@uliege.be">cgeuzaine@uliege.be</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi guys,<br>
<br>
All 3 cases work for me with Gmsh 4.4... (Some earlier versions had indeed an issue with preseance of mesh size specs on points with OCC.)<br>
<br>
Here is a 4th method, which IMHO gives an even nicer result:<br>
<br>
// **************<br>
SetFactory("OpenCASCADE");<br>
Rectangle(1) = {-0.7, -0.2, 0, 1, 0.5, 0.1};<br>
<br>
Point(9) = {-0.39, 0.21, 0, 1.0};<br>
Point(10) = {-0.25, 0.14, 0, 1.0};<br>
Point(11) = {-0.12, -0.05, 0, 1.0};<br>
Point(12) = {-0.03, 0.12, 0, 1.0};<br>
Point(13) = {0.14, 0.12, 0, 1.0};<br>
Spline(9) = {9, 10, 11, 12, 13};<br>
<br>
BooleanFragments{ Surface{1}; Delete; }{ Curve{9}; Delete; }<br>
<br>
Field[1] = Distance;<br>
Field[1].NNodesByEdge = 200;<br>
Field[1].EdgesList = {9};<br>
<br>
Field[2] = Threshold;<br>
Field[2].IField = 1;<br>
Field[2].LcMin = 0.005;<br>
Field[2].LcMax = 0.05;<br>
Field[2].DistMin = 0.01;<br>
Field[2].DistMax = 0.1;<br>
<br>
Background Field = 2;<br>
<br>
Mesh.Algorithm = 6;<br>
Mesh.CharacteristicLengthExtendFromBoundary = 0;<br>
// **************<br>
<br>
Christophe<br>
<br>
> On 3 Jul 2019, at 19:41, Max Orok <<a href="mailto:morok@mevex.com" target="_blank" rel="noreferrer">morok@mevex.com</a>> wrote:<br>
> <br>
> Hi there, <br>
> <br>
> I was able to get your script to work using the PointsOf function with the curve to specify the characteristic length. I also was able to directly list the tags in the characteristic length call, but only after removing the 1.0 characteristic length parameter that was the fourth argument to the Point initialization calls. In contrast, PointsOf seems to work even when the length is specified earlier. Perhaps there is a subtle difference somewhere between PointsOf and directly listing tags for this command? I've named the two working cases A (using PointsOf) and B (directly specifying the tags without setting the characteristic length earlier).<br>
> <br>
> Here is the modified script with the other cases commented out in case you'd like to try them: <br>
> <br>
> // -- <br>
> <br>
> SetFactory("OpenCASCADE");<br>
> Rectangle(1) = {-0.7, -0.2, 0, 1, 0.5, 0.1};<br>
> <br>
> //------------------------------------------------------------------------------<br>
> <br>
> <br>
> // case A: specify a value, only to be changed later <br>
> Point(9) = {-0.39, 0.21, 0, 1.0};<br>
> Point(10) = {-0.25, 0.14, 0, 1.0};<br>
> Point(11) = {-0.12, -0.05, 0, 1.0};<br>
> Point(12) = {-0.03, 0.12, 0, 1.0};<br>
> Point(13) = {0.14, 0.12, 0, 1.0};<br>
> <br>
> Spline(9) = {9, 10, 11, 12, 13};<br>
> <br>
> // works even if the characteristic length was set initialization ^<br>
> Characteristic Length { PointsOf{ Curve{9}; } } = 0.01;<br>
> <br>
> <br>
> //------------------------------------------------------------------------------<br>
> <br>
> /*<br>
> // case B: don't specify the characteristic lengths <br>
> Point(9) = {-0.39, 0.21, 0};<br>
> Point(10) = {-0.25, 0.14, 0};<br>
> Point(11) = {-0.12, -0.05, 0};<br>
> Point(12) = {-0.03, 0.12, 0};<br>
> Point(13) = {0.14, 0.12, 0};<br>
> <br>
> Spline(9) = {9, 10, 11, 12, 13};<br>
> <br>
> // only works if the characteristic length wasn't set on initialization<br>
> Characteristic Length { 9,10,11,12,13 } = 0.01;<br>
> */<br>
> <br>
> // maybe a subtle difference between PointsOf and directly specifying tags?<br>
> <br>
> //------------------------------------------------------------------------------<br>
> <br>
> /*<br>
> // case C: specify the characteristic lengths then use the tags directly <br>
> // DOESN'T WORK <br>
> Point(9) = {-0.39, 0.21, 0, 1.0};<br>
> Point(10) = {-0.25, 0.14, 0, 1.0};<br>
> Point(11) = {-0.12, -0.05, 0, 1.0};<br>
> Point(12) = {-0.03, 0.12, 0, 1.0};<br>
> Point(13) = {0.14, 0.12, 0, 1.0};<br>
> <br>
> Spline(9) = {9, 10, 11, 12, 13};<br>
> <br>
> // only works if the characteristic length wasn't set on initialization<br>
> Characteristic Length { 9,10,11,12,13 } = 0.01;<br>
> */<br>
> <br>
> //------------------------------------------------------------------------------<br>
> <br>
> BooleanFragments{ Surface{1}; Delete; }{ Curve{9}; Delete; }<br>
> <br>
> // -- <br>
> <br>
> This probably wasn't your issue, but I had also forgotten about setting a minimum characteristic length option, which stopped me from manually setting the characteristic lengths at first. <br>
> <br>
> Sincerely,<br>
> Max <br>
> <br>
> p.s. here are pictures of each case: <br>
> <br>
> Case A: <br>
> <image.png> <br>
> <br>
> Case B (looks the same as Case A to me): <br>
> <image.png><br>
> <br>
> Case C (broken): <br>
> <image.png><br>
> <br>
> <br>
> On Wed, Jul 3, 2019 at 12:30 PM Karin&NiKo <<a href="mailto:niko.karin@gmail.com" target="_blank" rel="noreferrer">niko.karin@gmail.com</a>> wrote:<br>
> Dear Gmsh Gurus,<br>
> <br>
> I would like to define a 1D crack in a planar surface. To this end, I use the attached script. <br>
> 1. When I specify the mesh size at the curve point *in the script* and then load the script, it does not work aka the mesh haven't the right size<br>
> 2. When I load the script and then specify the mesh size at the curve point *in the GUI*, it works (and it is beautiful!)<br>
> <br>
> Am I missing something? Is it a bug (NO????)?<br>
> <br>
> Thanks in advance,<br>
> Your oldest fan<br>
> _______________________________________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@onelab.info" target="_blank" rel="noreferrer">gmsh@onelab.info</a><br>
> <a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer noreferrer" target="_blank">http://onelab.info/mailman/listinfo/gmsh</a><br>
> <br>
> <br>
> -- <br>
> Max Orok<br>
> Contractor<br>
> <a href="http://www.mevex.com" rel="noreferrer noreferrer" target="_blank">www.mevex.com</a><br>
> <br>
> <br>
> <myCrack-fixed.geo>_______________________________________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@onelab.info" target="_blank" rel="noreferrer">gmsh@onelab.info</a><br>
> <a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer noreferrer" target="_blank">http://onelab.info/mailman/listinfo/gmsh</a><br>
<br>
— <br>
Prof. Christophe Geuzaine<br>
University of Liege, Electrical Engineering and Computer Science <br>
<a href="http://www.montefiore.ulg.ac.be/~geuzaine" rel="noreferrer noreferrer" target="_blank">http://www.montefiore.ulg.ac.be/~geuzaine</a><br>
<br>
<br>
<br>
</blockquote></div>