1 #ifndef ERF_KESSLER_UTILS_H_
2 #define ERF_KESSLER_UTILS_H_
8 #include <AMReX_GpuQualifiers.H>
9 #include <AMReX_REAL.H>
35 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
37 const int k_hi) noexcept
39 return (k == k_hi + 1) ? k - 1 : k;
42 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
52 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
57 return rho * terminal_velocity *
qp;
60 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
70 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
75 return precip_mass_per_area
80 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
84 return std::fabs(
value) < 1e-14;
87 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
100 if ((
qv > qsat) && do_cond) {
101 source_terms.dq_vapor_to_cloud = std::min(
qv, (
qv - qsat) / (
amrex::Real(1) + fac));
106 source_terms.dq_cloud_to_vapor = std::min(
qc, (qsat -
qv) / (
amrex::Real(1) + fac));
112 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
128 face_state.rho = rho_km1;
129 face_state.qp = qp_km1;
131 face_state.rho = rho_k;
132 face_state.qp = qp_k;
134 face_state.rho =
amrex::Real(0.5) * (rho_km1 + rho_k);
135 face_state.qp = qp_k;
139 face_state.qp = std::max(
amrex::Real(0), face_state.qp);
143 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
154 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
189 && (qv_eff < qsat) && (remaining_capacity >
amrex::Real(0))) {
199 source_terms.dq_rain_to_vapor = amrex::min(
qp, amrex::min(raw_rain_to_vapor, remaining_capacity));
217 source_terms.dq_cloud_to_rain = dt * (accrr * qcc + auto_r * (qcc -
qcw0));
218 source_terms.dq_cloud_to_rain = amrex::min(source_terms.dq_cloud_to_rain, available_cloud);
constexpr amrex::Real alphaelq
Definition: ERF_Constants.H:67
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
constexpr amrex::Real qcw0
Definition: ERF_Constants.H:65
constexpr amrex::Real rhor
Definition: ERF_Constants.H:47
amrex::Real value
Definition: ERF_HurricaneDiagnostics.H:20
rho
Definition: ERF_InitCustomPert_Bubble.H:106
static constexpr amrex::Real kessler_sedimentation_cfl_max
Definition: ERF_KesslerUtils.H:31
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, const amrex::Real latent_over_cp) noexcept
Definition: ERF_KesslerUtils.H:88
static constexpr amrex::Real kessler_water_depth_m_per_kg_m2
Definition: ERF_KesslerUtils.H:32
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:61
static constexpr amrex::Real kessler_millimeters_per_meter
Definition: ERF_KesslerUtils.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE KesslerFaceState kessler_face_state(const int k, 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:113
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, const amrex::Real latent_over_cp) noexcept
Definition: ERF_KesslerUtils.H:155
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:144
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:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real kessler_rain_accumulation_increment(const amrex::Real precip_mass_per_area) noexcept
Definition: ERF_KesslerUtils.H:71
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:53
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool kessler_is_small_sedimentation_value(const amrex::Real value) noexcept
Definition: ERF_KesslerUtils.H:81
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int kessler_face_donor_k(const int k, const int k_hi) noexcept
Definition: ERF_KesslerUtils.H:36
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ qp
Definition: ERF_Kessler.H:32
@ qv
Definition: ERF_Kessler.H:29
@ qc
Definition: ERF_SatAdj.H:40
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