variable_container_class Module

Houses all variables, both implicit and derived, as well as relevant support types


Used by


Interfaces

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)

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

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

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

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

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

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

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(:)

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(:)

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)

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)

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

interface

  • private pure module subroutine initCalculationRule(this, deriv, names)

    Calculation rule object initialization routine

    Arguments

    Type IntentOptional Attributes Name
    class(CalculationRule), intent(inout) :: this
    class(Derivation), intent(in), optional :: deriv

    Derivation component

    type(StringArray), intent(in), optional, dimension(:) :: names

    Required variable names

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

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

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

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

Derived Types

type, public, extends(Object) ::  CalculationRule

Object used to calculate derived variables using a derivation object and set of required variable names

Components

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

True only if user explicitly sets it to true

class(Derivation), public, allocatable :: derivationMethod

Derivation object used to calculate derived variables

type(StringArray), public, allocatable, dimension(:) :: requiredVarNames

Names of variables required for the derivation

Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject
procedure, public :: makeDefined => makeDefinedObject
procedure, public :: makeUndefined => makeUndefinedObject
procedure, public :: init => initCalculationRule

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
procedure, public :: makeDefined => makeDefinedObject
procedure, public :: makeUndefined => makeUndefinedObject
procedure, public :: getVarIndex
procedure, public :: isVarNameRegistered
procedure, public :: calculateDerivedVars
procedure, public :: extractImplicitVars
procedure, public :: copyImplicitVarsToVec
procedure, public :: isVarDist
procedure, public :: isVarScalar
procedure, public :: getVarName
procedure, public :: getAllVarNames
procedure, public :: getImplicitVarNames
procedure, public :: isVarImplicit
procedure, public :: isVarOnDualGrid
procedure, public :: getVarDepth
procedure, public :: getMaxDepth
procedure, public :: isStationary
procedure, public :: init => initVarContainer