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 parameter nElems refers subsequently to the new coordinate system.

    ../Carttocurve.jpg

    Fig. 2.1 Transformation of the 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.

../CurveCOS.jpg

Fig. 2.2 Visualization of the parameters which determine the shape.

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.

Table 2.35 Curved Structured Mesh: Overview of parameters.

Parameters

Setting

Description

Meshtype

3

1: Cube (origin + dimensions)
2: Bilinear (8 points CGNS notation)
3: Curved (add WhichMapping)

WhichMapping

4

Type of mapping using 6 boundary faces to build the curved structured mesh:
3: Half cylinder
4: Full cylinder

R_0

0.5

Inner radius of curved structured mesh. The value 0 is not allowed.

R_INF

20

Outer radius of curved structured mesh.

DZ

2

Dimension in z-direction: [-DZ,DZ]

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.

Table 2.36 Curved Structured Mesh: Stretching functions.

Parameters

Setting

Description

stretchType

(/3,1,0/)

(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

fac        

(/1.5,2.2,10/)

Stretching factor of the elements in the direction of the cylindrical coordinate axis

DXmaxToDXmin

(/6.,100.,1./)

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) \]
../Stretching-math.jpg

Fig. 2.3 Plot of the calculation function if the parameter stretchType is set to 3 (\(f\) means fac, \(\frac{\Delta x_{max}}{\Delta x_{min}}\) means DXmaxToDXmin). If the value of fac increases, the peakedness will increase and the element sizes near the boundaries will decrease.

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.

../Stretch-curve_ex1.jpg

Fig. 2.4 Non-stretched element arrangement.
nElems =(/8,6,4/)
stretchType =(/1,1,0/)
fac =(/1,1,0./)
DXmaxToDXmin =(/100.,100.,1/)

../Stretch-curve_ex2.jpg

Fig. 2.5 Stretched element arrangement. The element size in the direction of the x-axis increases by a factor of 1.5. In the direction of the y-axis it increases by the factor of 2.2.
nElems =(/8,6,4/)
stretchType =(/1,1,0/)
fac =(/1.5,2.2,0./)
DXmaxToDXmin =(/100.,100.,1/)

../Stretch-curve_ex3.jpg

Fig. 2.6 The stretchType parameter is set to 3 for the x-axis. The plot of the belonging calculation function shows that the element sizes increase immediately. In the direction of the y-axis the element size increases by the factor of 2.2.
nElems =(/8,6,4/)
stretchType =(/3,1,0/)
fac =(/1.5,2.2,0./)
DXmaxToDXmin =(/100.,100.,1/)

../Stretch-curve_ex4.jpg

Fig. 2.7 The stretchType parameter is set to 3 for the x-axis and the y-axis. although the fac values are different the plots of the belonging calculation function looks very similar to each other.
nElems =(/8,6,4/)
stretchType =(/3,3,0/)
fac =(/1.5,2.2,0./)
DXmaxToDXmin =(/100.,100.,1/)



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.

../Cylinder.jpg

Fig. 2.8 Sketch of the 1 zone curved structured mesh. The full cirlce mesh (WhichMapping=4) shall consist of twelve elements in x-direction, eight elements in y-direction and four elements in z-direction, all equidistant.

../Cylinder2.jpg

Fig. 2.9 Sketch of the 1 zone curved structured mesh with a stretched element arrangement. For the x-direction the stretchType parameter was set to 3. The parameter DXmaxToDXmin was set to 6 and the parameter fac to 1.5. For the y-direction the stretchType parameter was set to 1 and the elements were stretched by the factor 2.2. The elements in z-direction remain equidistant.

2.1.2.1. Curved Structured Mesh without Stretched Elements

../Curvedtotal.jpg

Fig. 2.10 Curved structured mesh

../Curvedinner.jpg

Fig. 2.11 Inner domain of the curved structured mesh

2.1.2.2. Curved Structured Mesh with Stretched Elements

../Curvedstretchedtotal.jpg

Fig. 2.12 Curved structured mesh with stretched element arrangement.

../Curvedstretchedinner.jpg

Fig. 2.13 Inner domain of the curved structured mesh with stretched element arrangement

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
../Nopost.jpg

Fig. 2.14 MeshPostDeform=0

../Withpost.jpg

Fig. 2.15 MeshPostDeform=1

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.

../Cylinder_param2.jpg

Fig. 2.16 Outer circular mapping with parameter2.ini

../Cylinder_param3.jpg

Fig. 2.17 9 block mesh with stretching parameter3.ini

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.

../Nopost_torus.jpg

Fig. 2.18 MeshPostDeform=0

../Torusmesh_q0.jpg

Fig. 2.19 MeshPostDeform=1

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 .

../Nopost_sphere.jpg

Fig. 2.20 MeshPostDeform=0

../Withpost_sphere.jpg

Fig. 2.21 MeshPostDeform=2

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.

../Nopost_shell.jpg

Fig. 2.22 parameter_shell.ini, MeshPostDeform=0

../Withpost_shell.jpg

Fig. 2.23 parameter_shell.ini, MeshPostDeform=2