1 #ifndef ERF_FORCE_RESTORE_SNOW_STATE_H_
2 #define ERF_FORCE_RESTORE_SNOW_STATE_H_
7 #include <AMReX_MultiFab.H>
8 #include <AMReX_iMultiFab.H>
9 #include <AMReX_Periodicity.H>
10 #include <AMReX_REAL.H>
11 #include <AMReX_Vector.H>
43 amrex::Real
swe = 0.0;
53 void resize (
int nlevs_max);
60 const amrex::DistributionMapping& dm,
const amrex::IntVect&
ng);
63 [[nodiscard]]
bool defined (
int lev)
const noexcept {
64 return lev >= 0 && lev < static_cast<int>(
m_swe.size()) &&
m_swe[lev] !=
nullptr;
83 StepSums
step (
int lev, amrex::MultiFab& t_s,
const amrex::MultiFab& lh,
84 const amrex::MultiFab* footprint, amrex::Real dt,
86 amrex::Real& t_s_sum_local, amrex::Real& t_s_max_local,
87 const amrex::iMultiFab* land_mask =
nullptr);
97 const amrex::MultiFab* footprint =
nullptr,
98 const amrex::iMultiFab* land_mask =
nullptr)
const;
101 [[nodiscard]] amrex::MultiFab*
swe (
int lev) noexcept {
106 [[nodiscard]] amrex::MultiFab*
totals (
int lev) noexcept {
111 [[nodiscard]]
const amrex::MultiFab*
soil_water (
int lev)
const noexcept {
122 const amrex::Periodicity&
period);
125 amrex::Vector<std::unique_ptr<amrex::MultiFab>>
m_swe;
126 amrex::Vector<std::unique_ptr<amrex::MultiFab>>
m_totals;
GpuArray< Real, AMREX_SPACEDIM > period
Definition: ERF_ActuatorSpreading.cpp:131
One bulk snow layer on the two-stream force-restore surface (erf.radiation.seb_snow_enable): the snow...
The per-level state of the force-restore snow layer (ERF_ForceRestoreSnow.H, erf.radiation....
Definition: ERF_ForceRestoreSnowState.H:33
void write_checkpoint(int lev, const std::string &checkpointname) const
Definition: ERF_ForceRestoreSnowState.cpp:175
void read_checkpoint(int lev, const std::string &restart_chkfile, const amrex::Periodicity &period)
Read W_n and the totals. A checkpoint with neither file was written without the snow layer: the snow ...
Definition: ERF_ForceRestoreSnowState.cpp:185
amrex::MultiFab * totals(int lev) noexcept
The running totals (Total components) [kg/m^2], or nullptr.
Definition: ERF_ForceRestoreSnowState.H:106
StepSums step(int lev, amrex::MultiFab &t_s, const amrex::MultiFab &lh, const amrex::MultiFab *footprint, amrex::Real dt, const ForceRestoreSnowParams &prm, const ForceRestorePrecipInput &snowfall, amrex::Real &t_s_sum_local, amrex::Real &t_s_max_local, const amrex::iMultiFab *land_mask=nullptr)
One snow step on every open column of lev, after the balance has updated T_s. A footprint cell (footp...
Definition: ERF_ForceRestoreSnowState.cpp:54
void define_level(int lev, const RadChoice &rc, const amrex::BoxArray &ba2d, const amrex::DistributionMapping &dm, const amrex::IntVect &ng)
Allocate the level's fields, with the snow water equivalent at erf.radiation.seb_snow_initial_swe_kg_...
Definition: ERF_ForceRestoreSnowState.cpp:41
amrex::Vector< std::unique_ptr< amrex::MultiFab > > m_swe
W_n.
Definition: ERF_ForceRestoreSnowState.H:125
amrex::Vector< std::unique_ptr< amrex::MultiFab > > m_totals
Total components.
Definition: ERF_ForceRestoreSnowState.H:126
void apply_albedo(int lev, amrex::MultiFab &alb_sw, const ForceRestoreSnowParams &prm, const amrex::MultiFab *footprint=nullptr, const amrex::iMultiFab *land_mask=nullptr) const
Write the surface albedo with snow into alb_sw, which holds the snow-free albedo: DRM95 Eq....
Definition: ERF_ForceRestoreSnowState.cpp:147
Total
Components of totals(lev), each a running total [kg/m^2] since the start.
Definition: ERF_ForceRestoreSnowState.H:36
@ Melt
Definition: ERF_ForceRestoreSnowState.H:36
@ NumTotals
Definition: ERF_ForceRestoreSnowState.H:36
@ Sublimation
Definition: ERF_ForceRestoreSnowState.H:36
@ Snowfall
Definition: ERF_ForceRestoreSnowState.H:36
static ForceRestoreSnowParams params(const RadChoice &rc)
The parameters of one step, from the erf.radiation.seb_* inputs.
Definition: ERF_ForceRestoreSnowState.cpp:22
amrex::Vector< std::unique_ptr< amrex::MultiFab > > m_soil_water
melt + sublimation of the last step
Definition: ERF_ForceRestoreSnowState.H:127
void resize(int nlevs_max)
Definition: ERF_ForceRestoreSnowState.cpp:33
const amrex::MultiFab * soil_water(int lev) const noexcept
Water the last step() handed the soil [kg/m^2]: melt plus sublimation; or nullptr.
Definition: ERF_ForceRestoreSnowState.H:111
amrex::MultiFab * swe(int lev) noexcept
The snow water equivalent [kg/m^2], or nullptr.
Definition: ERF_ForceRestoreSnowState.H:101
bool defined(int lev) const noexcept
True once define_level allocated lev.
Definition: ERF_ForceRestoreSnowState.H:63
@ ng
Definition: ERF_Morrison.H:51
constexpr std::array< amrex::Real, num_veg_params > rc
Definition: ERF_SLM_DefaultParams.H:22
Parameters of one snow step (from erf.radiation.seb_*).
Definition: ERF_ForceRestoreSnow.H:67
Domain sums of one step on one level (rank-reduced), for the log.
Definition: ERF_ForceRestoreSnowState.H:39
amrex::Real swe
sum of W_n after the step [kg/m^2]
Definition: ERF_ForceRestoreSnowState.H:43
amrex::Real sublimation
[kg/m^2]
Definition: ERF_ForceRestoreSnowState.H:41
amrex::Real snowfall
[kg/m^2]
Definition: ERF_ForceRestoreSnowState.H:40
amrex::Long columns
Definition: ERF_ForceRestoreSnowState.H:45
amrex::Long bad_columns
open columns left with a non-finite T_s, or a non-finite or negative W_n
Definition: ERF_ForceRestoreSnowState.H:47
amrex::Real melt
[kg/m^2]
Definition: ERF_ForceRestoreSnowState.H:42
amrex::Real max_residual
max |column budget residual| [kg/m^2]
Definition: ERF_ForceRestoreSnowState.H:44
Container holding radiation-related choices and parameters.
Definition: ERF_RadStruct.H:142