general_mat_term_class Module

Houses general matrix term


Used by


Interfaces

interface

  • private module subroutine initGeneralTerm(this, gridObj, partitionObj, indexingObj, procRank, evolvedVar, implicitVar, varCont, sTemplate, vData, normConst, coordProfile, tData, evalTermGroup, mbData, copyTermName)

    General matrix term initialization routine

    Arguments

    Type IntentOptional Attributes Name
    class(GeneralMatrixTerm), intent(inout) :: this
    type(Grid), intent(in) :: gridObj

    Grid object used to initialize stencil

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

    Parition object used to determine local number of DoF

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

    Indexing object used to initialize matrix row data

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

    Current processor rank

    character(len=*), intent(in) :: evolvedVar

    Name of evolved variable

    character(len=*), intent(in) :: implicitVar

    Name of implicit variable

    type(VariableContainer), intent(in) :: varCont

    Reference variable container

    type(StencilTemplate), intent(inout) :: sTemplate

    StencilTemplate used

    type(VarData), intent(in), optional :: vData

    Required variable names and powers

    real(kind=rk), intent(in), optional :: normConst

    Normalization constant

    type(CoordProfiles), intent(in), optional :: coordProfile

    Multiplicative coordinate profiles (globally indexed)

    type(TimeSignalData), intent(in), optional :: tData

    Explicit time dependence

    integer(kind=ik), intent(in), optional :: evalTermGroup

    Optional term group of host model to evaluate and use as additional row variable

    class(ModelboundData), intent(in), optional :: mbData

    Optional modelbound data object used when initializing fixed stancil generators which might require it

    character(len=*), intent(in), optional :: copyTermName

    Name of the term whose values should be copied and multiplied with this term's stencil

interface

  • private pure module subroutine generalRow(this, varCont, rowVals, indexingData)

    Multiplies all required variables and raises them to their corresponding power,using modelbound row variable buffer if allocated, and adding spatial and time profiles

    Arguments

    Type IntentOptional Attributes Name
    class(GeneralMatrixTerm), intent(inout) :: this
    type(VariableContainer), intent(in) :: varCont
    real(kind=rk), intent(inout), dimension(:) :: rowVals
    type(MatrixTermIndexingData), intent(in) :: indexingData

interface

  • private pure module subroutine generalCol(this, varCont, colVals, indexingData)

    Multiplies all required variables and raises them to their corresponding power,using modelbound row variable buffer if allocated

    Arguments

    Type IntentOptional Attributes Name
    class(GeneralMatrixTerm), intent(inout) :: this
    type(VariableContainer), intent(in) :: varCont
    type(RealArray), intent(inout), dimension(:) :: colVals
    type(MatrixTermIndexingData), intent(in) :: indexingData

interface

  • private module subroutine updateGeneralTerm(this, varCont, indexingData, modelData, hostModel)

    Update general term if using any modelbound data, updating stencil values, evaluating other terms, or if there is any explicit time dependence

    Arguments

    Type IntentOptional Attributes Name
    class(GeneralMatrixTerm), intent(inout) :: this
    type(VariableContainer), intent(in) :: varCont

    Variable container - used to update stencil values and signal

    type(MatrixTermIndexingData), intent(in) :: indexingData
    class(ModelboundData), intent(in), optional :: modelData

    Model data used to retrieve modelbound variable

    class(ModelSurrogate), intent(in), optional :: hostModel

    Host model - used to evaluate term group


Derived Types

type, public ::  VarData

Container for common data used to initialize general matrix terms

Components

Type Visibility Attributes Name Initial
type(StringArray), public, allocatable, dimension(:) :: rowVars

Names of required row variables

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

Names of required column variables

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

Named of required modelbound row variables

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

Named of required modelbound column variables

real(kind=rk), public, allocatable, dimension(:) :: rowVarPowers

Powers corresponding to row variables

real(kind=rk), public, allocatable, dimension(:) :: colVarPowers

Powers corresponding to column variables

real(kind=rk), public, allocatable, dimension(:) :: modelboundRowVarPowers

Powers corresponding to modelbound row variables

real(kind=rk), public, allocatable, dimension(:) :: modelboundColVarPowers

Powers corresponding to modelbound column variables

type, public ::  StencilTemplate

Components

Type Visibility Attributes Name Initial
class(JaggedArrayGenerator), public, allocatable :: stencilGen
integer(kind=ik), public, allocatable, dimension(:,:) :: rowCoords
type(Stencil), public :: defaultStencil
integer(kind=ik), public, allocatable, dimension(:,:) :: overridingStencilCoords
type(Stencil), public, allocatable, dimension(:) :: overridingStencils
logical, public :: fixedStencil = .false.

type, public ::  CoordProfiles

Container for profiles in the x,h, and v directions

Components

Type Visibility Attributes Name Initial
real(kind=rk), public, allocatable, dimension(:) :: xProfile

Profile in x direction (should be same size as grid)

real(kind=rk), public, allocatable, dimension(:) :: hProfile

Profile in harmonic direction (should conform to number of harmonics)

real(kind=rk), public, allocatable, dimension(:) :: vProfile

Profile in v direction (should be same saize as v grid)

type, public, extends(MatrixTerm) ::  GeneralMatrixTerm

General matrix term with the capability to take in various stencils, time and spaticoordinate profiles, and evaluate other term groups in the host model. Required row and column variables passed through the VarData object are raised to corresponding powers.

Components

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

True only if user explicitly sets it to true

type(VarData), private :: vData

Common variable data

type(CoordProfiles), private :: coordProfile

Optional multiplicative constants giving x-dependence if size 1 or x,h,v dependence if size 3

type(TimeSignalData), private, allocatable :: tData

Optional time signal data

real(kind=rk), private :: timeSignalMult

Multiplier containing tSignal result. Defaults to 1

integer(kind=ik), private, allocatable :: targetTermGroup

Term group to evaluate and use as a row function

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

Buffer for evaluating target term group

class(JaggedArrayGenerator), private, allocatable :: stencilGen

Optional stencil value generator used to update this term's multConst

type(RealArray), private, allocatable, dimension(:) :: stencilVals

Current values of stencil variables, used as this term's multConst

type(SparseRowData), private :: copyTermVals

Matrix values of the optional copy term

character(len=:), private, allocatable :: copyTermName

Name of the term whose values should be copied and multiplied with this term's stencil

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

Buffer holding the product of modelbound row variables raised to their corresponding powers

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

Buffer holding the product of modelbound col variables raised to their corresponding powers

logical, private :: xPeriodic

True if term treats x grid as periodic

logical, private :: isActive
logical, private :: kineticRow

True if row variable is a distribution

logical, private :: kineticCol

True if col variable is a distribution

logical, private, allocatable, dimension(:) :: reqRowVarIsDist

True for all required row variables that are distributions

logical, private, allocatable, dimension(:) :: reqColVarIsDist

True for all required column variables that are distributions

integer(kind=ik), private :: locNumX

Local number of spatial cells - used when handling modelbound data

integer(kind=ik), private :: numH

Local number of spatial cells - used when handling modelbound data

integer(kind=ik), private :: numV

Local number of spatial cells - used when handling modelbound data

integer(kind=ik), private, allocatable, dimension(:) :: rowCoordsX
integer(kind=ik), private, allocatable, dimension(:) :: rowCoordsH
integer(kind=ik), private, allocatable, dimension(:) :: rowCoordsV

Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject
procedure, public :: makeDefined => makeDefinedObject
procedure, public :: makeUndefined => makeUndefinedObject
procedure, public :: calculateValues
procedure, public :: setNormalizationConst
procedure, public :: getNormalizationConst
procedure, public :: setReqVars
procedure, public :: setEvolvedAndImplicitVar
procedure, public :: initRowData
procedure, public :: evaluate => evaluateMatTerm
procedure, public :: getMultConst
procedure, public :: setMultConst
procedure, public :: getIndexingData
procedure, public :: setFixedMatrix
procedure, public :: setNontrivialRowFun => setNonTrivialRowFun
procedure, public :: setNontrivialColFun => setNonTrivialColFun
procedure, public :: addRowDataToPreallocationData
procedure, public :: addRowDataPatternToController
procedure, public :: addRowValuesToPETScMatrix
procedure, public :: getVarName => getRowVarName
procedure, public :: getRowData
procedure, public :: update => matTermUpdate
procedure, public :: matrixTermUpdate => updateGeneralTerm
procedure, public :: calculateRows => generalRow
procedure, public :: calculateCols => generalCol
procedure, public :: init => initGeneralTerm