Split cloud components according to saturation pressures; source theta from latent heat.
16 constexpr Real bn =
tbgmin*an;
23 int SAM_moisture_type = 1;
26 SAM_moisture_type = 2;
41 const auto& box3d = mfi.tilebox();
43 ParallelFor(box3d, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
52 Real delta_qv, delta_qc, delta_qi;
60 if (SAM_moisture_type == 1){
62 if (tabs_array(i,j,k) >=
tbgmax) {
64 delta_qi = qci_array(i,j,k);
65 qci_array(i,j,k) = 0.0;
66 qcl_array(i,j,k) += delta_qi;
67 tabs_array(i,j,k) -= fac_fus * delta_qi;
68 pres_array(i,j,k) = rho_array(i,j,k) *
R_d * tabs_array(i,j,k)
69 * (1.0 +
R_v/
R_d * qv_array(i,j,k));
70 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
71 pres_array(i,j,k) *= 0.01;
74 else if (tabs_array(i,j,k) <=
tbgmin) {
76 delta_qc = qcl_array(i,j,k);
77 qcl_array(i,j,k) = 0.0;
78 qci_array(i,j,k) += delta_qc;
79 tabs_array(i,j,k) += fac_fus * delta_qc;
80 pres_array(i,j,k) = rho_array(i,j,k) *
R_d * tabs_array(i,j,k)
81 * (1.0 +
R_v/
R_d * qv_array(i,j,k));
82 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
83 pres_array(i,j,k) *= 0.01;
87 omn = an*tabs_array(i,j,k)-bn;
88 delta_qc = qcl_array(i,j,k) - qn_array(i,j,k) * omn;
89 delta_qi = qci_array(i,j,k) - qn_array(i,j,k) * (1.0 - omn);
90 qcl_array(i,j,k) = qn_array(i,j,k) * omn;
91 qci_array(i,j,k) = qn_array(i,j,k) * (1.0 - omn);
92 tabs_array(i,j,k) += fac_fus * delta_qc;
93 pres_array(i,j,k) = rho_array(i,j,k) *
R_d * tabs_array(i,j,k)
94 * (1.0 +
R_v/
R_d * qv_array(i,j,k));
95 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
96 pres_array(i,j,k) *= 0.01;
99 else if (SAM_moisture_type == 2)
102 delta_qc = qcl_array(i,j,k) - qn_array(i,j,k);
104 qcl_array(i,j,k) = qn_array(i,j,k);
105 qci_array(i,j,k) = 0.0;
106 tabs_array(i,j,k) += fac_cond * delta_qc;
107 pres_array(i,j,k) = rho_array(i,j,k) *
R_d * tabs_array(i,j,k)
108 * (1.0 +
R_v/
R_d * qv_array(i,j,k));
109 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
110 pres_array(i,j,k) *= 0.01;
114 erf_qsatw(tabs_array(i,j,k), pres_array(i,j,k), qsatw);
115 erf_qsati(tabs_array(i,j,k), pres_array(i,j,k), qsati);
116 qsat = omn * qsatw + (1.0-omn) * qsati;
119 if (qt_array(i,j,k) > qsat) {
122 tabs_array(i,j,k) =
NewtonIterSat(i, j, k , SAM_moisture_type ,
123 fac_cond , fac_fus , fac_sub ,
125 tabs_array, pres_array,
126 qv_array , qcl_array , qci_array,
127 qn_array , qt_array);
130 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
141 delta_qv = qcl_array(i,j,k) + qci_array(i,j,k);
142 delta_qc = qcl_array(i,j,k);
143 delta_qi = qci_array(i,j,k);
146 qv_array(i,j,k) += delta_qv;
147 qcl_array(i,j,k) = 0.0;
148 qci_array(i,j,k) = 0.0;
149 qn_array(i,j,k) = 0.0;
150 qt_array(i,j,k) = qv_array(i,j,k);
153 tabs_array(i,j,k) -= fac_cond * delta_qc + fac_sub * delta_qi;
156 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
159 erf_qsatw(tabs_array(i,j,k), pres_array(i,j,k), qsatw);
160 erf_qsati(tabs_array(i,j,k), pres_array(i,j,k), qsati);
161 qsat = omn * qsatw + (1.0-omn) * qsati;
162 if (qt_array(i,j,k) > qsat) {
165 tabs_array(i,j,k) =
NewtonIterSat(i, j, k , SAM_moisture_type ,
166 fac_cond , fac_fus , fac_sub ,
168 tabs_array, pres_array,
169 qv_array , qcl_array , qci_array,
170 qn_array , qt_array);
173 theta_array(i,j,k) =
getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
constexpr amrex::Real R_v
Definition: ERF_Constants.H:11
constexpr amrex::Real tbgmax
Definition: ERF_Constants.H:32
constexpr amrex::Real tbgmin
Definition: ERF_Constants.H:31
constexpr amrex::Real R_d
Definition: ERF_Constants.H:10
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenPandT(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp)
Definition: ERF_EOS.H:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsatw(amrex::Real t, amrex::Real p, amrex::Real &qsatw)
Definition: ERF_MicrophysicsUtils.H:158
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_qsati(amrex::Real t, amrex::Real p, amrex::Real &qsati)
Definition: ERF_MicrophysicsUtils.H:151
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real NewtonIterSat(int &i, int &j, int &k, const int &SAM_moisture_type, const amrex::Real &fac_cond, const amrex::Real &fac_fus, const amrex::Real &fac_sub, const amrex::Real &an, const amrex::Real &bn, const amrex::Array4< amrex::Real > &tabs_array, const amrex::Array4< amrex::Real > &pres_array, const amrex::Array4< amrex::Real > &qv_array, const amrex::Array4< amrex::Real > &qc_array, const amrex::Array4< amrex::Real > &qi_array, const amrex::Array4< amrex::Real > &qn_array, const amrex::Array4< amrex::Real > &qt_array)
Definition: ERF_SAM.H:153
amrex::Array< FabPtr, MicVar::NumVars > mic_fab_vars
Definition: ERF_SAM.H:325
amrex::Real m_rdOcp
Definition: ERF_SAM.H:318
amrex::Real m_fac_fus
Definition: ERF_SAM.H:315
amrex::Real m_fac_cond
Definition: ERF_SAM.H:314
amrex::Real m_fac_sub
Definition: ERF_SAM.H:316
@ pres
Definition: ERF_SAM.H:33
@ qci
Definition: ERF_SAM.H:39
@ qv
Definition: ERF_SAM.H:37
@ rho
Definition: ERF_SAM.H:30
@ qt
Definition: ERF_SAM.H:35
@ qn
Definition: ERF_SAM.H:36
@ theta
Definition: ERF_SAM.H:31
@ qcl
Definition: ERF_SAM.H:38
@ tabs
Definition: ERF_SAM.H:32
MoistureType moisture_type
Definition: ERF_DataStruct.H:664