2. Curved Meshes
2.1. Curved Structured Mesh
This tutorial shows how to generate a curved structured mesh with an equidistant or with a stretched element arrangement alternatively. The parameter file can be found in
tutorials/1-05-curved_structured/parameter.ini
To generate a curved structured mesh the following parameter settings are mandatory:
Mode=11
(curved structured block with hexahedral elements):
This mode activates a transformation of the cartesian coordinate system to a rotated cylindrical coordinate system as shown in Fig. 2.1. The element distribution which the user can determine by the parameternElems
refers subsequently to the new coordinate system.nZones=1
MeshType=3
(for curved mesh)
The HOPR user has to choose whether he wants to generate a half or a full cylindrical mesh. Therefore the new parameter WhichMapping
is provided. For specifying the general shape of the (half) cylinder three parameters are provided: R_0
, R_INF
and DZ
. Their meaning is visualized in Fig. 2.2. It must be taken into account that the value for the inner radius (R_0
) must not be zero and the value for DZ
corresponds to the half thickness of the (half) cylinder.
The assignment of the boundary conditions to the surfaces refers to the new coordinate system by the parameter BCIndex (z-,y-,x+,y+,x-,z+)
. For the case that the parameter WhichMapping
is set to 4 (full cylindrical mesh), the third and fifth surface (x+, x-) coincide and the corresponding components of the BCIndex
vector have to be set to zero. An overview of the mentioned parameters is given below. A description of all parameters can be found in List of Parameters.
Parameters |
Setting |
Description |
---|---|---|
|
|
1: Cube (origin + dimensions) |
|
|
Type of mapping using 6 boundary faces to build the curved structured mesh: |
|
|
Inner radius of curved structured mesh. The value 0 is not allowed. |
|
|
Outer radius of curved structured mesh. |
|
|
Dimension in z-direction: |
2.1.1. Stretching Functions
Similar to straight-edged boxes one can generate curved structured meshes with a stretched element arrangement. For this purpose, three additional parameters have to be defined in the parameter file: stretchType
, fac
and DXmaxToDXmin
. Each parameter is defined for each axis in the rotated coordinate system as a vector (x,y,z). The parameters are explained below.
Parameters |
Setting |
Description |
---|---|---|
|
|
(De)activation of the stretching functions for cylindrical coordinate axis (0: Stretching is deactivated) |
1: Stretching with a factor |
||
2: Stretching with a length ratio |
||
3: Stretching with a bell function |
||
|
|
Stretching factor of the elements in the direction of the cylindrical coordinate axis |
|
|
Frame ratio of the maximum to the minimum element size |
A stretching factor fac
of greater 1 means an increase of the element size in the direction of the coordinate axis, a value of the intervall (0,1) means a decrease. The value 1 does not affect the element sizes and means an deactivation of the stretching function for this axis. The value 0 is only allowed if the stretching function for this axis is deactivated (stretchType
vector component for this axis is 0). Furthermore the stretching behaviour can be mirrored by adding a negative sign to the values. If the stretchType
vector component for an axis is 3, the factor will be multiplied by -1 if the half distance is reached. In addition, fac
has not the significant influence on the element arrangement anymore but the parameter DXmaxToDXmin
. In case of (/1.5,2.2,10/)
each following element in x-direction is stretched by the factor 1.5, in y-direction by the factor 2.2 and in the direction of the z-axis by the factor 10 (dependent on stretchType
)
If the stretchType
vector component for an axis is 3, the element arrangement is affected significantly by DXmaxToDXmin
instead of the parameter fac
. In case of (/6,100,1/)
the maximum element size in x-direction can be 6 times larger than the minimum element size. In y-direction the maximum element size can be 100 times larger than the minimum element size. The value 1, here set for ratio of the z-direction, is used typically for a deactivated stretching
2.1.1.1. Calculation Formulas
For a better understanding how the element sizes are calculated, the formulas for different stretchType
settings are shown below.
Calculation of the element size for
stretchType = 1
:\[ {\Delta x_{i+1} = f \cdot \Delta x_{i} f = \left(\frac{\Delta x_{max}}{\Delta x_{min}} \right)^{1/(nElems - 1)} }\]Calculation of the element size for
stretchType = 3
:\[ \Delta x(\xi) \sim 1 + \left( \frac{\Delta x_{max}}{\Delta x_{min}}-1\right)\cdot \left( \frac{\exp[-(\xi \cdot f)^2] - \exp[-f^2]}{\exp[0] - \exp[-f^2]}\right) \]
2.1.1.2. Exemplary Stretching Cases
Furthermore, three different stretching cases are presented below with a full circle (WhichMapping=4
) and an element distribution nElems=(/8,6,4/)
, where only x- and y-values were visualized.
2.1.2. Examples
In the following two exemplary curved structured meshes are presented. The first mesh shall consist of twelve equidistant elements in x-direction, eight elements in y-direction and four elements in z-direction. The sketch of this problem is shown in Fig. 2.8. The second mesh consists of the same number of elements in each direction but with stretched elements. This sketch is presented in Fig. 2.9.
2.1.2.1. Curved Structured Mesh without Stretched Elements
2.1.2.2. Curved Structured Mesh with Stretched Elements
2.2. Mesh Curving by Post-Deformation
This tutorial shows how to generate a curved multi-block mesh, composed of several structured boxes, which are first assembled and then globally mapped to a curved domain. The parameter file can be found here:
tutorials/1-06-curved-postdeform/parameter.ini
Here, user-defined variables are used to parametrize the parameter file. They are searched and replaced in all other lines(!) of the parameter file (all strings between the = and ! sign are searched). They are either an Integer or Real value and defined in the parameter file as
DEFVAR=(INT): i0 = 002 ! no. elems in inner square i0xi0
DEFVAR=(REAL): ri = 0.5 ! inner square dim
Note that each variable is searched and replaced one sequentially, so that names should be absolutely unique. In the example, a variable called ri0
would not be allowed.
2.2.1. Post-Deformation from a box to a cylinder
The idea is to build first a simple box using the internal mesh procedures explained in Multiple Cartesian Boxes and then use a deformation function to obtain a cylinder. The post-deformation parameter is
MeshPostDeform=1
The undeformed and deformed mesh is shown in Fig. 2.14 and Fig. 2.15.
The order of the curved element mapping can be chosen arbitrarily
useCurveds =T
BoundaryOrder=5
The mapping function maps the xy [-1;1]^2 coordinates to a circular domain of radius 1, but smoothed towards the center to avoid a singular mesh. The radius can be scaled with the parameter
MeshPostDeform_R0=1.0
We choose a periodic boundary condition in z direction.
2.2.2. Parameter Variations
In a variant of the parameter file, parameter2.ini, the extent of the domain in xy is [-2;2]^2 and is mapped to a circular domain with a radius of 2. The part of the domain inside [-1;1]^2 is mapped like in the example above, but ouside of [-1;1]^2, the mapping is perfectly circular. A final radius of 1 is then achieved by setting the scaling factor to, see Fig. 2.16:
MeshPostDeform_R0 = 0.5
In another variant of the parameter file, parameter3.ini, a mesh with 9 zones in built, and refined at a specific radius, using the stretching functions explained in Stretching Functions, see Fig. 2.17.
2.3. Curved Torus
The same post-deformation is applied to generate a torus. The parameter file can be found in
tutorials/1-07-curved-torus/parameter.ini
2.3.1. Post-Deformation from a box to a torus
Analogously to the previous tutorial Mesh Curving by Post-Deformation, we deform a box to a torus with a circular cross section. We only add the main radius of the torus as a parameter
MeshPostDeform = 1 ! deforms [-1,1]^2 to a cylinder with radius Postdeform_R0
PostDeform_R0 = s0 ! here domain is [-2,2]^2 mapped to a cylinder with radius 0.5*2 = 1
PostDeform_Rtorus = rz ! z must be inside [0,1] and periodic
Since the connectivity of the mesh is created before the deformation, the boundary condition in z direction must be periodic on the undeformed mesh. The torus then has the correct connectivity.
2.4. Curved Sphere
The same post-deformation is applied to generate a mesh of a sphere and a spherical shell. The parameter file can be found in
tutorials/1-08-curved-sphere/parameter.ini
2.4.1. Post-Deformation from a box to a sphere
Analogously to the tutorial Mesh Curving by Post-Deformation, we deform a box to a sphere.
MeshPostDeform=2
PostDeform_R0=0.5
The initial box consists of 1 central zone and 6 neighbor zones, and forms a cube of [-2;2]^3 , being mapped to a sphere of radius 2. Again, PostDeform_R0
can be used to scale the radius. The mapping of the domain inside [-1;1]^3 is again smoothed to avoid singular elements, and outside [-1,1]^3 is perfectly spherical, see Fig. 2.20 and Fig. 2.21 .
2.4.2. Spherical shell
In a variant of the parameter file, parameter_shell.ini, only 6 domains without the central domain are used and a spherical shell is generated. The boundary conditions have to be changed, and the central hole has a size of [-1,1]^3, see Fig. 2.22 and Fig. 2.23, where also the inner boundary face is shown.