ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
near_surface_diagnostics Namespace Reference

Classes

struct  NativeBundle
 
struct  NativeAggregate
 
struct  MostState
 
struct  MostProfile
 
struct  Sources
 
struct  WindSources
 

Functions

void fill (MultiFab &dst, int temperature_comp, int mixing_ratio_comp, int source_comp, const Sources &sources, Real missing_value)
 
void fill_wind_10m (MultiFab &dst, int u_comp, int v_comp, int u_east_comp, int v_north_comp, const WindSources &sources, Real missing_value)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_real (amrex::Real value) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_noahmp_component (amrex::Real value) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_temperature_is_valid (const NativeBundle &bundle) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_mixing_ratio_is_valid (const NativeBundle &bundle) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_vegetation_fraction_is_valid (const NativeBundle &bundle) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_is_valid (const NativeBundle &bundle) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_vegetated_tile_is_used (amrex::Real vegetation_fraction) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bare_tile_is_used (amrex::Real vegetation_fraction) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE NativeAggregate aggregate_native_bundle (const NativeBundle &bundle) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most_profile_zeta_max () noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool evaluate_most_factor (const MostState &state, amrex::Real height, amrex::Real &factor) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool evaluate_most_momentum_factor (amrex::Real roughness_height, amrex::Real obukhov_length, amrex::Real height, amrex::Real &factor) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool evaluate_most_profile (const MostState &state, amrex::Real height, MostProfile &profile) noexcept
 
void fill (amrex::MultiFab &dst, int temperature_comp, int mixing_ratio_comp, int source_comp, const Sources &sources, amrex::Real missing_value=amrex::Real(-999.0))
 
void fill_wind_10m (amrex::MultiFab &dst, int u_comp, int v_comp, int u_east_comp, int v_north_comp, const WindSources &sources, amrex::Real missing_value=amrex::Real(-999.0))
 

Variables

constexpr amrex::Real wind_height = amrex::Real(10.0)
 

Function Documentation

◆ aggregate_native_bundle()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE NativeAggregate near_surface_diagnostics::aggregate_native_bundle ( const NativeBundle &  bundle)
noexcept
132 {
133  const amrex::Real f = bundle.vegetation_fraction;
134  // At the endpoints take the one tile in use, so that an unused tile's
135  // placeholder (which may be a sentinel) cannot leak in through 0 * value.
137  return {bundle.temperature_bare, bundle.mixing_ratio_bare};
138  }
139  if (!native_bare_tile_is_used(f)) {
140  return {bundle.temperature_vegetated, bundle.mixing_ratio_vegetated};
141  }
142  return {
143  f * bundle.temperature_vegetated + (amrex::Real(1.0)-f) * bundle.temperature_bare,
144  f * bundle.mixing_ratio_vegetated + (amrex::Real(1.0)-f) * bundle.mixing_ratio_bare
145  };
146 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_vegetated_tile_is_used(amrex::Real vegetation_fraction) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:83
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bare_tile_is_used(amrex::Real vegetation_fraction) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:89

Referenced by fill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_most_factor()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::evaluate_most_factor ( const MostState &  state,
amrex::Real  height,
amrex::Real &  factor 
)
noexcept
158 {
159  if (!valid_real(state.roughness_height) ||
160  !valid_real(state.obukhov_length) ||
161  state.roughness_height <= amrex::Real(0.0) ||
162  height <= state.roughness_height ||
163  state.obukhov_length == amrex::Real(0.0)) {
164  return false;
165  }
166  const similarity_funs sfuns{};
167  const amrex::Real zeta = amrex::min(height / state.obukhov_length,
169  factor = std::log(height / state.roughness_height) - sfuns.calc_psi_h(zeta);
170  return valid_real(factor);
171 }
Real height
Definition: ERF_InitCustomPert_SquallLine.H:37
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most_profile_zeta_max() noexcept
Definition: ERF_NearSurfaceDiagnostics.H:152
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_real(amrex::Real value) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:49
Definition: ERF_MOSTUtils.H:67

Referenced by evaluate_most_profile(), and fill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_most_momentum_factor()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::evaluate_most_momentum_factor ( amrex::Real  roughness_height,
amrex::Real  obukhov_length,
amrex::Real  height,
amrex::Real &  factor 
)
noexcept
180 {
181  if (!valid_real(roughness_height) || !valid_real(obukhov_length) ||
182  roughness_height <= amrex::Real(0.0) ||
183  height <= roughness_height ||
184  obukhov_length == amrex::Real(0.0)) {
185  return false;
186  }
187  const similarity_funs sfuns{};
188  const amrex::Real zeta = amrex::min(height / obukhov_length,
190  factor = std::log(height / roughness_height) - sfuns.calc_psi_m(zeta);
191  return valid_real(factor);
192 }

Referenced by fill_wind_10m().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_most_profile()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::evaluate_most_profile ( const MostState &  state,
amrex::Real  height,
MostProfile &  profile 
)
noexcept
200 {
201  if (!valid_real(state.theta_surface) || !valid_real(state.theta_star) ||
202  !valid_real(state.mixing_ratio_surface) || !valid_real(state.mixing_ratio_star)) {
203  return false;
204  }
205 
206  amrex::Real profile_factor = amrex::Real(0.0);
207  if (!evaluate_most_factor(state, height, profile_factor)) {
208  return false;
209  }
210 
211  profile.potential_temperature = state.theta_surface +
212  state.theta_star / KAPPA * profile_factor;
213  profile.mixing_ratio = state.mixing_ratio_surface +
214  state.mixing_ratio_star / KAPPA * profile_factor;
215  return valid_real(profile.potential_temperature) &&
216  valid_real(profile.mixing_ratio) &&
217  profile.potential_temperature > amrex::Real(0.0) &&
218  profile.mixing_ratio >= amrex::Real(0.0);
219 }
constexpr amrex::Real KAPPA
Definition: ERF_Constants.H:71
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool evaluate_most_factor(const MostState &state, amrex::Real height, amrex::Real &factor) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:155
Here is the call graph for this function:

◆ fill() [1/2]

void near_surface_diagnostics::fill ( amrex::MultiFab &  dst,
int  temperature_comp,
int  mixing_ratio_comp,
int  source_comp,
const Sources &  sources,
amrex::Real  missing_value = amrex::Real(-999.0) 
)

◆ fill() [2/2]

void near_surface_diagnostics::fill ( MultiFab &  dst,
int  temperature_comp,
int  mixing_ratio_comp,
int  source_comp,
const Sources &  sources,
Real  missing_value 
)
48 {
49 #ifdef _OPENMP
50 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
51 #endif
52  for (MFIter mfi(dst, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
53  const Box& bx = mfi.tilebox();
54  const auto dst_arr = dst.array(mfi);
55 
56  const auto tv = array_or_empty(sources.native_temperature_vegetated, mfi);
57  const auto tb = array_or_empty(sources.native_temperature_bare, mfi);
58  const auto qv = array_or_empty(sources.native_mixing_ratio_vegetated, mfi);
59  const auto qb = array_or_empty(sources.native_mixing_ratio_bare, mfi);
60  const auto fv = array_or_empty(sources.native_vegetation_fraction, mfi);
61  const auto ts = array_or_empty(sources.theta_surface, mfi);
62  const auto tstar = array_or_empty(sources.theta_star, mfi);
63  const auto qs = array_or_empty(sources.mixing_ratio_surface, mfi);
64  const auto qstar = array_or_empty(sources.mixing_ratio_star, mfi);
65  const auto z0 = array_or_empty(sources.roughness_height, mfi);
66  const auto olen = array_or_empty(sources.obukhov_length, mfi);
67  const auto source_mask = array_or_empty(sources.source_mask, mfi);
68  const auto lmask = int_array_or_empty(sources.land_mask, mfi);
69  const auto cons = array_or_empty(sources.cons, mfi);
70  const auto znd = array_or_empty(sources.z_phys_nd, mfi);
71 
72  const bool request_temperature = temperature_comp >= 0;
73  const bool request_mixing_ratio = mixing_ratio_comp >= 0;
74  const bool request_source = source_comp >= 0;
75  // Provenance follows the temperature path only for a source-only
76  // request. When paired with humidity, it describes the humidity
77  // source without adding an unrequested temperature prerequisite.
78  const bool source_only = request_source && !request_temperature &&
79  !request_mixing_ratio;
80  const bool need_temperature = request_temperature || source_only;
81  const bool need_mixing_ratio = request_mixing_ratio;
82  const bool have_native_temperature = sources.native_temperature_vegetated &&
83  sources.native_temperature_bare &&
84  sources.native_vegetation_fraction;
85  const bool have_native_mixing_ratio = sources.native_mixing_ratio_vegetated &&
86  sources.native_mixing_ratio_bare &&
87  sources.native_vegetation_fraction;
88  const bool have_most_temperature = sources.theta_surface && sources.theta_star &&
89  sources.roughness_height && sources.obukhov_length;
90  const bool have_most_mixing_ratio = sources.mixing_ratio_surface &&
91  sources.mixing_ratio_star &&
92  sources.roughness_height && sources.obukhov_length;
93  const bool have_atmosphere = sources.cons != nullptr;
94  const bool have_source_mask = sources.source_mask != nullptr;
95  const bool have_land_mask = sources.land_mask != nullptr;
96  const int klo = sources.klo;
97  const Real dz = sources.dz;
98  const bool moist = sources.moist;
99  const bool has_lsm = sources.has_lsm;
100 
101  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
102  Real temperature = missing_value;
103  Real mixing_ratio = missing_value;
106 
107  const NativeBundle native_bundle{
108  have_native_temperature ? tv(i,j,0) : missing_value,
109  have_native_temperature ? tb(i,j,0) : missing_value,
110  have_native_mixing_ratio ? qv(i,j,0) : missing_value,
111  have_native_mixing_ratio ? qb(i,j,0) : missing_value,
112  (have_native_temperature || have_native_mixing_ratio) ? fv(i,j,0) : missing_value
113  };
114  const bool native_temperature_valid = have_native_temperature &&
115  native_bundle_temperature_is_valid(native_bundle);
116  const bool native_mixing_ratio_valid = moist && have_native_mixing_ratio &&
118  const bool native_selected = (!need_temperature || native_temperature_valid) &&
119  (!need_mixing_ratio || native_mixing_ratio_valid);
120 
121  bool selected = false;
122  if (native_selected && (need_temperature || need_mixing_ratio)) {
123  const NativeAggregate aggregate = aggregate_native_bundle(native_bundle);
124  if (need_temperature) {
125  temperature = aggregate.temperature;
126  }
127  if (need_mixing_ratio) {
128  mixing_ratio = aggregate.mixing_ratio;
129  }
130  source_value = surface_diagnostics::to_plot_value(
132  selected = true;
133  }
134 
135  if (!selected && (need_temperature || need_mixing_ratio)) {
136  const MostState state{
137  have_most_temperature ? ts(i,j,0) : missing_value,
138  have_most_temperature ? tstar(i,j,0) : missing_value,
139  have_most_mixing_ratio ? qs(i,j,0) : missing_value,
140  have_most_mixing_ratio ? qstar(i,j,0) : missing_value,
141  (have_most_temperature || have_most_mixing_ratio) ? z0(i,j,0) : missing_value,
142  (have_most_temperature || have_most_mixing_ratio) ? olen(i,j,0) : missing_value
143  };
144  Real factor = zero;
145  const bool common_most_valid = evaluate_most_factor(state, Real(2.0), factor);
146  bool most_temperature_valid = false;
147  bool most_mixing_ratio_valid = false;
148  Real theta_2m = missing_value;
149  Real q_2m = missing_value;
150  if (common_most_valid && need_temperature && have_most_temperature) {
151  theta_2m = state.theta_surface + state.theta_star / KAPPA * factor;
152  if (valid_real(theta_2m) && theta_2m > zero && have_atmosphere) {
153  const Real rho = cons(i,j,klo,Rho_comp);
154  const Real rhotheta = cons(i,j,klo,RhoTheta_comp);
155  const Real q_cell = moist ? cons(i,j,klo,RhoQ1_comp) / rho : zero;
156  if (valid_real(rho) && rho > zero && valid_real(rhotheta) &&
157  valid_real(q_cell) && q_cell >= zero) {
158  const Real p_cc = getPgivenRTh(rhotheta, q_cell);
159  const Real z_cc_agl = znd ? Compute_Zrel_AtCellCenter(i,j,klo,znd)
160  : Real(0.5) * dz;
161  const Real p_2m = p_cc + rho * CONST_GRAV *
162  (z_cc_agl - Real(2.0));
163  const Real t_2m = (valid_real(p_2m) && p_2m > zero)
164  ? getTgivenPandTh(p_2m, theta_2m, R_d/Cp_d)
165  : missing_value;
166  most_temperature_valid = valid_real(t_2m) && t_2m > zero;
167  if (most_temperature_valid) { temperature = t_2m; }
168  }
169  }
170  }
171  if (common_most_valid && need_mixing_ratio && moist &&
172  have_most_mixing_ratio && valid_real(state.mixing_ratio_surface) &&
173  valid_real(state.mixing_ratio_star)) {
174  q_2m = state.mixing_ratio_surface + state.mixing_ratio_star / KAPPA * factor;
175  most_mixing_ratio_valid = valid_real(q_2m) && q_2m >= zero;
176  if (most_mixing_ratio_valid) {
177  mixing_ratio = q_2m;
178  }
179  }
180  const bool most_selected = (!need_temperature || most_temperature_valid) &&
181  (!need_mixing_ratio || most_mixing_ratio_valid);
182  // Do not expose a valid scalar from an incomplete MOST bundle
183  // when both requested fields must come from one source.
184  if (!most_selected) {
185  temperature = missing_value;
186  mixing_ratio = missing_value;
187  }
188  if (most_selected) {
189  if (have_source_mask && source_value_is_valid(source_mask(i,j,0))) {
190  source_value = source_mask(i,j,0);
191  if (static_cast<int>(source_value) ==
193  source_value = surface_diagnostics::to_plot_value(
195  }
196  } else if (have_land_mask && lmask(i,j,0) == 0) {
197  source_value = surface_diagnostics::to_plot_value(
199  } else {
200  source_value = surface_diagnostics::to_plot_value(
203  }
204  selected = true;
205  }
206  }
207 
208  if (temperature_comp >= 0) {
209  dst_arr(i,j,k,temperature_comp) = temperature;
210  }
211  if (mixing_ratio_comp >= 0) {
212  dst_arr(i,j,k,mixing_ratio_comp) = (selected && moist)
213  ? mixing_ratio : missing_value;
214  }
215  if (source_comp >= 0) {
216  dst_arr(i,j,k,source_comp) = source_value;
217  }
218  });
219  }
220 }
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:51
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
constexpr amrex::Real R_d
Definition: ERF_Constants.H:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:81
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenPandTh(const amrex::Real P, const amrex::Real th, const amrex::Real rdOcp)
Definition: ERF_EOS.H:32
#define Rho_comp
Definition: ERF_IndexDefines.H:53
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:66
Real z0
Definition: ERF_InitCustomPertVels_ScalarAdvDiff.H:12
const int klo
Definition: ERF_InitCustomPert_KE.H:9
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_Zrel_AtCellCenter(const int &i, const int &j, const int &k, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:762
@ olen
Definition: ERF_SLM.H:104
@ tv
Definition: ERF_SLM.H:46
@ qstar
Definition: ERF_SLM.H:30
@ tstar
Definition: ERF_SLM.H:29
@ rho
Definition: ERF_Kessler.H:25
@ qv
Definition: ERF_Kessler.H:31
@ qs
Definition: ERF_Morrison.H:113
@ cons
Definition: ERF_IndexDefines.H:254
@ dz
Definition: ERF_AdvanceWDM6.cpp:273
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_temperature_is_valid(const NativeBundle &bundle) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:95
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE NativeAggregate aggregate_native_bundle(const NativeBundle &bundle) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:131
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_mixing_ratio_is_valid(const NativeBundle &bundle) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real to_plot_value(SurfaceDiagnosticSource source) noexcept
Definition: ERF_SurfaceDiagnosticSource.H:45
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int to_int(SurfaceDiagnosticSource source) noexcept
Definition: ERF_SurfaceDiagnosticSource.H:33

Referenced by erf_auxiliary::CompletedStepFluxLedger::begin_stage(), IBFaceSet::build(), erf_auxiliary::CompletedStepFluxLedger::discard_step(), ERF::FillPlot2DVars(), SLM::init_from_inputs(), PlaneAverage::operator()(), obs_nudging::parse_station_series(), and WidenForPBLH().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_wind_10m() [1/2]

void near_surface_diagnostics::fill_wind_10m ( amrex::MultiFab &  dst,
int  u_comp,
int  v_comp,
int  u_east_comp,
int  v_north_comp,
const WindSources &  sources,
amrex::Real  missing_value = amrex::Real(-999.0) 
)

◆ fill_wind_10m() [2/2]

void near_surface_diagnostics::fill_wind_10m ( MultiFab &  dst,
int  u_comp,
int  v_comp,
int  u_east_comp,
int  v_north_comp,
const WindSources &  sources,
Real  missing_value 
)
229 {
230  if (u_comp < 0 && v_comp < 0 && u_east_comp < 0 && v_north_comp < 0) { return; }
231 
232  const bool have_surface_layer = sources.u_star && sources.roughness_height &&
233  sources.obukhov_length && sources.xvel && sources.yvel;
234  const bool have_rotation = sources.cos_alpha && sources.sin_alpha;
235  const int klo = sources.klo;
236 
237 #ifdef _OPENMP
238 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
239 #endif
240  for (MFIter mfi(dst, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
241  const Box& bx = mfi.tilebox();
242  const auto dst_arr = dst.array(mfi);
243 
244  const auto ustar = array_or_empty(sources.u_star, mfi);
245  const auto z0 = array_or_empty(sources.roughness_height, mfi);
246  const auto olen = array_or_empty(sources.obukhov_length, mfi);
247  const auto u = array_or_empty(sources.xvel, mfi);
248  const auto v = array_or_empty(sources.yvel, mfi);
249  const auto cosa = array_or_empty(sources.cos_alpha, mfi);
250  const auto sina = array_or_empty(sources.sin_alpha, mfi);
251 
252  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
253  Real u10 = missing_value;
254  Real v10 = missing_value;
255  Real factor = zero;
256  if (have_surface_layer &&
257  valid_real(ustar(i,j,0)) && ustar(i,j,0) >= zero &&
258  evaluate_most_momentum_factor(z0(i,j,0), olen(i,j,0), wind_height, factor)) {
259  const Real speed = ustar(i,j,0) / KAPPA * factor;
260  // The direction of the wind at the centre of the first cell
261  const Real u_cc = myhalf * (u(i,j,klo) + u(i+1,j,klo));
262  const Real v_cc = myhalf * (v(i,j,klo) + v(i,j+1,klo));
263  const Real speed_cc = std::sqrt(u_cc*u_cc + v_cc*v_cc);
264  if (valid_real(speed) && speed >= zero && valid_real(speed_cc)) {
265  u10 = (speed_cc > zero) ? speed * u_cc / speed_cc : zero;
266  v10 = (speed_cc > zero) ? speed * v_cc / speed_cc : zero;
267  }
268  }
269 
270  if (u_comp >= 0) { dst_arr(i,j,k,u_comp) = u10; }
271  if (v_comp >= 0) { dst_arr(i,j,k,v_comp) = v10; }
272  if (u_east_comp >= 0 || v_north_comp >= 0) {
273  Real u_east = u10;
274  Real v_north = v10;
275  // Without a grid orientation the grid is taken to be aligned with east
276  if (u10 != missing_value && have_rotation) {
277  erf_earth_wind::grid_to_earth(u10, v10, cosa(i,j,0), sina(i,j,0), u_east, v_north);
278  }
279  if (u_east_comp >= 0) { dst_arr(i,j,k,u_east_comp) = u_east; }
280  if (v_north_comp >= 0) { dst_arr(i,j,k,v_north_comp) = v_north; }
281  }
282  });
283  }
284 }
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
Real u_east
Definition: ERF_Plotfile2DInterpolator.cpp:21
Real v_north
Definition: ERF_Plotfile2DInterpolator.cpp:22
@ ustar
Definition: ERF_SLM.H:28
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void grid_to_earth(amrex::Real u, amrex::Real v, amrex::Real cos_alpha, amrex::Real sin_alpha, amrex::Real &u_east, amrex::Real &v_north) noexcept
Definition: ERF_EarthRelativeWind.H:29
constexpr amrex::Real wind_height
Definition: ERF_NearSurfaceDiagnostics.H:274
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool evaluate_most_momentum_factor(amrex::Real roughness_height, amrex::Real obukhov_length, amrex::Real height, amrex::Real &factor) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:176

Referenced by ERF::FillPlot2DVars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ most_profile_zeta_max()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real near_surface_diagnostics::most_profile_zeta_max ( )
noexcept
152 { return amrex::Real(1.0); }

Referenced by evaluate_most_factor(), and evaluate_most_momentum_factor().

Here is the caller graph for this function:

◆ native_bare_tile_is_used()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_bare_tile_is_used ( amrex::Real  vegetation_fraction)
noexcept
90 {
91  return vegetation_fraction < amrex::Real(1.0);
92 }

Referenced by aggregate_native_bundle(), native_bundle_mixing_ratio_is_valid(), and native_bundle_temperature_is_valid().

Here is the caller graph for this function:

◆ native_bundle_is_valid()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_bundle_is_valid ( const NativeBundle &  bundle)
noexcept
72 {
73  return native_bundle_temperature_is_valid(bundle) &&
76 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool native_bundle_vegetation_fraction_is_valid(const NativeBundle &bundle) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:123
Here is the call graph for this function:

◆ native_bundle_mixing_ratio_is_valid()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_bundle_mixing_ratio_is_valid ( const NativeBundle &  bundle)
noexcept
110 {
111  if (!native_bundle_vegetation_fraction_is_valid(bundle)) { return false; }
112  const amrex::Real f = bundle.vegetation_fraction;
113  const bool vegetated_ok = !native_vegetated_tile_is_used(f) ||
114  (valid_noahmp_component(bundle.mixing_ratio_vegetated) &&
115  bundle.mixing_ratio_vegetated >= amrex::Real(0.0));
116  const bool bare_ok = !native_bare_tile_is_used(f) ||
117  (valid_noahmp_component(bundle.mixing_ratio_bare) &&
118  bundle.mixing_ratio_bare >= amrex::Real(0.0));
119  return vegetated_ok && bare_ok;
120 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_noahmp_component(amrex::Real value) noexcept
Definition: ERF_NearSurfaceDiagnostics.H:55

Referenced by fill(), and native_bundle_is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ native_bundle_temperature_is_valid()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_bundle_temperature_is_valid ( const NativeBundle &  bundle)
noexcept
96 {
97  if (!native_bundle_vegetation_fraction_is_valid(bundle)) { return false; }
98  const amrex::Real f = bundle.vegetation_fraction;
99  const bool vegetated_ok = !native_vegetated_tile_is_used(f) ||
100  (valid_noahmp_component(bundle.temperature_vegetated) &&
101  bundle.temperature_vegetated > amrex::Real(0.0));
102  const bool bare_ok = !native_bare_tile_is_used(f) ||
103  (valid_noahmp_component(bundle.temperature_bare) &&
104  bundle.temperature_bare > amrex::Real(0.0));
105  return vegetated_ok && bare_ok;
106 }

Referenced by fill(), and native_bundle_is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ native_bundle_vegetation_fraction_is_valid()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_bundle_vegetation_fraction_is_valid ( const NativeBundle &  bundle)
noexcept
124 {
125  return valid_noahmp_component(bundle.vegetation_fraction) &&
126  bundle.vegetation_fraction >= amrex::Real(0.0) &&
127  bundle.vegetation_fraction <= amrex::Real(1.0);
128 }

Referenced by native_bundle_is_valid(), native_bundle_mixing_ratio_is_valid(), and native_bundle_temperature_is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ native_vegetated_tile_is_used()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::native_vegetated_tile_is_used ( amrex::Real  vegetation_fraction)
noexcept
84 {
85  return vegetation_fraction > amrex::Real(0.0);
86 }

Referenced by aggregate_native_bundle(), native_bundle_mixing_ratio_is_valid(), and native_bundle_temperature_is_valid().

Here is the caller graph for this function:

◆ valid_noahmp_component()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::valid_noahmp_component ( amrex::Real  value)
noexcept
56 {
57  return valid_real(value) && value > amrex::Real(-9990.0) &&
58  value < amrex::Real(0.5) * lsm_undefined;
59 }
constexpr amrex::Real lsm_undefined
Definition: ERF_Constants.H:28

Referenced by native_bundle_mixing_ratio_is_valid(), native_bundle_temperature_is_valid(), and native_bundle_vegetation_fraction_is_valid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid_real()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool near_surface_diagnostics::valid_real ( amrex::Real  value)
noexcept
50 {
51  return amrex::Math::isfinite(value);
52 }

Referenced by evaluate_most_factor(), evaluate_most_momentum_factor(), evaluate_most_profile(), fill(), fill_wind_10m(), and valid_noahmp_component().

Here is the caller graph for this function:

Variable Documentation

◆ wind_height

constexpr amrex::Real near_surface_diagnostics::wind_height = amrex::Real(10.0)
constexpr

Referenced by fill_wind_10m().