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

Classes

struct  SurfacePressureResult
 
struct  ConversionFailure
 

Enumerations

enum class  SurfacePressureError : int {
  none = 0 , bad_density , bad_rho_theta , no_moisture_comp ,
  bad_rho_qv , bad_qv , bad_delta_z , bad_pressure
}
 
enum class  SurfaceTemperatureSource : int { tsk , sst , prescribed }
 
enum class  ConversionError : int {
  none = 0 , bad_density , bad_rho_theta , no_moisture_comp ,
  bad_rho_qv , bad_qv , bad_delta_z , bad_theta_to_temperature ,
  bad_temperature_to_theta , bad_pressure , bad_skin_temperature , bad_q_air ,
  bad_q_surf
}
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SurfacePressureResult diagnose_surface_pressure (const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real rho_qv, const bool moist, const bool have_rho_qv, const amrex::Real delta_z)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pressure_at_boundary_from_cell (const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real qv, const amrex::Real delta_z)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pressure_at_surface (const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real qv, const amrex::Real delta_z)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_pressure (const amrex::Real pressure)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_temperature (const amrex::Real temperature)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool theta_to_temperature (const amrex::Real theta, const amrex::Real pressure, const amrex::Real rdOcp, amrex::Real &temperature)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool temperature_to_theta (const amrex::Real temperature, const amrex::Real pressure, const amrex::Real rdOcp, amrex::Real &theta)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool sst_ignored (const bool ignore_sst_requested, const bool have_tsk)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SurfaceTemperatureSource surface_temperature_source (const bool is_land, const bool have_tsk, const bool ignore_sst)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConversionError conversion_error (const SurfacePressureError error)
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void record_conversion_failure (ConversionFailure *fail, const bool fatal, const ConversionError code, const int i, const int j, const int k, const amrex::Real rho=amrex::Real(0.0), const amrex::Real rho_theta=amrex::Real(0.0), const amrex::Real rho_qv=amrex::Real(0.0), const amrex::Real t_surf=amrex::Real(0.0), const amrex::Real pressure=amrex::Real(0.0), const amrex::Real delta_z=amrex::Real(0.0), const amrex::Real q_air=amrex::Real(0.0))
 
AMREX_GPU_DEVICE AMREX_FORCE_INLINE SurfacePressureResult diagnose_and_record_surface_pressure (ConversionFailure *fail, const bool fatal, const int i, const int j, const int k, const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real rho_qv, const bool moist, const bool have_rho_qv, const amrex::Real delta_z, const amrex::Real surface_temperature=amrex::Real(0.0))
 
AMREX_FORCE_INLINE const char * conversion_error_text (const ConversionError code)
 
void abort_on_conversion_failure (const char *who, const int lev, ConversionFailure const &fail)
 

Enumeration Type Documentation

◆ ConversionError

Why a surface conversion could not be made, in the order the kernels test for it.

Every kernel that converts between the atmospheric state and a surface temperature or humidity guards the same sequence of ways that state can be unusable. Which guard tripped is the difference between "the surface layer gave up" and knowing that the state handed to it was already bad – so the guards are named rather than merged into a single flag.

Enumerator
none 
bad_density 
bad_rho_theta 
no_moisture_comp 
bad_rho_qv 
bad_qv 
bad_delta_z 
bad_theta_to_temperature 
bad_temperature_to_theta 
bad_pressure 
bad_skin_temperature 
bad_q_air 
bad_q_surf 

◆ SurfacePressureError

Error returned while diagnosing pressure at a surface from an atmospheric cell.

Enumerator
none 
bad_density 
bad_rho_theta 
no_moisture_comp 
bad_rho_qv 
bad_qv 
bad_delta_z 
bad_pressure 
18  : int {
19  none = 0,
23  bad_rho_qv,
24  bad_qv,
27 };

◆ SurfaceTemperatureSource

The field a cell of the lower boundary takes its surface temperature from, when the level has an SST (SurfaceLayer::fill_tsurf_with_sst_and_tsk)

Enumerator
tsk 

the skin temperature, TSK

sst 

the sea-surface temperature, SST

prescribed 

the prescribed land surface potential temperature (most.pot_surf_temp)

176  : int {
177  tsk, ///< the skin temperature, TSK
178  sst, ///< the sea-surface temperature, SST
179  prescribed ///< the prescribed land surface potential temperature (most.pot_surf_temp)
180 };
@ prescribed
the prescribed land surface potential temperature (most.pot_surf_temp)
@ sst
the sea-surface temperature, SST

Function Documentation

◆ abort_on_conversion_failure()

void erf_surface_temperature::abort_on_conversion_failure ( const char *  who,
const int  lev,
ConversionFailure const &  fail 
)
inline

Describe what this rank recorded, then abort if any rank recorded anything.

Collective: every rank must call this. Each rank that failed describes its own first failure before the abort, so a failure confined to one rank still names the cell and the numbers rather than only the check that tripped.

Parameters
[in]whoName of the fill, used to open the message
[in]levLevel being filled
[in]failThis rank's record
406 {
407  int any_failed = (fail.code != static_cast<int>(ConversionError::none)) ? 1 : 0;
408  amrex::ParallelDescriptor::ReduceIntMax(any_failed);
409  if (any_failed == 0) { return; }
410 
411  if (fail.code != static_cast<int>(ConversionError::none)) {
412  const auto code = static_cast<ConversionError>(fail.code);
413 
414  const bool is_conversion = (code == ConversionError::bad_theta_to_temperature ||
415  code == ConversionError::bad_temperature_to_theta);
416  const bool has_state = (code != ConversionError::no_moisture_comp);
417  const bool has_vapor = (is_conversion ||
418  code == ConversionError::bad_rho_qv ||
419  code == ConversionError::bad_qv ||
420  code == ConversionError::bad_q_air ||
421  code == ConversionError::bad_q_surf);
422  const bool has_surface = (is_conversion ||
423  code == ConversionError::bad_pressure ||
424  code == ConversionError::bad_delta_z ||
425  code == ConversionError::bad_skin_temperature ||
426  code == ConversionError::bad_q_surf);
427  const bool has_q_air = (code == ConversionError::bad_q_air ||
428  code == ConversionError::bad_q_surf);
429 
430  // Assemble the whole report before writing it, so that ranks that failed do not
431  // interleave their lines with one another
432  std::ostringstream msg;
433  msg << who << ": surface conversion failed at level " << lev
434  << " [rank " << amrex::ParallelDescriptor::MyProc() << "]\n"
435  << " " << fail.count << " of the cells this fill owns failed";
436  if (fail.halo_count > 0) {
437  msg << " (and " << fail.halo_count << " halo cells, which are not fatal)";
438  }
439  msg << "\n first failure at (" << fail.i << "," << fail.j << "," << fail.k << "): "
440  << conversion_error_text(code) << "\n";
441 
442  if (has_state) {
443  msg << std::setprecision(10) << " rho = " << fail.rho
444  << " (rho theta) = " << fail.rho_theta;
445  if (has_vapor) { msg << " (rho qv) = " << fail.rho_qv; }
446  if (has_q_air) { msg << " q_air = " << fail.q_air; }
447  if (has_surface) {
448  msg << "\n surface temperature = " << fail.t_surf
449  << " pressure = " << fail.pressure
450  << " delta_z = " << fail.delta_z;
451  }
452  msg << "\n";
453  }
454 
455  amrex::AllPrint() << msg.str() << std::flush;
456  }
457 
458  // Let every rank finish writing before one of them tears the job down
459  amrex::ParallelDescriptor::Barrier();
460  amrex::Abort(std::string(who) + ": could not convert the surface state (see above)");
461 }
std::string code
Definition: ERF_InputPreflight.cpp:25
AMREX_FORCE_INLINE const char * conversion_error_text(const ConversionError code)
Definition: ERF_SurfaceTemperature.H:359
ConversionError
Definition: ERF_SurfaceTemperature.H:225

Referenced by ERF::convert_legacy_surface_temperature(), and SurfaceLayer::update_fluxes().

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

◆ conversion_error()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConversionError erf_surface_temperature::conversion_error ( const SurfacePressureError  error)
244 {
245  switch (error) {
246  case SurfacePressureError::bad_density: return ConversionError::bad_density;
247  case SurfacePressureError::bad_rho_theta: return ConversionError::bad_rho_theta;
248  case SurfacePressureError::no_moisture_comp: return ConversionError::no_moisture_comp;
249  case SurfacePressureError::bad_rho_qv: return ConversionError::bad_rho_qv;
250  case SurfacePressureError::bad_qv: return ConversionError::bad_qv;
251  case SurfacePressureError::bad_delta_z: return ConversionError::bad_delta_z;
252  case SurfacePressureError::bad_pressure: return ConversionError::bad_pressure;
253  default: return ConversionError::none;
254  }
255 }

Referenced by ERF::convert_legacy_surface_temperature(), diagnose_and_record_surface_pressure(), and SurfaceLayer::fill_tsurf_with_sst_and_tsk().

Here is the caller graph for this function:

◆ conversion_error_text()

AMREX_FORCE_INLINE const char* erf_surface_temperature::conversion_error_text ( const ConversionError  code)
360 {
361  switch (code) {
362  case ConversionError::bad_density:
363  return "the density of the state cell is not usable";
364  case ConversionError::bad_rho_theta:
365  return "the (rho theta) of the state cell is not usable";
366  case ConversionError::no_moisture_comp:
367  return "the state carries no water vapor component to convert";
368  case ConversionError::bad_rho_qv:
369  return "the (rho qv) of the state cell is not usable";
370  case ConversionError::bad_qv:
371  return "the water vapor mixing ratio derived from the state cell is not usable";
372  case ConversionError::bad_delta_z:
373  return "the geometry-derived boundary-to-cell height difference is not finite";
374  case ConversionError::bad_theta_to_temperature:
375  return "the surface potential temperature could not be converted to absolute temperature";
376  case ConversionError::bad_temperature_to_theta:
377  return "the surface temperature could not be converted to potential temperature";
378  case ConversionError::bad_pressure:
379  return "the surface pressure derived from the state cell is not usable";
380  case ConversionError::bad_skin_temperature:
381  return "the skin temperature is not usable";
382  case ConversionError::bad_q_air:
383  return "the reference-height water vapor mixing ratio is not usable";
384  case ConversionError::bad_q_surf:
385  return "the surface mixing ratio came out non-finite";
386  default:
387  return "the conversion failed for a reason that was not recorded";
388  }
389 }

Referenced by abort_on_conversion_failure().

Here is the caller graph for this function:

◆ diagnose_and_record_surface_pressure()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE SurfacePressureResult erf_surface_temperature::diagnose_and_record_surface_pressure ( ConversionFailure *  fail,
const bool  fatal,
const int  i,
const int  j,
const int  k,
const amrex::Real  rho,
const amrex::Real  rho_theta,
const amrex::Real  rho_qv,
const bool  moist,
const bool  have_rho_qv,
const amrex::Real  delta_z,
const amrex::Real  surface_temperature = amrex::Real(0.0) 
)

Diagnose pressure and append a structured diagnostic if the state is unusable.

346 {
347  const auto result = diagnose_surface_pressure(rho, rho_theta, rho_qv, moist,
348  have_rho_qv, delta_z);
349  if (result.error != SurfacePressureError::none) {
350  record_conversion_failure(fail, fatal, conversion_error(result.error),
351  i, j, k, rho, rho_theta, rho_qv,
352  surface_temperature, result.pressure, delta_z);
353  }
354  return result;
355 }
@ rho
Definition: ERF_Kessler.H:25
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void record_conversion_failure(ConversionFailure *fail, const bool fatal, const ConversionError code, const int i, const int j, const int k, const amrex::Real rho=amrex::Real(0.0), const amrex::Real rho_theta=amrex::Real(0.0), const amrex::Real rho_qv=amrex::Real(0.0), const amrex::Real t_surf=amrex::Real(0.0), const amrex::Real pressure=amrex::Real(0.0), const amrex::Real delta_z=amrex::Real(0.0), const amrex::Real q_air=amrex::Real(0.0))
Definition: ERF_SurfaceTemperature.H:298
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ConversionError conversion_error(const SurfacePressureError error)
Definition: ERF_SurfaceTemperature.H:243
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SurfacePressureResult diagnose_surface_pressure(const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real rho_qv, const bool moist, const bool have_rho_qv, const amrex::Real delta_z)
Definition: ERF_SurfaceTemperature.H:46

Referenced by SurfaceLayer::fill_tsurf_with_abs_surf_temp(), SurfaceLayer::fill_tsurf_with_coupled_sst(), SurfaceLayer::fill_tsurf_with_sfc_sst(), SurfaceLayer::fill_tsurf_with_skin_temperature(), and SurfaceLayer::get_lsm_tsurf().

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

◆ diagnose_surface_pressure()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SurfacePressureResult erf_surface_temperature::diagnose_surface_pressure ( const amrex::Real  rho,
const amrex::Real  rho_theta,
const amrex::Real  rho_qv,
const bool  moist,
const bool  have_rho_qv,
const amrex::Real  delta_z 
)

Diagnose pressure at a boundary face from the adjacent atmospheric cell.

The state pressure is diagnosed at the cell center. Adding rho*g*delta_z gives the pressure at the boundary face, where delta_z is the signed distance from the face to the cell center. The moisture component is read only when moisture is enabled and present.

52 {
53  SurfacePressureResult result{};
54  if (!amrex::Math::isfinite(rho) || rho <= amrex::Real(0.0)) {
55  result.error = SurfacePressureError::bad_density;
56  return result;
57  }
58  if (!amrex::Math::isfinite(rho_theta) || rho_theta <= amrex::Real(0.0)) {
59  result.error = SurfacePressureError::bad_rho_theta;
60  return result;
61  }
62  if (!amrex::Math::isfinite(delta_z)) {
63  result.error = SurfacePressureError::bad_delta_z;
64  return result;
65  }
66  if (moist) {
67  if (!have_rho_qv) {
68  result.error = SurfacePressureError::no_moisture_comp;
69  return result;
70  }
71  if (!amrex::Math::isfinite(rho_qv)) {
72  result.error = SurfacePressureError::bad_rho_qv;
73  return result;
74  }
75  result.qv = rho_qv / rho;
76  if (!amrex::Math::isfinite(result.qv)) {
77  result.error = SurfacePressureError::bad_qv;
78  return result;
79  }
80  // Advection can produce finite negative undershoots. Treat them as dry for this
81  // thermodynamic diagnostic; the prognostic rho_qv field is left untouched.
82  result.qv = amrex::max(result.qv, amrex::Real(0.0));
83  }
84  result.pressure = getPgivenRTh(rho_theta, result.qv) +
85  rho * CONST_GRAV * delta_z;
86  if (!amrex::Math::isfinite(result.pressure) ||
87  result.pressure <= amrex::Real(0.0)) {
88  result.error = SurfacePressureError::bad_pressure;
89  }
90  return result;
91 }
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
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

Referenced by ERF::convert_legacy_surface_temperature(), diagnose_and_record_surface_pressure(), and SurfaceLayer::fill_tsurf_with_sst_and_tsk().

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

◆ pressure_at_boundary_from_cell()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_surface_temperature::pressure_at_boundary_from_cell ( const amrex::Real  rho,
const amrex::Real  rho_theta,
const amrex::Real  qv,
const amrex::Real  delta_z 
)

Pressure at a boundary face from the adjacent atmospheric cell state.

The state pressure is diagnosed at the cell center. Adding rho*g*delta_z gives the pressure at the boundary face, where delta_z is the signed distance from the face to the cell center.

106 {
107  return getPgivenRTh(rho_theta, qv) + rho * CONST_GRAV * delta_z;
108 }
@ qv
Definition: ERF_Kessler.H:31

Referenced by pressure_at_surface().

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

◆ pressure_at_surface()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_surface_temperature::pressure_at_surface ( const amrex::Real  rho,
const amrex::Real  rho_theta,
const amrex::Real  qv,
const amrex::Real  delta_z 
)
116 {
117  return pressure_at_boundary_from_cell(rho, rho_theta, qv, delta_z);
118 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pressure_at_boundary_from_cell(const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real qv, const amrex::Real delta_z)
Definition: ERF_SurfaceTemperature.H:102

Referenced by ERF::FillPlot2DVars(), Radiation::mf_to_kokkos_buffers(), and vertical_two_stream_sweep().

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

◆ record_conversion_failure()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void erf_surface_temperature::record_conversion_failure ( ConversionFailure *  fail,
const bool  fatal,
const ConversionError  code,
const int  i,
const int  j,
const int  k,
const amrex::Real  rho = amrex::Real(0.0),
const amrex::Real  rho_theta = amrex::Real(0.0),
const amrex::Real  rho_qv = amrex::Real(0.0),
const amrex::Real  t_surf = amrex::Real(0.0),
const amrex::Real  pressure = amrex::Real(0.0),
const amrex::Real  delta_z = amrex::Real(0.0),
const amrex::Real  q_air = amrex::Real(0.0) 
)

Record one cell's failure.

Every failing cell adds to a count; the first authoritative one to arrive also claims the description, so what gets reported is a failure that matters rather than whichever thread happened to finish last. Pass the values the caller has reached by this point: the report prints the ones that mean something for the code it is given.

Parameters
[in,out]failThis rank's record
[in]fatalWhether this is a cell the fill is authoritative for
[in]codeWhich guard tripped
[in]i,j,kThe cell whose state was read
309 {
310  if (!fatal) {
311  amrex::Gpu::Atomic::Add(&fail->halo_count, 1);
312  return;
313  }
314 
315  amrex::Gpu::Atomic::Add(&fail->count, 1);
316 
317  // The first failure to arrive owns the description; the rest only add to the count.
318  constexpr int unclaimed = static_cast<int>(ConversionError::none);
319  if (amrex::Gpu::Atomic::CAS(&fail->code, unclaimed, static_cast<int>(code)) != unclaimed) {
320  return;
321  }
322 
323  fail->i = i; fail->j = j; fail->k = k;
324  fail->rho = rho;
325  fail->rho_theta = rho_theta;
326  fail->rho_qv = rho_qv;
327  fail->t_surf = t_surf;
328  fail->pressure = pressure;
329  fail->delta_z = delta_z;
330  fail->q_air = q_air;
331 }

Referenced by ERF::convert_legacy_surface_temperature(), diagnose_and_record_surface_pressure(), SurfaceLayer::fill_tsurf_with_abs_surf_temp(), SurfaceLayer::fill_tsurf_with_coupled_sst(), SurfaceLayer::fill_tsurf_with_sfc_sst(), SurfaceLayer::fill_tsurf_with_skin_temperature(), SurfaceLayer::fill_tsurf_with_sst_and_tsk(), and SurfaceLayer::get_lsm_tsurf().

Here is the caller graph for this function:

◆ sst_ignored()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool erf_surface_temperature::sst_ignored ( const bool  ignore_sst_requested,
const bool  have_tsk 
)

Whether the surface layer ignores the SST of a level: when asked to (most.ignore_sst), and whenever the level has TSK, which carries the SST over water (update_sst_tsk) and so supplies every cell (make_SurfaceLayer_at_level).

190 {
191  return ignore_sst_requested || have_tsk;
192 }

Referenced by SurfaceLayer::make_SurfaceLayer_at_level(), and erf_checkpoint_surface_temperature::restart_surface_temperature_use().

Here is the caller graph for this function:

◆ surface_temperature_source()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SurfaceTemperatureSource erf_surface_temperature::surface_temperature_source ( const bool  is_land,
const bool  have_tsk,
const bool  ignore_sst 
)

Which field supplies the surface temperature of a cell: TSK over land, and over water where the SST is ignored, if the level has TSK; else the SST over water and the prescribed temperature over land.

Parameters
is_landwhether the cell is land: a nonzero land mask, or no land mask at all
have_tskwhether the level has TSK
ignore_sstwhether the surface layer ignores the SST (sst_ignored)
206 {
207  if (have_tsk && (is_land || ignore_sst)) {
208  return SurfaceTemperatureSource::tsk;
209  }
210  if (!is_land) {
211  return SurfaceTemperatureSource::sst;
212  }
213  return SurfaceTemperatureSource::prescribed;
214 }

Referenced by SurfaceLayer::fill_tsurf_with_sst_and_tsk(), and erf_checkpoint_surface_temperature::potential_to_absolute_temperature().

Here is the caller graph for this function:

◆ temperature_to_theta()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool erf_surface_temperature::temperature_to_theta ( const amrex::Real  temperature,
const amrex::Real  pressure,
const amrex::Real  rdOcp,
amrex::Real &  theta 
)
159 {
160  if (!valid_pressure(pressure) || !valid_temperature(temperature) ||
161  !amrex::Math::isfinite(rdOcp) || rdOcp <= amrex::Real(0.0)) {
162  return false;
163  }
164  const amrex::Real result = getThgivenTandP(temperature, pressure, rdOcp);
165  if (!valid_temperature(result)) {
166  return false;
167  }
168  theta = result;
169  return true;
170 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenTandP(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp)
Definition: ERF_EOS.H:18
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:128
@ theta
Definition: ERF_Kessler.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_pressure(const amrex::Real pressure)
Definition: ERF_SurfaceTemperature.H:122
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_temperature(const amrex::Real temperature)
Definition: ERF_SurfaceTemperature.H:129

Referenced by SurfaceLayer::fill_tsurf_with_abs_surf_temp(), SurfaceLayer::fill_tsurf_with_coupled_sst(), SurfaceLayer::fill_tsurf_with_sfc_sst(), SurfaceLayer::fill_tsurf_with_skin_temperature(), SurfaceLayer::fill_tsurf_with_sst_and_tsk(), and SurfaceLayer::get_lsm_tsurf().

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

◆ theta_to_temperature()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool erf_surface_temperature::theta_to_temperature ( const amrex::Real  theta,
const amrex::Real  pressure,
const amrex::Real  rdOcp,
amrex::Real &  temperature 
)
140 {
141  if (!valid_pressure(pressure) || !valid_temperature(theta) ||
142  !amrex::Math::isfinite(rdOcp) || rdOcp <= amrex::Real(0.0)) {
143  return false;
144  }
145  const amrex::Real result = getTgivenPandTh(pressure, theta, rdOcp);
146  if (!valid_temperature(result)) {
147  return false;
148  }
149  temperature = result;
150  return true;
151 }
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

Referenced by erf_checkpoint_surface_temperature::potential_to_absolute_temperature(), rrtmgp::resolve_surface_temperature(), and vertical_two_stream_sweep().

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

◆ valid_pressure()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool erf_surface_temperature::valid_pressure ( const amrex::Real  pressure)
123 {
124  return amrex::Math::isfinite(pressure) && pressure > amrex::Real(0.0);
125 }

Referenced by temperature_to_theta(), and theta_to_temperature().

Here is the caller graph for this function:

◆ valid_temperature()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool erf_surface_temperature::valid_temperature ( const amrex::Real  temperature)
130 {
131  return amrex::Math::isfinite(temperature) && temperature > amrex::Real(0.0);
132 }

Referenced by erf_checkpoint_surface_temperature::potential_to_absolute_temperature(), temperature_to_theta(), and theta_to_temperature().

Here is the caller graph for this function: