Table of Contents
1D Meshers (Curves)
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
Basic meshing of Curves
can be done with the following command:
SimpleMesher1D(curve).execute(ne, d=1.0, gencells=False)
with
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
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
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:
- A uniform distribution of the arc length, where grid points are separated by equal distances in the physical domain. In this case, the grid points density function must be proportional to the arc length change rate: $$\rho(u) \propto \left\| \frac{d\boldsymbol{x}}{du} \right\| $$
- A uniform distribution of the arc length weighted by the curvature, where grid points are concentrated in areas with greater curvature. In this case, the grid points density function is written as: $$\rho(u) \propto \kappa(u) \left\| \frac{d\boldsymbol{x}}{du} \right\| $$ where $\kappa(u)$ is the curvature of the curve $\boldsymbol{x}$, in $u$.
- An attraction of the grid towards an attraction point $u^{*}$ in the parametric domain (which corresponds to the point $\boldsymbol{x}^{*} = \boldsymbol{x}(u^{*})$ in the physical domain). A usual possibility is $u^{*}=0$ or $u^{*}=1$, when a very small scale is desired at one end of the curve. Alternatively, $0< u^* < 1$ will focus the refining near a point inside the curve.
For these cases, a proper choice for $\rho(u)$ is :
$$ \rho_{u^{*}} (u) \propto \frac{1}{\sqrt{(k (u-u^{*}))^2 +1} } $$ where $k$ is an attraction factor which determines the intensity of the attraction towards $u^{*}$.
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:
- the weights $\lambda_s$ and $\lambda_{\kappa}$,
- the points $\{u_i^* \; | \; 0 \leq u_i^* \leq 1, \; 1 \leq i \leq p\}$,
- the weights $\{\lambda_i, \; 1 \leq i \leq p\}$,
- the attraction factors $\{k_i, \; 1 \leq i \leq p\}$
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:
- of a higher density close to the attraction points $\{u_i^*\}$,
- positioned in areas where the curvature is large,
- positioned to avoid large differences on the arc length.
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
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
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