# State Check

ClimateMachine.StateCheckModule
StateCheck

Module with a minimal set of functions for getting statistics and basic I/O from ClimateMachine DG state arrays (MPIStateArray type). Created for regression testing and code change tracking and debugging. StateCheck functions iterate over named variables in an MPIStateArray, calculate and report their statistics and/or write values for all or some subset of points at a fixed frequency.

Functions

source

## Methods

ClimateMachine.StateCheck.sccreateFunction
sccreate(
io::IO,
fields::Array{<:Tuple{<:MPIStateArray, String}},
nt_freq::Int = 10;
prec = 15
)

Create a "state check" call-back for one or more MPIStateArray variables that will report basic statistics for the fields in the array.

• io an IO stream to use for printed output
• fields a required first argument that is an array of one or more MPIStateArray variable and label string pair tuples. State array statistics will be reported for the named symbols in each MPIStateArray labeled with the label string.
• nt_freq an optional second argument with default value of 10 that sets how frequently (in time-step counts) the statistics are reported.
• prec a named argument that sets number of decimal places to print for statistics, defaults to 15.

Examples

using ClimateMachine.VariableTemplates
using StaticArrays
using ClimateMachine.MPIStateArrays
using MPI
MPI.Init()
FT=Float64
F1=@vars begin; ν∇u::SMatrix{3, 2, FT, 6}; κ∇θ::SVector{3, FT}; end
F2=@vars begin; u::SVector{2, FT}; θ::SVector{1, FT}; end
Q1=MPIStateArray{Float32,F1}(MPI.COMM_WORLD,ClimateMachine.array_type(),4,9,8);
Q2=MPIStateArray{Float64,F2}(MPI.COMM_WORLD,ClimateMachine.array_type(),4,6,8);
cb=ClimateMachine.StateCheck.sccreate([(Q1,"My gradients"),(Q2,"My fields")],1; prec=15);
source
ClimateMachine.StateCheck.scdocheckFunction
scdocheck(cb, ref_dat)

Compare a current State check call-back set of values with a reference set and match precision table pair.

• cb StateCheck call-back variables
• ref_dat an array of reference values and precision to match tables.
source
ClimateMachine.StateCheck.scprintrefFunction
scprintref(cb)

Print out a "state check" call-back table of values in a format suitable for use as a set of reference numbers for CI comparison.

• cb callback variable of type ClimateMachine.GenericCallbacks.Every*
source