Single Stack Utils
Functions
ClimateMachine.SingleStackUtils.get_vars_from_nodal_stack
— Functionget_vars_from_nodal_stack(
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars;
vrange::UnitRange = 1:size(Q, 3),
i::Int = 1,
j::Int = 1,
exclude::Vector{String} = String[],
) where {T, dim, N}
Return a dictionary whose keys are the flattenednames()
of the variables specified in vars
(as returned by e.g. vars_state
), and whose values are arrays of the values for that variable along the vertical dimension in Q
. Only a single element is expected in the horizontal as this is intended for the single stack configuration and i
and j
identify the horizontal nodal coordinates.
Variables listed in exclude
are skipped.
ClimateMachine.SingleStackUtils.get_vars_from_element_stack
— Functionget_vars_from_element_stack(
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars;
vrange::UnitRange = 1:size(Q, 3),
exclude::Vector{String} = String[],
) where {T, dim, N}
Return an array of get_vars_from_nodal_stack()
s whose dimensions are the number of nodal points per element in the horizontal plane.
Variables listed in exclude
are skipped.
ClimateMachine.SingleStackUtils.get_horizontal_mean
— Functionget_horizontal_mean(
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars;
vrange::UnitRange = 1:size(Q, 3),
exclude::Vector{String} = String[],
) where {T, dim, N}
Return a dictionary whose keys are the flattenednames()
of the variables specified in vars
(as returned by e.g. vars_state
), and whose values are arrays of the horizontal averages for that variable along the vertical dimension in Q
. Only a single element is expected in the horizontal as this is intended for the single stack configuration.
Variables listed in exclude
are skipped.
ClimateMachine.SingleStackUtils.get_horizontal_variance
— Functionget_horizontal_variance(
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars;
vrange::UnitRange = 1:size(Q, 3),
exclude::Vector{String} = String[],
) where {T, dim, N}
Return a dictionary whose keys are the flattenednames()
of the variables specified in vars
(as returned by e.g. vars_state
), and whose values are arrays of the horizontal variance for that variable along the vertical dimension in Q
. Only a single element is expected in the horizontal as this is intended for the single stack configuration.
Variables listed in exclude
are skipped.
ClimateMachine.SingleStackUtils.reduce_nodal_stack
— Functionreduce_nodal_stack(
op::Function,
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars::NamedTuple,
var::String;
vrange::UnitRange = 1:size(Q, 3),
) where {T, dim, N}
Reduce var
from vars
within Q
over all nodal points in the specified vrange
of elements with op
. Return a tuple (result, z)
where result
is the final value returned by op
and z
is the index within vrange
where the result
was determined.
ClimateMachine.SingleStackUtils.reduce_element_stack
— Functionreduce_element_stack(
op::Function,
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
vars::NamedTuple,
var::String;
vrange::UnitRange = 1:size(Q, 3),
) where {T, dim, N}
Reduce var
from vars
within Q
over all nodal points in the specified vrange
of elements with op
. Return a tuple (result, z)
where result
is the final value returned by op
and z
is the index within vrange
where the result
was determined.
ClimateMachine.SingleStackUtils.horizontally_average!
— Functionhorizontally_average!(
grid::DiscontinuousSpectralElementGrid{T, dim, N},
Q::MPIStateArray,
i_vars,
) where {T, dim, N}
Horizontally average variables, from variable indexes i_vars
, in MPIStateArray
Q
.
These are not proper horizontal averages– the main purpose of this method is to ensure that there are no horizontal fluxes for a single stack configuration.
ClimateMachine.SingleStackUtils.dict_of_nodal_states
— Functiondict_of_nodal_states(
solver_config,
aux_excludes = [],
state_types = (Prognostic(), Auxiliary())
)
A dictionary of single stack prognostic and auxiliary variables at the i=1
,j=1
node given
solver_config
aSolverConfiguration
aux_excludes
a vector of strings containing the variables to exclude from the auxiliary state.