Post on 26-Nov-2018
GmshandGetDPinAcademiaandIndustry
C.GeuzaineUniversityofLiège,Belgium
OctConf2015-Darmstadt,September232015
• IamaprofessorofElectricalEngineeringandComputerScienceattheUniversityofLiègeinBelgium,whereIleadtheACEresearchgroup
• Ourresearchinterests:modeling,analysis,algorithmdevelopment,andsimulaNonforproblemsarisinginvariousareasofengineeringandscience
• Wewritequitealotofcodes,mostlyPDEsolversinC++/Python
• TwocodesreleasedunderGNUGPL:
• Gmshmeshgenerator:hVp://gmsh.info
• GetDPfiniteelementsolver:hVp://getdp.info
• Thesearelongtermefforts(bothstartedin1997)
SomeBackground
SomeBackground
Today,GmshandGetDPrepresent
• halfamillionlinesof(mostlyC++)code
• sNllonly3coredevs;butabout100withrepowriteaccess
• about1000peopleonmailinglists
• about5000binarydownloadsperweek(80%Windows)
• about400(googlescholar)citaNonsperyear
SomeBackground
Today,GmshandGetDPrepresent
• halfamillionlinesof(mostlyC++)code
• sNllonly3coredevs;butabout100withrepowriteaccess
• about1000peopleonmailinglists
• about5000binarydownloadsperweek(80%Windows)
• about400(googlescholar)citaNonsperyear
Let’shavealook!
QuickoverviewofGmsh
• Gmshisbasedaroundfourmodules:Geometry,Mesh,SolverandPost-processing;3levelsofuse:
• Developper:throughthe(undocumented…)C++orPythonAPI
• Advanceduser:throughthededicated“.geo”language
• Noviceuser:throughtheGUI(whichtranslatesmostacNonsinto“.geo”filecommands)
• MaincharacterisNc:allalgorithmsarewriVenintermsofabstractCADenNNes,usinga“BoundaryREPresentaNon”approach
T2:InterfaceCAO/maillage
6
T2:InterfaceCAO/maillage
8
10 E. MARCHANDISE
10
51
50
60
61 62
41
00@T1
30
12
11
u00(x)
20
3140
Figure 5. Multiscale Laplace partitioning method of an aorta(G = 0, NB = 13, ⌘ = 17). In thisexample there are n = 6 di↵erent levels on which harmonic maps are computed. The red line showsthe partition line that recursively splits the mesh into two area balanced mesh partitions (see the
resulting mesh partition in Fig.6 ).
Copyright c� 2010 John Wiley & Sons, Ltd. Int. J. Numer. Meth. Engng 2010; 00:1–6Prepared using nmeauth.cls
Basic concepts
Any 3-D model can be defined using its Boundary Representation
(BRep): a volume is bounded by a set of surfaces, and a surface is
bounded by a series of curves; a curve is bounded by two end points.
Therefore, four kinds of model entities are defined:
1. Model Vertices G
0i
that are topological entities of dimension 0,
2. Model Edges G
1i
that are topological entities of dimension 1,
3. Model Faces G
2i
that are topological entities of dimension 2,
4. Model Regions G
3i
that are topological entities of dimension 3.
11
QuickoverviewofGmsh
Model entities are topological entities, i.e., they only deal with adja-
cencies in the model, and we use a bi-directional data structure for
representing the graph of adjacencies.
Schematically, we have
G
0i
⌦ G
1i
⌦ G
2i
⌦ G
3i
.
Any model entity is able to build its list of adjacencies using local
operations.
12
QuickoverviewofGmsh
The geometry of a model entity depends on the solid modeler for its
underlying representation. Solid modelers usually provide a parametriza-
tion of the shapes, i.e., a mapping p 2 R
d 7! x 2 R
3:
1. The geometry of a model vertex G
0i
is simply its 3-D location
x
i
= (xi
, y
i
, z
i
).
2. The geometry of a model edge G
1i
is its underlying curve Ci
with
its parametrization p(t) 2 Ci
, t 2 [t1, t2].
3. The geometry of a model face G
2i
is its underlying surface Si
with
its parametrization p(u, v) 2 Si
.
4. The geometry associated to a model region is R
3.
13
QuickoverviewofGmsh
u = u(t), v = v(t)
S
p(u, v)
C
v
u
x
x = x(t), y = y(t), z = z(t)
v = v(x, y, z)
C
S
p(x, y, z)
t1 p(t)tt2
C
u = u(x, y, z)
z
y
Point p located on the curve C that is itself embedded in surface S
14
QuickoverviewofGmsh
CAD kernel idiosyncrasies: seam edges and degenerated edges
15
QuickoverviewofGmsh
CAD kernel idiosyncrasies: seam edges and degenerated edges
15
QuickoverviewofGmsh
C.#Geuzaine#+#Onera#Scien0fic#Day#+#Oct.#3#2012 2
Surface&meshes
Surface#triangula?ons#can#be#generated
• either#directly#in#the#embedding#3MD#Euclidean#space
• or#in#the#parametric#plane#of#the#surface,#which#is#far#more#robust#(Delaunay#and#variants)
Surface mesh generation techniques
Surface meshes can be1 generated directly in the “real” 3D space; or2 generated in the parametric plane of the surface.
Several algorithms implemented: Delaunay, “Frontal Delaunay”, localmesh modifications (collapse and splits only)
C. Geuzaine WIAS, December 4th, 2008
Surface mesh generation techniques
When a decent parametrization of the surface exists, building themesh in the parametric plane is more robustIssues like seam and/or degenerated edges have to be taken intoaccount,Need ability to generate (highly) anisotropic meshes.
C. Geuzaine WIAS, December 4th, 2008
Abstract interface
• For the geometry:
GModel
GVertex
GEdge
GFace
GRegion
Concrete implementation for each CAD kernel (e.g. gmshFace, OCCFace,
parasolidFace, fourierFace, levelsetFace, discreteFace).
Direct access via CAD kernel APIs: never translate/convert formats!
16
QuickoverviewofGmsh
class GEdge : public GEntity {//bi-directional data structure
GVertex *v1, *v2;
std::list<GFace*> faces;
public:
//pure virtual functions that have to be overloaded for every
//solid modeler
virtual std::pair<double> parRange() = 0;
virtual Point3 point(double t) = 0;
virtual Vector3 firstDer(double t) = 0;
virtual Point2 reparam(GFace *f, double t, int dir) = 0;
virtual bool isSeam(GFace *f) = 0;
//other functions of the class are non pure virtual
//..
};
17
QuickoverviewofGmsh
class GFace : public GEntity {//bi-directional data structure
GRegion *r1, *r2;
std::list<GEdge*> edges;
public:
//pure virtual functions that have to be overloaded for every
//solid modeler
virtual std::pair<double> parRange(int dir) const = 0;
virtual Point3 point(double u, double v) const = 0;
virtual std::pair<Vector3> firstDer(double u, double v) const = 0;
//other functions of the class are non pure virtual
virtual double curvature(double u, double v) const;
//...
};
18
QuickoverviewofGmsh
Abstract interface (cont’d)
• For the mesh:
MElement
MVertex
Each GEntity stores its “internal” vertices. Parallel I/O through GModel.
Minimal storage:
- 44 bytes per vertex, 28 bytes per tetrahedron (12 Mtets/Gb)
- Enriched for specific algorithms
- MEdge and MFace created on demand
MElement provides access to mapping, Jacobian and integration
Library can be compiled with mesh generation algorithms built-in
19
QuickoverviewofGmsh
Recentfeatures:
• ReparameterizaNonofsurfaces(“STLremeshing”)
• Coarsegrained(distributed,viaMPI)andfine-grained(sharedmemory,viaOpenMP)parallel3DDelaunaymeshingalgorithm
• AutomaNcquadandhex-dominantmeshing
• Anisotropicmeshesandboundarylayers
• Homologyandcohomologysolver
QuickoverviewofGmsh
QuickoverviewofGetDP
• GetDPlanguage(“.pro”files)forthenaturalexpressionoffiniteelementproblems(explicitfuncNonspacesandweakforms,…)
• Solvingondomaintranslatesinto:
i.e.aquitedirecttranscripNonoftheweakformoftheproblem:Findsuchthat,
r · (aru) = f ⌦
Formulation{{NameF;TypeFemEquation;Quantity{{Nameu;TypeLocal;NameOfSpaceH1_0;}}Equation{Galerkin{[a[]*Dof{du},{du}];InOmega;…}Galerkin{[f[],{u}];InOmega;…}}}}
u 2 H10 (⌦)
Z
⌦aru ·ru0 d⌦+
Z
⌦f u0 d⌦ = 0
8u0 2 H10 (⌦)
QuickoverviewofGetDP
• NodisNncNonbetween1D,2Dor3D;staNc,transient,Nme-(mulN-)harmonic,eigenproblems
• EasycouplingoffieldsandformulaNons(physics),staggeredormonolithic,e.g.forexplicitJacobianmatrices/sensiNvityanalysisofstronglycouplednonlinearproblems
• Naturalhandlingofnon-local(global,integral)quanNNes,e.g.forcircuitcoupling
• LinearalgebrathroughPETSc/SLEPcand/orSparksit/Arpack
QuickoverviewofGetDP
• Recentdevelopments:
• UseofGmshlibraryforIO,post-processing,mesh-to-meshinterpolaNon
• LargescalecalculaNonsthroughdomaindecomposiNonmethods(>1billionDoFson10,000CPUsforNme-harmonicwavescaVering)
• High-ordereigenvalueproblems
• Built-inOctaveandPythoninterpreters
GmshandGetDPinacademiaandinindustry
Actualuseisdifficulttoassess,buttodayweesNmatethat
• Gmshisprobablythemostpopularopensourcemeshgenerator;itisusedinhundredsofuniversiNes,researchcentersandcommercialcompaniesaroundtheworld
• GetDPisusedintensivelyinafewdozensuniversiNesandcompanies
Severalcommercialtoolsuseorintegrate(withduallicensing)thecodes,e.g.hVp://www.nxmagneNcs.de
GmshandGetDPinacademiaandinindustry
Actualuseisdifficulttoassess,buttodayweesNmatethat
• Gmshisprobablythemostpopularopensourcemeshgenerator;itisusedinhundredsofuniversiNes,researchcentersandcommercialcompaniesaroundtheworld
• GetDPisusedintensivelyinafewdozensuniversiNesandcompanies
Severalcommercialtoolsuseorintegrate(withduallicensing)thecodes,e.g.hVp://www.nxmagneNcs.de
Wheredowegofromhere?TheONELABproject:hVp://onelab.info
• Economic• GrowingimportanceofnumericalsimulaNonineducaNonandindustry
• ProhibiNvecostofcommercialpackagesforasignificantsubsetofpotenNalusers(SMEs,educaNon,occasionaluse)
• ScienIfic• Highqualityoffree/open-sourcesoowaredevelopedinuniversiNesandresearchcenters
• SomeNmesaheadofcommercialequivalents
• PracIcal• Nouser-friendlyinterfaceand/orpoordocumentaNonformostopensourceFiniteElementAnalysis(FEA)codes
ContextoftheONELABproject
DevelopaplapormforintegraIngfreeFiniteElementAnalysis(FEA)sooware:
• allowingtheintegraNon(byco-simultaNon)ofanyopen-sourcecode,whatevertheircharacterisNcs
• withanintuiNveGUIallowingnewbieuserstogetstartedandguidedintotheworldofFEmodeling—butwiththepossibilitytoconstructsophis1cated,upgradable,mul1-code,mul1-pla8ormscriptsforthespecializeduser
• andwiththepossibilitytoconstructbotheducaNon-andbusiness-specifictools
GeneralgoaloftheONELABproject
ThesoluNonshouldovercometwodifficulNesassociatedwithfreeFEAsooware:
(1) Theheterogeneityofthetools
(2) Themissing“expertlayer”,top-downvalidaIonanddocumentaIonfoundincommercialofferings
GeneralgoaloftheONELABproject
• Manyclosed,commercialtools(COMSOL,AnsysWorkbench,…)
• Moreopentools,e.g.GiD(hVp://gid.cimne.upc.es),butnotfree
• Closestfreesooware:SALOME(hVp://salome-plaporm.org),butverylargeproject,notwellsuitedforbuilding“fastandlight”domain-specificapplicaNons
• Otheropensourceprojects:“mulN-physic”codes(Elmer,etc.)sNllmainlyfocusedonasingledomain(CFD,solids,E-M);theimplementaNonofnewphysicsleadstobare-bonesfeatures,farfromtherefinementofspecializedcodes;noeasy-to-useinterfaceandnodrivingofothercodes
Stateoftheart
• Don’treimplement,interfacetheexisNng!
• Makeitassmall,lightweightandaseasytomaintainaspossible(nosolver-dependentcodeintheinterface)
• Makeiteasytoprovidetemplates,withinteracNveparametermodificaNon
• ONELABrole=datacentralizaIon,(opNonal)modificaIonandredispatching
ONELABguidingprinciples
• Don’treimplement,interfacetheexisNng!
• Makeitassmall,lightweightandaseasytomaintainaspossible(nosolver-dependentcodeintheinterface)
• Makeiteasytoprovidetemplates,withinteracNveparametermodificaNon
• ONELABrole=datacentralizaIon,(opNonal)modificaIonandredispatching
Issuesofcompletenessandconsistencyoftheparametersetarecompletelydealtwithonthesolverside
ONELABguidingprinciples
(1)Heterogeneityofthetools
(2)Missing“expert”layer,top-downvalidaIonanddocumentaIon
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
• Parameterexchangelibrary
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
• Parameterexchangelibrary
• NaNveC++andPythonclients;Parserfornon-naNveclients
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
• Parameterexchangelibrary
• NaNveC++andPythonclients;Parserfornon-naNveclients
(2)DevelopmentanddocumentaIonoftemplates(“meta-models”)
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
• Parameterexchangelibrary
• NaNveC++andPythonclients;Parserfornon-naNveclients
(2)DevelopmentanddocumentaIonoftemplates(“meta-models”)
• Model:blackbox,parameterizableviaabstractinterface
ONELABfeatures
(1)AbstractinterfacetoFEAcodes
• CAD&meshing;physicalproperNes,constraints&codedrivers;post-processing
• ImplementedinGmsh:
• Parameterexchangelibrary
• NaNveC++andPythonclients;Parserfornon-naNveclients
(2)DevelopmentanddocumentaIonoftemplates(“meta-models”)
• Model:blackbox,parameterizableviaabstractinterface
• Meta-model:setofmodels+selecNonlogic
ONELABfeatures
Client-server:
• Clients:CADkernels,meshers,solvers,post-processors
• Server:Gmsh(currently)+database
Abstractinterface:
• Theserverhasnoaprioriknowledgeoftheclients(nometa-languageorexchangefileformat)
• Theserverdoesnotwriteinputfilesfor(naIve)clients:theclientcommunicateswiththeservertodefinewhatinformaNonshouldbeexchanged
ONELABimplementaIon
AbstractinterfacetophysicalproperNes,constraints&codedrivers:
• Libraryforparameterexchange:
• ReferenceserverinC++forportability,e.g.oniOS/Android(onelab::server)
• ClientsinC++(onelab::client)orPython
• Exchangeparameters(onelab::parameter)throughTCP/IPorUnixsockets,orin-memory
ONELABimplementaIon
AbstractinterfacetophysicalproperNes,constraints&codedrivers:
• Libraryforparameterexchange:
• ReferenceserverinC++forportability,e.g.oniOS/Android(onelab::server)
• ClientsinC++(onelab::client)orPython
• Exchangeparameters(onelab::parameter)throughTCP/IPorUnixsockets,orin-memory
• “NaNve”clientsuseC++orPythondirectly
• “Non-naNve”clientsusePython,byinstrumenNngtheirinputfiles
• Currently:Elmer,OpenFOAM,Code_Aster,Abaqus,Gnuplot
ONELABimplementaIon
ONELABimplementaIon
NaNveclient:overloadingofexisNngfuncNons(GetDP)...DefineConstant[Numstep={50,Name"Elmer/Numberoftimesteps"}];DefineConstant[TimeStep={0.1,Name"Elmer/Timestep"}];...
Non-naNveclients:instrumentaNontheinputfilesoftheclient(Elmer)...OL.lineNumStep.number(50,Elmer/,Numberoftimesteps);OL.lineTimeStep.number(0.1,Elmer/,Timestep);SimulationSimulationType=TransientTimestepsizes=OL.get(TimeStep)TimestepIntervals=OL.get(NumStep)...
Preprocessing:conversionintoavalidinputfilefortheclient(Elmer)...SimulationSimulationType=TransientTimestepsizes=0.1TimestepIntervals=50...
onelab::parameter
• nameas‘/’-separatedpath
• dynamicdependencylistofclientsandstatuschange
• decoraNons(help,bounds,choices,...)
• serializaNonanddeserializaNon
ONELABimplementaIon
onelab::parameter
• nameas‘/’-separatedpath
• dynamicdependencylistofclientsandstatuschange
• decoraNons(help,bounds,choices,...)
• serializaNonanddeserializaNon
ExamplefornaNveGmsh&GetDPclients(in.geoor.profiles):DefineConstant[N={32,Name“Numberofslices”}];
ExampleforPythonclient:c=onelab.client()
N=c.defineNumber('Numberofslices',value=32)
ONELABimplementaIon
onelab::parameter
• nameas‘/’-separatedpath
• dynamicdependencylistofclientsandstatuschange
• decoraNons(help,bounds,choices,...)
• serializaNonanddeserializaNon
ExamplefornaNveGmsh&GetDPclients(in.geoor.profiles):DefineConstant[N={32,Name“Numberofslices”}];
ExampleforPythonclient:c=onelab.client()
N=c.defineNumber('Numberofslices',value=32)
ONELABimplementaIon
Let’shaveanotherlook!
• GrowinguseofGmshandGetDPinacademiaandindustry
• “VulgarizaNon”requiresquiteabitofwork,hencetheONELABproject:
• Asimple(trivial?)waytointerfaceFEAsolvers
• InteracNve,basedonGmsh,andfree
• AndnowavailableoniOSandAndroid
• Giveitatry:
• Wishlist:wewantanOctaveserver(andclient)!
hVp://onelab.info
Conclusion
CommentaboutGmshonhVp://www.fltk.org(sic): >From Anonymous, 20:33 May 18, 2004 (score=1) Je suis outre du programme pour des intellectuels vous devrez avoir plus d’imagination vous faite onte au genie informatique
PS:Doingopensourceisrewarding!
CommentaboutGmshonhVp://www.fltk.org(sic): >From Anonymous, 20:33 May 18, 2004 (score=1) Je suis outre du programme pour des intellectuels vous devrez avoir plus d’imagination vous faite onte au genie informatique
TranslaNon(includingmisspellings!)forthenon-frenchspeaking:
>From Anonymous, 20:33 May 18, 2004 (score=1) I am ashamed of the program for intelectuals you should have more imagination you are the schame of computer science
PS:Doingopensourceisrewarding!
ThanksforyouraVenNon!
cgeuzaine@ulg.ac.be