SEMHex Derived Type

type, public :: SEMHex


Inherits

type~~semhex~~InheritsGraph type~semhex SEMHex type~vector3d~2 Vector3D type~semhex->type~vector3d~2 x, nHat, xMesh type~tensor3d~2 Tensor3D type~semhex->type~tensor3d~2 dxds, dsdx type~scalar3d~2 Scalar3D type~semhex->type~scalar3d~2 nScale, J type~lagrange Lagrange type~semhex->type~lagrange meshToModel type~vector3d_t Vector3D_t type~vector3d~2->type~vector3d_t type~tensor3d_t Tensor3D_t type~tensor3d~2->type~tensor3d_t type~scalar3d_t Scalar3D_t type~scalar3d~2->type~scalar3d_t type~lagrange_t Lagrange_t type~lagrange->type~lagrange_t type~self_dataobj SELF_DataObj type~vector3d_t->type~self_dataobj type~scalar3d_t->type~self_dataobj type~tensor3d_t->type~self_dataobj type~self_dataobj->type~lagrange interp type~metadata Metadata type~self_dataobj->type~metadata meta EquationParser EquationParser type~self_dataobj->EquationParser eqn

Inherited by

type~~semhex~~InheritedByGraph type~semhex SEMHex type~mappedscalar3d_t MappedScalar3D_t type~mappedscalar3d_t->type~semhex geometry type~dgmodel3d_t DGModel3D_t type~dgmodel3d_t->type~semhex geometry type~mappedscalar3d~2 MappedScalar3D type~dgmodel3d_t->type~mappedscalar3d~2 solution, source, fluxDivergence, dSdt, workSol type~mappedvector3d MappedVector3D type~dgmodel3d_t->type~mappedvector3d solutionGradient, flux type~amrcontroller3d AMRController3D type~amrcontroller3d->type~semhex activeGeom, geomA, geomB, genGeom type~mappedvector3d_t MappedVector3D_t type~mappedvector3d_t->type~semhex geometry type~mappedtwopointvector3d_t MappedTwoPointVector3D_t type~mappedtwopointvector3d_t->type~semhex geometry type~mappedscalar3d~2->type~mappedscalar3d_t type~dgmodel3d DGModel3D type~dgmodel3d->type~dgmodel3d_t type~mappedvector3d->type~mappedvector3d_t type~dgmodel3d~2 DGModel3D type~dgmodel3d~2->type~dgmodel3d_t type~mappedscalar3d MappedScalar3D type~mappedscalar3d->type~mappedscalar3d_t type~mappedvector3d~2 MappedVector3D type~mappedvector3d~2->type~mappedvector3d_t type~mappedtwopointvector3d MappedTwoPointVector3D type~mappedtwopointvector3d->type~mappedtwopointvector3d_t type~mappedtwopointvector3d~2 MappedTwoPointVector3D type~mappedtwopointvector3d~2->type~mappedtwopointvector3d_t type~esatmo3d_t ESAtmo3D_t type~esatmo3d_t->type~mappedscalar3d~2 diffDiv type~esatmo3d_t->type~mappedvector3d diffFlux type~ecdgmodel3d ECDGModel3D type~esatmo3d_t->type~ecdgmodel3d type~nulldgmodel3d_t NullDGModel3D_t type~nulldgmodel3d_t->type~dgmodel3d~2 type~ecdgmodel3d_t ECDGModel3D_t type~ecdgmodel3d_t->type~dgmodel3d~2 type~ecdgmodel3d_t->type~mappedtwopointvector3d twoPointFlux type~lineareuler3d_t LinearEuler3D_t type~lineareuler3d_t->type~dgmodel3d~2 type~advection_diffusion_3d_t advection_diffusion_3d_t type~advection_diffusion_3d_t->type~dgmodel3d~2 type~esatmo3d ESAtmo3D type~esatmo3d->type~esatmo3d_t type~nulldgmodel3d NullDGModel3D type~nulldgmodel3d->type~nulldgmodel3d_t type~ecdgmodel3d->type~ecdgmodel3d_t type~nulldgmodel3d~2 NullDGModel3D type~nulldgmodel3d~2->type~nulldgmodel3d_t type~esatmo3d~2 ESAtmo3D type~esatmo3d~2->type~esatmo3d_t type~ecdgmodel3d~2 ECDGModel3D type~ecdgmodel3d~2->type~ecdgmodel3d_t type~lineareuler3d LinearEuler3D type~lineareuler3d->type~lineareuler3d_t type~lineareuler3d~2 LinearEuler3D type~lineareuler3d~2->type~lineareuler3d_t type~advection_diffusion_3d advection_diffusion_3d type~advection_diffusion_3d->type~advection_diffusion_3d_t type~advection_diffusion_3d~2 advection_diffusion_3d type~advection_diffusion_3d~2->type~advection_diffusion_3d_t type~ecadvection3d_t ECAdvection3D_t type~ecadvection3d_t->type~ecdgmodel3d type~ecadvection3d ECAdvection3D type~ecadvection3d->type~ecadvection3d_t type~ecadvection3d~2 ECAdvection3D type~ecadvection3d~2->type~ecadvection3d_t

Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
type(Scalar3D), public :: J

Default-initialized so a freshly allocated object can be distinguished from an initialized one (the controller uses nElem == 0 to decide Init versus Resize).

type(Tensor3D), public :: dsdx
type(Tensor3D), public :: dxds
type(Lagrange), public, pointer:: meshToModel=> null()
integer, public :: nElem =0

Cached scratch for GenerateFromMesh (AMR Stage 6c). Both were previously constructed and destroyed on every call, which the adaptive loop makes once per epoch:

meshToModel - the nGeo -> N interpolant. It depends only on (mesh%nGeo, mesh%quadrature, interp%N, interp%controlNodeType), all of which are invariant across adaptation, yet building it costs a quadrature plus eight matrices and, on GPU builds, eight device allocations and uploads. xMesh - staging for the mesh node coordinates. Only its element count changes between epochs, so it is resized rather than rebuilt.

meshToModel is a POINTER so that xMesh may hold a valid interp pointer into it: a derived-type component cannot carry TARGET, and pointing at a component of an object that is not itself a target is not conforming, whereas an allocated pointer is always a valid target. Same reasoning as the storage pools in SELF_DataPool.

type(Vector3D), public :: nHat
type(Scalar3D), public :: nScale
integer, public :: scratchNGeo =-1
logical, public :: scratchReady =.false.
type(Vector3D), public :: x
type(Vector3D), public :: xMesh

Type-Bound Procedures

procedure, private :: CalculateContravariantBasis => CalculateContravariantBasis_SEMHex

procedure, public :: CalculateMetricTerms => CalculateMetricTerms_SEMHex

procedure, public :: CopyElements => CopyElements_SEMHex

  • public subroutine CopyElements_SEMHex(myGeom, src, srcIdx, dstIdx, n)

    Copy whole-element geometry blocks from src into myGeom: element srcIdx(k) of src becomes element dstIdx(k) of myGeom, for k = 1..n (AMR Stage 6c).

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom
    type(SEMHex), intent(in) :: src
    integer, intent(in) :: srcIdx(:)
    integer, intent(in) :: dstIdx(:)
    integer, intent(in) :: n

procedure, private :: EnsureScratch => EnsureScratch_SEMHex

  • public subroutine EnsureScratch_SEMHex(myGeom, nGeo, quadrature, nElem)

    Prepare the cached GenerateFromMesh scratch for a mesh with nGeo/quadrature and nElem elements (AMR Stage 6c). The nGeo -> N interpolant is built once and reused; the node coordinate staging is resized, so an adapting run stops rebuilding either one per epoch.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom
    integer, intent(in) :: nGeo
    integer, intent(in) :: quadrature
    integer, intent(in) :: nElem

procedure, public :: Free => Free_SEMHex

  • public subroutine Free_SEMHex(myGeom)

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom

procedure, public :: GenerateFromMesh => GenerateFromMesh_SEMHex

procedure, public :: GenerateFromNodeCoords => GenerateFromNodeCoords_SEMHex

  • public subroutine GenerateFromNodeCoords_SEMHex(myGeom, nodeCoords, nGeo, quadrature, nElem)

    Generate geometry for nElem elements directly from their mesh node coordinates (AMR Stage 6c). GenerateFromMesh is a thin wrapper over this.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom
    real(kind=prec), intent(in) :: nodeCoords(1:3,1:nGeo+1,1:nGeo+1,1:nGeo+1,1:nElem)
    integer, intent(in) :: nGeo
    integer, intent(in) :: quadrature
    integer, intent(in) :: nElem

procedure, public :: Init => Init_SEMHex

  • public subroutine Init_SEMHex(myGeom, interp, nElem)

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(out) :: myGeom
    type(Lagrange), intent(in), pointer:: interp
    integer, intent(in) :: nElem

procedure, public :: Resize => Resize_SEMHex

  • public subroutine Resize_SEMHex(myGeom, interp, nElem)

    Rebind a live geometry to a new element count, reusing storage where it fits (AMR Stage 6c). This replaces the Free + Init cycle the adaptive loop performed on a freshly allocated SEMHex every epoch, which threw away exactly the amortization Stage 6b introduced: each member Free released its pools and device buffers, and each Init reallocated, zeroed, rebuilt metadata and equation parsers, and uploaded the zeros.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom
    type(Lagrange), intent(in), pointer:: interp
    integer, intent(in) :: nElem

procedure, public :: UploadGeometry => UploadGeometry_SEMHex

  • public subroutine UploadGeometry_SEMHex(myGeom)

    Push the geometry the solver kernels read to the device. Mirrors the uploads that GenerateFromMesh's own path performs, for use when geometry was assembled by element copy rather than generated (AMR Stage 6c).

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: myGeom

procedure, public :: WriteTecplot => WriteTecplot_SEMHex

  • public subroutine WriteTecplot_SEMHex(this, filename)

    Arguments

    TypeIntentOptionalAttributesName
    class(SEMHex), intent(inout) :: this
    character, intent(in) :: filename

Source Code

  type,public :: SEMHex
    type(Vector3D) :: x ! Physical positions
    type(Tensor3D) :: dxds ! Covariant basis vectors
    type(Tensor3D) :: dsdx ! Contavariant basis vectors
    type(Vector3D) :: nHat ! Normal Vectors pointing across coordinate lines
    type(Scalar3D) :: nScale ! Boundary scale
    type(Scalar3D) :: J ! Jacobian of the transformation
    !! Default-initialized so a freshly allocated object can be distinguished from an
    !! initialized one (the controller uses nElem == 0 to decide Init versus Resize).
    integer :: nElem = 0

    !! Cached scratch for GenerateFromMesh (AMR Stage 6c). Both were previously constructed and
    !! destroyed on every call, which the adaptive loop makes once per epoch:
    !!
    !!   meshToModel - the nGeo -> N interpolant. It depends only on
    !!     (mesh%nGeo, mesh%quadrature, interp%N, interp%controlNodeType), all of which are
    !!     invariant across adaptation, yet building it costs a quadrature plus eight matrices
    !!     and, on GPU builds, eight device allocations and uploads.
    !!   xMesh - staging for the mesh node coordinates. Only its element count changes between
    !!     epochs, so it is resized rather than rebuilt.
    !!
    !! meshToModel is a POINTER so that xMesh may hold a valid interp pointer into it: a
    !! derived-type component cannot carry TARGET, and pointing at a component of an object that
    !! is not itself a target is not conforming, whereas an allocated pointer is always a valid
    !! target. Same reasoning as the storage pools in SELF_DataPool.
    type(Lagrange),pointer :: meshToModel => null()
    type(Vector3D) :: xMesh
    logical :: scratchReady = .false.
    integer :: scratchNGeo = -1
  contains

    procedure,public :: Init => Init_SEMHex
    procedure,public :: Resize => Resize_SEMHex
    procedure,public :: Free => Free_SEMHex
    procedure,public :: GenerateFromMesh => GenerateFromMesh_SEMHex
    procedure,public :: GenerateFromNodeCoords => GenerateFromNodeCoords_SEMHex
    procedure,public :: CopyElements => CopyElements_SEMHex
    procedure,public :: UploadGeometry => UploadGeometry_SEMHex
    procedure,private :: EnsureScratch => EnsureScratch_SEMHex
    procedure,public :: CalculateMetricTerms => CalculateMetricTerms_SEMHex
    procedure,private :: CalculateContravariantBasis => CalculateContravariantBasis_SEMHex
    procedure,public :: WriteTecplot => WriteTecplot_SEMHex

  endtype SEMHex