RefinementIndicator2D Derived Type

type, public, extends(RefinementIndicator2D_t) :: RefinementIndicator2D


Inherits

type~~refinementindicator2d~2~~InheritsGraph type~refinementindicator2d~2 RefinementIndicator2D c_ptr c_ptr type~refinementindicator2d~2->c_ptr Pmodal_gpu, indicator_gpu, flag_gpu type~refinementindicator2d_t RefinementIndicator2D_t type~refinementindicator2d~2->type~refinementindicator2d_t

Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
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).

type(c_ptr), public :: Pmodal_gpu =c_null_ptr
character(len=3), public :: backend ="gpu"
real(kind=prec), public :: coarsenThreshold =0.0_prec

Elements with sigma_e below this value are flagged SELF_AMR_COARSEN.

integer, public, pointer, contiguous, dimension(:):: flag=> null()

Per-element refinement flag: SELF_AMR_REFINE / SELF_AMR_KEEP / SELF_AMR_COARSEN.

type(c_ptr), public :: flag_gpu =c_null_ptr
real(kind=prec), public, pointer, contiguous, dimension(:):: indicator=> null()

Per-element indicator value sigma_e = log10(S_e).

type(c_ptr), public :: indicator_gpu =c_null_ptr
integer, public :: nElem =0

Number of (rank-local) elements the indicator arrays are sized for.

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

Elements with sigma_e above this value are flagged SELF_AMR_REFINE.


Type-Bound Procedures

procedure, public :: CountFlagged => CountFlagged_RefinementIndicator2D_t

  • public function CountFlagged_RefinementIndicator2D_t(this, flagValue) result(n)

    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.

    Arguments

    TypeIntentOptionalAttributesName
    class(RefinementIndicator2D_t), intent(in) :: this
    integer, intent(in) :: flagValue

    Return Value integer

procedure, public :: Estimate => Estimate_RefinementIndicator2D

  • public subroutine Estimate_RefinementIndicator2D(this, solution, ivar)

    GPU path: one device thread per element computes the modal transform and energy ratios, writes the indicator and flag on device, then copies both back to the host so the (host-side) mesh-adaptation logic can consume them directly.

    Arguments

    TypeIntentOptionalAttributesName
    class(RefinementIndicator2D), intent(inout) :: this
    class(Scalar2D), intent(in) :: solution
    integer, intent(in) :: ivar

procedure, public :: Free => Free_RefinementIndicator2D

procedure, public :: Init => Init_RefinementIndicator2D

  • public subroutine Init_RefinementIndicator2D(this, interp, nElem, refineThreshold, coarsenThreshold)

    Arguments

    TypeIntentOptionalAttributesName
    class(RefinementIndicator2D), 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

procedure, public :: SetThresholds => SetThresholds_RefinementIndicator2D_t

  • public subroutine SetThresholds_RefinementIndicator2D_t(this, refineThreshold, coarsenThreshold)

    Update the refine/coarsen thresholds without rebuilding the transform.

    Arguments

    TypeIntentOptionalAttributesName
    class(RefinementIndicator2D_t), intent(inout) :: this
    real(kind=prec), intent(in) :: refineThreshold
    real(kind=prec), intent(in) :: coarsenThreshold

procedure, public :: UpdateDevice => UpdateDevice_RefinementIndicator2D

procedure, public :: UpdateHost => UpdateHost_RefinementIndicator2D

Source Code

  type,extends(RefinementIndicator2D_t),public :: RefinementIndicator2D
    character(3) :: backend = "gpu"
    type(c_ptr) :: Pmodal_gpu = c_null_ptr
    type(c_ptr) :: indicator_gpu = c_null_ptr
    type(c_ptr) :: flag_gpu = c_null_ptr

  contains

    procedure,public :: Init => Init_RefinementIndicator2D
    procedure,public :: Free => Free_RefinementIndicator2D
    procedure,public :: UpdateHost => UpdateHost_RefinementIndicator2D
    procedure,public :: UpdateDevice => UpdateDevice_RefinementIndicator2D
    procedure,public :: Estimate => Estimate_RefinementIndicator2D

  endtype RefinementIndicator2D