17 if (t_sfc.boxArray() != file_skin.boxArray() ||
18 t_sfc.DistributionMap() != file_skin.DistributionMap()) {
19 Abort(
"seb_init_skin_from_file: the file's skin temperature is not on the grids of "
20 "the balance's skin temperature");
26 ReduceOps<ReduceOpSum, ReduceOpSum, ReduceOpMin, ReduceOpMax> reduce_op;
27 ReduceData<Long, Long, Real, Real> reduce_data(reduce_op);
28 using ReduceTuple =
typename decltype(reduce_data)::Type;
29 const Real huge = std::numeric_limits<Real>::max();
31 for (MFIter mfi(t_sfc, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
32 const Box& bx = mfi.tilebox();
33 const Array4<Real>& skin = t_sfc.array(mfi);
34 const Array4<const Real>& file = file_skin.const_array(mfi);
36 reduce_op.eval(bx, reduce_data,
37 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept -> ReduceTuple
39 if (mask.
water(i, j)) { return {Long(0), Long(0), huge, -huge}; }
40 const Real
t = file(i, j, k);
43 return {Long(1), Long(0),
t,
t};
47 const ReduceTuple result = reduce_data.value(reduce_op);
49 report.
n_set = amrex::get<0>(result);
51 report.
t_min = amrex::get<2>(result);
52 report.
t_max = amrex::get<3>(result);
SEBLandMaskView seb_land_mask_view(const amrex::iMultiFab *mask, const amrex::MFIter &mfi)
The view of mask on the box of mfi; off when mask is nullptr.
Definition: ERF_SEBLandMask.H:54
void seb_assert_land_mask_layout(const amrex::iMultiFab *mask, const amrex::FabArrayBase &field, const char *who)
Stop when mask is given and is not on the grids of field.
Definition: ERF_SEBLandMask.H:43
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
@ t
Definition: ERF_WSM6.H:295
The land mask of one box, for a device kernel. Captured by value.
Definition: ERF_SEBLandMask.H:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool water(int i, int j) const noexcept
True when the balance does not run on column (i, j).
Definition: ERF_SEBLandMask.H:35
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