ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SEBLandMask.H File Reference

The one place that says how the two-stream force-restore balance reads the land mask (ERF::lmask_lev: 0 water, 1 land, 2 a building's column). More...

#include <string>
#include <AMReX.H>
#include <AMReX_Array4.H>
#include <AMReX_FabArrayBase.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_MFIter.H>
#include <AMReX_iMultiFab.H>
Include dependency graph for ERF_SEBLandMask.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SEBLandMaskView
 The land mask of one box, for a device kernel. Captured by value. More...
 

Functions

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. More...
 
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. More...
 
bool seb_land_mask_has_water (const amrex::iMultiFab *mask)
 True when mask holds a water column on any rank; false for nullptr. More...
 

Detailed Description

The one place that says how the two-stream force-restore balance reads the land mask (ERF::lmask_lev: 0 water, 1 land, 2 a building's column).

The balance is a model of soil. A column is left out of it when the mask is 0 there. The balance, its snow and hydrology steps, the albedo with snow, the average-down and the fill of a new level all ask through this file, so a change of the rule is one edit.

Function Documentation

◆ seb_assert_land_mask_layout()

void seb_assert_land_mask_layout ( const amrex::iMultiFab *  mask,
const amrex::FabArrayBase &  field,
const char *  who 
)
inline

Stop when mask is given and is not on the grids of field.

Parameters
whothe caller, named in the message
45 {
46  if (mask == nullptr) { return; }
47  if (mask->boxArray() != field.boxArray() || mask->DistributionMap() != field.DistributionMap()) {
48  amrex::Abort(std::string(who) + ": the land mask is not on the level's 2D grids");
49  }
50 }

Referenced by TwoStreamRadiation::advance(), ForceRestoreSnow::apply_albedo(), seb_average_down_land(), seb_fill_from_coarse_over_land(), seb_init_skin_from_file(), seb_init_soil_moisture_from_file(), ForceRestoreSnow::step(), and ForceRestoreHydrology::step().

Here is the caller graph for this function:

◆ seb_land_mask_has_water()

bool seb_land_mask_has_water ( const amrex::iMultiFab *  mask)
inline

True when mask holds a water column on any rank; false for nullptr.

Read from the mask each time it is asked: the mask can be rewritten during a run (the WW3 coupling does), and a cached answer would then be wrong. One reduction and one MPI collective per call.

71 {
72  return mask != nullptr && mask->min(0) == 0;
73 }

Referenced by TwoStreamRadiation::advance(), ERF::fill_seb_from_coarse(), and ERF::post_timestep().

Here is the caller graph for this function:

◆ seb_land_mask_view()

SEBLandMaskView seb_land_mask_view ( const amrex::iMultiFab *  mask,
const amrex::MFIter &  mfi 
)
inline

The view of mask on the box of mfi; off when mask is nullptr.

55 {
57  v.on = (mask != nullptr);
58  if (v.on) { v.arr = mask->const_array(mfi); }
59  return v;
60 }
The land mask of one box, for a device kernel. Captured by value.
Definition: ERF_SEBLandMask.H:29
amrex::Array4< const int > arr
Definition: ERF_SEBLandMask.H:31
bool on
Definition: ERF_SEBLandMask.H:30

Referenced by TwoStreamRadiation::advance(), ForceRestoreSnow::apply_albedo(), seb_average_down_land(), seb_fill_from_coarse_over_land(), seb_init_skin_from_file(), seb_init_soil_moisture_from_file(), ForceRestoreSnow::step(), and ForceRestoreHydrology::step().

Here is the caller graph for this function: