AMRController3D Derived Type

type, public :: AMRController3D


Inherits

type~~amrcontroller3d~~InheritsGraph type~amrcontroller3d AMRController3D type~octreemesh3d OctreeMesh3D type~amrcontroller3d->type~octreemesh3d forest type~lagrange Lagrange type~amrcontroller3d->type~lagrange interp type~refinementindicator3d~2 RefinementIndicator3D type~amrcontroller3d->type~refinementindicator3d~2 indicator type~semhex SEMHex type~amrcontroller3d->type~semhex activeGeom, geomA, geomB, genGeom type~mesh3d Mesh3D type~amrcontroller3d->type~mesh3d baseMesh, activeMesh type~lagrange_t Lagrange_t type~lagrange->type~lagrange_t type~refinementindicator3d_t RefinementIndicator3D_t type~refinementindicator3d~2->type~refinementindicator3d_t type~semhex->type~lagrange meshToModel type~vector3d~2 Vector3D type~semhex->type~vector3d~2 x, nHat, xMesh type~scalar3d~2 Scalar3D type~semhex->type~scalar3d~2 nScale, J type~tensor3d~2 Tensor3D type~semhex->type~tensor3d~2 dxds, dsdx type~mesh3d_t Mesh3D_t type~mesh3d->type~mesh3d_t type~vector3d_t Vector3D_t type~vector3d~2->type~vector3d_t type~scalar3d_t Scalar3D_t type~scalar3d~2->type~scalar3d_t type~tensor3d_t Tensor3D_t type~tensor3d~2->type~tensor3d_t type~semmesh SEMMesh type~mesh3d_t->type~semmesh type~self_dataobj SELF_DataObj type~vector3d_t->type~self_dataobj type~domaindecomposition DomainDecomposition type~semmesh->type~domaindecomposition decomp 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 type~domaindecomposition_t DomainDecomposition_t type~domaindecomposition->type~domaindecomposition_t

Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
type(SEMHex), public, pointer:: activeGeom=> null()

geometry the model currently runs on

type(Mesh3D), public, pointer:: activeMesh=> null()

mesh the model currently runs on

type(Mesh3D), public, pointer:: baseMesh=> null()

caller-owned; metadata source for EmitMesh

real(kind=prec), public :: coarsenThreshold =0.0_prec
real(kind=prec), public, allocatable:: energyWeights(:)
type(OctreeMesh3D), public :: forest
type(SEMHex), public, pointer:: genGeom=> null()

Cumulative geometry-reuse accounting, so a run can report what fraction of elements avoided regeneration rather than leaving the payoff to be estimated.

type(SEMHex), public, pointer:: geomA=> null()
type(SEMHex), public, pointer:: geomB=> null()
integer, public :: geomSlot =0

Scratch geometry holding just the elements an epoch actually changed, generated compacted and then scattered into place. Persistent and resized, so it allocates only when an epoch changes more elements than any epoch before it.

type(RefinementIndicator3D), public :: indicator
type(Lagrange), public, pointer:: interp=> null()

the model's solution interpolant

integer, public :: ivar =SELF_AMR_ALLVARS

driving variable for the indicator

integer, public :: maxLevel =1

refinement-level cap

integer(kind=int64), public :: nGeomGenerated =0
integer(kind=int64), public :: nGeomReused =0
integer, public :: nHalo =1

refine-flag halo-expansion passes

logical, public :: ownsActive =.false.

whether activeMesh was emitted by us (vs the caller's) Two long-lived geometry buffers, alternated each epoch. Geometry is resized in place rather than allocated and freed per epoch; alternating means the PREVIOUS epoch's geometry is still intact while the new one is filled, which the incremental reuse path needs. geomSlot records which buffer activeGeom currently is, or 0 while it is still the caller's geometry.

real(kind=prec), public :: refineThreshold =0.0_prec
real(kind=prec), public :: relativeEnergyFloor =SELF_AMR_DEFAULT_RELFLOOR
real(kind=prec), public :: significantEnergyFloor =SELF_AMR_DEFAULT_RELFLOOR

Type-Bound Procedures

procedure, public :: Adapt => Adapt_AMRController3D

  • public subroutine Adapt_AMRController3D(this, model, adapted)

    Perform one adaptation epoch on the model (see the module documentation). On return, adapted reports whether the mesh changed; when it did, the model is already rebound to the new mesh with the solution transferred (conservatively), and the caller should re-evaluate its time step (RecommendedTimeStep) before the next ForwardStep. When the leaf set is unchanged the model is untouched.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(inout) :: this
    class(DGModel3D_t), intent(inout) :: model
    logical, intent(out) :: adapted

procedure, private :: ApplyIndicatorSettings => ApplyIndicatorSettings_AMRController3D

  • public subroutine ApplyIndicatorSettings_AMRController3D(this)

    Push the controller-owned amplitude-gate settings onto the indicator. Called after every indicator Init, because Init is intent(out) and therefore resets them to the indicator's defaults. The setters carry the validation.

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(inout) :: this

procedure, private :: BuildGeometry => BuildGeometry_AMRController3D

  • public subroutine BuildGeometry_AMRController3D(this, newMesh, plan, newGeom, nReused)

    Fill newGeom for the emitted mesh, reusing the previous epoch's geometry for every element that did not change and generating only the rest. nReused reports how many elements were copied rather than computed.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(inout) :: this
    type(Mesh3D), intent(in) :: newMesh
    type(TransferPlan3D), intent(in) :: plan
    type(SEMHex), intent(inout) :: newGeom
    integer, intent(out) :: nReused

procedure, public :: Free => Free_AMRController3D

  • public subroutine Free_AMRController3D(this)

    Release the forest, the indicator, and any controller-emitted mesh/geometry. The caller-owned base mesh/geometry are untouched. A model still pointing at a controller-emitted mesh must not be used after this call.

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(inout) :: this

procedure, public :: Init => Init_AMRController3D

  • public subroutine Init_AMRController3D(this, model, refineThreshold, coarsenThreshold, ivar, maxLevel, nHalo, relativeEnergyFloor, energyWeights, significantEnergyFloor)

    Attach the controller to an initialized model. The model's current mesh becomes the forest's base mesh (level 0); its geometry interpolant drives the indicator and the solution transfer. Thresholds are the sigma = log10 modal-energy-ratio cut-offs of the refinement indicator (refineThreshold > coarsenThreshold; see SELF_RefinementIndicator_3D). ivar is the driving solution variable (or SELF_AMR_ALLVARS). maxLevel >= 0 caps the refinement depth; nHalo >= 0 sets the refine-flag halo width in elements.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(out) :: this
    class(DGModel3D_t), intent(in) :: model
    real(kind=prec), intent(in) :: refineThreshold
    real(kind=prec), intent(in) :: coarsenThreshold
    integer, intent(in) :: ivar
    integer, intent(in) :: maxLevel
    integer, intent(in) :: nHalo
    real(kind=prec), intent(in), optional :: relativeEnergyFloor
    real(kind=prec), intent(in), optional :: energyWeights(:)
    real(kind=prec), intent(in), optional :: significantEnergyFloor

procedure, private :: NextGeomBuffer => NextGeomBuffer_AMRController3D

  • public subroutine NextGeomBuffer_AMRController3D(this, nElem, geom, slot)

    Select the geometry buffer to fill this epoch: whichever of the two is not currently active, so the previous epoch's geometry stays intact and readable.

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(inout) :: this
    integer, intent(in) :: nElem
    type(SEMHex), intent(out), pointer:: geom
    integer, intent(out) :: slot

procedure, public :: RecommendedTimeStep => RecommendedTimeStep_AMRController3D

  • public function RecommendedTimeStep_AMRController3D(this, dtBase) result(dt)

    Level-based explicit-stability time step: refinement halves the element scale per level, so a time step dtBase that is stable on the base (level-0) mesh scales to dtBase / 2**MaxLevel on the current forest. Deterministic and exact for the octree (child elements are exact half-scale subdivisions); no geometry reduction is needed.

    Arguments

    TypeIntentOptionalAttributesName
    class(AMRController3D), intent(in) :: this
    real(kind=prec), intent(in) :: dtBase

    Return Value real(kind=prec)

Source Code

  type :: AMRController3D
    type(OctreeMesh3D) :: forest
    type(RefinementIndicator3D) :: indicator
    type(Mesh3D),pointer :: baseMesh => null() !! caller-owned; metadata source for EmitMesh
    type(Mesh3D),pointer :: activeMesh => null() !! mesh the model currently runs on
    type(SEMHex),pointer :: activeGeom => null() !! geometry the model currently runs on
    type(Lagrange),pointer :: interp => null() !! the model's solution interpolant
    logical :: ownsActive = .false. !! whether activeMesh was emitted by us (vs the caller's)
    !! Two long-lived geometry buffers, alternated each epoch. Geometry is resized in place
    !! rather than allocated and freed per epoch; alternating means the PREVIOUS epoch's
    !! geometry is still intact while the new one is filled, which the incremental reuse path
    !! needs. geomSlot records which buffer activeGeom currently is, or 0 while it is still the
    !! caller's geometry.
    type(SEMHex),pointer :: geomA => null()
    type(SEMHex),pointer :: geomB => null()
    integer :: geomSlot = 0
    !! Scratch geometry holding just the elements an epoch actually changed, generated compacted
    !! and then scattered into place. Persistent and resized, so it allocates only when an epoch
    !! changes more elements than any epoch before it.
    type(SEMHex),pointer :: genGeom => null()
    !! Cumulative geometry-reuse accounting, so a run can report what fraction of elements
    !! avoided regeneration rather than leaving the payoff to be estimated.
    integer(int64) :: nGeomReused = 0
    integer(int64) :: nGeomGenerated = 0
    integer :: ivar = SELF_AMR_ALLVARS !! driving variable for the indicator
    integer :: maxLevel = 1 !! refinement-level cap
    integer :: nHalo = 1 !! refine-flag halo-expansion passes
    real(prec) :: refineThreshold = 0.0_prec
    real(prec) :: coarsenThreshold = 0.0_prec
    ! Amplitude-gate settings forwarded to the indicator. They are held here because the
    ! indicator is Freed and re-Init-ed (intent(out)) at the end of every adapting epoch, which
    ! resets its own copies; the controller re-applies these afterwards.
    real(prec) :: relativeEnergyFloor = SELF_AMR_DEFAULT_RELFLOOR
    real(prec) :: significantEnergyFloor = SELF_AMR_DEFAULT_RELFLOOR
    real(prec),allocatable :: energyWeights(:)

  contains
    procedure,public :: Init => Init_AMRController3D
    procedure,public :: Free => Free_AMRController3D
    procedure,public :: Adapt => Adapt_AMRController3D
    procedure,public :: RecommendedTimeStep => RecommendedTimeStep_AMRController3D
    procedure,private :: ApplyIndicatorSettings => ApplyIndicatorSettings_AMRController3D
    procedure,private :: NextGeomBuffer => NextGeomBuffer_AMRController3D
    procedure,private :: BuildGeometry => BuildGeometry_AMRController3D

  endtype AMRController3D