InterpStencilGenerator Derived Type

type, public, extends(JaggedArrayGenerator) :: InterpStencilGenerator

JaggedArrayGenerator for calculating implicit interpolation stencil between regular and staggered grids. Expects that the xStencil is [0,1] for regular to staggered grid interpolation, and [-1,0] for staggered to regular. If non-periodic and going from staggered to regular the values are implicitly extrapolated to the first and last cell centres from the edges leading up to the boundary. In this case the generator expects that the left boundary stencil is overriden with [0,1] and the right stencil with [-2,-1]


Components

Type Visibility Attributes Name Initial
logical, public :: userDefined = .false.

True only if user explicitly sets it to true

real(kind=rk), private, allocatable, dimension(:) :: linInterp

Linear interpolation coefficients for inner points

real(kind=rk), private :: linExterpL

Linear extrapolation coefficient for the left boundary point during inverse interpolation on non-periodic grid

real(kind=rk), private :: linExterpR

Linear extrapolation coefficient for the right boundary point during inverse interpolation on non-periodic grid

logical, private :: periodicGrid

True if stencil is calculated on periodic grid

logical, private :: staggeredGridMode

If true will interpolate from staggered to regular grid. Defaults to false

logical, private :: containsLeftBoundary

True if the local x-grid contains the left boundary

logical, private :: containsRightBoundary

True if the local x-grid contains the right boundary

integer(kind=ik), private :: locNumX

Size of local grid chunk (without any halos)


Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject

  • interface

    private pure module function isDefinedObject(this) result(defined)

    Getter for userDefined

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(in) :: this

    Return Value logical

procedure, public :: makeDefined => makeDefinedObject

  • interface

    private pure module subroutine makeDefinedObject(this)

    Set userDefined to .true.

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(inout) :: this

procedure, public :: makeUndefined => makeUndefinedObject

  • interface

    private pure module subroutine makeUndefinedObject(this)

    Set userDefined to .false.

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(inout) :: this

procedure, public :: calculate

  • interface

    private module function calculate(this, varCont, mbData, hostModel) result(res)

    Use in place version of stencil calculation to return values

    Arguments

    Type IntentOptional Attributes Name
    class(JaggedArrayGenerator), intent(inout) :: this
    type(VariableContainer), intent(in) :: varCont
    class(ModelboundData), intent(in), optional :: mbData
    class(ModelSurrogate), intent(in), optional :: hostModel

    Return Value type(RealArray), allocatable, dimension(:)

procedure, public :: init => initInterpValGen

  • interface

    private module subroutine initInterpValGen(this, partitionObj, geometryObj, procRank, staggeredGridMode)

    Central differentiation stencil value generator initialization routine

    Arguments

    Type IntentOptional Attributes Name
    class(InterpStencilGenerator), intent(inout) :: this
    type(Partition), intent(in) :: partitionObj

    Partition object used to determine local number of rows

    type(Geometry), intent(in) :: geometryObj

    Geometry object used to get interpolation/extrapolation coefficients

    integer(kind=ik), intent(in) :: procRank

    Current processor rank

    logical, intent(in), optional :: staggeredGridMode

    If true will interpolate from staggered to regular grid.

procedure, public :: calculateInPlace => calcInterpVals

  • interface

    private module subroutine calcInterpVals(this, varCont, res, mbData, hostModel)

    Calculate interpolation stencil values in place (does not depend on varCont)

    Arguments

    Type IntentOptional Attributes Name
    class(InterpStencilGenerator), intent(inout) :: this
    type(VariableContainer), intent(in) :: varCont
    type(RealArray), intent(inout), allocatable, dimension(:) :: res
    class(ModelboundData), intent(in), optional :: mbData
    class(ModelSurrogate), intent(in), optional :: hostModel