| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | N | = | 0 | Polynomial degree of the interpolant the indicator is built for. |
|
| real(kind=prec), | public, | pointer, contiguous, dimension(:,:) | :: | Pmodal | => | null() | Nodal-to-modal transform. Pmodal(ii,p) is the (p,ii) entry of the inverse Legendre Vandermonde in the L2-normalized basis, so the 1-D modal coefficients are uhat(p) = sum_ii Pmodal(ii,p) * u(ii) (first index summed, SELF matrix convention). |
| real(kind=prec), | public | :: | coarsenThreshold | = | 0.0_prec | Elements with sigma_e below this value are flagged SELF_AMR_COARSEN. |
|
| real(kind=prec), | public | :: | energyScale | = | 0.0_prec | Squared field scale the relative floor is measured against, in the units of the gate energy. Meaningful only when energyScaleIsSet is true; otherwise the scale is recomputed from the current field on every Estimate. |
|
| logical, | public | :: | energyScaleIsSet | = | .false. | Whether energyScale was pinned by SetEnergyScale (true) or is computed automatically as the largest gate energy over the elements (false, the default). |
|
| real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | energyWeight | => | null() | Non-negative weights w_v of the gate energy g_e = sum_v w_v E_tot,e,v, indexed by solution variable. Resolved lazily, because the variable count is a property of the solution field and is not known at Init. |
| logical, | public | :: | energyWeightsSet | = | .false. | Whether energyWeight was supplied by SetEnergyWeights (true) or is regenerated from the driving-variable index on every Estimate (false, the default). |
|
| integer, | public, | pointer, contiguous, dimension(:) | :: | flag | => | null() | Per-element refinement flag: SELF_AMR_REFINE / SELF_AMR_KEEP / SELF_AMR_COARSEN. |
| real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | gate | => | null() | Per-element gate energy g_e from the most recent Estimate. Retained as a diagnostic: it is the quantity the amplitude gate actually compared against the effective floor. |
| real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | indicator | => | null() | Per-element indicator value sigma_e = log10(S_e). |
| integer, | public | :: | nElem | = | 0 | Number of (rank-local) elements the indicator arrays are sized for. |
|
| integer, | public | :: | nVarWeights | = | 0 | Allocated length of energyWeight (the solution variable count it was resolved for). |
|
| real(kind=prec), | public | :: | refineThreshold | = | 0.0_prec | Elements with sigma_e above this value are flagged SELF_AMR_REFINE. |
|
| real(kind=prec), | public | :: | relativeEnergyFloor | = | SELF_AMR_DEFAULT_RELFLOOR | Elements whose gate energy is at or below relativeEnergyFloorenergyScale are treated as quiescent (hence perfectly resolved) regardless of their modal shape. Energy goes as amplitude squared, so this is 10*(dB/10) in amplitude terms: 1e-8 gates amplitudes below 1e-4 (-80 dB) of the field scale. Set to 0 to recover the pure absolute (machine-epsilon) floor. |
|
| real(kind=prec), | public | :: | significantEnergyFloor | = | SELF_AMR_DEFAULT_RELFLOOR | Upper edge of the hysteresis band on the energy axis. Elements between relativeEnergyFloor and this fraction of the energy scale are flagged SELF_AMR_KEEP whatever their spectrum: too weak to justify spending levels on, too strong to declare resolved. Equal to relativeEnergyFloor by default, which collapses the band to a single hard cut. See SetRelativeEnergyFloor. |
Return to the automatic energy scale (the largest gate energy over the elements).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this |
Count the rank-local elements currently carrying the requested flag value (SELF_AMR_REFINE / SELF_AMR_KEEP / SELF_AMR_COARSEN). Provided as a convenience for drivers and tests; a global count across MPI ranks is the caller's responsibility.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | flagValue |
Compute the per-element modal-energy indicator sigma_e and refine/keep/coarsen flag from the nodal solution field. ivar selects the driving variable in [1,solution%nVar]; passing SELF_AMR_ALLVARS (=0) reduces the indicator over all variables by taking, per element, the largest (least smooth) smoothness ratio S_e before the log10.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this | |||
| class(Scalar3D), | intent(in) | :: | solution | |||
| integer, | intent(in) | :: | ivar | |||
| integer, | intent(in), | optional | :: | comm | ||
| real(kind=prec), | intent(in), | optional | :: | gate(:) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this |
Allocate the indicator for an interpolant of degree interp%N and nElem elements and precompute the nodal->modal transform matrix from the interpolant control points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(out) | :: | this | |||
| type(Lagrange), | intent(in), | target | :: | interp | ||
| integer, | intent(in) | :: | nElem | |||
| real(kind=prec), | intent(in) | :: | refineThreshold | |||
| real(kind=prec), | intent(in) | :: | coarsenThreshold |
Pin the energy scale that normalizes the relative floor, in the units of the gate energy (squared field amplitude times the reference-element volume). Two reasons to use this rather than the automatic maximum over elements:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this | |||
| real(kind=prec), | intent(in) | :: | energyScale |
Set the per-variable weights w_v >= 0 of the gate energy g_e = sum_v w_v E_tot,e,v, where E_tot,e,v is the exact L2 energy of variable v on the reference element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this | |||
| real(kind=prec), | intent(in) | :: | w(:) |
Set the relative energy floor of the amplitude gate. An element whose gate energy g satisfies
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this | |||
| real(kind=prec), | intent(in) | :: | relativeEnergyFloor | |||
| real(kind=prec), | intent(in), | optional | :: | significantEnergyFloor |
Update the refine/coarsen thresholds without rebuilding the transform.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this | |||
| real(kind=prec), | intent(in) | :: | refineThreshold | |||
| real(kind=prec), | intent(in) | :: | coarsenThreshold |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RefinementIndicator3D_t), | intent(inout) | :: | this |
type :: RefinementIndicator3D_t
integer :: N = 0
!! Polynomial degree of the interpolant the indicator is built for.
integer :: nElem = 0
!! Number of (rank-local) elements the indicator arrays are sized for.
real(prec) :: refineThreshold = 0.0_prec
!! Elements with sigma_e above this value are flagged SELF_AMR_REFINE.
real(prec) :: coarsenThreshold = 0.0_prec
!! Elements with sigma_e below this value are flagged SELF_AMR_COARSEN.
real(prec) :: relativeEnergyFloor = SELF_AMR_DEFAULT_RELFLOOR
!! Elements whose gate energy is at or below relativeEnergyFloor*energyScale are treated as
!! quiescent (hence perfectly resolved) regardless of their modal shape. Energy goes as
!! amplitude squared, so this is 10**(dB/10) in amplitude terms: 1e-8 gates amplitudes
!! below 1e-4 (-80 dB) of the field scale. Set to 0 to recover the pure absolute
!! (machine-epsilon) floor.
real(prec) :: significantEnergyFloor = SELF_AMR_DEFAULT_RELFLOOR
!! Upper edge of the hysteresis band on the energy axis. Elements between
!! relativeEnergyFloor and this fraction of the energy scale are flagged SELF_AMR_KEEP
!! whatever their spectrum: too weak to justify spending levels on, too strong to declare
!! resolved. Equal to relativeEnergyFloor by default, which collapses the band to a single
!! hard cut. See SetRelativeEnergyFloor.
real(prec) :: energyScale = 0.0_prec
!! Squared field scale the relative floor is measured against, in the units of the gate
!! energy. Meaningful only when energyScaleIsSet is true; otherwise the scale is recomputed
!! from the current field on every Estimate.
logical :: energyScaleIsSet = .false.
!! Whether energyScale was pinned by SetEnergyScale (true) or is computed automatically as
!! the largest gate energy over the elements (false, the default).
logical :: energyWeightsSet = .false.
!! Whether energyWeight was supplied by SetEnergyWeights (true) or is regenerated from the
!! driving-variable index on every Estimate (false, the default).
integer :: nVarWeights = 0
!! Allocated length of energyWeight (the solution variable count it was resolved for).
real(prec),pointer,contiguous,dimension(:) :: energyWeight => null()
!! Non-negative weights w_v of the gate energy g_e = sum_v w_v E_tot,e,v, indexed by
!! solution variable. Resolved lazily, because the variable count is a property of the
!! solution field and is not known at Init.
real(prec),pointer,contiguous,dimension(:) :: gate => null()
!! Per-element gate energy g_e from the most recent Estimate. Retained as a diagnostic: it
!! is the quantity the amplitude gate actually compared against the effective floor.
real(prec),pointer,contiguous,dimension(:,:) :: Pmodal => null()
!! Nodal-to-modal transform. Pmodal(ii,p) is the (p,ii) entry of the inverse Legendre
!! Vandermonde in the L2-normalized basis, so the 1-D modal coefficients are
!! uhat(p) = sum_ii Pmodal(ii,p) * u(ii) (first index summed, SELF matrix convention).
real(prec),pointer,contiguous,dimension(:) :: indicator => null()
!! Per-element indicator value sigma_e = log10(S_e).
integer,pointer,contiguous,dimension(:) :: flag => null()
!! Per-element refinement flag: SELF_AMR_REFINE / SELF_AMR_KEEP / SELF_AMR_COARSEN.
contains
procedure,public :: Init => Init_RefinementIndicator3D_t
procedure,public :: Free => Free_RefinementIndicator3D_t
procedure,public :: SetThresholds => SetThresholds_RefinementIndicator3D_t
procedure,public :: SetRelativeEnergyFloor => SetRelativeEnergyFloor_RefinementIndicator3D_t
procedure,public :: SetEnergyScale => SetEnergyScale_RefinementIndicator3D_t
procedure,public :: ClearEnergyScale => ClearEnergyScale_RefinementIndicator3D_t
procedure,public :: SetEnergyWeights => SetEnergyWeights_RefinementIndicator3D_t
procedure,public :: UpdateHost => UpdateHost_RefinementIndicator3D_t
procedure,public :: UpdateDevice => UpdateDevice_RefinementIndicator3D_t
procedure,public :: Estimate => Estimate_RefinementIndicator3D_t
procedure,public :: CountFlagged => CountFlagged_RefinementIndicator3D_t
endtype RefinementIndicator3D_t