ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SAMUtils.H File Reference
#include <cmath>
#include <limits>
#include <AMReX_Array4.H>
#include <AMReX_GpuQualifiers.H>
#include "ERF_Constants.H"
#include "ERF_DataStruct.H"
#include "ERF_EOS.H"
#include "ERF_IndexDefines.H"
#include "ERF_MicrophysicsUtils.H"
Include dependency graph for ERF_SAMUtils.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SAMPhaseFractions
 
struct  SAMCloudPhaseChange
 
struct  SAMPrecipSources
 
struct  SAMPrimitiveCell
 
struct  SAMPrecipConfig
 
struct  SAMPrecipCellDiagnostics
 
struct  SAMCoefficientRow
 
struct  SAMPrecipFaceState
 
struct  SAMPrecipComponentFaceState
 
struct  SAMFaceState
 
struct  SAMSurfaceAccumulation
 
struct  SAMPrecipFluxComponents
 

Typedefs

using SAMCellState = SAMPrimitiveCell
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mbar_to_pa (const amrex::Real pres_mbar) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_pa_to_mbar (const amrex::Real pres_pa) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_theta_from_stored_mbar_converted_to_pa (const amrex::Real tabs, const amrex::Real pres_mbar, const amrex::Real rdOcp) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrimitiveCell sam_cons_to_primitive (const amrex::Real rho, const amrex::Real rho_theta, const amrex::Real rho_qv, const amrex::Real rho_qcl, const amrex::Real rho_qci, const amrex::Real rho_qpr, const amrex::Real rho_qps, const amrex::Real rho_qpg) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void sam_primitive_to_cons (const SAMPrimitiveCell &primitive, const amrex::Array4< amrex::Real > &states_arr, const int i, const int j, const int k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool sam_is_no_ice (const MoistureType moisture_type) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool sam_is_no_precip (const MoistureType moisture_type) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_cloud_liquid_fraction (const int SAM_moisture_type, const amrex::Real tabs, const amrex::Real an, const amrex::Real bn) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_rain_fraction (const int SAM_moisture_type, const amrex::Real tabs) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_graupel_fraction (const int SAM_moisture_type, const amrex::Real tabs) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCloudPhaseChange sam_partition_cloud_phase (const int SAM_moisture_type, const amrex::Real tabs, const amrex::Real qn, const amrex::Real qcl, const amrex::Real qci, const amrex::Real fac_cond, const amrex::Real fac_fus, const amrex::Real an, const amrex::Real bn) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mixed_qsat (const amrex::Real omn, const amrex::Real qsatw, const amrex::Real qsati) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mixed_dqsat_dT (const amrex::Real omn, const amrex::Real domn, const amrex::Real qsatw, const amrex::Real qsati, const amrex::Real dqsatw, const amrex::Real dqsati) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_newton_residual (const amrex::Real tabs_new, const amrex::Real tabs_old, const amrex::Real lstar, const amrex::Real qv, const amrex::Real qsat) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_newton_residual_derivative (const amrex::Real lstar, const amrex::Real dlstar, const amrex::Real qv, const amrex::Real qsat, const amrex::Real dqsat) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCloudPhaseChange sam_apply_condensate_limiter (const amrex::Real qv, const amrex::Real qsat, const amrex::Real qc, const amrex::Real qi, const amrex::Real omn) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_autoconversion_rates (const amrex::Real dtn, const amrex::Real qcc, const amrex::Real qii, const amrex::Real coefice_k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_accretion_rates (const amrex::Real dtn, const amrex::Real qcc, const amrex::Real qii, const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, const amrex::Real powr1, const amrex::Real pows1, const amrex::Real powg1, const amrex::Real omp, const amrex::Real omg, const amrex::Real accrrc_k, const amrex::Real accrsc_k, const amrex::Real accrsi_k, const amrex::Real accrgc_k, const amrex::Real accrgi_k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_rescale_cloud_sinks (const amrex::Real qcl, const amrex::Real qci, const amrex::Real eps, SAMPrecipSources result) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_partition_autoconverted_precip (SAMPrecipSources result, const amrex::Real omp, const amrex::Real omg) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_precip_evaporation_rates (const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, const amrex::Real powr2, const amrex::Real pows2, const amrex::Real powg2, const amrex::Real evapr1_k, const amrex::Real evapr2_k, const amrex::Real evaps1_k, const amrex::Real evaps2_k, const amrex::Real evapg1_k, const amrex::Real evapg2_k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_apply_precip_evaporation_limiter (const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, SAMPrecipSources result) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCellState sam_precip_cell_update (SAMCellState state, const SAMCoefficientRow &coeffs, const SAMPrecipConfig &config, SAMPrecipCellDiagnostics *diagnostics=nullptr) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCoefficientRow sam_compute_coefficient_row (const amrex::Real rho, const amrex::Real tabs, const amrex::Real gamr1, const amrex::Real gamr2, const amrex::Real gams1, const amrex::Real gams2, const amrex::Real gamg1, const amrex::Real gamg2) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_cloud_ice_terminal_velocity (const amrex::Real qci_avg) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMFaceState sam_face_average_state (const int k, const int k_lo, const int k_hi, const amrex::Real rho_km1, const amrex::Real rho_k, const amrex::Real tabs_km1, const amrex::Real tabs_k, const amrex::Real qci_km1, const amrex::Real qci_k, const amrex::Real qp_km1, const amrex::Real qp_k) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int sam_precip_face_donor_k (const int face_k, const int k_lo, const int k_hi) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int sam_substep_count_from_reduced_flux (const amrex::Real reduced_flux, const amrex::Real dt, const amrex::Real dz) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFaceState sam_precip_face_state (const int SAM_moisture_type, const amrex::Array4< const amrex::Real > &rho_array, const amrex::Array4< const amrex::Real > &tabs_array, const amrex::Array4< const amrex::Real > &qp_array, const int i, const int j, const int k, const int k_lo, const int k_hi) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipComponentFaceState sam_precip_component_face_state (const amrex::Array4< const amrex::Real > &rho_array, const amrex::Array4< const amrex::Real > &tabs_array, const amrex::Array4< const amrex::Real > &qpr_array, const amrex::Array4< const amrex::Real > &qps_array, const amrex::Array4< const amrex::Real > &qpg_array, const int i, const int j, const int k, const int k_lo, const int k_hi) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_flux_from_face_state (const SAMPrecipFaceState &face_state, const amrex::Real vrain, const amrex::Real vsnow, const amrex::Real vgrau) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_from_face_state (const SAMPrecipFaceState &face_state, const amrex::Real vrain, const amrex::Real vsnow, const amrex::Real vgrau) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_component_fluxes_from_face_state (const SAMPrecipComponentFaceState &face_state, const amrex::Real vrain, const amrex::Real vsnow, const amrex::Real vgrau) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_flux_density_corrected (const amrex::Real precip_flux, const amrex::Real rho_0, const amrex::Real rho_avg) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_density_corrected (const SAMPrecipFluxComponents &precip_fluxes, const amrex::Real rho_0, const amrex::Real rho_avg) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_limit_precip_component_flux (const amrex::Real raw_flux, const amrex::Real rho_donor, const amrex::Real q_donor, const amrex::Real detJ_donor, const amrex::Real coef) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_sedimentation_tendency (const amrex::Real fz_hi, const amrex::Real fz_lo, const amrex::Real rho, const amrex::Real dJinv, const amrex::Real coef) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMSurfaceAccumulation sam_surface_accumulation_from_component_fluxes (const SAMPrecipFluxComponents &component_fluxes, const amrex::Real dtn) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMSurfaceAccumulation sam_surface_accumulation (const SAMPrecipFaceState &face_state, const amrex::Real rho_0, const amrex::Real vrain, const amrex::Real vsnow, const amrex::Real vgrau, const amrex::Real dtn) noexcept
 

Typedef Documentation

◆ SAMCellState

Function Documentation

◆ sam_accretion_rates()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_accretion_rates ( const amrex::Real  dtn,
const amrex::Real  qcc,
const amrex::Real  qii,
const amrex::Real  qpr,
const amrex::Real  qps,
const amrex::Real  qpg,
const amrex::Real  powr1,
const amrex::Real  pows1,
const amrex::Real  powg1,
const amrex::Real  omp,
const amrex::Real  omg,
const amrex::Real  accrrc_k,
const amrex::Real  accrsc_k,
const amrex::Real  accrsi_k,
const amrex::Real  accrgc_k,
const amrex::Real  accrgi_k 
)
noexcept
441 {
442  SAMPrecipSources result{};
443  amrex::Real accrcr = zero;
444  amrex::Real accrcs = zero;
445  amrex::Real accris = zero;
446  amrex::Real accrcg = zero;
447  amrex::Real accrig = zero;
448 
449  // Accretion increments over dtn. Liquid-origin sinks feed rain, snow, and
450  // graupel; ice-origin sinks feed snow and graupel. These strict empirical
451  // selector thresholds are implementation rules, not fundamental laws:
452  // rain requires omp > 0.001, snow requires omp < 0.999 and omg < 0.999,
453  // and graupel requires omp < 0.999 and omg > 0.001. Equality is inactive.
454  if (omp > amrex::Real(0.001)) {
455  accrcr = accrrc_k;
456  }
457  if (omp < amrex::Real(0.999) && omg < amrex::Real(0.999)) {
458  accrcs = accrsc_k;
459  accris = accrsi_k;
460  }
461  if (omp < amrex::Real(0.999) && omg > amrex::Real(0.001)) {
462  accrcg = accrgc_k;
463  accrig = accrgi_k;
464  }
465 
466  result.dprc = dtn * accrcr * qcc * std::pow(qpr, powr1);
467  result.dpsc = dtn * accrcs * qcc * std::pow(qps, pows1);
468  result.dpgc = dtn * accrcg * qcc * std::pow(qpg, powg1);
469  result.dpsi = dtn * accris * qii * std::pow(qps, pows1);
470  result.dpgi = dtn * accrig * qii * std::pow(qpg, powg1);
471  return result;
472 }
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ qpg
Definition: ERF_Morrison.H:41
@ qps
Definition: ERF_Morrison.H:40
@ qpr
Definition: ERF_Morrison.H:39
Definition: ERF_SAMUtils.H:35

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_apply_condensate_limiter()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCloudPhaseChange sam_apply_condensate_limiter ( const amrex::Real  qv,
const amrex::Real  qsat,
const amrex::Real  qc,
const amrex::Real  qi,
const amrex::Real  omn 
)
noexcept
392 {
393  // Prevents the adjustment from evaporating or depositing more condensate
394  // than is locally available.
395  SAMCloudPhaseChange result{};
396  result.delta_qv = qv - qsat;
397  result.delta_qc = amrex::max(-qc, result.delta_qv * omn);
398  result.delta_qi = amrex::max(-qi, result.delta_qv * (one - omn));
399  result.qv = qsat;
400  result.qcl = qc + result.delta_qc;
401  result.qci = qi + result.delta_qi;
402  result.qn = result.qcl + result.qci;
403  result.qt = result.qv + result.qn;
404  return result;
405 }
constexpr amrex::Real one
Definition: ERF_Constants.H:7
@ qv
Definition: ERF_Kessler.H:29
@ qc
Definition: ERF_SatAdj.H:40
@ qi
Definition: ERF_WSM6.H:26
Definition: ERF_SAMUtils.H:22
amrex::Real delta_qv
Definition: ERF_SAMUtils.H:24

Referenced by SAM::NewtonIterSat().

Here is the caller graph for this function:

◆ sam_apply_precip_evaporation_limiter()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_apply_precip_evaporation_limiter ( const amrex::Real  qpr,
const amrex::Real  qps,
const amrex::Real  qpg,
SAMPrecipSources  result 
)
noexcept
547 {
548  // Limits rain evaporation and snow/graupel sublimation by available
549  // qpr/qps/qpg so the source update cannot make precipitating species
550  // negative.
551  result.dqpr = amrex::min(qpr, result.dqpr);
552  result.dqps = amrex::min(qps, result.dqps);
553  result.dqpg = amrex::min(qpg, result.dqpg);
554  result.dqp = result.dqpr + result.dqps + result.dqpg;
555  return result;
556 }
amrex::Real dqpg
Definition: ERF_SAMUtils.H:47
amrex::Real dqps
Definition: ERF_SAMUtils.H:46
amrex::Real dqp
Definition: ERF_SAMUtils.H:48
amrex::Real dqpr
Definition: ERF_SAMUtils.H:45

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_autoconversion_rates()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_autoconversion_rates ( const amrex::Real  dtn,
const amrex::Real  qcc,
const amrex::Real  qii,
const amrex::Real  coefice_k 
)
noexcept
412 {
413  SAMPrecipSources result{};
414  // Thresholded cloud-liquid and cloud-ice autoconversion increments over
415  // the microphysics time step dtn. The strict qcw0/qci0 thresholds are
416  // intentional: equality leaves the source inactive.
417  const amrex::Real auto_r = (qcc > qcw0) ? alphaelq : zero;
418  const amrex::Real autos = (qii > qci0) ? betaelq * coefice_k : zero;
419  result.dqca = dtn * auto_r * (qcc - qcw0);
420  result.dqia = dtn * autos * (qii - qci0);
421  return result;
422 }
constexpr amrex::Real qci0
Definition: ERF_Constants.H:66
constexpr amrex::Real betaelq
Definition: ERF_Constants.H:68
constexpr amrex::Real alphaelq
Definition: ERF_Constants.H:67
constexpr amrex::Real qcw0
Definition: ERF_Constants.H:65

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_cloud_ice_terminal_velocity()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_cloud_ice_terminal_velocity ( const amrex::Real  qci_avg)
noexcept
769 {
770  // MUST MATCH: SAM cloud-ice terminal-velocity coefficient and exponent.
771  return amrex::min(amrex::Real(0.4),
772  amrex::Real(8.66) * std::pow((amrex::max(amrex::Real(0.0), qci_avg) + amrex::Real(1.e-10)), amrex::Real(0.24)));
773 }

Referenced by SAM::IceFall().

Here is the caller graph for this function:

◆ sam_cloud_liquid_fraction()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_cloud_liquid_fraction ( const int  SAM_moisture_type,
const amrex::Real  tabs,
const amrex::Real  an,
const amrex::Real  bn 
)
noexcept
249 {
250  // Empirical cloud phase-fraction closure for omega_n. No-ice mode forces
251  // liquid fraction to one; the warm branch is all liquid, the cold branch
252  // is all ice, and the mixed branch varies linearly with temperature.
253  if (SAM_moisture_type == 2) {
254  return one;
255  }
256  if (tabs >= tbgmax) {
257  return one;
258  }
259  if (tabs <= tbgmin) {
260  return zero;
261  }
262  return an * tabs - bn;
263 }
constexpr amrex::Real tbgmax
Definition: ERF_Constants.H:51
constexpr amrex::Real tbgmin
Definition: ERF_Constants.H:50
@ tabs
Definition: ERF_Kessler.H:25

Referenced by SAM::NewtonIterSat(), sam_partition_cloud_phase(), and sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_compute_coefficient_row()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCoefficientRow sam_compute_coefficient_row ( const amrex::Real  rho,
const amrex::Real  tabs,
const amrex::Real  gamr1,
const amrex::Real  gamr2,
const amrex::Real  gams1,
const amrex::Real  gams2,
const amrex::Real  gamg1,
const amrex::Real  gamg2 
)
noexcept
719 {
720  // Preserve the SAM baseline formula ordering in these closure rows.
721  SAMCoefficientRow row{};
722  amrex::Real prefactor;
723  amrex::Real pratio = std::sqrt(amrex::Real(1.29) / rho);
724  amrex::Real estw = amrex::Real(100.0) * erf_esatw(tabs);
725  amrex::Real esti = amrex::Real(100.0) * erf_esati(tabs);
726 
727  amrex::Real coef1 = fourth * PI * nzeros * a_snow * gams1 * pratio
728  / std::pow((PI * rhos * nzeros / rho), ((three + b_snow) / amrex::Real(4.0)));
729  amrex::Real coef2 = std::exp(amrex::Real(0.025) * (tabs - amrex::Real(273.15)));
730  row.accrsi = coef1 * coef2 * esicoef;
731  row.accrsc = coef1 * esccoef;
732  row.coefice = coef2;
733 
734  coef1 = (lsub / (tabs * R_v) - one) * lsub / (therco * tabs);
735  coef2 = R_v * R_d / (diffelq * esti);
736  prefactor = two * PI * nzeros / (rho * (coef1 + coef2));
737  prefactor *= (two / PI);
738  row.evaps1 = prefactor * amrex::Real(0.65) * std::sqrt(rho / (PI * rhos * nzeros));
739  row.evaps2 = prefactor * amrex::Real(0.44) * std::sqrt(a_snow * rho / muelq) * gams2
740  * std::sqrt(pratio) * std::pow(rho / (PI * rhos * nzeros), ((amrex::Real(5.0) + b_snow) / amrex::Real(8.0)));
741 
742  coef1 = fourth * PI * nzerog * a_grau * gamg1 * pratio
743  / std::pow((PI * rhog * nzerog / rho), ((three + b_grau) / amrex::Real(4.0)));
744  coef2 = std::exp(amrex::Real(0.025) * (tabs - amrex::Real(273.15)));
745  row.accrgi = coef1 * coef2 * egicoef;
746  row.accrgc = coef1 * egccoef;
747 
748  coef1 = (lsub / (tabs * R_v) - one) * lsub / (therco * tabs);
749  coef2 = R_v * R_d / (diffelq * esti);
750  prefactor = two * PI * nzerog / (rho * (coef1 + coef2));
751  row.evapg1 = prefactor * amrex::Real(0.78) * std::sqrt(rho / (PI * rhog * nzerog));
752  row.evapg2 = prefactor * amrex::Real(0.31) * std::sqrt(a_grau * rho / muelq) * gamg2
753  * std::sqrt(pratio) * std::pow(rho / (PI * rhog * nzerog), ((amrex::Real(5.0) + b_grau) / amrex::Real(8.0)));
754 
755  row.accrrc = fourth * PI * nzeror * a_rain * gamr1 * pratio
756  / std::pow((PI * rhor * nzeror / rho), ((three + b_rain) / amrex::Real(4.0))) * erccoef;
757 
758  coef1 = (lcond / (tabs * R_v) - one) * lcond / (therco * tabs);
759  coef2 = R_v * R_d / (diffelq * estw);
760  prefactor = two * PI * nzeror / (rho * (coef1 + coef2));
761  row.evapr1 = prefactor * amrex::Real(0.78) * std::sqrt(rho / (PI * rhor * nzeror));
762  row.evapr2 = prefactor * amrex::Real(0.31) * std::sqrt(a_rain * rho / muelq) * gamr2
763  * std::sqrt(pratio) * std::pow(rho / (PI * rhor * nzeror), ((amrex::Real(5.0) + b_rain) / amrex::Real(8.0)));
764  return row;
765 }
constexpr amrex::Real rhog
Definition: ERF_Constants.H:49
constexpr amrex::Real R_v
Definition: ERF_Constants.H:30
constexpr amrex::Real three
Definition: ERF_Constants.H:9
constexpr amrex::Real muelq
Definition: ERF_Constants.H:94
constexpr amrex::Real nzerog
Definition: ERF_Constants.H:78
constexpr amrex::Real two
Definition: ERF_Constants.H:8
constexpr amrex::Real a_grau
Definition: ERF_Constants.H:61
constexpr amrex::Real lsub
Definition: ERF_Constants.H:87
constexpr amrex::Real esicoef
Definition: ERF_Constants.H:72
constexpr amrex::Real diffelq
Definition: ERF_Constants.H:92
constexpr amrex::Real fourth
Definition: ERF_Constants.H:12
constexpr amrex::Real therco
Definition: ERF_Constants.H:93
constexpr amrex::Real b_grau
Definition: ERF_Constants.H:62
constexpr amrex::Real egccoef
Definition: ERF_Constants.H:73
constexpr amrex::Real egicoef
Definition: ERF_Constants.H:74
constexpr amrex::Real b_rain
Definition: ERF_Constants.H:58
constexpr amrex::Real lcond
Definition: ERF_Constants.H:85
constexpr amrex::Real PI
Definition: ERF_Constants.H:24
constexpr amrex::Real nzeror
Definition: ERF_Constants.H:76
constexpr amrex::Real rhos
Definition: ERF_Constants.H:48
constexpr amrex::Real esccoef
Definition: ERF_Constants.H:71
constexpr amrex::Real rhor
Definition: ERF_Constants.H:47
constexpr amrex::Real a_rain
Definition: ERF_Constants.H:57
constexpr amrex::Real nzeros
Definition: ERF_Constants.H:77
constexpr amrex::Real R_d
Definition: ERF_Constants.H:29
constexpr amrex::Real a_snow
Definition: ERF_Constants.H:59
constexpr amrex::Real b_snow
Definition: ERF_Constants.H:60
constexpr amrex::Real erccoef
Definition: ERF_Constants.H:70
rho
Definition: ERF_InitCustomPert_Bubble.H:106
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_esati(amrex::Real t)
Definition: ERF_MicrophysicsUtils.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_esatw(amrex::Real t, bool use_empirical=false)
Definition: ERF_MicrophysicsUtils.H:123
Definition: ERF_SAMUtils.H:98

Referenced by SAM::Compute_Coefficients().

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

◆ sam_cons_to_primitive()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrimitiveCell sam_cons_to_primitive ( const amrex::Real  rho,
const amrex::Real  rho_theta,
const amrex::Real  rho_qv,
const amrex::Real  rho_qcl,
const amrex::Real  rho_qci,
const amrex::Real  rho_qpr,
const amrex::Real  rho_qps,
const amrex::Real  rho_qpg 
)
noexcept
190 {
191  // Copy-in reconstructs the SAM primitive cell state from the conserved ERF
192  // state, clips negative moisture defensively, and diagnoses tabs and
193  // pres_mbar from the incoming rho*theta/rho*q state. That diagnosed mbar
194  // pressure is the held pressure for the following source updates.
195  SAMPrimitiveCell result{};
196  result.rho = rho;
197  result.theta = rho_theta / rho;
198  result.qv = amrex::max(amrex::Real(0.0), rho_qv / rho);
199  result.qcl = amrex::max(amrex::Real(0.0), rho_qcl / rho);
200  result.qci = amrex::max(amrex::Real(0.0), rho_qci / rho);
201  result.qn = result.qcl + result.qci;
202  result.qt = result.qv + result.qn;
203  result.qpr = amrex::max(amrex::Real(0.0), rho_qpr / rho);
204  result.qps = amrex::max(amrex::Real(0.0), rho_qps / rho);
205  result.qpg = amrex::max(amrex::Real(0.0), rho_qpg / rho);
206  result.qp = result.qpr + result.qps + result.qpg;
207  result.tabs = getTgivenRandRTh(rho, rho_theta, result.qv);
208  result.pres_mbar = sam_pa_to_mbar(getPgivenRTh(rho_theta, result.qv));
209  return result;
210 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:46
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 sam_pa_to_mbar(const amrex::Real pres_pa) noexcept
Definition: ERF_SAMUtils.H:165
Definition: ERF_SAMUtils.H:51
amrex::Real rho
Definition: ERF_SAMUtils.H:52

Referenced by SAM::Copy_State_to_Micro().

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

◆ sam_face_average_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMFaceState sam_face_average_state ( const int  k,
const int  k_lo,
const int  k_hi,
const amrex::Real  rho_km1,
const amrex::Real  rho_k,
const amrex::Real  tabs_km1,
const amrex::Real  tabs_k,
const amrex::Real  qci_km1,
const amrex::Real  qci_k,
const amrex::Real  qp_km1,
const amrex::Real  qp_k 
)
noexcept
787 {
788  SAMFaceState result{};
789  if (k == k_lo) {
790  result.rho_avg = rho_k;
791  result.tabs_avg = tabs_k;
792  result.qci_avg = qci_k;
793  result.qp_avg = qp_k;
794  } else if (k == k_hi + 1) {
795  result.rho_avg = rho_km1;
796  result.tabs_avg = tabs_km1;
797  result.qci_avg = qci_km1;
798  result.qp_avg = qp_km1;
799  } else {
800  result.rho_avg = myhalf * (rho_km1 + rho_k);
801  result.tabs_avg = myhalf * (tabs_km1 + tabs_k);
802  result.qci_avg = myhalf * (qci_km1 + qci_k);
803  result.qp_avg = myhalf * (qp_km1 + qp_k);
804  }
805  return result;
806 }
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
Definition: ERF_SAMUtils.H:132
amrex::Real rho_avg
Definition: ERF_SAMUtils.H:133

Referenced by SAM::IceFall().

Here is the caller graph for this function:

◆ sam_graupel_fraction()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_graupel_fraction ( const int  SAM_moisture_type,
const amrex::Real  tabs 
)
noexcept
280 {
281  // Empirical graupel fraction omega_g. No-ice mode forces graupel fraction
282  // to zero, and the result is clipped to [0, 1].
283  if (SAM_moisture_type == 2) {
284  return zero;
285  }
286  return amrex::max(amrex::Real(0.0), amrex::min(amrex::Real(1.0), (tabs - tgrmin) * a_gr));
287 }
constexpr amrex::Real a_gr
Definition: ERF_Constants.H:98
constexpr amrex::Real tgrmin
Definition: ERF_Constants.H:54

Referenced by sam_precip_cell_update(), and sam_precip_face_state().

Here is the caller graph for this function:

◆ sam_is_no_ice()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool sam_is_no_ice ( const MoistureType  moisture_type)
noexcept
233 {
234  return moisture_type == MoistureType::SAM_NoIce ||
235  moisture_type == MoistureType::SAM_NoPrecip_NoIce;
236 }

Referenced by SAM::Cloud(), and SAM::IceFall().

Here is the caller graph for this function:

◆ sam_is_no_precip()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool sam_is_no_precip ( const MoistureType  moisture_type)
noexcept
240 {
241  return moisture_type == MoistureType::SAM_NoPrecip_NoIce;
242 }

Referenced by SAM::Precip(), and SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_limit_precip_component_flux()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_limit_precip_component_flux ( const amrex::Real  raw_flux,
const amrex::Real  rho_donor,
const amrex::Real  q_donor,
const amrex::Real  detJ_donor,
const amrex::Real  coef 
)
noexcept
1005 {
1006  const amrex::Real available_flux =
1007  rho_donor * amrex::max(amrex::Real(0.0), q_donor) * detJ_donor / coef;
1008  return amrex::min(raw_flux, available_flux);
1009 }

Referenced by SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_mbar_to_pa()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mbar_to_pa ( const amrex::Real  pres_mbar)
noexcept
159 {
160  // SAM stores pressure in mbar. EOS and theta helpers expect Pa.
161  return amrex::Real(100.0) * pres_mbar;
162 }

Referenced by sam_theta_from_stored_mbar_converted_to_pa().

Here is the caller graph for this function:

◆ sam_mixed_dqsat_dT()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mixed_dqsat_dT ( const amrex::Real  omn,
const amrex::Real  domn,
const amrex::Real  qsatw,
const amrex::Real  qsati,
const amrex::Real  dqsatw,
const amrex::Real  dqsati 
)
noexcept
358 {
359  // Temperature derivative of mixed saturation, including the mixed-branch
360  // temperature derivative of the liquid/ice phase fraction.
361  return omn * dqsatw + (one - omn) * dqsati + domn * qsatw - domn * qsati;
362 }
@ qsatw
Definition: ERF_WSM6.H:236
@ qsati
Definition: ERF_WSM6.H:236

Referenced by SAM::NewtonIterSat().

Here is the caller graph for this function:

◆ sam_mixed_qsat()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mixed_qsat ( const amrex::Real  omn,
const amrex::Real  qsatw,
const amrex::Real  qsati 
)
noexcept
346 {
347  // Mixed liquid/ice saturation relation used by the SAM cloud adjustment.
348  return omn * qsatw + (one - omn) * qsati;
349 }

Referenced by SAM::Cloud(), SAM::NewtonIterSat(), and sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_newton_residual()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_newton_residual ( const amrex::Real  tabs_new,
const amrex::Real  tabs_old,
const amrex::Real  lstar,
const amrex::Real  qv,
const amrex::Real  qsat 
)
noexcept
370 {
371  // Residual for the local constant-pressure saturation adjustment solve.
372  return -tabs_new + tabs_old + lstar * (qv - qsat);
373 }

Referenced by SAM::NewtonIterSat().

Here is the caller graph for this function:

◆ sam_newton_residual_derivative()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_newton_residual_derivative ( const amrex::Real  lstar,
const amrex::Real  dlstar,
const amrex::Real  qv,
const amrex::Real  qsat,
const amrex::Real  dqsat 
)
noexcept
381 {
382  // Derivative for the local constant-pressure saturation adjustment solve.
383  return -one + dlstar * (qv - qsat) - lstar * dqsat;
384 }

Referenced by SAM::NewtonIterSat().

Here is the caller graph for this function:

◆ sam_pa_to_mbar()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_pa_to_mbar ( const amrex::Real  pres_pa)
noexcept
166 {
167  return amrex::Real(0.01) * pres_pa;
168 }

Referenced by SAM::Compute_Coefficients(), and sam_cons_to_primitive().

Here is the caller graph for this function:

◆ sam_partition_autoconverted_precip()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_partition_autoconverted_precip ( SAMPrecipSources  result,
const amrex::Real  omp,
const amrex::Real  omg 
)
noexcept
508 {
509  // Partitions limited autoconversion sources into rain/snow/graupel using
510  // the precipitating phase fractions and adds direct accretion
511  // contributions. dqpr + dqps + dqpg equals the limited cloud sink total.
512  result.dqpr = (result.dqca + result.dqia) * omp + result.dprc;
513  result.dqps = (result.dqca + result.dqia) * (one - omp) * (one - omg) + result.dpsc + result.dpsi;
514  result.dqpg = (result.dqca + result.dqia) * (one - omp) * omg + result.dpgc + result.dpgi;
515  return result;
516 }
amrex::Real dpgc
Definition: ERF_SAMUtils.H:39
amrex::Real dqca
Definition: ERF_SAMUtils.H:36
amrex::Real dpsc
Definition: ERF_SAMUtils.H:38
amrex::Real dpgi
Definition: ERF_SAMUtils.H:42
amrex::Real dprc
Definition: ERF_SAMUtils.H:37
amrex::Real dqia
Definition: ERF_SAMUtils.H:40
amrex::Real dpsi
Definition: ERF_SAMUtils.H:41

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_partition_cloud_phase()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCloudPhaseChange sam_partition_cloud_phase ( const int  SAM_moisture_type,
const amrex::Real  tabs,
const amrex::Real  qn,
const amrex::Real  qcl,
const amrex::Real  qci,
const amrex::Real  fac_cond,
const amrex::Real  fac_fus,
const amrex::Real  an,
const amrex::Real  bn 
)
noexcept
299 {
300  // Repartition cloud condensate between liquid and ice using omega_n while
301  // preserving total cloud condensate qn. The temperature increment accounts
302  // for fusion heating/cooling under the held-pressure source-step
303  // convention; no-ice mode collapses condensate into liquid.
304  SAMCloudPhaseChange result{};
305  result.qcl = qcl;
306  result.qci = qci;
307  result.tabs = tabs;
308  result.omn = sam_cloud_liquid_fraction(SAM_moisture_type, tabs, an, bn);
309 
310  if (SAM_moisture_type == 1) {
311  if (tabs >= tbgmax) {
312  result.omn = one;
313  result.delta_qi = qci;
314  result.qci = zero;
315  result.qcl += result.delta_qi;
316  result.tabs -= fac_fus * result.delta_qi;
317  } else if (tabs <= tbgmin) {
318  result.omn = zero;
319  result.delta_qc = qcl;
320  result.qcl = zero;
321  result.qci += result.delta_qc;
322  result.tabs += fac_fus * result.delta_qc;
323  } else {
324  result.delta_qc = qcl - qn * result.omn;
325  result.delta_qi = qci - qn * (one - result.omn);
326  result.qcl = qn * result.omn;
327  result.qci = qn * (one - result.omn);
328  result.tabs += fac_fus * result.delta_qc;
329  }
330  } else {
331  result.omn = one;
332  result.delta_qc = qcl - qn;
333  result.qcl = qn;
334  result.qci = zero;
335  result.tabs += fac_cond * result.delta_qc;
336  }
337 
338  result.qn = result.qcl + result.qci;
339  return result;
340 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_cloud_liquid_fraction(const int SAM_moisture_type, const amrex::Real tabs, const amrex::Real an, const amrex::Real bn) noexcept
Definition: ERF_SAMUtils.H:245
@ qcl
Definition: ERF_Kessler.H:30
@ qn
Definition: ERF_Morrison.H:33
@ qci
Definition: ERF_Morrison.H:36
amrex::Real qcl
Definition: ERF_SAMUtils.H:28

Referenced by SAM::Cloud().

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

◆ sam_precip_cell_update()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMCellState sam_precip_cell_update ( SAMCellState  state,
const SAMCoefficientRow coeffs,
const SAMPrecipConfig config,
SAMPrecipCellDiagnostics diagnostics = nullptr 
)
noexcept
563 {
564  // Local SAM precipitation source update. This is a cell-local,
565  // held-pressure microphysics update; sedimentation and surface
566  // accumulation are handled in PrecipFall. Before sedimentation, the source
567  // terms exchange water among qv/qcl/qci/qpr/qps/qpg, conserve total water,
568  // and conserve the constant-pressure latent proxy
569  // tabs + fac_cond*qv - fac_fus*(qci + qps + qpg)
570  // up to limiter and roundoff effects.
571  if (diagnostics != nullptr) {
572  *diagnostics = {};
573  }
574 
575  state.qn = state.qcl + state.qci;
576  state.qt = state.qv + state.qn;
577  state.qp = state.qpr + state.qps + state.qpg;
578 
579  if (!config.enable_precip || state.qn + state.qp <= zero) {
580  return state;
581  }
582 
583  amrex::Real omn;
584  amrex::Real omp;
585  amrex::Real omg;
586  if (config.sam_moisture_type == 2) {
587  omn = one;
588  omp = one;
589  omg = zero;
590  } else {
592  state.tabs, a_bg, tbgmin * a_bg);
594  state.tabs);
596  state.tabs);
597  }
598 
599  if (diagnostics != nullptr) {
600  diagnostics->omn = omn;
601  diagnostics->omp = omp;
602  diagnostics->omg = omg;
603  }
604 
605  if (state.qn > zero) {
606  SAMPrecipSources source_terms =
607  sam_autoconversion_rates(config.dtn, state.qcl, state.qci, coeffs.coefice);
608  const SAMPrecipSources accretion_terms =
609  sam_accretion_rates(config.dtn, state.qcl, state.qci, state.qpr, state.qps, state.qpg,
610  config.powr1, config.pows1, config.powg1,
611  omp, omg,
612  coeffs.accrrc, coeffs.accrsc, coeffs.accrsi,
613  coeffs.accrgc, coeffs.accrgi);
614  if (diagnostics != nullptr) {
615  diagnostics->autoconversion = source_terms;
616  diagnostics->accretion = accretion_terms;
617  }
618 
619  source_terms.dprc = accretion_terms.dprc;
620  source_terms.dpsc = accretion_terms.dpsc;
621  source_terms.dpgc = accretion_terms.dpgc;
622  source_terms.dpsi = accretion_terms.dpsi;
623  source_terms.dpgi = accretion_terms.dpgi;
624  source_terms = sam_rescale_cloud_sinks(state.qcl, state.qci,
625  config.eps, source_terms);
626  if (diagnostics != nullptr) {
627  diagnostics->limited_sources = source_terms;
628  }
629 
630  source_terms = sam_partition_autoconverted_precip(source_terms, omp, omg);
631  if (diagnostics != nullptr) {
632  diagnostics->partitioned_sources = source_terms;
633  }
634 
635  const amrex::Real dqca = source_terms.dqca;
636  const amrex::Real dqia = source_terms.dqia;
637 
638  state.qcl -= source_terms.dqc;
639  state.qci -= source_terms.dqi;
640  state.qpr += source_terms.dqpr;
641  state.qps += source_terms.dqps;
642  state.qpg += source_terms.dqpg;
643 
644  state.qn = state.qcl + state.qci;
645  state.qt = state.qv + state.qn;
646  state.qp = state.qpr + state.qps + state.qpg;
647 
648  // Cloud-liquid accretion onto snow and graupel increases frozen mass
649  // and must contribute the same fusion-heating term to the local latent
650  // proxy as the autoconverted frozen branch.
651  state.tabs += config.fac_fus * (dqca * (one - omp) - dqia * omp
652  + source_terms.dpsc + source_terms.dpgc);
654  state.pres_mbar,
655  config.rdOcp);
656  }
657 
660  erf_qsatw(state.tabs, state.pres_mbar, qsatw);
661  erf_qsati(state.tabs, state.pres_mbar, qsati);
662  const amrex::Real qsat = sam_mixed_qsat(omn, qsatw, qsati);
663  if (diagnostics != nullptr) {
664  diagnostics->qsat = qsat;
665  }
666 
667  if (state.qp > zero && state.qv < qsat) {
668  SAMPrecipSources evaporation_terms =
669  sam_precip_evaporation_rates(state.qpr, state.qps, state.qpg,
670  config.powr2, config.pows2, config.powg2,
671  coeffs.evapr1, coeffs.evapr2,
672  coeffs.evaps1, coeffs.evaps2,
673  coeffs.evapg1, coeffs.evapg2);
674 
675  const amrex::Real supersat_factor = config.dtn * (one - state.qv / qsat);
676  evaporation_terms.dqpr *= supersat_factor;
677  evaporation_terms.dqps *= supersat_factor;
678  evaporation_terms.dqpg *= supersat_factor;
679  evaporation_terms = sam_apply_precip_evaporation_limiter(state.qpr,
680  state.qps,
681  state.qpg,
682  evaporation_terms);
683  if (diagnostics != nullptr) {
684  diagnostics->evaporation = evaporation_terms;
685  }
686 
687  state.qv += evaporation_terms.dqp;
688  state.qpr -= evaporation_terms.dqpr;
689  state.qps -= evaporation_terms.dqps;
690  state.qpg -= evaporation_terms.dqpg;
691 
692  state.qt = state.qv + state.qn;
693  state.qp = state.qpr + state.qps + state.qpg;
694 
695  // Rain evaporation cools with Lv/cp; snow and graupel sublimation cool
696  // with Ls/cp, preserving the same local latent proxy.
697  state.tabs -= config.fac_cond * evaporation_terms.dqpr
698  + config.fac_sub * (evaporation_terms.dqps + evaporation_terms.dqpg);
700  state.pres_mbar,
701  config.rdOcp);
702  }
703 
704  return state;
705 }
constexpr amrex::Real a_bg
Definition: ERF_Constants.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsatw(amrex::Real t, amrex::Real p, amrex::Real &qsatw)
Definition: ERF_MicrophysicsUtils.H:228
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsati(amrex::Real t, amrex::Real p, amrex::Real &qsati)
Definition: ERF_MicrophysicsUtils.H:218
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_rain_fraction(const int SAM_moisture_type, const amrex::Real tabs) noexcept
Definition: ERF_SAMUtils.H:266
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_partition_autoconverted_precip(SAMPrecipSources result, const amrex::Real omp, const amrex::Real omg) noexcept
Definition: ERF_SAMUtils.H:505
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_precip_evaporation_rates(const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, const amrex::Real powr2, const amrex::Real pows2, const amrex::Real powg2, const amrex::Real evapr1_k, const amrex::Real evapr2_k, const amrex::Real evaps1_k, const amrex::Real evaps2_k, const amrex::Real evapg1_k, const amrex::Real evapg2_k) noexcept
Definition: ERF_SAMUtils.H:519
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_accretion_rates(const amrex::Real dtn, const amrex::Real qcc, const amrex::Real qii, const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, const amrex::Real powr1, const amrex::Real pows1, const amrex::Real powg1, const amrex::Real omp, const amrex::Real omg, const amrex::Real accrrc_k, const amrex::Real accrsc_k, const amrex::Real accrsi_k, const amrex::Real accrgc_k, const amrex::Real accrgi_k) noexcept
Definition: ERF_SAMUtils.H:425
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_apply_precip_evaporation_limiter(const amrex::Real qpr, const amrex::Real qps, const amrex::Real qpg, SAMPrecipSources result) noexcept
Definition: ERF_SAMUtils.H:543
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_rescale_cloud_sinks(const amrex::Real qcl, const amrex::Real qci, const amrex::Real eps, SAMPrecipSources result) noexcept
Definition: ERF_SAMUtils.H:475
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_autoconversion_rates(const amrex::Real dtn, const amrex::Real qcc, const amrex::Real qii, const amrex::Real coefice_k) noexcept
Definition: ERF_SAMUtils.H:408
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_graupel_fraction(const int SAM_moisture_type, const amrex::Real tabs) noexcept
Definition: ERF_SAMUtils.H:278
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mixed_qsat(const amrex::Real omn, const amrex::Real qsatw, const amrex::Real qsati) noexcept
Definition: ERF_SAMUtils.H:343
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_theta_from_stored_mbar_converted_to_pa(const amrex::Real tabs, const amrex::Real pres_mbar, const amrex::Real rdOcp) noexcept
Definition: ERF_SAMUtils.H:171
amrex::Real coefice
Definition: ERF_SAMUtils.H:102
amrex::Real evaps2
Definition: ERF_SAMUtils.H:104
amrex::Real accrsi
Definition: ERF_SAMUtils.H:100
amrex::Real accrgc
Definition: ERF_SAMUtils.H:106
amrex::Real accrgi
Definition: ERF_SAMUtils.H:105
amrex::Real accrsc
Definition: ERF_SAMUtils.H:101
amrex::Real evapg1
Definition: ERF_SAMUtils.H:107
amrex::Real evapr1
Definition: ERF_SAMUtils.H:109
amrex::Real evapg2
Definition: ERF_SAMUtils.H:108
amrex::Real accrrc
Definition: ERF_SAMUtils.H:99
amrex::Real evapr2
Definition: ERF_SAMUtils.H:110
amrex::Real evaps1
Definition: ERF_SAMUtils.H:103
SAMPrecipSources limited_sources
Definition: ERF_SAMUtils.H:89
amrex::Real omg
Definition: ERF_SAMUtils.H:95
amrex::Real omp
Definition: ERF_SAMUtils.H:94
SAMPrecipSources partitioned_sources
Definition: ERF_SAMUtils.H:90
amrex::Real qsat
Definition: ERF_SAMUtils.H:92
SAMPrecipSources evaporation
Definition: ERF_SAMUtils.H:91
amrex::Real omn
Definition: ERF_SAMUtils.H:93
SAMPrecipSources autoconversion
Definition: ERF_SAMUtils.H:87
SAMPrecipSources accretion
Definition: ERF_SAMUtils.H:88
bool enable_precip
Definition: ERF_SAMUtils.H:71
amrex::Real fac_cond
Definition: ERF_SAMUtils.H:74
amrex::Real rdOcp
Definition: ERF_SAMUtils.H:73
amrex::Real dtn
Definition: ERF_SAMUtils.H:72
amrex::Real eps
Definition: ERF_SAMUtils.H:77
amrex::Real powr2
Definition: ERF_SAMUtils.H:81
amrex::Real fac_sub
Definition: ERF_SAMUtils.H:76
amrex::Real pows2
Definition: ERF_SAMUtils.H:82
amrex::Real pows1
Definition: ERF_SAMUtils.H:79
amrex::Real fac_fus
Definition: ERF_SAMUtils.H:75
amrex::Real powg2
Definition: ERF_SAMUtils.H:83
amrex::Real powg1
Definition: ERF_SAMUtils.H:80
int sam_moisture_type
Definition: ERF_SAMUtils.H:70
amrex::Real powr1
Definition: ERF_SAMUtils.H:78
amrex::Real dqc
Definition: ERF_SAMUtils.H:43
amrex::Real dqi
Definition: ERF_SAMUtils.H:44
amrex::Real theta
Definition: ERF_SAMUtils.H:53
amrex::Real qpr
Definition: ERF_SAMUtils.H:61
amrex::Real qn
Definition: ERF_SAMUtils.H:59
amrex::Real qps
Definition: ERF_SAMUtils.H:62
amrex::Real qci
Definition: ERF_SAMUtils.H:58
amrex::Real qv
Definition: ERF_SAMUtils.H:56
amrex::Real tabs
Definition: ERF_SAMUtils.H:54
amrex::Real qpg
Definition: ERF_SAMUtils.H:63
amrex::Real qt
Definition: ERF_SAMUtils.H:60
amrex::Real qcl
Definition: ERF_SAMUtils.H:57
amrex::Real pres_mbar
Definition: ERF_SAMUtils.H:55
amrex::Real qp
Definition: ERF_SAMUtils.H:64

Referenced by SAM::Precip().

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

◆ sam_precip_component_face_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipComponentFaceState sam_precip_component_face_state ( const amrex::Array4< const amrex::Real > &  rho_array,
const amrex::Array4< const amrex::Real > &  tabs_array,
const amrex::Array4< const amrex::Real > &  qpr_array,
const amrex::Array4< const amrex::Real > &  qps_array,
const amrex::Array4< const amrex::Real > &  qpg_array,
const int  i,
const int  j,
const int  k,
const int  k_lo,
const int  k_hi 
)
noexcept
884 {
885  // MUST MATCH: SAM PrecipFall bottom/interior/top face rules.
887  if (k == k_lo) {
888  result.rho_avg = rho_array(i,j,k);
889  result.tabs_avg = tabs_array(i,j,k);
890  result.qpr_avg = qpr_array(i,j,k);
891  result.qps_avg = qps_array(i,j,k);
892  result.qpg_avg = qpg_array(i,j,k);
893  } else if (k == k_hi + 1) {
894  result.rho_avg = rho_array(i,j,k-1);
895  result.tabs_avg = tabs_array(i,j,k-1);
896  result.qpr_avg = qpr_array(i,j,k-1);
897  result.qps_avg = qps_array(i,j,k-1);
898  result.qpg_avg = qpg_array(i,j,k-1);
899  } else {
900  result.rho_avg = myhalf * (rho_array(i,j,k-1) + rho_array(i,j,k));
901  result.tabs_avg = myhalf * (tabs_array(i,j,k-1) + tabs_array(i,j,k));
902  result.qpr_avg = myhalf * (qpr_array(i,j,k-1) + qpr_array(i,j,k));
903  result.qps_avg = myhalf * (qps_array(i,j,k-1) + qps_array(i,j,k));
904  result.qpg_avg = myhalf * (qpg_array(i,j,k-1) + qpg_array(i,j,k));
905  }
906  return result;
907 }
Definition: ERF_SAMUtils.H:124
amrex::Real rho_avg
Definition: ERF_SAMUtils.H:125

Referenced by SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_precip_component_fluxes_from_face_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_component_fluxes_from_face_state ( const SAMPrecipComponentFaceState face_state,
const amrex::Real  vrain,
const amrex::Real  vsnow,
const amrex::Real  vgrau 
)
noexcept
960 {
961  SAMPrecipFluxComponents result{};
962  if (face_state.qpr_avg > zero) {
963  result.rain = vrain * std::pow(face_state.rho_avg * face_state.qpr_avg, one + crain);
964  }
965  if (face_state.qps_avg > zero) {
966  result.snow = vsnow * std::pow(face_state.rho_avg * face_state.qps_avg, one + csnow);
967  }
968  if (face_state.qpg_avg > zero) {
969  result.graupel = vgrau * std::pow(face_state.rho_avg * face_state.qpg_avg, one + cgrau);
970  }
971  return result;
972 }
constexpr amrex::Real csnow
Definition: ERF_Constants.H:101
constexpr amrex::Real cgrau
Definition: ERF_Constants.H:102
constexpr amrex::Real crain
Definition: ERF_Constants.H:100
amrex::Real qpr_avg
Definition: ERF_SAMUtils.H:127
amrex::Real qpg_avg
Definition: ERF_SAMUtils.H:129
amrex::Real qps_avg
Definition: ERF_SAMUtils.H:128
Definition: ERF_SAMUtils.H:145
amrex::Real rain
Definition: ERF_SAMUtils.H:146

Referenced by SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_precip_evaporation_rates()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_precip_evaporation_rates ( const amrex::Real  qpr,
const amrex::Real  qps,
const amrex::Real  qpg,
const amrex::Real  powr2,
const amrex::Real  pows2,
const amrex::Real  powg2,
const amrex::Real  evapr1_k,
const amrex::Real  evapr2_k,
const amrex::Real  evaps1_k,
const amrex::Real  evaps2_k,
const amrex::Real  evapg1_k,
const amrex::Real  evapg2_k 
)
noexcept
531 {
532  // Positive-domain evaporation/sublimation rate form for precipitating
533  // species: C1*sqrt(q_m) + C2*q_m^p. The derivative is singular at q_m = 0,
534  // so derivative checks only make sense away from zero.
535  SAMPrecipSources result{};
536  result.dqpr = evapr1_k * std::sqrt(qpr) + evapr2_k * std::pow(qpr, powr2);
537  result.dqps = evaps1_k * std::sqrt(qps) + evaps2_k * std::pow(qps, pows2);
538  result.dqpg = evapg1_k * std::sqrt(qpg) + evapg2_k * std::pow(qpg, powg2);
539  return result;
540 }

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_precip_face_donor_k()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int sam_precip_face_donor_k ( const int  face_k,
const int  k_lo,
const int  k_hi 
)
noexcept
812 {
813  if (face_k <= k_lo) {
814  return k_lo;
815  }
816  if (face_k >= k_hi + 1) {
817  return k_hi;
818  }
819  return face_k;
820 }

Referenced by SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_precip_face_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFaceState sam_precip_face_state ( const int  SAM_moisture_type,
const amrex::Array4< const amrex::Real > &  rho_array,
const amrex::Array4< const amrex::Real > &  tabs_array,
const amrex::Array4< const amrex::Real > &  qp_array,
const int  i,
const int  j,
const int  k,
const int  k_lo,
const int  k_hi 
)
noexcept
845 {
846  // MUST MATCH: SAM PrecipFall bottom/interior/top face rules.
847  SAMPrecipFaceState result{};
848  if (k == k_lo) {
849  result.rho_avg = rho_array(i,j,k);
850  result.tabs_avg = tabs_array(i,j,k);
851  result.qp_avg = qp_array(i,j,k);
852  } else if (k == k_hi + 1) {
853  result.rho_avg = rho_array(i,j,k-1);
854  result.tabs_avg = tabs_array(i,j,k-1);
855  result.qp_avg = qp_array(i,j,k-1);
856  } else {
857  result.rho_avg = myhalf * (rho_array(i,j,k-1) + rho_array(i,j,k));
858  result.tabs_avg = myhalf * (tabs_array(i,j,k-1) + tabs_array(i,j,k));
859  result.qp_avg = myhalf * (qp_array(i,j,k-1) + qp_array(i,j,k));
860  }
861  result.omp = sam_precip_rain_fraction(SAM_moisture_type, result.tabs_avg);
862  result.omg = sam_graupel_fraction(SAM_moisture_type, result.tabs_avg);
863  result.qrr = result.omp * result.qp_avg;
864  result.qss = (one - result.omp) * (one - result.omg) * result.qp_avg;
865  result.qgg = (one - result.omp) * result.omg * result.qp_avg;
866  return result;
867 }
Definition: ERF_SAMUtils.H:113
amrex::Real rho_avg
Definition: ERF_SAMUtils.H:114
Here is the call graph for this function:

◆ sam_precip_flux_components_density_corrected()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_density_corrected ( const SAMPrecipFluxComponents precip_fluxes,
const amrex::Real  rho_0,
const amrex::Real  rho_avg 
)
noexcept
987 {
988  const amrex::Real density_correction = std::sqrt(rho_0 / rho_avg);
989  return {
990  precip_fluxes.rain * density_correction,
991  precip_fluxes.snow * density_correction,
992  precip_fluxes.graupel * density_correction};
993 }
Real rho_0
Definition: ERF_InitCustomPert_ABL.H:4
amrex::Real snow
Definition: ERF_SAMUtils.H:147
amrex::Real graupel
Definition: ERF_SAMUtils.H:148

Referenced by SAM::PrecipFall(), and sam_surface_accumulation().

Here is the caller graph for this function:

◆ sam_precip_flux_components_from_face_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_from_face_state ( const SAMPrecipFaceState face_state,
const amrex::Real  vrain,
const amrex::Real  vsnow,
const amrex::Real  vgrau 
)
noexcept
936 {
937  SAMPrecipFluxComponents result{};
938  if (face_state.qp_avg <= qp_threshold) {
939  return result;
940  }
941 
942  result.rain = face_state.omp * vrain * std::pow(face_state.rho_avg * face_state.qrr, one + crain);
943  result.snow = (one - face_state.omp) * (one - face_state.omg)
944  * vsnow * std::pow(face_state.rho_avg * face_state.qss, one + csnow);
945  result.graupel = (one - face_state.omp) * face_state.omg
946  * vgrau * std::pow(face_state.rho_avg * face_state.qgg, one + cgrau);
947  return result;
948 }
constexpr amrex::Real qp_threshold
Definition: ERF_Constants.H:79
amrex::Real omg
Definition: ERF_SAMUtils.H:118
amrex::Real qss
Definition: ERF_SAMUtils.H:120
amrex::Real qrr
Definition: ERF_SAMUtils.H:119
amrex::Real qp_avg
Definition: ERF_SAMUtils.H:116
amrex::Real qgg
Definition: ERF_SAMUtils.H:121
amrex::Real omp
Definition: ERF_SAMUtils.H:117

Referenced by sam_surface_accumulation().

Here is the caller graph for this function:

◆ sam_precip_flux_density_corrected()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_flux_density_corrected ( const amrex::Real  precip_flux,
const amrex::Real  rho_0,
const amrex::Real  rho_avg 
)
noexcept
978 {
979  return precip_flux * std::sqrt(rho_0 / rho_avg);
980 }

◆ sam_precip_flux_from_face_state()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_flux_from_face_state ( const SAMPrecipFaceState face_state,
const amrex::Real  vrain,
const amrex::Real  vsnow,
const amrex::Real  vgrau 
)
noexcept
918 {
919  if (face_state.qp_avg <= qp_threshold) {
920  return zero;
921  }
922  return face_state.omp * vrain * std::pow(face_state.rho_avg * face_state.qrr, one + crain)
923  + (one - face_state.omp)
924  * ((one - face_state.omg) * vsnow * std::pow(face_state.rho_avg * face_state.qss, one + csnow)
925  + face_state.omg * vgrau * std::pow(face_state.rho_avg * face_state.qgg, one + cgrau));
926 }

◆ sam_precip_rain_fraction()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_precip_rain_fraction ( const int  SAM_moisture_type,
const amrex::Real  tabs 
)
noexcept
268 {
269  // Empirical precipitating rain fraction omega_p. No-ice mode forces rain
270  // fraction to one, and the result is clipped to [0, 1].
271  if (SAM_moisture_type == 2) {
272  return one;
273  }
274  return amrex::max(amrex::Real(0.0), amrex::min(amrex::Real(1.0), (tabs - tprmin) * a_pr));
275 }
constexpr amrex::Real tprmin
Definition: ERF_Constants.H:52
constexpr amrex::Real a_pr
Definition: ERF_Constants.H:97

Referenced by sam_precip_cell_update(), and sam_precip_face_state().

Here is the caller graph for this function:

◆ sam_primitive_to_cons()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void sam_primitive_to_cons ( const SAMPrimitiveCell primitive,
const amrex::Array4< amrex::Real > &  states_arr,
const int  i,
const int  j,
const int  k 
)
noexcept
218 {
219  // Copy-out writes rho*theta and clipped moisture species back to the
220  // conserved state. Pressure is not stored here; it is diagnosed again on
221  // the next copy-in.
222  states_arr(i,j,k,RhoTheta_comp) = primitive.rho * primitive.theta;
223  states_arr(i,j,k,RhoQ1_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qv);
224  states_arr(i,j,k,RhoQ2_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qcl);
225  states_arr(i,j,k,RhoQ3_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qci);
226  states_arr(i,j,k,RhoQ4_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qpr);
227  states_arr(i,j,k,RhoQ5_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qps);
228  states_arr(i,j,k,RhoQ6_comp) = primitive.rho * amrex::max(amrex::Real(0.0), primitive.qpg);
229 }
#define RhoQ4_comp
Definition: ERF_IndexDefines.H:45
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:43
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:44
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
#define RhoQ6_comp
Definition: ERF_IndexDefines.H:47
#define RhoQ5_comp
Definition: ERF_IndexDefines.H:46

Referenced by SAM::Copy_Micro_to_State().

Here is the caller graph for this function:

◆ sam_rescale_cloud_sinks()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipSources sam_rescale_cloud_sinks ( const amrex::Real  qcl,
const amrex::Real  qci,
const amrex::Real  eps,
SAMPrecipSources  result 
)
noexcept
479 {
480  // Proportional donor limiter. If requested liquid or ice sinks exceed
481  // available qcl/qci, all competing sinks from the same donor phase share
482  // one scale factor. This preserves source ratios while preventing negative
483  // qcl or qci. The eps denominator intentionally leaves only an epsilon-
484  // scale undershoot.
485  result.dqc = result.dqca + result.dprc + result.dpsc + result.dpgc;
486  result.dqi = result.dqia + result.dpsi + result.dpgi;
487 
488  const amrex::Real scalec = amrex::min(qcl, result.dqc) / (result.dqc + eps);
489  const amrex::Real scalei = amrex::min(qci, result.dqi) / (result.dqi + eps);
490 
491  result.dqca *= scalec;
492  result.dprc *= scalec;
493  result.dpsc *= scalec;
494  result.dpgc *= scalec;
495  result.dqia *= scalei;
496  result.dpsi *= scalei;
497  result.dpgi *= scalei;
498  result.dqc = result.dqca + result.dprc + result.dpsc + result.dpgc;
499  result.dqi = result.dqia + result.dpsi + result.dpgi;
500 
501  return result;
502 }

Referenced by sam_precip_cell_update().

Here is the caller graph for this function:

◆ sam_sedimentation_tendency()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_sedimentation_tendency ( const amrex::Real  fz_hi,
const amrex::Real  fz_lo,
const amrex::Real  rho,
const amrex::Real  dJinv,
const amrex::Real  coef 
)
noexcept
1020 {
1021  return dJinv * (one / rho) * (fz_hi - fz_lo) * coef;
1022 }

Referenced by SAM::IceFall(), and SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_substep_count_from_reduced_flux()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int sam_substep_count_from_reduced_flux ( const amrex::Real  reduced_flux,
const amrex::Real  dt,
const amrex::Real  dz 
)
noexcept
826 {
827  // Substeps follow the legacy reduced-flux rule based on the maximum
828  // density-corrected precip flux, not directly on a terminal fall speed.
829  // Property tests characterize this behavior before any intended change.
830  // MUST MATCH: SAM::CFL_MAX.
831  return static_cast<int>(std::ceil(reduced_flux * (dt / dz) / myhalf));
832 }
@ dz
Definition: ERF_AdvanceWSM6.cpp:104

Referenced by SAM::IceFall(), and SAM::PrecipFall().

Here is the caller graph for this function:

◆ sam_surface_accumulation()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMSurfaceAccumulation sam_surface_accumulation ( const SAMPrecipFaceState face_state,
const amrex::Real  rho_0,
const amrex::Real  vrain,
const amrex::Real  vsnow,
const amrex::Real  vgrau,
const amrex::Real  dtn 
)
noexcept
1046 {
1047  const SAMPrecipFluxComponents face_fluxes =
1048  sam_precip_flux_components_from_face_state(face_state, vrain, vsnow, vgrau);
1049 
1052  dtn);
1053 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMSurfaceAccumulation sam_surface_accumulation_from_component_fluxes(const SAMPrecipFluxComponents &component_fluxes, const amrex::Real dtn) noexcept
Definition: ERF_SAMUtils.H:1028
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_density_corrected(const SAMPrecipFluxComponents &precip_fluxes, const amrex::Real rho_0, const amrex::Real rho_avg) noexcept
Definition: ERF_SAMUtils.H:983
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMPrecipFluxComponents sam_precip_flux_components_from_face_state(const SAMPrecipFaceState &face_state, const amrex::Real vrain, const amrex::Real vsnow, const amrex::Real vgrau) noexcept
Definition: ERF_SAMUtils.H:932
Here is the call graph for this function:

◆ sam_surface_accumulation_from_component_fluxes()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE SAMSurfaceAccumulation sam_surface_accumulation_from_component_fluxes ( const SAMPrecipFluxComponents component_fluxes,
const amrex::Real  dtn 
)
noexcept
1031 {
1032  SAMSurfaceAccumulation result{};
1033  result.rain = component_fluxes.rain * dtn / rhor * amrex::Real(1000.0);
1034  result.snow = component_fluxes.snow * dtn / rhos * amrex::Real(1000.0);
1035  result.graupel = component_fluxes.graupel * dtn / rhog * amrex::Real(1000.0);
1036  return result;
1037 }
Definition: ERF_SAMUtils.H:139
amrex::Real rain
Definition: ERF_SAMUtils.H:140

Referenced by SAM::PrecipFall(), and sam_surface_accumulation().

Here is the caller graph for this function:

◆ sam_theta_from_stored_mbar_converted_to_pa()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_theta_from_stored_mbar_converted_to_pa ( const amrex::Real  tabs,
const amrex::Real  pres_mbar,
const amrex::Real  rdOcp 
)
noexcept
174 {
175  // Do not replace this with getThgivenRandT(rho,T,qv): that would enforce a
176  // fixed-density EOS projection rather than the SAM source-step
177  // thermodynamic contract.
178  return getThgivenTandP(tabs, sam_mbar_to_pa(pres_mbar), rdOcp);
179 }
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_Bomex.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sam_mbar_to_pa(const amrex::Real pres_mbar) noexcept
Definition: ERF_SAMUtils.H:158

Referenced by SAM::Cloud(), and sam_precip_cell_update().

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