ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SEBSkinInit.H
Go to the documentation of this file.
1 #ifndef ERF_SEB_SKIN_INIT_H_
2 #define ERF_SEB_SKIN_INIT_H_
3 
4 #include <AMReX_GpuQualifiers.H>
5 #include <AMReX_INT.H>
6 #include <AMReX_Math.H>
7 #include <AMReX_MultiFab.H>
8 #include <AMReX_REAL.H>
9 #include <AMReX_iMultiFab.H>
10 
11 /**
12  * @file ERF_SEBSkinInit.H
13  * @brief The first value of the two-stream force-restore balance's skin temperature from
14  * the skin temperature of the initial file (TSK of a wrfinput file, SKINTEMP of a metgrid
15  * file), with erf.radiation.seb_init_skin_from_file.
16  *
17  * Without the input every column starts at the one value erf.rad_t_sfc. With it a land
18  * column starts at the file's value. A water column keeps erf.rad_t_sfc: the balance does
19  * not run there and the sweep takes the surface layer's sea surface temperature.
20  */
21 
22 /**
23  * @brief True when @p temperature [K] can start the skin: finite and inside the range the
24  * balance holds the skin in, [@p t_lo, @p t_hi] (erf.radiation.seb_prognostic_t_min_k and
25  * seb_prognostic_t_max_k).
26  *
27  * A value outside the range would be moved to the nearest bound by the first update of the
28  * balance, so it is refused here.
29  */
30 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
31 bool
32 seb_skin_init_usable (const amrex::Real temperature, const amrex::Real t_lo,
33  const amrex::Real t_hi) noexcept
34 {
35  return amrex::Math::isfinite(temperature) && temperature >= t_lo && temperature <= t_hi;
36 }
37 
38 /** @brief What seb_init_skin_from_file did on the boxes of this rank. */
40 {
41  amrex::Long n_set = 0; //!< land columns that took the file's value
42  amrex::Long n_refused = 0; //!< land columns whose file value is not usable (left as they were)
43  amrex::Real t_min = 0; //!< lowest value set [K]; meaningful when n_set > 0
44  amrex::Real t_max = 0; //!< highest value set [K]; meaningful when n_set > 0
45 };
46 
47 /**
48  * @brief Copy @p file_skin [K] into the land columns of @p t_sfc [K], valid columns only.
49  *
50  * @param[in,out] t_sfc the balance's skin temperature of one level
51  * @param[in] file_skin the file's skin temperature on the same grids
52  * @param[in] land_mask ERF::lmask_lev of the level (0 is water); nullptr means all land
53  * @param[in] t_lo lowest usable value [K]
54  * @param[in] t_hi highest usable value [K]
55  * @return the counts and range of this rank. The caller sums them over the ranks, stops
56  * when a column was refused, and fills the ghost columns of @p t_sfc.
57  */
58 [[nodiscard]] SEBSkinInitReport
59 seb_init_skin_from_file (amrex::MultiFab& t_sfc, const amrex::MultiFab& file_skin,
60  const amrex::iMultiFab* land_mask, amrex::Real t_lo, amrex::Real t_hi);
61 
62 #endif
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool seb_skin_init_usable(const amrex::Real temperature, const amrex::Real t_lo, const amrex::Real t_hi) noexcept
True when temperature [K] can start the skin: finite and inside the range the balance holds the skin ...
Definition: ERF_SEBSkinInit.H:32
SEBSkinInitReport seb_init_skin_from_file(amrex::MultiFab &t_sfc, const amrex::MultiFab &file_skin, const amrex::iMultiFab *land_mask, amrex::Real t_lo, amrex::Real t_hi)
Copy file_skin [K] into the land columns of t_sfc [K], valid columns only.
What seb_init_skin_from_file did on the boxes of this rank.
Definition: ERF_SEBSkinInit.H:40
amrex::Real t_max
highest value set [K]; meaningful when n_set > 0
Definition: ERF_SEBSkinInit.H:44
amrex::Real t_min
lowest value set [K]; meaningful when n_set > 0
Definition: ERF_SEBSkinInit.H:43
amrex::Long n_set
land columns that took the file's value
Definition: ERF_SEBSkinInit.H:41
amrex::Long n_refused
land columns whose file value is not usable (left as they were)
Definition: ERF_SEBSkinInit.H:42