[Gmsh] Problem with the Boolean Operation

Matthieu Lecouvez matthieu.lecouvez at gmail.com
Tue Jul 17 16:47:38 CEST 2018


Hi all,

I have never managed to figure out how GMSH keeps track of the mesh sizes
during boolean operations. The solution I came up with is to set the mesh
sizes after the operation : Say you have two surfaces (with id 1 and 2)
sharing a common interface and you want to set a mesh size h1 on surface 1,
and h2 on surface 2, with h1 > h2, then :

-  out[] = PointsOf { Surface{1}; };
-  Characteristic Length {out[]} = h1;
-  out[] = PointsOf { Surface{2}; };
-  Characteristic Length {out[]} = h2;

Note that the order in which you set the mesh sizes does matter, you
probably want to set the smallest mesh sizes last.
Also, you need to do that only for your surfaces that have been modified by
the boolean operation.

Hope this helps.

Matt


2018-07-17 15:41 GMT+02:00 Benoit CURVERS <benoit.curvers at screen-lasse.com>:

> Hello Juan,
>
> Thank you very much for your answer.
> I already tried the solution you gave me. I tried to add a specific box in
> order to refine the mesh in specific part but unfortunately, I did not
> obtain the result I wanted
> As a result, this solution is not suitable for my problem (in 2D and 3D
> case)
>
> So, I just would like to know : how does GMSH keep the mesh size on the
> points after a Boolean operation ? Does GMSH chose the size randomly ? Does
> GMSH chose the size thank to the points' index ?
>
> Thank you very much for your answer,
> Kind regards,
>
> Benoît CURVERS
> Laser Systems & Solutions of Europe (LASSE)
> SCREEN Semiconductor Solutions Co. Ltd
> Taïwan Cell : +886 (0)965-875-974 or 7629511
> Email : benoit.curvers at screen-lasse.com
>
>
>
> -----Message d'origine-----
> De : gmsh <gmsh-bounces at ace20.montefiore.ulg.ac.be> De la part de Juan E.
> Sanchez
> Envoyé : vendredi 13 juillet 2018 17:51
> À : gmsh at onelab.info
> Objet : Re: [Gmsh] Problem with the Boolean Operation
>
> Hi Benoit,
>
> I recommend a background field.  Here is a project where I did some
> refinement (based on electric field) for a semiconductor simulation.
>
> https://github.com/devsim/devsim_bjt_example
>
> All the simulation files are there, as well as a book chapter in pdf form.
>
> At that time of the work, the boolean operations were not available in
> gmsh.
>
> Regards,
>
> Juan
>
>
> On 7/12/18 9:56 AM, Benoit CURVERS wrote:
> > Dear,
> >
> > I am writing in connection with the Boolean operation with GMSH. I
> > have some trouble with the meshing size on points after a Boolean
> operation.
> >
> > For example, on the picture below, I have four main surface. In the
> > geo file, I create my surface according to the mesh size.
> >
> > So, first, I create the surface 6 and 8 with the mesh size of 1 and
> > after the layer 3 and 5 with the mesh size of 10.
> >
> > But when I perform the Boolean operation (Boolean fragment), in one
> > case, the minimal size is keeping and in the other case, the maximal
> > size is keeping (as you can see with the red circle).
> >
> > So, I would like to know, How does GMSH keep the size after a Boolean
> > operation ? Is there a specific condition or GMSH chose the size
> randomly ?
> >
> > Because it seems that the size is not chosen according to the index,
> > or to the creation's order or to the mesh size
> >
> > I also see this problem in 3D.
> >
> > You can find the geo file below.
> >
> > Thank you for your answer,
> >
> > Kind regards,
> >
> > Benoît CURVERS
> >
> > *Laser Systems & Solutions of Europe (LASSE)*
> >
> > SCREEN Semiconductor Solutions Co. Ltd
> >
> > Taïwan Cell : +886 (0)965-875-974 or 7629511
> >
> > Email : benoit.curvers at screen-lasse.com
> > <mailto:benoit.curvers at screen-lasse.com>
> >
> > SetFactory("OpenCASCADE");
> >
> > // TopFin
> >
> > p10=newp; Point(p10) = {-2.5,60,0, 0.5};
> >
> > p11=newp; Point(p11) = {-2.5,22.5,0, 0.5};
> >
> > p12=newp; Point(p12) = {-1.75,20.5,0, 0.5};
> >
> > p13=newp; Point(p13) = {-1,20,0, 0.5};
> >
> > p14=newp; Point(p14) = {1,20,0, 0.5};
> >
> > p15=newp; Point(p15) = {1.75,20.5,0, 0.5};
> >
> > p16=newp; Point(p16) = {2.5,22.5,0, 0.5};
> >
> > p17=newp; Point(p17) = {2.5,60,0, 0.5};
> >
> > l10=newl; Line(l10) = {p10,p11};
> >
> > l11=newl; Line(l11) = {p11,p12};
> >
> > l12=newl; Line(l12) = {p12,p13};
> >
> > l13=newl; Line(l13) = {p13,p14};
> >
> > l14=newl; Line(l14) = {p14,p15};
> >
> > l15=newl; Line(l15) = {p15,p16};
> >
> > l16=newl; Line(l16) = {p16,p17};
> >
> > l17=newl; Line(l17) = {p17,p10};
> >
> > ll10 = newll; Line Loop(ll10) = {l10,l11,l12,l13,l14,l15,l16,l17};
> >
> > Plane Surface(1) = {ll10};
> >
> > Physical Surface(1)={1};
> >
> > // Bot1
> >
> > p20=newp; Point(p20) = {-15.235,120,0, 0.5};
> >
> > p21=newp; Point(p21) = {-13,119.3,0, 0.5};
> >
> > p22=newp; Point(p22) = {-12,119,0, 0.5};
> >
> > p23=newp; Point(p23) = {-10.9,118.1,0, 0.5};
> >
> > p24=newp; Point(p24) = {-10,117,0, 0.5};
> >
> > p25=newp; Point(p25) = {-9.7,116,0, 0.5};
> >
> > p26=newp; Point(p26) = {-9.235,114,0, 0.5};
> >
> > p27=newp; Point(p27) = {-10,120,0, 0.5};
> >
> > l20=newl; Line(l20) = {p20,p21};
> >
> > l21=newl; Line(l21) = {p21,p22};
> >
> > l22=newl; Line(l22) = {p22,p23};
> >
> > l23=newl; Line(l23) = {p23,p24};
> >
> > l24=newl; Line(l24) = {p24,p25};
> >
> > l25=newl; Line(l25) = {p25,p26};
> >
> > l26=newl; Line(l26) = {p26,p27};
> >
> > l27=newl; Line(l27) = {p27,p20};
> >
> > ll20 = newll; Line Loop(ll20) = {l20,l21,l22,l23,l24,l25,l26,l27};
> >
> > Plane Surface(2) = {ll20};
> >
> > Physical Surface(2)={2};
> >
> > // Bot2
> >
> > p40=newp; Point(p40) = {10,120,0, 0.5};
> >
> > p41=newp; Point(p41) = {9.235,114,0, 0.5};
> >
> > p42=newp; Point(p42) = {9.7,116,0, 0.5};
> >
> > p43=newp; Point(p43) = {10,117,0, 0.5};
> >
> > p44=newp; Point(p44) = {10.9,118.1,0, 0.5};
> >
> > p45=newp; Point(p45) = {12,119,0, 0.5};
> >
> > p46=newp; Point(p46) = {13,119.3,0, 0.5};
> >
> > p47=newp; Point(p47) = {15.235,120,0, 0.5};
> >
> > l40=newl; Line(l40) = {p40,p41};
> >
> > l41=newl; Line(l41) = {p41,p42};
> >
> > l42=newl; Line(l42) = {p42,p43};
> >
> > l43=newl; Line(l43) = {p43,p44};
> >
> > l44=newl; Line(l44) = {p44,p45};
> >
> > l45=newl; Line(l45) = {p45,p46};
> >
> > l46=newl; Line(l46) = {p46,p47};
> >
> > l47=newl; Line(l47) = {p47,p40};
> >
> > ll40 = newll; Line Loop(ll40) = {l40,l41,l42,l43,l44,l45,l46,l47};
> >
> > Plane Surface(4) = {ll40};
> >
> > Physical Surface(4)={4};
> >
> > // BotFin
> >
> > p60=newp; Point(p60) = {-10,120,0, 0.5};
> >
> > p61=newp; Point(p61) = {-9.235,114,0, 0.5};
> >
> > p62=newp; Point(p62) = {-2.5,60,0, 0.5};
> >
> > p63=newp; Point(p63) = {2.5,60,0, 0.5};
> >
> > p64=newp; Point(p64) = {9.235,114,0, 0.5};
> >
> > p65=newp; Point(p65) = {10,120,0, 0.5};
> >
> > l60=newl; Line(l60) = {p60,p61};
> >
> > l61=newl; Line(l61) = {p61,p62};
> >
> > l62=newl; Line(l62) = {p62,p63};
> >
> > l63=newl; Line(l63) = {p63,p64};
> >
> > l64=newl; Line(l64) = {p64,p65};
> >
> > l65=newl; Line(l65) = {p65,p60};
> >
> > ll60 = newll; Line Loop(ll60) = {l60,l61,l62,l63,l64,l65};
> >
> > Plane Surface(6) = {ll60};
> >
> > Physical Surface(6)={6};
> >
> > // Substrate
> >
> > p80=newp; Point(p80) = {-67.5,120,0, 1};
> >
> > p81=newp; Point(p81) = {-15.235,120,0, 1};
> >
> > p82=newp; Point(p82) = {-10,120,0, 1};
> >
> > p83=newp; Point(p83) = {10,120,0, 1};
> >
> > p84=newp; Point(p84) = {15.235,120,0, 1};
> >
> > p85=newp; Point(p85) = {67.5,120,0, 1};
> >
> > p86=newp; Point(p86) = {67.5,140,0, 1};
> >
> > p87=newp; Point(p87) = {-67.5,140,0, 1};
> >
> > l80=newl; Line(l80) = {p80,p81};
> >
> > l81=newl; Line(l81) = {p81,p82};
> >
> > l82=newl; Line(l82) = {p82,p83};
> >
> > l83=newl; Line(l83) = {p83,p84};
> >
> > l84=newl; Line(l84) = {p84,p85};
> >
> > l85=newl; Line(l85) = {p85,p86};
> >
> > l86=newl; Line(l86) = {p86,p87};
> >
> > l87=newl; Line(l87) = {p87,p80};
> >
> > ll80 = newll; Line Loop(ll80) = {l80,l81,l82,l83,l84,l85,l86,l87};
> >
> > Plane Surface(8) = {ll80};
> >
> > Physical Surface(8)={8};
> >
> > // Ins
> >
> > p90=newp; Point(p90) = {-3.5,60,0, 1};
> >
> > p91=newp; Point(p91) = {-3.5,22.5,0, 1};
> >
> > p92=newp; Point(p92) = {-2.75,20,0, 1};
> >
> > p93=newp; Point(p93) = {-1,19,0, 1};
> >
> > p94=newp; Point(p94) = {1,19,0, 1};
> >
> > p95=newp; Point(p95) = {2.75,20,0, 1};
> >
> > p96=newp; Point(p96) = {3.5,22.5,0, 1};
> >
> > p97=newp; Point(p97) = {3.5,60,0, 1};
> >
> > p98=newp; Point(p98) = {2.5,60,0, 1};
> >
> > p99=newp; Point(p99) = {2.5,22.5,0, 1};
> >
> > p910=newp; Point(p910) = {1.75,20.5,0, 1};
> >
> > p911=newp; Point(p911) = {1,20,0, 1};
> >
> > p912=newp; Point(p912) = {-1,20,0, 1};
> >
> > p913=newp; Point(p913) = {-1.75,20.5,0, 1};
> >
> > p914=newp; Point(p914) = {-2.5,22.5,0, 1};
> >
> > p915=newp; Point(p915) = {-2.5,60,0, 1};
> >
> > l90=newl; Line(l90) = {p90,p91};
> >
> > l91=newl; Line(l91) = {p91,p92};
> >
> > l92=newl; Line(l92) = {p92,p93};
> >
> > l93=newl; Line(l93) = {p93,p94};
> >
> > l94=newl; Line(l94) = {p94,p95};
> >
> > l95=newl; Line(l95) = {p95,p96};
> >
> > l96=newl; Line(l96) = {p96,p97};
> >
> > l97=newl; Line(l97) = {p97,p98};
> >
> > l98=newl; Line(l98) = {p98,p99};
> >
> > l99=newl; Line(l99) = {p99,p910};
> >
> > l910=newl; Line(l910) = {p910,p911};
> >
> > l911=newl; Line(l911) = {p911,p912};
> >
> > l912=newl; Line(l912) = {p912,p913};
> >
> > l913=newl; Line(l913) = {p913,p914};
> >
> > l914=newl; Line(l914) = {p914,p915};
> >
> > l915=newl; Line(l915) = {p915,p90};
> >
> > ll90 = newll; Line Loop(ll90) =
> > {l90,l91,l92,l93,l94,l95,l96,l97,l98,l99,l910,l911,l912,l913,l914,l915
> > };
> >
> > Plane Surface(9) = {ll90};
> >
> > Physical Surface(9)={9};
> >
> > // Ox1
> >
> > p30=newp; Point(p30) = {-67.5,120,0, 10};
> >
> > p31=newp; Point(p31) = {-67.5,60,0, 10};
> >
> > p32=newp; Point(p32) = {-3.5,60,0, 10};
> >
> > p33=newp; Point(p33) = {-2.5,60,0, 10};
> >
> > p34=newp; Point(p34) = {-9.235,114,0, 10};
> >
> > p35=newp; Point(p35) = {-9.7,116,0, 10};
> >
> > p36=newp; Point(p36) = {-10,117,0, 10};
> >
> > p37=newp; Point(p37) = {-10.9,118.1,0, 10};
> >
> > p38=newp; Point(p38) = {-12,119,0, 10};
> >
> > p39=newp; Point(p39) = {-13,119.3,0, 10};
> >
> > p310=newp; Point(p310) = {-15.235,120,0, 10};
> >
> > l30=newl; Line(l30) = {p30,p31};
> >
> > l31=newl; Line(l31) = {p31,p32};
> >
> > l32=newl; Line(l32) = {p32,p33};
> >
> > l33=newl; Line(l33) = {p33,p34};
> >
> > l34=newl; Line(l34) = {p34,p35};
> >
> > l35=newl; Line(l35) = {p35,p36};
> >
> > l36=newl; Line(l36) = {p36,p37};
> >
> > l37=newl; Line(l37) = {p37,p38};
> >
> > l38=newl; Line(l38) = {p38,p39};
> >
> > l39=newl; Line(l39) = {p39,p310};
> >
> > l310=newl; Line(l310) = {p310,p30};
> >
> > ll30 = newll; Line Loop(ll30) =
> > {l30,l31,l32,l33,l34,l35,l36,l37,l38,l39,l310};
> >
> > Plane Surface(3) = {ll30};
> >
> > Physical Surface(3)={3};
> >
> > // Ox2
> >
> > p50=newp; Point(p50) = {15.235,120,0, 10};
> >
> > p51=newp; Point(p51) = {13,119.3,0, 10};
> >
> > p52=newp; Point(p52) = {12,119,0, 10};
> >
> > p53=newp; Point(p53) = {10.9,118.1,0, 10};
> >
> > p54=newp; Point(p54) = {10,117,0, 10};
> >
> > p55=newp; Point(p55) = {9.7,116,0, 10};
> >
> > p56=newp; Point(p56) = {9.235,114,0, 10};
> >
> > p57=newp; Point(p57) = {2.5,60,0, 10};
> >
> > p58=newp; Point(p58) = {3.5,60,0, 10};
> >
> > p59=newp; Point(p59) = {67.5,60,0, 10};
> >
> > p510=newp; Point(p510) = {67.5,120,0, 10};
> >
> > l50=newl; Line(l50) = {p50,p51};
> >
> > l51=newl; Line(l51) = {p51,p52};
> >
> > l52=newl; Line(l52) = {p52,p53};
> >
> > l53=newl; Line(l53) = {p53,p54};
> >
> > l54=newl; Line(l54) = {p54,p55};
> >
> > l55=newl; Line(l55) = {p55,p56};
> >
> > l56=newl; Line(l56) = {p56,p57};
> >
> > l57=newl; Line(l57) = {p57,p58};
> >
> > l58=newl; Line(l58) = {p58,p59};
> >
> > l59=newl; Line(l59) = {p59,p510};
> >
> > l510=newl; Line(l510) = {p510,p50};
> >
> > ll50 = newll; Line Loop(ll50) =
> > {l50,l51,l52,l53,l54,l55,l56,l57,l58,l59,l510};
> >
> > Plane Surface(5) = {ll50};
> >
> > Physical Surface(5)={5};
> >
> > // Cap
> >
> > p70=newp; Point(p70) = {-67.5,60,0, 10};
> >
> > p71=newp; Point(p71) = {-67.5,10,0, 10};
> >
> > p72=newp; Point(p72) = {67.5,10,0, 10};
> >
> > p73=newp; Point(p73) = {67.5,60,0, 10};
> >
> > p74=newp; Point(p74) = {3.5,60,0, 10};
> >
> > p75=newp; Point(p75) = {3.5,22.5,0, 10};
> >
> > p76=newp; Point(p76) = {2.75,20,0, 10};
> >
> > p77=newp; Point(p77) = {1,19,0, 10};
> >
> > p78=newp; Point(p78) = {-1,19,0, 10};
> >
> > p79=newp; Point(p79) = {-2.75,20,0, 10};
> >
> > p710=newp; Point(p710) = {-3.5,22.5,0, 10};
> >
> > p711=newp; Point(p711) = {-3.5,60,0, 10};
> >
> > l70=newl; Line(l70) = {p70,p71};
> >
> > l71=newl; Line(l71) = {p71,p72};
> >
> > l72=newl; Line(l72) = {p72,p73};
> >
> > l73=newl; Line(l73) = {p73,p74};
> >
> > l74=newl; Line(l74) = {p74,p75};
> >
> > l75=newl; Line(l75) = {p75,p76};
> >
> > l76=newl; Line(l76) = {p76,p77};
> >
> > l77=newl; Line(l77) = {p77,p78};
> >
> > l78=newl; Line(l78) = {p78,p79};
> >
> > l79=newl; Line(l79) = {p79,p710};
> >
> > l710=newl; Line(l710) = {p710,p711};
> >
> > l711=newl; Line(l711) = {p711,p70};
> >
> > ll70 = newll; Line Loop(ll70) =
> > {l70,l71,l72,l73,l74,l75,l76,l77,l78,l79,l710,l711};
> >
> > Plane Surface(7) = {ll70};
> >
> > Physical Surface(7)={7};
> >
> > // AddedSubstrate
> >
> > p100=newp; Point(p100) = {-67.5,140,0, 5};
> >
> > p101=newp; Point(p101) = {67.5,140,0, 5};
> >
> > p102=newp; Point(p102) = {67.5,2140,0, 5};
> >
> > p103=newp; Point(p103) = {-67.5,2140,0, 5};
> >
> > l100=newl; Line(l100) = {p100,p101};
> >
> > l101=newl; Line(l101) = {p101,p102};
> >
> > l102=newl; Line(l102) = {p102,p103};
> >
> > l103=newl; Line(l103) = {p103,p100};
> >
> > ll100 = newll; Line Loop(ll100) = {l100,l101,l102,l103};
> >
> > Plane Surface(10) = {ll100};
> >
> > Physical Surface(10)={10};
> >
> > // AddedSubstrate
> >
> > p110=newp; Point(p110) = {-67.5,2140,0, 10};
> >
> > p111=newp; Point(p111) = {67.5,2140,0, 10};
> >
> > p112=newp; Point(p112) = {67.5,3140,0, 10};
> >
> > p113=newp; Point(p113) = {-67.5,3140,0, 10};
> >
> > l110=newl; Line(l110) = {p110,p111};
> >
> > l111=newl; Line(l111) = {p111,p112};
> >
> > l112=newl; Line(l112) = {p112,p113};
> >
> > l113=newl; Line(l113) = {p113,p110};
> >
> > ll110 = newll; Line Loop(ll110) = {l110,l111,l112,l113};
> >
> > Plane Surface(11) = {ll110};
> >
> > Physical Surface(11)={11};
> >
> > // AddedSubstrate
> >
> > p120=newp; Point(p120) = {-67.5,3140,0, 20};
> >
> > p121=newp; Point(p121) = {67.5,3140,0, 20};
> >
> > p122=newp; Point(p122) = {67.5,5140,0, 20};
> >
> > p123=newp; Point(p123) = {-67.5,5140,0, 20};
> >
> > l120=newl; Line(l120) = {p120,p121};
> >
> > l121=newl; Line(l121) = {p121,p122};
> >
> > l122=newl; Line(l122) = {p122,p123};
> >
> > l123=newl; Line(l123) = {p123,p120};
> >
> > ll120 = newll; Line Loop(ll120) = {l120,l121,l122,l123};
> >
> > Plane Surface(12) = {ll120};
> >
> > Physical Surface(12)={12};
> >
> > pAir1=newp; Point(pAir1) = {-67.5,-190,0, 30};
> >
> > pAir2=newp; Point(pAir2) = {67.5,-190,0, 30};
> >
> > pAir3=newp; Point(pAir3) = {67.5,5140,0, 30};
> >
> > pAir4=newp; Point(pAir4) = {-67.5,5140,0, 30};
> >
> > lAir1=newl; Line(lAir1) = {pAir1,pAir2};
> >
> > lAir2=newl; Line(lAir2) = {pAir2,pAir3};
> >
> > lAir3=newl; Line(lAir3) = {pAir3,pAir4};
> >
> > lAir4=newl; Line(lAir4) = {pAir4,pAir1};
> >
> > llAir = newll; Line Loop(llAir) = {lAir1,lAir2,lAir3,lAir4};
> >
> > rsAir = news ; Plane Surface(rsAir) = {llAir};
> >
> > v() = BooleanFragments{ Surface{1:12}; Delete; }{ Surface{rsAir};
> > Delete; };
> >
> > Physical Surface(0)={13};
> >
> >
> >
> > This body part will be downloaded on demand.
> >
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180717/ba606f14/attachment-0001.html>


More information about the gmsh mailing list