| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| 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 | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom |
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).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom | |||
| type(SEMQuad), | intent(in) | :: | src | |||
| integer, | intent(in) | :: | srcIdx(:) | |||
| integer, | intent(in) | :: | dstIdx(:) | |||
| integer, | intent(in) | :: | n |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom | |||
| integer, | intent(in) | :: | nGeo | |||
| integer, | intent(in) | :: | quadrature | |||
| integer, | intent(in) | :: | nElem |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom | |||
| type(Mesh2D), | intent(in) | :: | mesh |
Generate geometry for nElem elements directly from their mesh node coordinates (AMR Stage 6c). GenerateFromMesh is a thin wrapper over this.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| 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 |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(out) | :: | myGeom | |||
| type(Lagrange), | intent(in), | pointer | :: | interp | ||
| integer, | intent(in) | :: | 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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom | |||
| type(Lagrange), | intent(in), | pointer | :: | interp | ||
| integer, | intent(in) | :: | nElem |
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).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | this | |||
| character, | intent(in) | :: | filename |
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