• Aucun résultat trouvé

Automatic surface mesh generation for discrete models--A complete and automatic pipeline based on reparametrization

N/A
N/A
Protected

Academic year: 2021

Partager "Automatic surface mesh generation for discrete models--A complete and automatic pipeline based on reparametrization"

Copied!
19
0
0

Texte intégral

(1)

Automatic

surface

mesh

generation

for

discrete

models

A

complete

and

automatic

pipeline

based

on

reparametrization

Pierre-Alexandre Beaufort

a

,

b

,∗

,

Christophe Geuzaine

b

,

Jean-François Remacle

a

aUniversitécatholiquedeLouvain,iMMC,AvenueGeorgesLemaitre4,1348Louvain-la-Neuve,Belgium bUniversitédeLiège,MontefioreInstitute,AlléedelaDécouverte10,B-4000Liège,Belgium

a

r

t

i

c

l

e

i

n

f

o

a

b

s

t

r

a

c

t

Articlehistory:

Received5November2019 Accepted18May2020 Availableonline22May2020 Keywords:

Triangulations Finiteelement Remeshing Parametrization Meanvaluecoordinates Gmsh

Triangulationsare anubiquitousinput forthefiniteelementcommunity.However,most rawtriangulationsobtainedbyimagingtechniquesareunsuitableas-isforfiniteelement analysis.Inthispaper,wegivearobustpipelineforhandlingthosetriangulations,based on the computation ofa one-to-one parametrization for automaticallyselectedpatches of input triangles, whichmakes each patch amenable to remeshing by standard finite elementmeshingalgorithms.Usingonlygeometricalarguments,weprovethatadiscrete parametrizationofapatchisone-to-oneif(andonlyif)itsimageintheparameterspace issuchthatallparametrictriangleshaveapositivearea.Wethenderiveanon-standard lineardiscretization schemebased onmeanvalue coordinatesto computesuch one-to-one parametrizations, and show that the scheme does not discretize aLaplacian on a structuredmesh.Theproposedpipelineisimplementedintheopensourcemeshgenerator Gmsh, where the creation of suitable patches is based on triangulation topology and parametrizationquality,combinedwithfeatureedgedetection.Severalexamplesillustrate therobustnessoftheresultingimplementation.

©2020ElsevierInc.Allrightsreserved.

1. Introduction

EngineeringdesignsareoftenencapsulatedinComputerAidedDesign(CAD)systems.Thisisusuallythecasein automo-tive,shipbuilding oraerospaceindustries.The finiteelementmethodisthe proeminenttechniqueforperforming analysis ofthesedesignsandthismethodrequiresafiniteelementmesh,i.e.asubdivisionofCADgeometricalentitiesintoa(large) collectionofsimplegeometrical shapessuchastriangles,quadrangles,tetrahedraandhexahedra,arrangedinsuch a way thatiftwoofthemintersect,theydosoalongaface,anedgeoranode,andneverotherwise.

InCADsystems,thegeometryofsurfacesisdescribedthroughaparametrizationi.e.amapping

x

:

A

→ R

3

, (

u

;

v

)

→

x

(

u

;

v

)

(1)

where A

⊂ R

2 is usually a rectangularregion

[

u

0

,

u1

]

× [

v0

,

v1

]

. When finiteelement mesh generation procedures have accesstosuchparametrizationsx

(

u

;

v

)

ofsurfaces,itisingeneralagoodideatogenerateaplanarmeshintheparametric domain A andmap itin3D.Thiswayofgeneratingsurfacemeshesiscalledindirect [1],andisthepredominant method forgeneratinghigh-qualityfiniteelementsurfacemeshesinarobustmanner.Thisapproachisinparticularfollowedbythe

*

Correspondingauthorat:UniversitécatholiquedeLouvain,iMMC,AvenueGeorgesLemaitre4,1348Louvain-la-Neuve,Belgium. E-mailaddress:pierre-alexandre.beaufort@uclouvain.be(P.-A. Beaufort).

https://doi.org/10.1016/j.jcp.2020.109575

(2)

Thispaperdescribesthecompletepipelinethatallowstobuildtheatlasofthemodeltogetherwiththeparametrizations of all its maps.It aims atbeing self-consistent, whichmakes it quite exhaustive.In §2, some theoretical backgroundon mappings is presented. Then, §3 develops the concept of discrete parametrizations. A complete set of proofs based on purelygeometricalargumentsisgiventhatasserttheinjectivityofthediscretemapsthatareused.ThewayGmshhandles theinput inordertoeasetheparametrizationandmeshingprocessisdescribedwithin§4.We pointoutthedrawbackof a generalprocessingofcoarsediscrete surfacesin§5,anddiscusstwowaystohandlesuch coarsediscretizations.Several examplesarepresentedinSection§6,andconclusionsaredrawninSection§7.

2. Mappings

Aparametrizationx

(

u

;

v

)

asdefinedinEquation(1) isregularif

ux and

vx existandarelinearlyindependent:

ux

× ∂

vx

=

0

forany

(

u

;

v

)

A.Inotherwords,x

(

u

;

v

)

isregularifandonlyiftheJacobianmatrix

J

=

x

∂(

u

;

v

)

∈ R

3×2 (2)

associatedto x

(

u

;

v

)

hasrank2

∀(

u

;

v

)

A.Thenatureofthemappingx

(

u

;

v

)

isfullycharacterizedby thesingularvalue decomposition (SVD)ofitsJacobian(2).Itssingularvalues

σ

1

σ

2

>

0 allowtocharacterizex:

x isisometric ifandonlyif

σ

1

=

σ

2

=

1,

x isconformal ifandonlyif

σ

2

σ

1

=

1,

x isequiareal ifandonlyif

σ

1

σ

2

=

1.

Isometric parametrizationspreserve essentially everything(lengths, areasandangles). Withsuch niceproperties, gen-eratingwell shapedtrianglesintheplanar domain A willleadtoa wellshapedmeshin3D.Disappointingly,suchlength preservingmappingsdonot existforsurfacesthat arenotdevelopable [6,Chapter2,§4] i.e.thathavenon zeroGaussian curvatures.

Conformalmappingsconserveangles.Ifx

(

u

;

v

)

isconformal,isotropyispreservedandstandardisotropicmesh genera-torscandothesurfacemeshingjob.Again,theoddsareagainstus:althoughitispossibletobuildconformalmappingsfor mostsurfaces,itisverydifficulttoensureglobalinjectivityofsuchmappings,eventhoughconformalmappingsarealways locallyinjective.Thus,ensuringtheglobalone-to-onenessofconformalmappingsisstillanopenquestion[7].

Equiareal mappings have no interest in mesh generation. Thus, in general, mesh generators are faced with general parametrizations that donotpreserve anything. Thismeans thatanisotropic planar meshgenerators arerequiredto gen-erate well shapedmeshesin 3D.Anisotropic meshgenerators usually take asinputa Riemannianmetric fielddefined in each

(

u

;

v

)

of A.Iftheaimisto produceanisotropic 3Dmeshwitha meshsizedefinedby anisotropicmesh sizefield

h

(

x

(

u

;

v

))

,themetrictensorthatisusedbythemeshgeneratorwillbe

M

(

u

;

v

)

=

J

T J h2

.

Letusassume forexamplethat thesurface tobemeshed isan ellipsoid.Fig.1showsa3D surface meshthatisadapted to themaximal curvatureofthe surfaceaswell asits counterpartinthe parameterplane oftheellipsoid.The particular ellipsoid of Fig. 1is e

=

7 timeswider in the x direction than in the two other directions y and z. Its parametrization (whichisstandardtomostCADsystems)is

x

(

u

,

v

)

=

e sin u sin v

y

(

u

,

v

)

=

sin u cos v

(3)

Fig. 1. Thecaseofanellipsoid.FigureashowsthemeshoftheellipsoidintheparameterspacewhileFigurebshowsthesamemeshinthe3Dspace. Figurescanddshowthelargestandsmallestsingularvaluesσ1andσ2ofthejacobian J .Figureeshowsthenonconformityparameterσ21.

whereu

∈ [

0

,

π

]

istheinclinationandv

∈ [−

π

,

π

[

istheazimuth.Themetrictensorassociatedtothatmappingis

M

=

1 h2



cos2v(e2sin2v+cos2v)+sin2u sin u sin v cos u cos v(e21)

sin u sin v cos u cos v(e21) sin2u(e2cos2v+sin2v)



.

(3)

Themappingisobviouslynotregularwhenu

=

0 andwhenu

=

π

.Thisissurprisinglynotsomuchofaproblemformesh generators.In [3],authors proposea wayto slightlymodifymeshing proceduresinorder todealwithsingular mappings such as the one ofthe ellipsoid. The metric field (3) is anisotropic (see Fig. 1e) andnon-uniform. Yet it issmooth and smoothnessofmappingsisthemostimportantfeatureofx

(

u

;

v

)

inordertoallowmeshgeneratorstodoagoodjob.When generatingameshinanindirectfashion,aplanarmesh,possiblyanisotropic,isgeneratedintheparameterplane A.Then, one may think that thisplanar mesh is mappedin 3D through x

(

u

;

v

)

, whichis not true: only corners ofthe triangles are mapped in 3D andthose corners are connected together with 3D straight lines that are not the actual mapping of 2D straight lines. Inthe best casescenario,any 2D straight lineconnectingpoints

(

ua

;

va

)

and

(

ub

;

vb

)

corresponds the geodesic betweenthose two points. When themetric M is locallyconstant, geodesicsare straight lines andtheindirect

(4)

Fig. 2. Sketch of proof for monotonicity.

meshingapproachgivesgoodresults.Whenthemetricvariesrapidlyalongonegivenedge,thenindirectmeshingbecomes difficult.InCADsystems,parametrizationsarealwayssmoothandindirectmeshgenerationisalwayspossible.

3. Discreteparametrizations

InSection§2,wehaveshownthathavingasmoothparametrizationwastheconditiontoallowindirectsurfacemeshing. CADsystemsprovidesmoothparametrizationsbutCADmodelsarenottheonlygeometricalrepresentationsthatare avail-ableinengineeringanalysis.Inmanydomainsofengineeringinterest,geometriesofmodelsaredescribedbytriangulations. Wecallsuchmodelsdiscretemodels.

AssumeatriangulationT with#p nodes(vertices),#e edgesand#t triangles.FindingaparametrizationofT consistsin assigning toevery vertexpiofthetriangulationa pairofcoordinates

(

ui

;

vi

)

.Ifeverytriangle

(

pi

,

pj

,

pk

)

,with p

∈ R

31 ofthetriangulationhasapositiveareainthe

(

u

;

v

)

plane,thentheparametrizationisinjective.

A parametrizationof T onto a subset of A

⊂ R

2 exists ifthe triangulationcorresponds to the one ofa planar mesh. AssumethattriangulationT issimplyconnectedwith#b boundariesand#h verticesonthoseboundaries.Thenthesurface isparameterizableifandonlyif

#t

=

2

(

#p

1

)

+

2

(

#b

1

)

#h

.

Inwhatfollows,wepresentsome existingmaterialthatisdetailedinnumerouspublications[8–10].Themaininterest ofthissectionisthatwetakeherethepointofviewofthenumericalgeometer.Themainresultabouttheone-to-oneness ofmappingsisprovenwithoutusingonesingle theoremofanalysissuchasmaximumprinciplesofRadó-Kneser-Choquet theorem [11].

Consideraninternalvertexi of T and J

(

i

)

thesetofindiceswhosethecorrespondingnodesareconnectedtothenode

i (inotherwords,edge

(

i

,

j

)

exists

j

J

(

i

)

).Thevalueoftheparametriccoordinates

(

ui

,

vi

)

atvertexi willbecomputed asaweightedaverageofthecoordinates

(

uj

,

vj

)

ofitsneighboringvertices:



jJ(i)

λ

i j

(

ui

uj

)

=

0

,



jJ(i)

λ

i j

(

vi

vj

)

=

0 (4)

where

λ

i j arecoefficients.Thisschemeisacalledadifferencescheme thatinvolvesonlydifferences

(

ui

uj

)

,with j

J

(

i

)

. Ifevery

λ

i j ispositive,valuesofui and vi areconvexcombinationsoftheir surroundingvalues.Inageometrical pointof view,itactuallymeansthatpoint

(

ui

,

vi

)

liesintheconvexhull

H

iofitsneighboringvertices.

Withthatassumption,itiseasy toprovethatthemappingprovidedby anypositive schemeofthetype (4) is one-to-one.Letusconsideratriangle

(

i

,

j

,

k

)

intheparameterplane

(

u

;

v

)

,Fig.2.Ifedge

(

j

,

k

)

belongsto

H

i,thattriangle

(

i

,

j

,

k

)

isobviouslypositive.

Ontheotherhand,if

(

j

,

k

)

isinside

H

i,asitisthecaseinFig.2,then

(

j

,

k

)

doesnotbelongto

H

i andmovingi toi createsaninvertedtriangle

(

i

,

j

,

k

)

whilekeeping

H

i

=

H

i.Inthiscase,iisinside

H

iwhiletriangle

(

i

,

j

,

k

)

isinverted.It iseasytoseethatmovingi toiimpliesthat j wouldbeoutside

H

jwhichisincontradictionwiththehypothesisthateach vertexisinsideitsconvexhull.Vertex j beinginside

H

i impliesthat

α

>

π

.Thesumofthefouranglesofaquadrangleis 2

π

.Thisimpliesthat

β <

π

whichimpliesthatedge

(

i

,

k

)

belongsto

H

j.So,movingi toiputs j outside

H

j.

1 Inwhatfollows,atriangleisdenotedbytheindicesofitsnodes,i.e.(i,j,k)insteadof(p

(5)

Fig. 3. Definitions ofθkandθlfor the difference scheme corresponding to the linear Galerkin approach.

Nowseewhathappensontheouter boundary

A ofthe

(

u

;

v

)

domain A.There,pointshavenoneighboringhull.Yet, assumingthat

A isconvex,thenallverticesof

A thatareconnectedtointernalverticesbelongtheirconvexhullandno internalvertexcannotbesituatedoutsideA.Thislastpartoftheproofhassomesimilaritieswiththeoneof[12].

Thismeansthatapositiveschemeappliedtoaconvexdomainimpliesthatthediscrete parametrizationisone-to-one. Inourcase,wewillalwayschoose

A astheunitcircle.

Now,therightchoiceofthe

λ

i jisofoutmostimportanceforensuringagoodparametrization.Ouruseofparametrization is meshing. The first and non negociable property of the discrete parametrizationis one-to-oneness. We thus choose a positive schemeanda

(

u

;

v

)

domainthat isaunit circle. Thesecond priorityissmoothness, we willdevelopthat aspect below. The icing on the cake would be conformity but, as noted in §2, Gmsh’s mesh generators are comfortable with anisotropic mappingsandwe willnot putanyeffort onthat aspectofthe game(ouraim isnot texturemappinglikein computergraphics,soweareOKtomapsquaresoncircles),eventhoughsomesortofconformitywillcomenaturally.

3.1. Parametrizationsmoothness

Welookhereforasmoothfunctionx

(

u

,

v

)

i.e.acontinuous functionwhichderivativesaresmoothaswellbecausewe want

σ

1and

σ

2 tobesmoothand

σ

1and

σ

2areby-productsofthemetrici.e.atensorcomputedusingthefirstderivatives of x

(

u

,

v

)

.Tutte’s barycentric mapping [9] consist in choosing

λ

i j

=

1. This choice leads to veryirregular mappings that are uselessfor meshgenerationpurposes. Theidea that hasbeenadvocated by manyauthors[7,13] is tosolve apartial differentialequationwhichsolutionsareinherentlysmooth.Forexample,thesolutionofLaplaceequationsondomainswith smoothboundariesandwithsmoothboundaryconditionsareC∞ anditisindeedagoodideatochoosethe

λ

i j insucha waythedifferenceoperator(4) isadiscreteversionoftheLaplaceoperator.

3.2. Laplacesmoothingusing

P

1finiteelements

Thestandard P1 finiteelementformulationoftheLaplaceproblemiswellknownformorethanahalfofacentury.In theearlydays,someauthors[14] havewrittencoefficients

λ

FEMi j inaquitegeometricalfashion(seeFig.3):

λ

FEMi j

:=

1 2



cos

k

)

sin

k

)

+

cos

l

)

sin

l

)



.

(5)

For sake of completeness, the so called “cotangentformula” (5) is fully derived in Appendix A. Coefficients

λ

FEMi j of (5) maybenegative for

θ



π2

;

π



,whichcouldleadtoschemethatisnotprovablyinjective.Thisistheveryoldresultthat statesthatthemaximumprinciplesatisfiedbysolutionsofLaplaceequationsisonlyguaranteedapriori byfiniteelements computedonacutetriangulations,i.e.triangulationswithoutobtuse angles.Acutetriangulationsare asufficient condition forinjectivity.Yet itisnot necessaryandit isindeedcomplicatedtofindexamples wherefiniteelements fail toprovide one-to-oneparametrizations.Disappointingly,intheworldofmeshgeneration,limitcasesthathappenonceinathousand havetobeavoided.So,wewillnotusefiniteelementsforparametrizingoursurfaces.

3.3. Meanvaluecoordinates

Acontinuousfunction f isasolutionofLaplaceequation

2f

=

0 onanopenset A

⊂ R

2 ifandonlyif,foreveryx

A, f

(

x

)

isequaltotheaveragevalueof f overeverycircleofradiusr

C(

x

;

r

)

thatfullybelongsto A:

f

(

x

)

=

1

2

π

r



C(x;r)

f

(

x

)

dx

.

(6)

Thisprinciplestatesthattheextremaofthemappingarelocatedontheboundaryofthedomain,andthatthereisnotlocal extremuminsidethedomain.

(6)

Fig. 4. Derivation of the difference scheme corresponding to the mean value coordinates.

In [12], Floater proposes a way to compute

λ

i j that actually mimics property (6): this scheme is calledmean value coordinates.Inthispaper,were-deriveFloater’s

λ

i j correspondingtomeanvaluecoordinatesusingafiniteelementpointof view.Accordingto(6),thevalue fi istheaverageofvalues f

(

x

)

alongacircle

C(

i

;

r

)

ofradiusr centeredoni (seeFig.4). Alinearinterpolation f

(

x

;

y

)

=



jfj

φ

j

(

x

;

y

)

isassumedovereachtriangle

T

i jk.Wearegoingtocomputethecontribution oftriangle

T

i jkfor(6)

θ

kr fi

=



ab fi

φ

i

+

fj

φ

j

+

fk

φ

kds

where

θ

kistheanglebetweenedges

[

i j

]

and

[

ik

]

,and

ab isthecirclearcof

C(

i

,

r

)

containsin

T

i jk,Fig.4a.Since

φ

i

+ φ

j

+

φ

k

=

1,

θ

kr



ab

φ

ids







ab φj+φkds fi



ab

φ

jdsfj



ab

φ

kdsfk

=

0 whichgives



ab

φ

jds

 

λi j

(

fi

fj

)

+



ab

φ

kds

 

λik

(

fi

fk

)

=

0 over

T

i jk.

Linearshapefunction

φ

jassociatedtonode j in

T

i jk correspondsto

φ

j

(

x

;

y

)

=

y yj

where y istheverticalcoordinaterelativetoedge

[

ik

]

andyjisthe y-coordinateofnode j.Wecomputetheintegralof y overab from

thecontour

C

composedofab,

[

bi

]

and

[

ia

]



C

y ds

Fromnormalvectorof

C(

i

;

r

)

n

ˆ

=

1r

(

x

;

y

)

,weget



L y r ds

=



L

ˆ

n

·

eyds

(7)

Fig. 5. Types of meshes on a square.

withey

= (

0

;

1

)

.Thedivergenceofeyisobviouslyzero,andowingtothedivergencetheorem



L y r ds

=



R(L)

∇ ·

eydx dy

=

0

where

R(L)

is theregion surroundedby

L

(grayarea, Fig.4a). The integral along thecirclearcab is

thenequal tothe oppositeofintegralsalongedges

[

bi

]

and

[

ia

]

oftriangles

T

i jk



ab

ˆ

n

·

ey

 

y r ds

= −



[ia]

ˆ

n

·

ey

 

−1 ds

+



[bi]

ˆ

n

·

ey

 

cos(θk) ds

= −(−

r

+

r cos

k

))

=

r

(

cos

k

)

1

)

Since yj

=

li jsin

k

)

,withlikthelengthofedge

[

i j

]



ab

φ

kds

=

r2 tan



θk 2



li j

Choosinga radiusr smallenough (i.e.smaller thanthe smallestedge withinthe triangulation)allows to simplifythe finitescheme(5) byr2,which meansthat theschemedoesnotdepend onthecircleofintegration.The coefficient

λ

i j is thengivenby

λ

i j

=

tan



θk 2



+

tan



θl 2



li j (7)

Wenoticethat

λ

i j

>

0

,

∀θ

∈ (

0

;

π

)

.Thedifferencescheme(4) with(7) buildslinearinjectivemappings.Thismonotone schemeisnotsymmetric,exceptonequilateraltriangulations.

At thatpoint, one can raisethe question ofthe actualaccuracy ofthe MVC schemefordiscretizing Laplaceequation, whichisourguaranteeofsmoothness.Aconvergenceexperiment2hasbeenperformedonasquare

[

0

;

1

]

× [

0

;

1

]

onvarious meshes(Fig. 5) usingthe standardtechnique ofmanufactured solutions. Wechoose f

(

x

;

y

)

=

sin

(

2

π

x

)

cosh

(

2

π

y

)

whose laplacian

2f iszero.

Fig. 6 shows that MVC scheme does not exhibit the usual FEM convergence.The absence of symmetry of the MVC schemeimpliesthat only

O(

h

)

convergenceisobservedforthe L2 norm.Yet, theMVC schemeseemsto convergeonall meshesexceptthestructuredone.Thisbehaviorisduetopollution.

3.4. Boundaryconditions

We consider 3D surfaces that are topologically equivalent to a disk with#b

1 internal boundaries. The parametric domainthatisconsideredisalwaysaunitdisk

A

=



(

u

;

v

)

2

:

u2

+

v2

<

1



.

The setup is described in Fig. 7. Dirichlet boundary conditions are applied on x

(∂

A

)

that actually ensure that the u

,

v

(8)

Fig. 6. h-convergence of discrete schemes (4) with (5) VS (7) on mesh types of Fig.5.

Fig. 7. A 3D domain that is topologically equivalent to a disk with 3 internal boundaries and its parametric domain A. coordinatesonx

(∂

A

)

correspondtotheunitcircle

δ

A

=



(

u

;

v

)

2

:

u2

+

v2

=

1



.

We shouldnow decideonwhat boundaryconditionstoapply onthe otherboundaries

δ

Bi.The issuehereisthatwe do not knowapriori their position in theparameter plane. We could decide their position andinsert #b

1 small circles inside A.Yet,thiswould leadto a parametrizationthat isquite distorted.Anotheroptionis toapply the smootherasis toeveryinternalpoints,includingtheonesontheinternalboundaries.Thisindeedcorrespondstoimposinghomogeneous Neumannboundaryconditionsonevery internalboundary.It isindeedeasy toprovethatthischoicestill leadstoa one-to-one parametrization.Onefirstthingtonoteisthatifevery

Bi isconvexandifweuseaconvexcombinationmaplike (7),thenthemappingisone-to-one.

Assumethatpoints p1

,

p2

,

. . . ,

pkformaclosedloopintheparameterplaneandthateverypointliesintheconvexhull ofitsneighbors,suchasFig.8.Then, polygon

(

p1

,

p2

,

. . . ,

pk

)

isconvex. Indeed,ifeverythreeconsecutivepointsi

,

j

,

k of such aloopforman angle

α

j thatisgreaterorequalto

π

,thentheedges

(

i

;

j

)

and

(

j

;

k

)

layintheconvexhull

H

j.Ifit istrueforeverypointoftheloopcorresponding tothehole,thenits loopintheparameterplaneisconvex.From §3,we knowthatapositiveschemeproduceaone-to-oneparametrization.Hence,ifnoconditionareimposedontheholes- which corresponds to Neumanncondition within FEMformulation- the parametric representationofthose holescorrespond to convexloop,whatevertheinitialshapeofholes(i.e.eveniftheywereconcave).

Fig. 9b shows a concave domain with a concave hole that is mapped using (7) and where homogeneous Neuman boundary conditions were applied to the internal boundary. In this case,

nu

= ∂

nv

=

0 on the internal boundary and the parametrizationis closeto besingular becausethe twotangent vectorsare nearly parallel: both ofthem areweakly

(9)

Fig. 8. Three consecutive points belonging to a loop describing an hole (hatched area) in A. Anotheroptionconsistsoffillingtheholes,whichleadstobetterresultsinpractice(seeFig.9b).

Aheuristictofillholesistolinkeachvertexlyingontheholetoapseudocenter c ofthehole.Thispseudocenter corre-spondstothecenterofthecircleassociatedtothehole,Fig.10.Theholeisapproximatedbyacirclewhichcircumference 2

π

r correspondstotheperimeterofthehole



jlj.Theverticesdefiningtheholearethenassumedtolieonsuchacircle. New triangles are thendefined, by connectingthose vertices tothe pseudo centerof thehole. The angle

α

j definedby  vicvi+1 is assumedto beequal to

lj

r. Since thetriangles fillingthe holeare assumedto sharec, they are isosceles.All thoseassumptionsenabletoaveragetheparametriccoordinatesofverticeslyingonthehole,suchthattherewas nohole. Thetrianglesfillingtheholearenotexplicitlybuilt.

Theheuristic performs well,evenifthe holeisconcaveandbadlyshaped, Fig.9b.The improvementcomparedtothe homogeneousNeumannconditionisobvious,Fig.9a.Actually,someparametrictrianglesofFig.9aaretootightformeshing purposes.

Thedrawbackoffillingholes isthatitincreasestheconnectivityofthelinearsystemenabling thecomputationofthe underlined parametrization. Indeed, the pseudo centers corresponds to extra unknowns which are related to the corre-spondingunknownsalongeachhole.Hence,thecorrespondingrowswithinthematrixrepresentingthelinearsystemmay havealotofnonzero.Inordertoavoidamemoryoverflow,athresholdofthepotentialconnectivityisset:iftherearetoo manyverticesonahole,Neumannboundaryconditionsareset.Otherwise,thisholeisfilledwiththepseudocenter. 4. Gmsh’spipelinefordiscretesurfacemeshing

ThespecificationsofGmsh’salgorithmforthegenerationofmeshesondiscretesurfacesarethefollowing

Aconforming“watertight”geometricaltriangulationisgivenasinput.

Ameshwithuserspecifiedmeshsizeparameters isgivenasoutputbyGmshwhereall meshverticesliesexactlyon theinputtriangulation.

InGmsh’s newpipeline,the problemofsurface meshing isdividedintwo stages:(i) apre-processingstage and(ii)a meshgeneration stage.Inorderto explaintheusefulnessthe twostagesofthepipeline,a relativelysimpleexamplewill serveasacommonthemetoillustratethevarioustreatments thathavetobeundergobyaroughgeometrictriangulation tobecomeahighqualityfiniteelementmesh.

Fig.11showsthegeometrictriangulationofa“Batman”objectthatisconnectedtoatorus.

InGmsh’spipeling,aroughgeometricaltriangulationistakenasinput.AtriangulationliketheoneofFig.11cannotbe processedasisforanumberofreasons.

4.1. Detectingfeatureedges

The geometricaltriangulation ofFig.11 iscomposed ofa listof triangles,period.The first partofourpre-processing istodetectfeatureedges ofthegeometrythat shouldbepresentinthefinalmesh.Weusehereasimpleanglecriterion todetectfeatureedges.Afterdetectingfeatureedges,afirstversionofthefinal atlasiscreated.Fig.12showstheBatman geometrywherefeatureedgeshavebeencreatedforalledgesthathavetwoadjacenttriangleswithnormalsseparatedby anangleofmorethan 40 degrees.Afirstversion ofthefinaltopology ofthedomainiscreatedwithmodelfacesthatare boundedbythe featureedges.After thecomputation offeatureedges, curvaturetensorsare computedatevery vertexof everysurfaceusing[15].

4.2. Creatingtheatlas

Atthatpoint,wearenotyetreadytocomputetheatlasofthemodeli.e.thefinalboundaryrepresentationofourmodel togetherwiththeparametrizationofallitsmodelsurfaces.Asexplainedin§3everymodelsurfaceoftheatlasshouldhave

(10)

Fig. 9. Demonstration offilling aconcaveholewiththe circleassumption.Top:parametrizationoverthe(discrete)geometry(u:redisolines, v:blue isolines).Bottom:triangleswithinthecomputedparametricspace.(Forinterpretationofthecolorsinthefigure(s),thereaderisreferredtothe web versionofthisarticle.)

(11)

Fig. 11. The Batman geometry.

Fig. 12. TopleftFigureshowsthefinalmodelwithfeatureedgesdetection(thresholdangleof40degrees).BottomleftFigureshowsauniformmeshon thatmodel.RightFiguresshowthefinalmodelandmeshwithoutfeatureedgesdetection.Thedomainhasbeensplitautomaticallyinsuchawaythat everymodelfacehastherighttopology.

therighttopology.Inthisfollowingstep,weensurethateverymapoftheatlashasthisrighttopology.Whenasurfacehas alarger genus,itissplitintwo partsusingagraphpartitioningtechnique[16].Thisoperationisappliedup tothepoint wheneverysurfaceisparametrizable.

Itisalsoknownthatsurfaceswithlargeaspectratiosmayleadtoparametrizationsthathavenondistinguishable coor-dinates.When theparametrizationiscomputed, we alsoensurethat parametrictriangles arenot toosmalli.e. that their areaisnotclosetomachineprecision[13].Ifitisthecase,thesurfaceissplitintwo.

Forlargemodels,wealsosplitsurfacesthatcontainatoolargenumberoftriangles(typically100,000).Computingmean valuecoordinatesrequiretosolveanonsymmetricalsystemofequationsandoneofthedesigngoalsoftheparametrization processistobefast.

Fig.12(topright) showsthe decompositionthat hasbeendoneon theBatman modelwithoutpre-computingfeature edges.

4.2.1. ThefinalBREP

At that point, the input triangulation has been transformed into a proper boundary representation that has a valid topologyandforwhicheachfacehasbeenparametrized.Allthosetopologicalandgeometricalinformation arenowsaved intheversion4oftheoutputmeshformatofGmsh.This“extended”meshfilecanbeusedasinputtoGmsh’ssurfacemesh generators.Fig.12(bottomimages)showmeshesforbothmodelsgeneratedusingfeatureedgesandautomaticsplitting. 5. Improvingparametrizationoncoarsediscretesurfaces

The methodologythat hasbeenpresentedbefore isgeneralandapplies totriangulatedsurfacesofarbitrary complex-ity.Yet, geometrical triangulationsof CADsurfacesmaynot be sufficiently denseto allow asmooth parametrization. For example,agoodgeometricaltriangulationofacylindermaynotcontaininternal verticesasdepictedonFig.13.We have computedtheparametrizationofthiscylinderusingmeanvaluecoordinatesandtheresultispresentedinFig.13a.Evenif

(12)

Fig. 13. Parametrization on coarse stl triangulations: a cylinder.

Fig. 14. Parametrization on refined stl triangulations: the cylinder (5 iterations).

thisparametrizationissaid“moderatelynoised”,itcannotbe usedformeshgenerationpurposes.Figs. 13band

13

c show conformityindicator σ2

σ1 bothontherealandparameterspaceofthecylinder.

From thisobservation, anumericalanalystwouldsuggest twowaystoimprovethecomputation:refiningthe solution (i.e.theinputmesh),eitherincreasingtheorderoftheapproximation(i.e.secondorder).

5.1. Refinementbylongestedgebisection

Werefinethegeometricaltriangulationwithoutchangingitsgeometryi.e.onlyusingedgesplits.Weusehereavariant ofthewellknownlongestedgebisectionprocess [17]:edgestobesplitaretaggedandthelongestedgeofthelistissplit, then thesecond longestedge issplit andthe processcontinues untiltheshortestedge ofthelistissplit. Werepeat the process severaltimesup tothepointallinneredgesrespectalengththreshold.Fig.14ashowsthenewgeometricalmesh ofthecylinder.

Inordertoillustratetheeffectofthisrefinementontheparametrization, wehavepre-computeda“goodmesh”ofthe cylinderinthe3Dspace(see FigureFig.15a). Thisgoodmeshhasbeeninverse-mappedontotheparameterspacesofthe non refinedcylinderandontherefinedcylinder.While doingthat,wecanseethemeshesthatshouldhavebeencreated by Gmsh’s surface meshers in both parameter planes toobtain the same “good mesh”. Fig. 15b showsthe mesh in the parameterplaneofthenonrefinedgeometricalcylinder:itcontainsseriesofelongatedtrianglesfollowedbyisotropicones, illustrating thetoogreat variabilityoftheconformity parameter.InFig. 15c,the meshisanosotropicbutelementshapes arelocallyuniformandanygoodanisotropicmesherisabletogeneratethatkindofmesh.

(13)
(14)

Fig. 16. Sketch for quadratic approximation ofλPi j2.

5.2. Secondorderapproximation

Asinthepiecewiselinearapproximation(see§3.3),wederive

λ

i j fromLagrange

P

2 functionshapes

θ

kr fi

=



ab

fi

φ

i

+

fj

φ

j

+

fk

φ

k

+

fi j

φ

i j

+

fjk

φ

jk

+

fik

φ

ikds

where

φ

are theLagrange

P

2 finiteelement shapefunctions, whichdefinedwiththebarycentric coordinates

(v

i

,

v

j

,

v

k

)

[18,Chapter1,§1.2.4]



φ

a

= v

a

(

2

v

a

1

),

a

∈ {

i

,

j

,

k

}

φ

ab

=

4

v

a

v

b

,

a

,

b

∈ {

i

,

j

,

k

} :

a

=

b Assigningcoordinatesrelativeto vi,Fig.16

v

i

= (

0

;

0

)

v

j

= (

li jcos

k

)

;

li jsin

k

))

v

k

= (

lik

;

0

)

Again,

φ

i

+ φ

j

+ φ

k

+ φ

i j

+ φ

jk

+ φ

ik

=

1 enablesustowrite

θ

kr



ab

φ

ids







ab φj+φk+φi j+φjk+φik fi



ab

φ

jdsfj



ab

φ

kdsfk



ab

φ

i jdsfi j



ab

φ

jkdsfjk



ab

φ

ikdsfik

=

0 whichgives



ab

φ

jds

 

λi j

(

fi

fj

)

+



ab

φ

kds

 

λik

(

fi

fk

)

+



ab

φ

i jds

 

λi(i j)

(

fi

fi j

)

+



ab

φ

jkds

 

λi(jk)

(

fi

fjk

)

+



ab

φ

ikds

 

λi(ik)

(

fi

fik

)

=

0

(15)

Fig. 17. Graph corresponding to LagrangeP2dof’s on a triangle has no planar representation.

Fig. 18. Complex scannedmechanical part. Theinitial triangulation(left) thatcontains 797,666 triangles has been split into 194 surfacesthat are parametrizable.Themeshontherightthatcontains1,762,388 trianglesandhasbeenadaptedtothecurvatureoftheoriginaldiscretesurface.Ithas beengeneratedbyGmshin640 seconds,includingIO’s.

Weuse

SymPy

[19] tocompute

λ

Pi j2 (codeinsupplementarymaterial)

λ

Pi j2

=

r 2 l2 i j sin 2

k

)



(

li j

r

)

cos

k

)

sin

k

)

+

r

θ

k

li jsin

k

)



(8)

Weshouldderivetheothercoefficients

λ

P2,butsomethingiswrongwith(8).Wecannotgetridofr withinthe expres-sion.Itmeansthatthecoefficientsgivetheaverageforacertaincircleofradiusr.Yet,ithastobeforany circle,whatever theradius.Itisthennotpossibletoderive

λ

P2 foramonotonescheme.

Actually, graph theory states such a result. Lagrange

P

2 degrees of freedom on a triangle may be depicted by a 3-connectedgraph,Fig.17b.Tutte[9,§4] claimsthat anygraphhavingaKuratowskisubgraph isnonplanar. Fig.17a cor-responds toa Kuratowski graph.Agraph isplanar ifit can be drawnon a plane, insuch a waythat its edge intersects only on vertices of the graph. It means that each vertex of the graph may correspond to a convex combination of its neighbors,whichweaim.However,Fig.17bhassuchaKuratowskisubgraph,Fig.17c.ThegraphofFig.17bhasnoplanar representation.Hence,itmeansitisnotpossibletowriteLagrange

P

2 schemewhichismonotone.

6. Examples

Inthissection,severalcomplexexamplesarepresentedthatshowthelevelofrobustnessthathasbeenattainedbyour methodology.(SeeFigs.

18

–21.) Theexamplesthathavebeenchoseninordertochallengeouralgorithmandpushittothe limit.

7. Conclusion

ThispaperhasdemonstratedtheGmsh’sabilityto remeshrobustlypoorqualitytriangulations, forthe purposetorun finite element analysis. Gmsh’s pipelineessentially relies on the one-to-onenessof parametrization, whereconformity is notmandatorysinceamesherhastodealwithanisotropicmeshes.Wehaveshownthatsuchadiscreteparametrizationis possibleonlyifthecorrespondingmappingorientsallparametrictrianglesinthesameway.

(16)

Fig. 19. X-raytomographyimageofasiliconcarbidefoam(fromP.Duru,F.MullerandL.Selle,IMFT,ERCAdvancedGrantSCIROCCO).Theinitial trian-gulation(left)thatcontains1,288,116 triangleshasbeensplitinto1,802 surfacesthatareparametrizable.Themeshontherightcontains4,922,322 trianglesandhasbeenadaptedtothecurvatureoftheoriginaldiscretesurface.ItbeengeneratedbyGmshin1,187 seconds,includingIO’s.

Fig. 20. CTscanofanartery.Theinitialtriangulation(left)thatcontains63,468 triangleshasbeensplitinto101 surfacesthatareparametrizable.Most ofthecutsweredonebecauseofthelargeaspectratioofthetubulardomains.Theuniformmeshontherightthatcontains170,692 triangleshasbeen generatedbyGmshin22 seconds,includingIO’s.

Fig. 21. Remeshingofaskull.Theinitialtriangulation(left)thatcontains142,742 triangleshasbeensplitinto715 surfacesthatareparametrizable.The meshontherightisadaptedtothesurfacecurvatureandcontains323,988 trianglesandhasbeengeneratedbyGmshin58 seconds,includingIO’s.

(17)

severaldifficultexamplesareexhibitedasademonstrationoftherobustnessofGmsh’spipeline. Declarationofcompetinginterest

The authors declarethat they haveno known competingfinancial interests or personal relationships that could have appearedtoinfluencetheworkreportedinthispaper.

Acknowledgement

Thepresentstudywascarriedoutintheframeworkoftheproject“LargeScaleSimulationofWavesinComplexMedia”, whichisfundedbytheCommunautéFrana¸isedeBelgiqueundercontractARCWAVES15/19-03.

Appendix A. DerivationoftheFEMschemeforharmonicmapping

Continuous harmonicmapsminimizetheDirichletenergy



Pi

|∇φ

i

|

2dx

oftheparametrization

φ

i onthepatchPi.Inotherwords,itminimizesthedistortionbetweenthepatchesandtheirplanar representation.

ItispossibletowriteaLaplacianasafinitedifferencescheme

2f

|

i

#i



j

λ

i j

(

fi

fj

)

It is a linear approximation of a Laplace operator ata vertex i. Indeed,the Laplace operator corresponds to the Euler-LagrangeequationsderivedfromtheDirichletenergy



|∇

f

|

2dx



||



j fj

∇φ

j

||

2dx d df



|∇

f

|

2dx





i

2

 

j fj

∇φ

j

· ∇φ

idx

with

φ

•denotingthelinearfunctionshapeassociatedtoanode.Onatriangle

T

i jk,knowingthat

φ

i

+ φ

j

+ φ

k

=

1 over

T

i jk



Ti jk fi

∇φ

i

· ∇ (

1

− φ

j

− φ

k

)





φi

+

fj

∇φ

i

· ∇φ

j

+

fk

∇φ

i

· ∇φ

kdx Rewritinglastrelationwithterms

(

fi

fj

)

and

(

fi

fk

)

,weobtain

λ

i j

= −



Ti jk

∇φ

i

· ∇φ

jdx

whichcorrespondstothestandardGalerkinfiniteelement. Ontriangle

T

i jk (Fig.3)

∇φ

i

· ∇φ

j

= |∇φ

i

||∇φ

j

|

cos

(

π

− θ

k

)

where

(18)

Fig. 22. Stencil within a structured mesh.

|∇φ

i

| =

1 liksin

k

)

|∇φ

j

| =

1 ljksin

k

)

withlkthelengthofedge

[•

k

]

.Knowingthat

|

T

i jk

|

=

12likljksin

k

)



Ti jk

∇φ

i

· ∇φ

jdx

=

1 2 cos

k

)

sin

k

)

Addingthecontributionof

T

ilj

λ

FEMi j

:=

1 2



cos

k

)

sin

k

)

+

cos

l

)

sin

l

)



.

Appendix B. MVCdifferenceschemeonastructuredmeshisnotaLaplacian TheMVCdifferenceschemerelativeto fi correspondsto

2

h

(

4 fi

− (

fi1

+

fi2

+

fi4

+

fi5

))

+

2

2

h

(

2 fi

− (

fi3

+

fi6

))

=

0 (B.1)

The firsttermof(B.1) (withoutthecoefficient)corresponds to thewell knownlinearcombinationofacentered finite differencetoapproximateaLaplacian.However,thesecondtermdoesnotapproximateacontinuous Laplacian.Indeed,the Taylorexpansionof fi3and ffi6 is

fi3

=

fi

f

x





i h

+

f

y





i h

+

2f

x2





i h2

+

2f

y2





i h2

2f

x

y





i h2

+ hot

fi6

=

fi

+

f

x





i h

f

y





i h

+

2f

x2





i h2

+

2f

y2





i h2

2f

x

y





i h2

+ hot

Hence, fi3

+

fi6

2 fi

=

2h22f i



2

2f

x2





i h2

+

2

2f

y2





i h2

2

2f

x

y





i h2

Becauseofthatlastterm,theMVCschemeonastructuredmeshsuch asFig.22isnottheapproximationofacontinuous Laplacian.(SeeFig.23.)

Appendix C. Supplementarymaterial

Supplementarymaterialrelatedtothisarticlecanbefoundonlineat

https://doi

.org/10.1016/j.jcp.2020.109575. References

[1]H.Borouchaki,P.Laug,P.-L.George,Parametricsurfacemeshingusingacombinedadvancing-frontgeneralizedDelaunayapproach,Int.J.Numer. MethodsEng.49 (1–2)(2000)233–259.

[2]C.Geuzaine,J.-F.Remacle,Gmsh:athree-dimensionalfiniteelementmeshgeneratorwithbuilt-inpre-andpost-processingfacilities,Int.J.Numer. MethodsEng.79 (11)(2009)1309–1331.

(19)

Fig. 23. Approximations of∇2f=0 on a structured mesh over a square[0;1] × [0;1].

[3]J.Remacle,C.Geuzaine,Gmsh’sapproachtorobustmeshgenerationofsurfaceswithirregularparameterizations,in:28thInternationMeshing Roun-datable,SandiaNationalLaboratories,October15-17,2019.

[4]P.Frey,YamsaFullyAutomaticAdaptiveIsotropicSurfaceRemeshingProcedure,2001.

[5]E.Béchet,J.-C.Cuilliere,F.Trochu,Generationofafiniteelementmeshfromstereolithography(stl)files,Comput.AidedDes.34 (1)(2002)1–17.

[6]D.J.Struik,LecturesonClassicalDifferentialGeometry,CourierCorporation,1961.

[7]B.Lévy,S.Petitjean,N.Ray,J.Maillot,LeastSquaresConformalMapsforAutomaticTextureAtlasGeneration,ACMTransactionsonGraphics(TOG), vol. 21,ACM,2002,pp. 362–371.

[8]M.S.Floater,K.Hormann,Surfaceparameterization:atutorialandsurvey,in:AdvancesinMultiresolutionforGeometricModelling,Springer,2005, pp. 157–186.

[9]W.T.Tutte,Howtodrawagraph,Proc.Lond.Math.Soc.3 (1)(1963)743–767.

[10]J.-F.Remacle,C.Geuzaine,G.Compere,E.Marchandise,High-qualitysurfaceremeshingusingharmonicmaps,Int.J.Numer.MethodsEng.83 (4)(2010) 403–425.

[11] P.Dirac,TheLorentztransformationandabsolutetime,Physica19 (1—12)(1953)888–896,https://doi.org/10.1016/S0031-8914(53)80099-6. [12]M.S.Floater,Meanvaluecoordinates,Comput.AidedGeom.Des.20 (1)(2003)19–27.

[13]E.Marchandise,C.C.deWiart,W.Vos,C.Geuzaine,J.-F.Remacle,High-qualitysurfaceremeshingusingharmonicmaps- partII:surfaceswithhigh genusandoflargeaspectratio,Int.J.Numer.MethodsEng.86 (11)(2011)1303–1321.

[14]R.J.Duffin,Distributedandlumpednetworks,J.Math.Mech.(1959)793–826.

[15]S.Rusinkiewicz,Estimatingcurvaturesandtheirderivativesontrianglemeshes,in:Proceedings.2ndInternationalSymposiumon3DDataProcessing, VisualizationandTransmission,2004,3DPVT2004,IEEE,2004,pp. 486–493.

[16] G.Karypis,V.Kumar,MeTis:unstructuredgraphpartitioningandsparsematrixorderingsystem,version4.0,http://www.cs.umn.edu/~metis,2009. [17]M.-C.Rivara,Newlongest-edgealgorithmsfortherefinementand/orimprovementofunstructuredtriangulations,Int.J.Numer.MethodsEng.40 (18)

(1997)3313–3324.

[18]A.Ern,J.-L.Guermond,TheoryandPracticeofFiniteElements,vol. 159,SpringerScience&BusinessMedia,2013.

[19]A.Meurer,C.P.Smith,M.Paprocki,O.ˇCertík,S.B.Kirpichev,M.Rocklin,A.Kumar,S.Ivanov,J.K.Moore,S.Singh,etal.,Sympy:symboliccomputingin python,PeerJComput.Sci.3(2017)e103.

Figure

Fig. 1. The case of an ellipsoid. Figure a shows the mesh of the ellipsoid in the parameter space while Figure b shows the same mesh in the 3D space.
Fig. 2. Sketch of proof for monotonicity.
Fig. 3. Definitions of θ k and θ l for the difference scheme corresponding to the linear Galerkin approach.
Fig. 4. Derivation of the difference scheme corresponding to the mean value coordinates.
+7

Références

Documents relatifs

M¨ uller- Hannemann: in a first stage, the input surface mesh is reduced to a single hexahedron by successively eliminating loops from the dual graph of the quad mesh; in the

This paper is positioned within the context of the CISMeF project (acronym of Catalogue and Index of French-speaking Medical Sites) and of a future Semantic Web.

3Deportment of Soil Science of Temperate Ecosystems, lJniversity of Gottingen, Gdttingen, Germony 4Chair of Soil Physics, lJniversity of Bayreuth, Bayreuth,

- A 2-dimensional Brownian motion, run for infinite time, almost surely contains no line segment... similarly the probability of covering at least 0N of these N

MICRO CRAFT CORPORATION MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS MANUAL OR WITH RESPECT TO THE SOFTWARE DESCRIBED IN THIS MANUAL,

N0 alternatives from which to choose. And if something is infinitely divisible, then the operation of halving it or halving some part of it can be performed infinitely often.

ˆ it allows a fully automatic computation of skinning weights, based on the distance on the surface rather than the Euclidean distance, which can then be used with standard

Change password is a request reply protocol that includes a KRB_PRIV message that contains the new password for the