Geometry and mesh preparation
Geometry and mesh are prepared using Gmsh. Note that the solver identifies the group of elements through Physical groups.
Python code structure
Include python library after compiling the code
The PYTHONPATH to the compiled directory must be specified in .bashrc for both gmsh and the solve, then the following line must be added in the beginning of the python file:
from gmshpy import *
from dG3Dpy import*
Define Material law and Domain
The basic principle of the FE implementation is to divide the whole domain of interest by domains. Each domain possesses its own constitutive behavior govering by a material law. Mechanical, thermal, or multi-physical coupled domain-material law can be used.
Material law
A material law is defined as
law = MaterialLawName(matNum, Arguments)
where the number matNum must be a unique integer to identify the law (when multiple laws are considered), MaterialLawName and its arguments Arguments can be found in the source code. When using linear elements, one should use
law.setUseBarF(True)
to avoid volumetric locking.
For example, a J2 plastic model can be defined as follows:
lawnum1 = 11 # unique number of law
E = 210E3
nu = 0.3
K = E/3./(1.-2.*nu) # Bulk mudulus
mu =E/2./(1.+nu) # Shear mudulus
rho = 2.7 # Bulk mass
sy0 = 507.
h = E/100.
harden = LinearExponentialJ2IsotropicHardening(lawnum1, sy0, h, 0., 10.)
# creation of material law
law1 = J2LinearDG3DMaterialLaw(lawnum1,rho,E,nu,harden)
Domain
A domain is defined as
domain = dG3DDomain(tag,phys,sp,lnum, fdg, dim, nonLocalVar, nonConstitutiveExtraDOFVar, nonCurlData)
where
-
tag: a positive integer associated to this domain. If only one domain is available, this number can be choose freely as a positive integer. When multiple domains are presents, this number provides different possibilities:
- If fdg=False and tag is the same for all domains, a conventional constitous Galerkin FE (CG) is found.
- If fdg=False and tag is different between two domains, CG is used for these domains but an DG interface between these two domains must be provided to guarantee the continuity of the fields accross this interface. This option is useful when considering multiple domains when only decohesion between them is interested.
- If fdg=True, tag can be assigned to an arbitrary positive integer as a full discontinuous Galerkin (DG) is considered.
- phys: Finite elemet support of this domain. The value of phys corresponds to the Physical number of the domain defined in the geometry with Gmsh.
-
sp: function space type governs the finite element approximation. There are two possibilities:
- sp=0: Lagrange-based shape functions
- sp=1: Hierarchical shape functions
- lnum: material number governs the constitutive behavior of the domain. Note that the material law must be unique with lnum while a domain must be unique with phys. One material law can be used for different domains.
- dim (3 by default): dimension of the FE support: 3= three-dimensional domain, 2 = two-dimensional domain, and 1 = 1-dimensional domain.
- nonLocalVar (0 by default): number of nonlocal variables when considering a nonlocal domain.
- nonConstitutiveExtraDOFVar (0 by default): number of extra fields when considering a multi-physics domain (e.g. nonConstitutiveExtraDOFVar=1 for thermal domain).
- nonCurlData (0 by default): number of curl fields when considering a multi-physics domain.
nfield = 217 # number of the field (physical number of entity)
dim =3
myfield1 = dG3DDomain(10,nfield,0,lawnum1,0,3)