SEMQuad Derived Type

type, public :: SEMQuad


Inherits

type~~semquad~~InheritsGraph type~semquad SEMQuad type~vector2d~2 Vector2D type~semquad->type~vector2d~2 x, nHat, xMesh type~lagrange Lagrange type~semquad->type~lagrange meshToModel type~scalar2d~2 Scalar2D type~semquad->type~scalar2d~2 nScale, J type~tensor2d~2 Tensor2D type~semquad->type~tensor2d~2 dxds, dsdx type~vector2d_t Vector2D_t type~vector2d~2->type~vector2d_t type~lagrange_t Lagrange_t type~lagrange->type~lagrange_t type~scalar2d_t Scalar2D_t type~scalar2d~2->type~scalar2d_t type~tensor2d_t Tensor2D_t type~tensor2d~2->type~tensor2d_t type~self_dataobj SELF_DataObj type~vector2d_t->type~self_dataobj type~tensor2d_t->type~self_dataobj type~scalar2d_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~~semquad~~InheritedByGraph type~semquad SEMQuad type~mappedscalar2d_t MappedScalar2D_t type~mappedscalar2d_t->type~semquad geometry type~amrcontroller2d AMRController2D type~amrcontroller2d->type~semquad activeGeom, geomA, geomB, genGeom type~mappedvector2d_t MappedVector2D_t type~mappedvector2d_t->type~semquad geometry type~mappedtwopointvector2d_t MappedTwoPointVector2D_t type~mappedtwopointvector2d_t->type~semquad geometry type~dgmodel2d_t DGModel2D_t type~dgmodel2d_t->type~semquad geometry type~mappedscalar2d~2 MappedScalar2D type~dgmodel2d_t->type~mappedscalar2d~2 solution, source, fluxDivergence, dSdt, workSol type~mappedvector2d MappedVector2D type~dgmodel2d_t->type~mappedvector2d solutionGradient, flux type~mappedscalar2d~2->type~mappedscalar2d_t type~mappedtwopointvector2d MappedTwoPointVector2D type~mappedtwopointvector2d->type~mappedtwopointvector2d_t type~mappedvector2d->type~mappedvector2d_t type~mappedscalar2d MappedScalar2D type~mappedscalar2d->type~mappedscalar2d_t type~mappedvector2d~2 MappedVector2D type~mappedvector2d~2->type~mappedvector2d_t type~mappedtwopointvector2d~2 MappedTwoPointVector2D type~mappedtwopointvector2d~2->type~mappedtwopointvector2d_t type~dgmodel2d~2 DGModel2D type~dgmodel2d~2->type~dgmodel2d_t type~dgmodel2d DGModel2D type~dgmodel2d->type~dgmodel2d_t type~linearshallowwater2d_t LinearShallowWater2D_t type~linearshallowwater2d_t->type~mappedscalar2d~2 fCori type~linearshallowwater2d_t->type~dgmodel2d~2 type~lineareuler2d_pml_t LinearEuler2D_PML_t type~lineareuler2d_pml_t->type~mappedscalar2d~2 sigma_x, sigma_y type~lineareuler2d_t LinearEuler2D_t type~lineareuler2d_pml_t->type~lineareuler2d_t type~advection_diffusion_2d_t advection_diffusion_2d_t type~advection_diffusion_2d_t->type~dgmodel2d~2 type~ecdgmodel2d_t ECDGModel2D_t type~ecdgmodel2d_t->type~mappedtwopointvector2d twoPointFlux type~ecdgmodel2d_t->type~dgmodel2d~2 type~esatmo2d_t ESAtmo2D_t type~esatmo2d_t->type~mappedscalar2d~2 diffDiv type~esatmo2d_t->type~mappedvector2d diffFlux type~ecdgmodel2d ECDGModel2D type~esatmo2d_t->type~ecdgmodel2d type~nulldgmodel2d_t NullDGModel2D_t type~nulldgmodel2d_t->type~dgmodel2d~2 type~lineareuler2d_t->type~dgmodel2d~2 type~lineareuler2d~2 LinearEuler2D type~lineareuler2d~2->type~lineareuler2d_t type~linearshallowwater2d LinearShallowWater2D type~linearshallowwater2d->type~linearshallowwater2d_t type~linearshallowwater2d~2 LinearShallowWater2D type~linearshallowwater2d~2->type~linearshallowwater2d_t type~lineareuler2d_pml LinearEuler2D_PML type~lineareuler2d_pml->type~lineareuler2d_pml_t type~lineareuler2d_pml~2 LinearEuler2D_PML type~lineareuler2d_pml~2->type~lineareuler2d_pml_t type~advection_diffusion_2d advection_diffusion_2d type~advection_diffusion_2d->type~advection_diffusion_2d_t type~advection_diffusion_2d~2 advection_diffusion_2d type~advection_diffusion_2d~2->type~advection_diffusion_2d_t type~ecdgmodel2d->type~ecdgmodel2d_t type~ecdgmodel2d~2 ECDGModel2D type~ecdgmodel2d~2->type~ecdgmodel2d_t type~esatmo2d ESAtmo2D type~esatmo2d->type~esatmo2d_t type~esatmo2d~2 ESAtmo2D type~esatmo2d~2->type~esatmo2d_t type~nulldgmodel2d NullDGModel2D type~nulldgmodel2d->type~nulldgmodel2d_t type~nulldgmodel2d~2 NullDGModel2D type~nulldgmodel2d~2->type~nulldgmodel2d_t type~lineareuler2d LinearEuler2D type~lineareuler2d->type~lineareuler2d_t type~ecadvection2d_t ECAdvection2D_t type~ecadvection2d_t->type~ecdgmodel2d type~ecadvection2d ECAdvection2D type~ecadvection2d->type~ecadvection2d_t type~ecadvection2d~2 ECAdvection2D type~ecadvection2d~2->type~ecadvection2d_t

Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
type(Scalar2D), 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(Tensor2D), public :: dsdx
type(Tensor2D), 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(Vector2D), public :: nHat
type(Scalar2D), public :: nScale
integer, public :: scratchNGeo =-1
logical, public :: scratchReady =.false.
type(Vector2D), public :: x
type(Vector2D), public :: xMesh

Type-Bound Procedures

procedure, private :: CalculateContravariantBasis => CalculateContravariantBasis_SEMQuad

procedure, public :: CalculateMetricTerms => CalculateMetricTerms_SEMQuad

procedure, public :: CopyElements => CopyElements_SEMQuad

  • public subroutine CopyElements_SEMQuad(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(SEMQuad), intent(inout) :: myGeom
    type(SEMQuad), intent(in) :: src
    integer, intent(in) :: srcIdx(:)
    integer, intent(in) :: dstIdx(:)
    integer, intent(in) :: n

procedure, private :: EnsureScratch => EnsureScratch_SEMQuad

  • public subroutine EnsureScratch_SEMQuad(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(SEMQuad), intent(inout) :: myGeom
    integer, intent(in) :: nGeo
    integer, intent(in) :: quadrature
    integer, intent(in) :: nElem

procedure, public :: Free => Free_SEMQuad

  • public subroutine Free_SEMQuad(myGeom)

    Arguments

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

procedure, public :: GenerateFromMesh => GenerateFromMesh_SEMQuad

procedure, public :: GenerateFromNodeCoords => GenerateFromNodeCoords_SEMQuad

  • public subroutine GenerateFromNodeCoords_SEMQuad(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(SEMQuad), intent(inout) :: myGeom
    real(kind=prec), intent(in) :: nodeCoords(1:2,1:nGeo+1,1:nGeo+1,1:nElem)
    integer, intent(in) :: nGeo
    integer, intent(in) :: quadrature
    integer, intent(in) :: nElem

procedure, public :: Init => Init_SEMQuad

  • public subroutine Init_SEMQuad(myGeom, interp, nElem)

    Arguments

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

procedure, public :: Resize => Resize_SEMQuad

  • public subroutine Resize_SEMQuad(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 SEMQuad 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(SEMQuad), intent(inout) :: myGeom
    type(Lagrange), intent(in), pointer:: interp
    integer, intent(in) :: nElem

procedure, public :: UploadGeometry => UploadGeometry_SEMQuad

  • public subroutine UploadGeometry_SEMQuad(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(SEMQuad), intent(inout) :: myGeom

procedure, public :: WriteTecplot => WriteTecplot_SEMQuad

  • public subroutine WriteTecplot_SEMQuad(this, filename)

    Arguments

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

Source Code

  type,public :: SEMQuad
    type(Vector2D) :: x ! Physical positions
    type(Tensor2D) :: dxds ! Covariant basis vectors
    type(Tensor2D) :: dsdx ! Contavariant basis vectors
    type(Vector2D) :: nHat ! Normal Vectors pointing across coordinate lines
    type(Scalar2D) :: nScale ! Boundary scale
    type(Scalar2D) :: 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(Vector2D) :: xMesh
    logical :: scratchReady = .false.
    integer :: scratchNGeo = -1
  contains

    procedure,public :: Init => Init_SEMQuad
    procedure,public :: Resize => Resize_SEMQuad
    procedure,public :: Free => Free_SEMQuad
    procedure,public :: GenerateFromMesh => GenerateFromMesh_SEMQuad
    procedure,public :: GenerateFromNodeCoords => GenerateFromNodeCoords_SEMQuad
    procedure,public :: CopyElements => CopyElements_SEMQuad
    procedure,public :: UploadGeometry => UploadGeometry_SEMQuad
    procedure,private :: EnsureScratch => EnsureScratch_SEMQuad
    procedure,public :: CalculateMetricTerms => CalculateMetricTerms_SEMQuad
    procedure,private :: CalculateContravariantBasis => CalculateContravariantBasis_SEMQuad
    procedure,public :: WriteTecplot => WriteTecplot_SEMQuad

  endtype SEMQuad