bodyFitted (1d, 2d, 3d)

Used for defining block structured body fitted grid by defining the vertices of each cell. Maps a regular Cartesian grid to a more complex grid with curved boundaries. Instructions on generating body fitted meshes are given in Solving Problems on Advanced Structured Meshes in USim.

Parameters

Vertices (block)
Defines the coordinates of the vertices of the grid
lower (float vector)
Defines the lower mapping x, y, z coordinates in the form lower=[XLOWER, YLOWER, ZLOWER]. In 1D only 1 component is required, in 2D 2 components, in 3D 3 components. Extra components are ignored.
upper (float vector)

Defines the upper mapping x, y, z coordinates in the form upper=[XUPPER, YUPPER, ZUPPER]. In 1D only 1 component is required, in 2D 2 components, in 3D 3 components. Extra components are ignored.

When combined with the Vertex, kind = funcVertCalc, the vertex mapping in the x direction ranges from XLOWER to XUPPER and the true x position is xnew = f(x) for x between XLOWER and XUPPER

cells (integer vector)
Defines the number of cells in the domain, cells=[CELLSX, CELLSY, CELLSZ]. Extra components are ignored, and in 1D only the first component is used, similarly in 2D only the first 2 components are used and in 3D the first 3 components are used.
isRadial (boolean)
Defines whether or not coordinates are radial (r, \(\theta\), z) or Cartesian (x, y, z). Defaults to false or cartesian coordinates
ghostLayers (integer)
Tell USim how many ghost layers the grid should use. The default value is 1.
writeGeom (boolean)
Tell USim whether or not to write out geometrical data. Defaults to false.
writeConn (boolean)
Tell USim whether or not to write out connectivity data. Defaults to false.
writeHalos (boolean)
Tell USim whether the halo data and grid should be dumped. Defaults to false. Useful for debugging.

Example

Sample code block

<Grid domain>
  kind = bodyFitted2d

  lower = [0.0, 0.0]
  upper = [1.0, 1.0]
  cells = [R_CELLS, $Z_INLET_CELLS+Z_CURVE_CELLS$]
  ghostLayers = 2

  isRadial = 1

  <Vertices vertices>
    kind = funcVertCalc

    <Function f>
      kind = exprFunc

      z_inlet = Z_INLET

      z_inlet_cells = $Z_INLET_CELLS*1.0$
      z_curve_cells = $Z_CURVE_CELLS*1.0$

      r_inner = R_INNER
      r_outer = R_OUTER
      r_cells = $R_CELLS*1.0$

      dz_inlet = $Z_INLET/Z_INLET_CELLS$

      circ_rad = CIRC_RAD

      # cell spacings in computational space
      dzc = $1.0/(Z_INLET_CELLS+Z_CURVE_CELLS)$
      drc = $1.0/R_CELLS$
      zc_inlet = $1.0*Z_INLET_CELLS/(Z_INLET_CELLS+Z_CURVE_CELLS)$

      preExprs = [ \
      "r = x", \
      "z = y", \
      "iz = rint(z/dzc)", \
      "ir = rint(r/drc)", \
      "zp_inlet = if (iz<=z_inlet_cells, dz_inlet*iz, 0.0)", \
      "rp_inlet = if (iz<=z_inlet_cells, r_inner+ir*(r_outer-r_inner)/r_cells, 0.0)", \
      "rr = r_inner + r*(r_outer-r_inner)", \
      "zz = 0.5*_pi*(z-zc_inlet)/(1.0-zc_inlet)", \
      "rp_curve = if (iz>z_inlet_cells, rr*cos(zz), 0.0)", \
      "zp_curve = if (iz>z_inlet_cells, rr*sin(zz) + z_inlet, 0.0)", \
      "rp = rp_curve+rp_inlet", \
      "zp = zp_curve+zp_inlet" \
      ]

      exprs = ["rp", "zp"]

    </Function>
  </Vertices>
</Grid>