VariableContainer Derived Type

type, public, extends(Object) :: VariableContainer

Container for variable data, allows for handling conversion between local data storage and flattened vectors used for PETSc NOTE: Does not support single harmonic variables


Components

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

True only if user explicitly sets it to true

type(RealArray), public, allocatable, dimension(:) :: variables

Value arrays for each stored variable in implicit,derived order

type(VariableList), private :: implicitVarList

List of implicit variables in container

type(VariableList), private :: derivedVarList

List of derived variables in container

type(CalculationRule), private, allocatable, dimension(:) :: derivationRules

List of derivation rules - conforms in size with derived list

type(IntArray), private, allocatable, dimension(:) :: requiredDerivationIndices

Indices of variables required by each derivation rule

type(IntArray), private, allocatable, dimension(:) :: implicitVarIndices

Indices in local implicit vector corresponding to each variabls implicitToLocIndex

type(IntArray), private, allocatable, dimension(:) :: implicitToLocIndex

Indices in each variable corresponding to their indices in the implicit vector

integer(kind=ik), private, allocatable, dimension(:) :: derivationDepth

Numbers of layers of derived variables on which each derivation depends (e.g. 0 if all required variables are implicit, 1 if all required variables have derivation depth 0, etc.) - -1 for implicit variables

integer(kind=ik), private :: maxDerivPriority

Highest priority value (lowest priority) among derived variables, used in calculating derived quantities


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 :: getVarIndex

  • interface

    private pure module function getVarIndex(this, name) result(ind)

    Get index of variable with given name

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value integer(kind=ik)

procedure, public :: isVarNameRegistered

  • interface

    private pure module function isVarNameRegistered(this, name) result(reg)

    Check whether variable with given name is registered in either the implicit or derived list

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value logical

procedure, public :: calculateDerivedVars

  • interface

    private module subroutine calculateDerivedVars(this, derivPriority, derivDepth)

    Calculate derived variables from implicit variables using derivation rules. If derivPriority is supplied only those variables with priority <= derivPriority will be derived. If derivDepth is present only variables at that derivation depth are calculated, otherwise all variables are calculated

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(inout) :: this
    integer(kind=ik), intent(in), optional :: derivPriority
    integer(kind=ik), intent(in), optional :: derivDepth

procedure, public :: extractImplicitVars

  • interface

    private pure module subroutine extractImplicitVars(this, vec)

    Extract implicit variables from a locally linearly indexed real vector

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(inout) :: this
    real(kind=rk), intent(in), dimension(:) :: vec

procedure, public :: copyImplicitVarsToVec

  • interface

    private pure module subroutine copyImplicitVarsToVec(this, vec, ignoreStationary)

    Copy variables into a locally linearly indexed real vector. If ignoreStationary is true copies any stationary variables as 0

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(inout) :: this
    real(kind=rk), intent(inout), dimension(:) :: vec
    logical, intent(in), optional :: ignoreStationary

procedure, public :: isVarDist

  • interface

    private pure module function isVarDist(this, ind) result(distf)

    Check whether variable with given index is a distribution function

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    integer(kind=ik), intent(in) :: ind

    Return Value logical

procedure, public :: isVarScalar

  • interface

    private pure module function isVarScalar(this, ind) result(scal)

    Check whether variable with given index is a scalar

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    integer(kind=ik), intent(in) :: ind

    Return Value logical

procedure, public :: getVarName

  • interface

    private pure module function getVarName(this, ind) result(name)

    Return variable name at index ind

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    integer(kind=ik), intent(in) :: ind

    Return Value character(len=:), allocatable

procedure, public :: getAllVarNames

  • interface

    private pure module function getAllVarNames(this) result(names)

    Return all variable names in this container

    Arguments

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

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

procedure, public :: getImplicitVarNames

  • interface

    private pure module function getImplicitVarNames(this) result(names)

    Return all implicit variable names in this container

    Arguments

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

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

procedure, public :: isVarImplicit

  • interface

    private pure module function isVarImplicit(this, name) result(imp)

    Check whether variable with given name is registered in either the implicit list

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value logical

procedure, public :: isVarOnDualGrid

  • interface

    private pure module function isVarOnDualGrid(this, name) result(dual)

    Check whether variable with given name is on dual grid

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value logical

procedure, public :: getVarDepth

  • interface

    private pure module function getVarDepth(this, name) result(depth)

    Get depth of variable with given name

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value integer(kind=ik)

procedure, public :: getMaxDepth

  • interface

    private pure module function getMaxDepth(this) result(depth)

    Get max of derivationDepth

    Arguments

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

    Return Value integer(kind=ik)

procedure, public :: isStationary

  • interface

    private pure module function isStationary(this, name) result(stationary)

    Check whether variable with given name is stationary

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(in) :: this
    character(len=*), intent(in) :: name

    Return Value logical

procedure, public :: init => initVarContainer

  • interface

    private pure module subroutine initVarContainer(this, implicitVars, derivedVars, derivationRules, indexingObj, partitionObj, xHaloWidth, procRank)

    Variable container initialization routine

    Arguments

    Type IntentOptional Attributes Name
    class(VariableContainer), intent(inout) :: this
    type(VariableList), intent(in) :: implicitVars

    List of implicit variables

    type(VariableList), intent(in) :: derivedVars

    List of derived variables

    type(CalculationRule), intent(in), dimension(:) :: derivationRules

    Derivation rules corresponding to derived variables

    type(Indexing), intent(in) :: indexingObj

    Reference indexing object used to map between variables and implicit vectors

    type(Partition), intent(in) :: partitionObj

    Reference partition object

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

    Width of halo in x-direction

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

    Current processor rank