The Open FUSION Toolkit 1.0.0-8905cc5
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines | Variables
oft_hexmesh_type Module Reference

Detailed Description

Hexhedral mesh definitions.

Author
Chris Hansen
Date
October 2018

Data Types

type  oft_hexmesh
 Hexahedral volume mesh type. More...
 

Functions/Subroutines

subroutine, public hex_3d_grid (order, xnodes, inodesp, inodese, inodesf, inodesc)
 Needs docs.
 
pure real(r8) function, dimension(6), public hex_get_bary (flog)
 Map from orthogonal logical coordinates to barycentric logical coordinates.
 
pure real(r8) function, dimension(3), public hex_get_bary_cgop (cglog, i, j)
 Map gradient cross-products from orthogonal logical coordinates to barycentric logical coordinates.
 
pure real(r8) function, dimension(3, 6), public hex_get_bary_gop (glog)
 Map gradients from orthogonal logical coordinates to barycentric logical coordinates.
 
subroutine, public hex_grid_forient (oflag, order, finds)
 Needs docs.
 
subroutine hex_grid_forient_inv (oflag, order, finds)
 Needs docs.
 
subroutine hexmesh_ctang (self, cell, ind, f, tang)
 Compute the curve tangent vector for a given edge on a cell.
 
subroutine hexmesh_g2inv (jac, a)
 Expand and invert the matrix for the grid Hessian.
 
subroutine hexmesh_get_surf_map (self, face, cell, lmap)
 Get mapping between boundary and volume logical coordinates.
 
subroutine hexmesh_hessian (self, cell, f, g2op, k)
 Compute the spatial hessian matrices for a given cell at a given logical position.
 
integer(i4) function hexmesh_in_cell (self, f, tol)
 Test if logical position lies within the base cell.
 
subroutine hexmesh_invert_cell (self, cell)
 Turn cell "inside out", used to ensure consistent orientations.
 
subroutine hexmesh_jacinv (a, c, j)
 Invert a 3x3 matrix.
 
subroutine hexmesh_jacobian (self, cell, f, gop, j)
 Compute the spatial jacobian matrix and its determinant for a given cell at a given logical position.
 
real(r8) function, dimension(3) hexmesh_log2phys (self, cell, f)
 Map from logical to physical coordinates in a given cell.
 
subroutine hexmesh_phys2log (self, cell, pt, f)
 Map from physical to logical coordinates in a given cell.
 
real(r8) function, dimension(4) hexmesh_phys2logho (self, cell, pt)
 Implementation of hexmesh_phys2log.
 
subroutine hexmesh_quad_rule (self, order, quad_rule)
 Retrieve suitable quadrature rule for mesh with given order.
 
subroutine hexmesh_set_order (self, order)
 Set maximum order of spatial mapping.
 
subroutine hexmesh_setup (self, cad_type)
 Setup mesh with implementation specifics (cell_np, cell_ne, etc.)
 
subroutine hexmesh_snormal (self, cell, ind, f, norm)
 Compute the surface normal vector for a given face on a cell.
 
subroutine hexmesh_surf_to_vol (self, fsurf, lmap, fvol)
 Map between surface and volume logical coordinates.
 
subroutine hexmesh_tessellate (self, rtmp, lctmp, order)
 Tessellate mesh onto lagrange FE nodes of specified order (usually for plotting)
 
integer(i4) function, dimension(2) hexmesh_tessellated_sizes (self)
 Get sizes of arrays returned by tetmesh_tessellate.
 
subroutine hexmesh_vlog (self, i, f)
 Get position in logical space of vertex i
 
subroutine tm_findcell_error (m, n, uv, err, iflag)
 Evalute the error between a logical point and the current active point.
 

Variables

integer(i4), private active_cell = 0
 Active cell for high order find_cell.
 
class(oft_hexmesh), pointer, private active_mesh => NULL()
 Active mesh for high order find_cell.
 
real(r8), dimension(3), private active_pt = 0.d0
 Active point for high order find_cell.
 
integer(i4), dimension(2, 12), parameter, public hex_bary_ecoords = RESHAPE((/ 5,3, 2,4, 3,5, 4,2, 1,6, 1,6, 1,6, 1,6, 5,3, 2,4, 3,5, 4,2/), (/2,12/))
 
integer(i4), dimension(2, 12), parameter, public hex_bary_efcoords = RESHAPE((/ 1,2, 1,3, 1,4, 1,5, 2,5, 2,3, 3,4, 4,5, 2,6, 3,6, 4,6, 5,6/), (/2,12/))
 
integer(i4), dimension(4, 6), parameter, public hex_bary_fcoords = RESHAPE((/ 5,2,3,4, 1,5,6,3, 1,2,6,4, 1,3,6,5, 2,1,4,6, 2,5,4,3/), (/4,6/))
 
integer(i4), dimension(6), parameter hex_bary_map = (/-3,-2,1, 2,-1,3/)
 
integer(i4), dimension(3, 8), parameter, public hex_bary_pfcoords = RESHAPE((/ 1,2,5, 1,2,3, 1,3,4, 1,4,5, 2,5,6, 2,3,6, 3,4,6, 4,5,6/), (/3,8/))
 
integer(i4), dimension(2, 12), parameter hex_ed =RESHAPE((/ 1,2, 2,3, 3,4, 4,1, 1,5, 2,6, 3,7, 4,8, 5,6, 6,7, 7,8, 8,5/), (/2,12/))
 
integer(i4), dimension(4, 6), parameter hex_fc =RESHAPE((/ 1,2,3,4, 1,5,6,2, 2,6,7,3, 3,7,8,4, 1,4,8,5, 5,8,7,6/), (/4,6/))
 
integer(i4), dimension(4, 6), parameter hex_fe =RESHAPE((/ 1,2,3,4, 5,9,-6,-1, 6,10,-7,-2, 7,11,-8,-3, -4,8,12,-5, -12,-11,-10,-9/), (/4,6/))
 
real(r8), parameter, private ho_find_du =1.d-6
 Step size used for jacobian eval during high order find_cell.
 
integer(i4), parameter, private ho_find_nsteps =100
 Maximum number of steps during high order find_cell.
 
real(r8), parameter, private ho_find_tol =1.d-6
 Convergence tolerance for high order find_cell.
 
integer(i4), dimension(3, 8), parameter inodes1p = RESHAPE((/ 1,1,1, 2,1,1, 2,2,1, 1,2,1, 1,1,2, 2,1,2, 2,2,2, 1,2,2/), (/3,8/))
 
integer(i4), dimension(3, 12), parameter inodes2e = RESHAPE((/ 2,1,1, 3,2,1, 2,3,1, 1,2,1, 1,1,2, 3,1,2, 3,3,2, 1,3,2, 2,1,3, 3,2,3, 2,3,3, 1,2,3/), (/3,12/))
 
integer(i4), dimension(3, 6), parameter inodes2f = RESHAPE((/ 2,2,1, 2,1,2, 3,2,2, 2,3,2, 1,2,2, 2,2,3/), (/3,6/))
 
integer(i4), dimension(3, 8), parameter inodes2p = RESHAPE((/ 1,1,1, 3,1,1, 3,3,1, 1,3,1, 1,1,3, 3,1,3, 3,3,3, 1,3,3/), (/3,8/))
 
integer(i4), dimension(3, 8), parameter inodesp_base = RESHAPE((/ 0,0,0, 1,0,0, 1,1,0, 0,1,0, 0,0,1, 1,0,1, 1,1,1, 0,1,1/), (/3,8/))
 
integer(i4), dimension(2, 4), parameter quad_ed =RESHAPE((/1,2, 2,3, 3,4, 4,1/), (/2,4/))
 Quad edge list.
 

Function/Subroutine Documentation

◆ hex_3d_grid()

subroutine, public hex_3d_grid ( integer(i4), intent(in)  order,
real(r8), dimension(:), intent(out), pointer  xnodes,
integer(i4), dimension(3,8), intent(out)  inodesp,
integer(i4), dimension(:,:,:), intent(out), pointer  inodese,
integer(i4), dimension(:,:,:), intent(out), pointer  inodesf,
integer(i4), dimension(:,:), intent(out), pointer  inodesc 
)

Needs docs.

◆ hex_get_bary()

pure real(r8) function, dimension(6), public hex_get_bary ( real(r8), dimension(:), intent(in)  flog)

Map from orthogonal logical coordinates to barycentric logical coordinates.

Parameters
[in]flogPosition in orthogonal logical coordinates [3]
Returns
Position in barycentric logical coordinates [6]

◆ hex_get_bary_cgop()

pure real(r8) function, dimension(3), public hex_get_bary_cgop ( real(r8), dimension(3,3), intent(in)  cglog,
integer(i4), intent(in)  i,
integer(i4), intent(in)  j 
)

Map gradient cross-products from orthogonal logical coordinates to barycentric logical coordinates.

Parameters
[in]cglogCrossed-gradients in orthogonal logical coordinates [3,3]
[in]iFirst barycentric coordinate
[in]jSecond barycentric coordinate
Returns
Crossed-gradient between barycentric coordinates i and j [3]

◆ hex_get_bary_gop()

pure real(r8) function, dimension(3,6), public hex_get_bary_gop ( real(r8), dimension(:,:), intent(in)  glog)

Map gradients from orthogonal logical coordinates to barycentric logical coordinates.

Parameters
[in]glogGradients in orthogonal logical coordinates [3,3]
Returns
Gradients in barycentric logical coordinates [3,6]

◆ hex_grid_forient()

subroutine, public hex_grid_forient ( integer(i4), intent(in)  oflag,
integer(i4), intent(in)  order,
integer(i4), dimension(:), intent(inout)  finds 
)

Needs docs.

◆ hex_grid_forient_inv()

subroutine hex_grid_forient_inv ( integer(i4), intent(in)  oflag,
integer(i4), intent(in)  order,
integer(i4), dimension(:), intent(inout)  finds 
)
private

Needs docs.

◆ hexmesh_ctang()

subroutine hexmesh_ctang ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  cell,
integer(i4), intent(in)  ind,
real(r8), dimension(:), intent(in)  f,
real(r8), dimension(3), intent(out)  tang 
)
private

Compute the curve tangent vector for a given edge on a cell.

If edge is not a global boundary edge the function returns with tang = 0

Note
The logical position in the cell must be on the chosen edge for this subroutine to return a meaningful result
Parameters
[in]selfMesh object
[in]cellIndex of cell
[in]indIndex of edge within cell
[in]fLogical coordinate in cell [4]
[out]tangUnit vector tangent to the edge [3]

◆ hexmesh_g2inv()

subroutine hexmesh_g2inv ( real(r8), dimension(3,3), intent(in)  jac,
real(r8), dimension(6,6), intent(out)  a 
)
private

Expand and invert the matrix for the grid Hessian.

◆ hexmesh_get_surf_map()

subroutine hexmesh_get_surf_map ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  face,
integer(i4), intent(out)  cell,
integer(i4), dimension(3), intent(out)  lmap 
)
private

Get mapping between boundary and volume logical coordinates.

Parameters
[in]selfMesh object
[in]faceIndex of face on boundary mesh
[out]cellCell containing face
[out]lmapCoordinate mapping

◆ hexmesh_hessian()

subroutine hexmesh_hessian ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  cell,
real(r8), dimension(:), intent(in)  f,
real(r8), dimension(:,:), intent(out)  g2op,
real(r8), dimension(:,:), intent(out)  k 
)
private

Compute the spatial hessian matrices for a given cell at a given logical position.

Parameters
[in]selfMesh object
[in]cellIndex of cell for evaulation
[in]fLogical coordinate in cell [4]
[out]g2opSecond order Jacobian matrix \( (\frac{\partial x_i}{\partial \lambda_l} \frac{\partial x_j}{\partial \lambda_k})^{-1} \)
[out]kGradient correction matrix \( \frac{\partial^2 x_i}{\partial \lambda_k \partial \lambda_l}\) [10,3]

◆ hexmesh_in_cell()

integer(i4) function hexmesh_in_cell ( class(oft_hexmesh), intent(in)  self,
real(r8), dimension(:), intent(in)  f,
real(r8), intent(in)  tol 
)
private

Test if logical position lies within the base cell.

Returns
Position f is inside the base cell?
Parameters
[in]selfMesh object
[in]fLogical coordinate to evaluate
[in]tolTolerance for test

◆ hexmesh_invert_cell()

subroutine hexmesh_invert_cell ( class(oft_hexmesh), intent(inout)  self,
integer(i4), intent(in)  cell 
)
private

Turn cell "inside out", used to ensure consistent orientations.

Parameters
[in,out]selfMesh object
[in]cellIndex of cell to invert

◆ hexmesh_jacinv()

subroutine hexmesh_jacinv ( real(r8), dimension(3,3), intent(in)  a,
real(r8), dimension(3,3), intent(out)  c,
real(r8), intent(out)  j 
)
private

Invert a 3x3 matrix.

Parameters
[in]aMatrix to invert
[out]c\( A^{-1} \)
[out]j|A|

◆ hexmesh_jacobian()

subroutine hexmesh_jacobian ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  cell,
real(r8), dimension(:), intent(in)  f,
real(r8), dimension(:,:), intent(out)  gop,
real(r8), intent(out)  j 
)
private

Compute the spatial jacobian matrix and its determinant for a given cell at a given logical position.

Parameters
[in]selfMesh object
[in]cellIndex of cell for evaulation
[in]fLogical coordinate in cell [4]
[out]gopJacobian matrix \( (\frac{\partial x_i}{\partial \lambda_j})^{-1} \) [3,4]
[out]jJacobian of transformation from logical to physical coordinates

◆ hexmesh_log2phys()

real(r8) function, dimension(3) hexmesh_log2phys ( class(oft_hexmesh), intent(in)  self,
integer, intent(in)  cell,
real(r8), dimension(:), intent(in)  f 
)
private

Map from logical to physical coordinates in a given cell.

Parameters
[in]selfMesh object
[in]cellIndex of cell for evaulation
[in]fLogical coordinate in cell [4]
Returns
Physical position [3]

◆ hexmesh_phys2log()

subroutine hexmesh_phys2log ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  cell,
real(r8), dimension(3), intent(in)  pt,
real(r8), dimension(:), intent(out)  f 
)
private

Map from physical to logical coordinates in a given cell.

Parameters
[in]selfMesh object
[in]cellIndex of cell for evaulation
[in]ptPhysical position [3]
[out]fLogical coordinates within the cell [4]

◆ hexmesh_phys2logho()

real(r8) function, dimension(4) hexmesh_phys2logho ( class(oft_hexmesh), intent(in), target  self,
integer(i4), intent(in)  cell,
real(r8), dimension(3), intent(in)  pt 
)
private

Implementation of hexmesh_phys2log.

The MINPACK package is used with step size given by ho_find_du. The convergence tolerance is set by the variable ho_find_tol.

Note
The final location may be outside the cell being searched. This is correct if the point is outside the cell, however it may also indicate a problem in the mapping, most likely due to a badly shaped cell
Parameters
[in]selfMesh object
[in]cellIndex of cell for evaulation
[in]ptPhysical position [3]
Returns
Logical coordinates within the cell [4]

◆ hexmesh_quad_rule()

subroutine hexmesh_quad_rule ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  order,
type(oft_quad_type), intent(out)  quad_rule 
)
private

Retrieve suitable quadrature rule for mesh with given order.

Parameters
[in]selfMesh object
[in]orderDesired order of quadrature rule
[out]quad_ruleResulting quadrature rule

◆ hexmesh_set_order()

subroutine hexmesh_set_order ( class(oft_hexmesh), intent(inout)  self,
integer(i4), intent(in)  order 
)
private

Set maximum order of spatial mapping.

Parameters
[in,out]selfMesh object
[in]orderMaximum order of spatial mapping

◆ hexmesh_setup()

subroutine hexmesh_setup ( class(oft_hexmesh), intent(inout)  self,
integer(i4), intent(in)  cad_type 
)
private

Setup mesh with implementation specifics (cell_np, cell_ne, etc.)

Parameters
[in,out]selfMesh object
[in]cad_typeCAD/mesh interface ID number

◆ hexmesh_snormal()

subroutine hexmesh_snormal ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  cell,
integer(i4), intent(in)  ind,
real(r8), dimension(:), intent(in)  f,
real(r8), dimension(3), intent(out)  norm 
)
private

Compute the surface normal vector for a given face on a cell.

If face is not a global boundary face the function returns with norm = 0

Note
The logical position in the cell must be on the chosen face for this subroutine, else an error will be thrown
Parameters
[in]selfMesh object
[in]cellIndex of cell
[in]indIndex of face within cell
[in]fLogical coordinate in cell [4]
[out]normUnit vector normal to the face [3]

◆ hexmesh_surf_to_vol()

subroutine hexmesh_surf_to_vol ( class(oft_hexmesh), intent(in)  self,
real(r8), dimension(:), intent(in)  fsurf,
integer(i4), dimension(3), intent(in)  lmap,
real(r8), dimension(:), intent(out)  fvol 
)
private

Map between surface and volume logical coordinates.

Parameters
[in]selfMesh object
[in]fsurfSurface coordinates [2]
[in]lmapCoordinate mapping
[out]fvolVolume coordinates [3]

◆ hexmesh_tessellate()

subroutine hexmesh_tessellate ( class(oft_hexmesh), intent(in)  self,
real(r8), dimension(:,:), intent(out), pointer  rtmp,
integer(i4), dimension(:,:), intent(out), pointer  lctmp,
integer(i4), intent(in)  order 
)
private

Tessellate mesh onto lagrange FE nodes of specified order (usually for plotting)

Note
The maximum tessellation order currently supported is 4 (may be lower for certain mesh types).
Warning
Cell lists are returned with zero based indexing
Parameters
[in]selfMesh to tessellate
[out]rtmpTessellated point list [3,:]
[out]lctmpTessellated cell list [8,:]
[in]orderTessellation order

◆ hexmesh_tessellated_sizes()

integer(i4) function, dimension(2) hexmesh_tessellated_sizes ( class(oft_hexmesh), intent(in)  self)
private

Get sizes of arrays returned by tetmesh_tessellate.

Parameters
[in]selfMesh object
Returns
Array sizes following tessellation [np_tess,nc_tess]

◆ hexmesh_vlog()

subroutine hexmesh_vlog ( class(oft_hexmesh), intent(in)  self,
integer(i4), intent(in)  i,
real(r8), dimension(:), intent(out)  f 
)
private

Get position in logical space of vertex i

Parameters
[in]selfMesh object
[in]iVertex to locate
[out]fLogical coordinates of vertex i

◆ tm_findcell_error()

subroutine tm_findcell_error ( integer(i4), intent(in)  m,
integer(i4), intent(in)  n,
real(r8), dimension(n), intent(in)  uv,
real(r8), dimension(m), intent(out)  err,
integer(i4), intent(inout)  iflag 
)
private

Evalute the error between a logical point and the current active point.

Note
Designed to be used as the error function for minimization in hexmesh_phys2logho
Parameters
[in]mNumber of spatial dimensions (3)
[in]nNumber of parametric dimensions (3)
[in]uvParametric position [n]
[out]errError vector between current and desired point [3]
[in,out]iflagUnused flag

Variable Documentation

◆ active_cell

integer(i4), private active_cell = 0
private

Active cell for high order find_cell.

◆ active_mesh

class(oft_hexmesh), pointer, private active_mesh => NULL()
private

Active mesh for high order find_cell.

◆ active_pt

real(r8), dimension(3), private active_pt = 0.d0
private

Active point for high order find_cell.

◆ hex_bary_ecoords

integer(i4), dimension(2,12), parameter, public hex_bary_ecoords = RESHAPE((/ 5,3, 2,4, 3,5, 4,2, 1,6, 1,6, 1,6, 1,6, 5,3, 2,4, 3,5, 4,2/), (/2,12/))

◆ hex_bary_efcoords

integer(i4), dimension(2,12), parameter, public hex_bary_efcoords = RESHAPE((/ 1,2, 1,3, 1,4, 1,5, 2,5, 2,3, 3,4, 4,5, 2,6, 3,6, 4,6, 5,6/), (/2,12/))

◆ hex_bary_fcoords

integer(i4), dimension(4,6), parameter, public hex_bary_fcoords = RESHAPE((/ 5,2,3,4, 1,5,6,3, 1,2,6,4, 1,3,6,5, 2,1,4,6, 2,5,4,3/), (/4,6/))

◆ hex_bary_map

integer(i4), dimension(6), parameter hex_bary_map = (/-3,-2,1, 2,-1,3/)
private

◆ hex_bary_pfcoords

integer(i4), dimension(3,8), parameter, public hex_bary_pfcoords = RESHAPE((/ 1,2,5, 1,2,3, 1,3,4, 1,4,5, 2,5,6, 2,3,6, 3,4,6, 4,5,6/), (/3,8/))

◆ hex_ed

integer(i4), dimension(2,12), parameter hex_ed =RESHAPE((/ 1,2, 2,3, 3,4, 4,1, 1,5, 2,6, 3,7, 4,8, 5,6, 6,7, 7,8, 8,5/), (/2,12/))

◆ hex_fc

integer(i4), dimension(4,6), parameter hex_fc =RESHAPE((/ 1,2,3,4, 1,5,6,2, 2,6,7,3, 3,7,8,4, 1,4,8,5, 5,8,7,6/), (/4,6/))
private

◆ hex_fe

integer(i4), dimension(4,6), parameter hex_fe =RESHAPE((/ 1,2,3,4, 5,9,-6,-1, 6,10,-7,-2, 7,11,-8,-3, -4,8,12,-5, -12,-11,-10,-9/), (/4,6/))
private

◆ ho_find_du

real(r8), parameter, private ho_find_du =1.d-6
private

Step size used for jacobian eval during high order find_cell.

◆ ho_find_nsteps

integer(i4), parameter, private ho_find_nsteps =100
private

Maximum number of steps during high order find_cell.

◆ ho_find_tol

real(r8), parameter, private ho_find_tol =1.d-6
private

Convergence tolerance for high order find_cell.

◆ inodes1p

integer(i4), dimension(3,8), parameter inodes1p = RESHAPE((/ 1,1,1, 2,1,1, 2,2,1, 1,2,1, 1,1,2, 2,1,2, 2,2,2, 1,2,2/), (/3,8/))
private

◆ inodes2e

integer(i4), dimension(3,12), parameter inodes2e = RESHAPE((/ 2,1,1, 3,2,1, 2,3,1, 1,2,1, 1,1,2, 3,1,2, 3,3,2, 1,3,2, 2,1,3, 3,2,3, 2,3,3, 1,2,3/), (/3,12/))
private

◆ inodes2f

integer(i4), dimension(3,6), parameter inodes2f = RESHAPE((/ 2,2,1, 2,1,2, 3,2,2, 2,3,2, 1,2,2, 2,2,3/), (/3,6/))
private

◆ inodes2p

integer(i4), dimension(3,8), parameter inodes2p = RESHAPE((/ 1,1,1, 3,1,1, 3,3,1, 1,3,1, 1,1,3, 3,1,3, 3,3,3, 1,3,3/), (/3,8/))
private

◆ inodesp_base

integer(i4), dimension(3,8), parameter inodesp_base = RESHAPE((/ 0,0,0, 1,0,0, 1,1,0, 0,1,0, 0,0,1, 1,0,1, 1,1,1, 0,1,1/), (/3,8/))
private

◆ quad_ed

integer(i4), dimension(2,4), parameter quad_ed =RESHAPE((/1,2, 2,3, 3,4, 4,1/), (/2,4/))
private

Quad edge list.