Table of Contents



1D Meshers (Curves)

FIXME Mesh Elements versus Finite Elements: these two notions are different and should not be misunderstood. A mesh is made of geometric cells, the mesh elements. A finite element is a physical entity, which is supported by a mesh element. In Metafor, this is a two-steps method: first, the mesh is created, then the finite elements are applied to the mesh (this second step is done once the integration is started and programmed in the InteractionSet).

Automatic meshers create nodes and mesh cells from the geometry. Metafor meshers are quite basic but still useful to mesh simple geometries, to avoid using external software.

Generating nodes (& cells)

SimpleMesher1D

Beginner Basic meshing of Curves can be done with the following command:

 SimpleMesher1D(curve).execute(ne, d=1.0, gencells=False)

with

curve [Curve] the curve to be meshed
ne [int] number of segments
d [float] distribution (ratio between the length of the last and first segments)
gencells Advanced [bool] generate mesh cells (e.g. for 1D springs)

Advanced Likewise, meshing at a higher degree (second or third):

 HighDegreeSimpleMesher1D(curveset(number), degree).execute(ne, d, cells)

Note : The d parameter is used to create segments d times smaller at the beginning of the curve than at its end. Therefore, the curve orientation matters.

Density mesher - DensityMesher1D

Advanced The density mesher is used to mesh a line while specifying the length of the desired segment as a function of the curvilinear abscissa. This is done in two steps:

First, a function “mesh element length” is defined, with the reduced curvilinear abscissa as argument ($s\in[0,1]$).

def ellength(s):
    return 0.1+(s-0.5)*(s-0.5)
ellength = PythonOneParameterFunction(ellength)

Second, the density mesher is created on curve #1.

mesher = DensityMesher1D(curveset(1), ellength)
mesher.setDeltaI(0.001)      # internal integration parameter
mesher.execute(False)

The parameter False, passed to execute, is used to generate only nodes, and not segments. This is important to be consistent with 2D meshing and for defo-defo contact.

HybridDensityMesher1D

Advanced The way to create a grid of $n$ intervals on a curve starts with specifying the distribution of points on this curve. This is done by specifying the distribution of the curve parameter ${u(\xi) \; 0 \leq \xi \leq n+1}$ in the parametric domain, corresponding to the points of the curve ${\boldsymbol{x}(u) \; 0 \leq u \leq 1}$ in the physical domain. The final task is to specify ${u(\xi) \; 0 \leq \xi \leq n+1}$ such as ${\boldsymbol{x}(u(\xi)) \; 0 \leq \xi \leq n+1}$ is a good parametrization of the curve $\boldsymbol{x}(u)$.

Finding the function $u(\xi)$ is equivalent to finding the function $\xi(u)$. With the definition $\rho(u) = \frac{d\xi}{du}$, it leads to:

$$ \xi(u) = \int_0^u \rho(w) dw. $$

In the hydrid case, the construction of the grid points density function $\rho(u)$ requires more complex physical considerations. Several approaches exist:

In practice, it is likely that the user wishes for an hybrid grid points density function, so a linear combination of several functions described above. These functions $\rho_i(u)$ can be combined, each one being normalized such as $\int_0^1 \rho_i(u) \, du = \xi(1)-\xi(0) = m$. Introducing the positive constants $\lambda_i$ such as $\sum_i \lambda_i=1$, the normalized hybrid density function $\rho(u)$ is defined as: $$\rho(u) = \sum_i \lambda_i \rho_i(u)$$ This hybrid density function migrates the grid points towards every area where a function $\rho_i(u)$ requires refining. Using this concept, it is possible to allocate grid points based on hybrid criteria of arc length, curvature and attraction towards a set of distinct points ${u_i^*}$.

Finally, supplying:

where $\lambda_s+\lambda_{\kappa}+\sum_{i=1}^p \lambda_i =1$, a distribution of $n+1$ points $u_0, u_1, \ldots, u_{n+1}$ is generated, where these points are simultaneously:

In Metafor, the mesher HybridDensityMesher1D is interfaced as:

Mesher = HybridDensityMesher1D(curveset(number),p)                              
Mesher.execute(n,lambdaS,lambdaK,cells)
number number of the curve to be meshed
p number of attraction points - [default=0]
n number of segments
lambdaS weight of the uniform arc length distribution criterion - [default=1.0]
lambdaK weight of the uniform arc length distribution weighted by the curvature criterion - [default=0.0]
cells generated mesh elements in addition to nodes [default=False]

To concentrate some mesh elements towards an attraction point, the follwoing command can be used before the .execute() operation:

Mesher.pushAttractorPt(uJ)
Mesher.pushWeight(lambdaJ)
Mesher.pushStrength(kJ)
uJ value of the $u$ parameter corresponding to the attraction point
lambdaJ weight associated to the attraction point
kJ attraction factor

Generating cells alone

Generating cells is only useful if you plan to define 1D elements (such as springs) in your model.

Manual definition

Advanced To manually create a 1D cell based on two mesh points,

mesh.define(no, CELL_LINE, grp, no1, no2)
no number of the 1D cell
grp entity which will contain the mesh element (for example a Group)
pt1 first mesh point
pt2 second mesh point

CellLineMesher

Advanced The CellLineMesher is used to generate a series of 1D cells linking two sets of mesh points.

The CellLineMesher is a mesher which, based on two meshed geometric entities, generates objects of CELL_LINE type. Every mesh point of the first entity will be linked by a CELL_LINE to every MeshPoint of the second entity.

The interaction generated on these CELL_LINE will be defined by the first geometric entity passed to the CellLineMesher.

Example:

Generation of CELL_LINE on two sets of mesh points (coming from a Bacon import for example)

mesher = CellLineMesher(groupset(no1), groupset(no2)) 
mesher.execute()
...
app = FieldApplicator(no)
app.push(groupset(no1))   # Definition of the element on the first 
                          # ''CellLineMesher'' entity