1 #ifndef ERF_KESSLER_UTILS_H_
2 #define ERF_KESSLER_UTILS_H_
8 #include <AMReX_GpuQualifiers.H>
9 #include <AMReX_REAL.H>
31 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
41 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
46 return rho * terminal_velocity *
qp;
49 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
59 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
63 return std::fabs(
value) < 1e-14;
66 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
71 const bool do_cond) noexcept
79 if ((
qv > qsat) && do_cond) {
80 source_terms.dq_vapor_to_cloud = std::min(
qv, (
qv - qsat) / (
amrex::Real(1) + fac));
85 source_terms.dq_cloud_to_vapor = std::min(
qc, (qsat -
qv) / (
amrex::Real(1) + fac));
91 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
104 face_state.rho = rho_k;
105 face_state.qp = qp_k;
106 }
else if (k == k_hi + 1) {
107 face_state.rho = rho_km1;
108 face_state.qp = qp_km1;
110 face_state.rho =
myhalf * (rho_km1 + rho_k);
111 face_state.qp =
myhalf * (qp_km1 + qp_k);
115 face_state.qp = std::max(
amrex::Real(0), face_state.qp);
119 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
130 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
139 const bool do_cond) noexcept
162 source_terms.dq_rain_to_vapor = std::min({
qp, source_terms.dq_rain_to_vapor});
176 source_terms.dq_cloud_to_rain = dt * (accrr * qcc + auto_r * (qcc -
qcw0));
177 source_terms.dq_cloud_to_rain = std::min(source_terms.dq_cloud_to_rain,
qc);
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:23
constexpr amrex::Real alphaelq
Definition: ERF_Constants.H:59
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
constexpr amrex::Real qcw0
Definition: ERF_Constants.H:57
constexpr amrex::Real L_v
Definition: ERF_Constants.H:27
amrex::Real value
Definition: ERF_HurricaneDiagnostics.H:20
rho
Definition: ERF_InitCustomPert_Bubble.H:106
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE KesslerSaturationAdjustment kessler_saturation_adjustment(const amrex::Real qv, const amrex::Real qc, const amrex::Real qsat, const amrex::Real dtqsat, const bool do_cond) noexcept
Definition: ERF_KesslerUtils.H:67
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int kessler_num_sedimentation_substeps(const amrex::Real current_reduced_value, const amrex::Real dt, const amrex::Real dzmin) noexcept
Definition: ERF_KesslerUtils.H:50
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE KesslerSourceTerms kessler_warm_rain_sources(const amrex::Real qv, const amrex::Real qc, const amrex::Real qp, const amrex::Real rho, const amrex::Real pressure_current_units, const amrex::Real qsat, const amrex::Real dtqsat, const amrex::Real dt, const bool do_cond) noexcept
Definition: ERF_KesslerUtils.H:131
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE KesslerFaceState kessler_face_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 qp_km1, const amrex::Real qp_k) noexcept
Definition: ERF_KesslerUtils.H:92
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kessler_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
Definition: ERF_KesslerUtils.H:120
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kessler_terminal_velocity(const amrex::Real rho, const amrex::Real qp) noexcept
Definition: ERF_KesslerUtils.H:32
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kessler_precip_flux(const amrex::Real rho, const amrex::Real terminal_velocity, const amrex::Real qp) noexcept
Definition: ERF_KesslerUtils.H:42
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool kessler_is_small_sedimentation_value(const amrex::Real value) noexcept
Definition: ERF_KesslerUtils.H:60
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ qp
Definition: ERF_Kessler.H:31
@ qv
Definition: ERF_Kessler.H:28
@ qc
Definition: ERF_SatAdj.H:36
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
Definition: ERF_KesslerUtils.H:26
amrex::Real rho
Definition: ERF_KesslerUtils.H:27
amrex::Real qp
Definition: ERF_KesslerUtils.H:28
Definition: ERF_KesslerUtils.H:21
amrex::Real dq_cloud_to_vapor
Definition: ERF_KesslerUtils.H:23
amrex::Real dq_vapor_to_cloud
Definition: ERF_KesslerUtils.H:22
Definition: ERF_KesslerUtils.H:14
amrex::Real dq_rain_to_vapor
Definition: ERF_KesslerUtils.H:18
amrex::Real dq_cloud_to_vapor
Definition: ERF_KesslerUtils.H:16
amrex::Real dq_cloud_to_rain
Definition: ERF_KesslerUtils.H:17
amrex::Real dq_vapor_to_cloud
Definition: ERF_KesslerUtils.H:15