ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Morrison Class Reference

#include <ERF_Morrison.H>

Inheritance diagram for Morrison:
Collaboration diagram for Morrison:

Public Member Functions

 Morrison ()
 
virtual ~Morrison ()=default
 
void Cloud (const SolverChoice &sc)
 
void IceFall (const SolverChoice &sc)
 
void Precip (const SolverChoice &sc)
 
void PrecipFall (const SolverChoice &sc)
 
void Define (SolverChoice &sc) override
 
void Init (const amrex::MultiFab &cons_in, const amrex::BoxArray &grids, const amrex::Geometry &geom, const amrex::Real &dt_advance, std::unique_ptr< amrex::MultiFab > &z_phys_nd, std::unique_ptr< amrex::MultiFab > &detJ_cc) override
 
void Copy_State_to_Micro (const amrex::MultiFab &cons_in) override
 
void Copy_Micro_to_State (amrex::MultiFab &cons_in) override
 
void Update_Micro_Vars (amrex::MultiFab &cons_in) override
 
void Update_State_Vars (amrex::MultiFab &cons_in) override
 
void Advance (const amrex::Real &dt_advance, const SolverChoice &sc) override
 
amrex::MultiFab * Qmoist_Ptr (const int &varIdx) override
 
void Compute_Coefficients ()
 
int Qmoist_Size () override
 
int Qstate_Size () override
 
void Qmoist_Restart_Vars (const SolverChoice &, std::vector< int > &a_idx, std::vector< std::string > &a_names) const override
 
- Public Member Functions inherited from NullMoist
 NullMoist ()
 
virtual ~NullMoist ()=default
 

Static Public Member Functions

AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real NewtonIterSat (int &i, int &j, int &k, 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)
 

Private Types

using FabPtr = std::shared_ptr< amrex::MultiFab >
 

Private Attributes

int m_qmoist_size = 3
 
int m_qstate_size = 6
 
amrex::Vector< int > MicVarMap
 
amrex::Geometry m_geom
 
amrex::BoxArray m_gtoe
 
amrex::Real dt
 
int nlev
 
int zlo
 
int zhi
 
int m_axis
 
amrex::Real m_fac_cond
 
amrex::Real m_fac_fus
 
amrex::Real m_fac_sub
 
amrex::Real m_gOcp
 
amrex::Real m_rdOcp
 
amrex::MultiFab * m_z_phys_nd
 
amrex::MultiFab * m_detJ_cc
 
amrex::Array< FabPtr, MicVar_Morr::NumVarsmic_fab_vars
 
amrex::TableData< amrex::Real, 1 > accrrc
 
amrex::TableData< amrex::Real, 1 > accrsi
 
amrex::TableData< amrex::Real, 1 > accrsc
 
amrex::TableData< amrex::Real, 1 > coefice
 
amrex::TableData< amrex::Real, 1 > evaps1
 
amrex::TableData< amrex::Real, 1 > evaps2
 
amrex::TableData< amrex::Real, 1 > accrgi
 
amrex::TableData< amrex::Real, 1 > accrgc
 
amrex::TableData< amrex::Real, 1 > evapg1
 
amrex::TableData< amrex::Real, 1 > evapg2
 
amrex::TableData< amrex::Real, 1 > evapr1
 
amrex::TableData< amrex::Real, 1 > evapr2
 
amrex::TableData< amrex::Real, 1 > rho1d
 
amrex::TableData< amrex::Real, 1 > pres1d
 
amrex::TableData< amrex::Real, 1 > tabs1d
 
amrex::TableData< amrex::Real, 1 > qt1d
 
amrex::TableData< amrex::Real, 1 > qv1d
 
amrex::TableData< amrex::Real, 1 > qn1d
 
amrex::TableData< amrex::Real, 1 > gamaz
 
amrex::TableData< amrex::Real, 1 > zmid
 

Static Private Attributes

static constexpr amrex::Real CFL_MAX = 0.5
 

Member Typedef Documentation

◆ FabPtr

using Morrison::FabPtr = std::shared_ptr<amrex::MultiFab>
private

Constructor & Destructor Documentation

◆ Morrison()

Morrison::Morrison ( )
inline
56 {}

◆ ~Morrison()

virtual Morrison::~Morrison ( )
virtualdefault

Member Function Documentation

◆ Advance()

void Morrison::Advance ( const amrex::Real &  dt_advance,
const SolverChoice sc 
)
inlineoverridevirtual

Reimplemented from NullMoist.

119  {
120  dt = dt_advance;
121 
122  this->Cloud(sc);
123  this->IceFall(sc);
124  this->Precip(sc);
125  this->PrecipFall(sc);
126  }
void Precip(const SolverChoice &sc)
Definition: ERF_Morrison_Precip.cpp:10
amrex::Real dt
Definition: ERF_Morrison.H:288
void PrecipFall(const SolverChoice &sc)
Definition: ERF_Morrison_PrecipFall.cpp:16
void IceFall(const SolverChoice &sc)
Definition: ERF_Morrison_IceFall.cpp:11
void Cloud(const SolverChoice &sc)
Definition: ERF_Morrison_Cloud.cpp:12
Here is the call graph for this function:

◆ Cloud()

void Morrison::Cloud ( const SolverChoice sc)

Split cloud components according to saturation pressures; source theta from latent heat.

13 {
14 
15  constexpr Real an = 1.0/(tbgmax-tbgmin);
16  constexpr Real bn = tbgmin*an;
17 
18  Real fac_cond = m_fac_cond;
19  Real fac_sub = m_fac_sub;
20  Real fac_fus = m_fac_fus;
21  Real rdOcp = m_rdOcp;
22 
23  for ( MFIter mfi(*(mic_fab_vars[MicVar_Morr::tabs]), TilingIfNotGPU()); mfi.isValid(); ++mfi) {
24  auto qt_array = mic_fab_vars[MicVar_Morr::qt]->array(mfi);
25  auto qn_array = mic_fab_vars[MicVar_Morr::qn]->array(mfi);
26  auto qv_array = mic_fab_vars[MicVar_Morr::qv]->array(mfi);
27  auto qcl_array = mic_fab_vars[MicVar_Morr::qcl]->array(mfi);
28  auto qci_array = mic_fab_vars[MicVar_Morr::qci]->array(mfi);
29 
30  auto rho_array = mic_fab_vars[MicVar_Morr::rho]->array(mfi);
31  auto tabs_array = mic_fab_vars[MicVar_Morr::tabs]->array(mfi);
32  auto theta_array = mic_fab_vars[MicVar_Morr::theta]->array(mfi);
33  auto pres_array = mic_fab_vars[MicVar_Morr::pres]->array(mfi);
34 
35  const auto& box3d = mfi.tilebox();
36 
37  ParallelFor(box3d, [=] AMREX_GPU_DEVICE (int i, int j, int k)
38  {
39  // Saturation moisture fractions
40  Real omn;
41  Real qsat;
42  Real qsatw;
43  Real qsati;
44 
45  // Newton iteration vars
46  Real delta_qv, delta_qc, delta_qi;
47 
48  // NOTE: Conversion before iterations is necessary to
49  // convert cloud water to ice or vice versa.
50  // This ensures the omn splitting is enforced
51  // before the Newton iteration, which assumes it is.
52 
53  omn = 1.0;
54  // Cloud ice not permitted (melt to form water)
55  if (tabs_array(i,j,k) >= tbgmax) {
56  omn = 1.0;
57  delta_qi = qci_array(i,j,k);
58  qci_array(i,j,k) = 0.0;
59  qcl_array(i,j,k) += delta_qi;
60  tabs_array(i,j,k) -= fac_fus * delta_qi;
61  pres_array(i,j,k) = rho_array(i,j,k) * R_d * tabs_array(i,j,k)
62  * (1.0 + R_v/R_d * qv_array(i,j,k));
63  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
64  pres_array(i,j,k) *= 0.01;
65  }
66  // Cloud water not permitted (freeze to form ice)
67  else if (tabs_array(i,j,k) <= tbgmin) {
68  omn = 0.0;
69  delta_qc = qcl_array(i,j,k);
70  qcl_array(i,j,k) = 0.0;
71  qci_array(i,j,k) += delta_qc;
72  tabs_array(i,j,k) += fac_fus * delta_qc;
73  pres_array(i,j,k) = rho_array(i,j,k) * R_d * tabs_array(i,j,k)
74  * (1.0 + R_v/R_d * qv_array(i,j,k));
75  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
76  pres_array(i,j,k) *= 0.01;
77  }
78  // Mixed cloud phase (split according to omn)
79  else {
80  omn = an*tabs_array(i,j,k)-bn;
81  delta_qc = qcl_array(i,j,k) - qn_array(i,j,k) * omn;
82  delta_qi = qci_array(i,j,k) - qn_array(i,j,k) * (1.0 - omn);
83  qcl_array(i,j,k) = qn_array(i,j,k) * omn;
84  qci_array(i,j,k) = qn_array(i,j,k) * (1.0 - omn);
85  tabs_array(i,j,k) += fac_fus * delta_qc;
86  pres_array(i,j,k) = rho_array(i,j,k) * R_d * tabs_array(i,j,k)
87  * (1.0 + R_v/R_d * qv_array(i,j,k));
88  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), pres_array(i,j,k), rdOcp);
89  pres_array(i,j,k) *= 0.01;
90  }
91 
92  // Saturation moisture fractions
93  erf_qsatw(tabs_array(i,j,k), pres_array(i,j,k), qsatw);
94  erf_qsati(tabs_array(i,j,k), pres_array(i,j,k), qsati);
95  qsat = omn * qsatw + (1.0-omn) * qsati;
96 
97  // We have enough total moisture to relax to equilibrium
98  if (qt_array(i,j,k) > qsat) {
99 
100  // Update temperature
101  tabs_array(i,j,k) = NewtonIterSat(i, j, k ,
102  fac_cond , fac_fus , fac_sub ,
103  an , bn ,
104  tabs_array, pres_array,
105  qv_array , qcl_array , qci_array,
106  qn_array , qt_array);
107 
108  // Update theta
109  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
110 
111  //
112  // We cannot blindly relax to qsat, but we can convert qc/qi -> qv.
113  // The concept here is that if we put all the moisture into qv and modify
114  // the temperature, we can then check if qv > qsat occurs (for final T/P/qv).
115  // If the reduction in T/qsat and increase in qv does trigger the
116  // aforementioned condition, we can do Newton iteration to drive qv = qsat.
117  //
118  } else {
119  // Changes in each component
120  delta_qv = qcl_array(i,j,k) + qci_array(i,j,k);
121  delta_qc = qcl_array(i,j,k);
122  delta_qi = qci_array(i,j,k);
123 
124  // Partition the change in non-precipitating q
125  qv_array(i,j,k) += delta_qv;
126  qcl_array(i,j,k) = 0.0;
127  qci_array(i,j,k) = 0.0;
128  qn_array(i,j,k) = 0.0;
129  qt_array(i,j,k) = qv_array(i,j,k);
130 
131  // Update temperature (endothermic since we evap/sublime)
132  tabs_array(i,j,k) -= fac_cond * delta_qc + fac_sub * delta_qi;
133 
134  // Update theta
135  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
136 
137  // Verify assumption that qv > qsat does not occur
138  erf_qsatw(tabs_array(i,j,k), pres_array(i,j,k), qsatw);
139  erf_qsati(tabs_array(i,j,k), pres_array(i,j,k), qsati);
140  qsat = omn * qsatw + (1.0-omn) * qsati;
141  if (qt_array(i,j,k) > qsat) {
142 
143  // Update temperature
144  tabs_array(i,j,k) = NewtonIterSat(i, j, k ,
145  fac_cond , fac_fus , fac_sub ,
146  an , bn ,
147  tabs_array, pres_array,
148  qv_array , qcl_array , qci_array,
149  qn_array , qt_array);
150 
151  // Update theta
152  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
153 
154  }
155  }
156  });
157  } // mfi
158 }
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::Real m_fac_cond
Definition: ERF_Morrison.H:297
amrex::Real m_fac_sub
Definition: ERF_Morrison.H:299
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real NewtonIterSat(int &i, int &j, int &k, 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_Morrison.H:147
amrex::Real m_rdOcp
Definition: ERF_Morrison.H:301
amrex::Array< FabPtr, MicVar_Morr::NumVars > mic_fab_vars
Definition: ERF_Morrison.H:308
amrex::Real m_fac_fus
Definition: ERF_Morrison.H:298
@ qv
Definition: ERF_Morrison.H:33
@ pres
Definition: ERF_Morrison.H:29
@ qcl
Definition: ERF_Morrison.H:34
@ tabs
Definition: ERF_Morrison.H:28
@ theta
Definition: ERF_Morrison.H:27
@ qn
Definition: ERF_Morrison.H:32
@ rho
Definition: ERF_Morrison.H:26
@ qci
Definition: ERF_Morrison.H:35
@ qt
Definition: ERF_Morrison.H:31

Referenced by Advance().

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

◆ Compute_Coefficients()

void Morrison::Compute_Coefficients ( )
142 {
143  auto dz = m_geom.CellSize(2);
144  auto lowz = m_geom.ProbLo(2);
145 
146  auto accrrc_t = accrrc.table();
147  auto accrsi_t = accrsi.table();
148  auto accrsc_t = accrsc.table();
149  auto coefice_t = coefice.table();
150  auto evaps1_t = evaps1.table();
151  auto evaps2_t = evaps2.table();
152  auto accrgi_t = accrgi.table();
153  auto accrgc_t = accrgc.table();
154  auto evapg1_t = evapg1.table();
155  auto evapg2_t = evapg2.table();
156  auto evapr1_t = evapr1.table();
157  auto evapr2_t = evapr2.table();
158 
159  auto rho1d_t = rho1d.table();
160  auto pres1d_t = pres1d.table();
161  auto tabs1d_t = tabs1d.table();
162 
163  auto gamaz_t = gamaz.table();
164  auto zmid_t = zmid.table();
165 
166  Real gam3 = erf_gammafff(3.0 );
167  Real gamr1 = erf_gammafff(3.0+b_rain );
168  Real gamr2 = erf_gammafff((5.0+b_rain)/2.0);
169  Real gams1 = erf_gammafff(3.0+b_snow );
170  Real gams2 = erf_gammafff((5.0+b_snow)/2.0);
171  Real gamg1 = erf_gammafff(3.0+b_grau );
172  Real gamg2 = erf_gammafff((5.0+b_grau)/2.0);
173 
174  // calculate the plane average variables
178  rho_ave.compute_averages(ZDir(), rho_ave.field());
179  theta_ave.compute_averages(ZDir(), theta_ave.field());
180  qv_ave.compute_averages(ZDir(), qv_ave.field());
181 
182  // get host variable rho, and rhotheta
183  int ncell = rho_ave.ncell_line();
184 
185  Gpu::HostVector<Real> rho_h(ncell), theta_h(ncell), qv_h(ncell);
186  rho_ave.line_average(0, rho_h);
187  theta_ave.line_average(0, theta_h);
188  qv_ave.line_average(0, qv_h);
189 
190  // copy data to device
191  Gpu::DeviceVector<Real> rho_d(ncell), theta_d(ncell), qv_d(ncell);
192  Gpu::copyAsync(Gpu::hostToDevice, rho_h.begin(), rho_h.end(), rho_d.begin());
193  Gpu::copyAsync(Gpu::hostToDevice, theta_h.begin(), theta_h.end(), theta_d.begin());
194  Gpu::copyAsync(Gpu::hostToDevice, qv_h.begin(), qv_h.end(), qv_d.begin());
195  Gpu::streamSynchronize();
196 
197  Real* rho_dptr = rho_d.data();
198  Real* theta_dptr = theta_d.data();
199  Real* qv_dptr = qv_d.data();
200 
201  Real gOcp = m_gOcp;
202 
203  ParallelFor(nlev, [=] AMREX_GPU_DEVICE (int k) noexcept
204  {
205  Real RhoTheta = rho_dptr[k]*theta_dptr[k];
206  Real pressure = getPgivenRTh(RhoTheta, qv_dptr[k]);
207  rho1d_t(k) = rho_dptr[k];
208  pres1d_t(k) = pressure*0.01;
209  // NOTE: Limit the temperature to the melting point of ice to avoid a divide by
210  // 0 condition when computing the cold evaporation coefficients. This should
211  // not affect results since evporation requires snow/graupel to be present
212  // and thus T<273.16
213  tabs1d_t(k) = std::min(getTgivenRandRTh(rho_dptr[k], RhoTheta, qv_dptr[k]),273.16);
214  zmid_t(k) = lowz + (k+0.5)*dz;
215  gamaz_t(k) = gOcp*zmid_t(k);
216  });
217 
218  if(round(gam3) != 2) {
219  std::cout << "cannot compute gamma-function in Microphysics::Init" << std::endl;
220  std::exit(-1);
221  }
222 
223  // Populate all the coefficients
224  ParallelFor(nlev, [=] AMREX_GPU_DEVICE (int k) noexcept
225  {
226  Real Prefactor;
227  Real pratio = sqrt(1.29 / rho1d_t(k));
228  //Real rrr1 = 393.0/(tabs1d_t(k)+120.0)*std::pow((tabs1d_t(k)/273.0),1.5);
229  //Real rrr2 = std::pow((tabs1d_t(k)/273.0),1.94)*(1000.0/pres1d_t(k));
230  Real estw = 100.0*erf_esatw(tabs1d_t(k));
231  Real esti = 100.0*erf_esati(tabs1d_t(k));
232 
233  // accretion by snow:
234  Real coef1 = 0.25 * PI * nzeros * a_snow * gams1 * pratio/pow((PI * rhos * nzeros/rho1d_t(k) ) , ((3.0+b_snow)/4.0));
235  Real coef2 = exp(0.025*(tabs1d_t(k) - 273.15));
236  accrsi_t(k) = coef1 * coef2 * esicoef;
237  accrsc_t(k) = coef1 * esccoef;
238  coefice_t(k) = coef2;
239 
240  // evaporation of snow:
241  coef1 = (lsub/(tabs1d_t(k)*R_v)-1.0)*lsub/(therco*tabs1d_t(k));
242  coef2 = R_v * R_d / (diffelq * esti);
243  Prefactor = 2.0 * PI * nzeros / (rho1d_t(k) * (coef1 + coef2));
244  Prefactor *= (2.0/PI); // Shape factor snow
245  evaps1_t(k) = Prefactor * 0.65 * sqrt(rho1d_t(k) / (PI * rhos * nzeros));
246  evaps2_t(k) = Prefactor * 0.44 * sqrt(a_snow * rho1d_t(k) / muelq) * gams2
247  * sqrt(pratio) * pow(rho1d_t(k) / (PI * rhos * nzeros) , ((5.0+b_snow)/8.0));
248 
249  // accretion by graupel:
250  coef1 = 0.25*PI*nzerog*a_grau*gamg1*pratio/pow((PI*rhog*nzerog/rho1d_t(k)) , ((3.0+b_grau)/4.0));
251  coef2 = exp(0.025*(tabs1d_t(k) - 273.15));
252  accrgi_t(k) = coef1 * coef2 * egicoef;
253  accrgc_t(k) = coef1 * egccoef;
254 
255  // evaporation of graupel:
256  coef1 = (lsub/(tabs1d_t(k)*R_v)-1.0)*lsub/(therco*tabs1d_t(k));
257  coef2 = R_v * R_d / (diffelq * esti);
258  Prefactor = 2.0 * PI * nzerog / (rho1d_t(k) * (coef1 + coef2)); // Shape factor for graupel is 1
259  evapg1_t(k) = Prefactor * 0.78 * sqrt(rho1d_t(k) / (PI * rhog * nzerog));
260  evapg2_t(k) = Prefactor * 0.31 * sqrt(a_grau * rho1d_t(k) / muelq) * gamg2
261  * sqrt(pratio) * pow(rho1d_t(k) / (PI * rhog * nzerog) , ((5.0+b_grau)/8.0));
262 
263  // accretion by rain:
264  accrrc_t(k) = 0.25 * PI * nzeror * a_rain * gamr1 * pratio/pow((PI * rhor * nzeror / rho1d_t(k)) , ((3.0+b_rain)/4.))* erccoef;
265 
266  // evaporation of rain:
267  coef1 = (lcond/(tabs1d_t(k)*R_v)-1.0)*lcond/(therco*tabs1d_t(k));
268  coef2 = R_v * R_d / (diffelq * estw);
269  Prefactor = 2.0 * PI * nzeror / (rho1d_t(k) * (coef1 + coef2)); // Shape factor for rain is 1
270  evapr1_t(k) = Prefactor * 0.78 * sqrt(rho1d_t(k) / (PI * rhor * nzeror));
271  evapr2_t(k) = Prefactor * 0.31 * sqrt(a_rain * rho1d_t(k) / muelq) * gamr2
272  * sqrt(pratio) * pow(rho1d_t(k) / (PI * rhor * nzeror) , ((5.0+b_rain)/8.0));
273  });
274 }
constexpr amrex::Real rhog
Definition: ERF_Constants.H:30
constexpr amrex::Real muelq
Definition: ERF_Constants.H:75
constexpr amrex::Real nzerog
Definition: ERF_Constants.H:59
constexpr amrex::Real a_grau
Definition: ERF_Constants.H:42
constexpr amrex::Real lsub
Definition: ERF_Constants.H:68
constexpr amrex::Real esicoef
Definition: ERF_Constants.H:53
constexpr amrex::Real diffelq
Definition: ERF_Constants.H:73
constexpr amrex::Real therco
Definition: ERF_Constants.H:74
constexpr amrex::Real b_grau
Definition: ERF_Constants.H:43
constexpr amrex::Real egccoef
Definition: ERF_Constants.H:54
constexpr amrex::Real egicoef
Definition: ERF_Constants.H:55
constexpr amrex::Real b_rain
Definition: ERF_Constants.H:39
constexpr amrex::Real lcond
Definition: ERF_Constants.H:66
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
constexpr amrex::Real nzeror
Definition: ERF_Constants.H:57
constexpr amrex::Real rhos
Definition: ERF_Constants.H:29
constexpr amrex::Real esccoef
Definition: ERF_Constants.H:52
constexpr amrex::Real rhor
Definition: ERF_Constants.H:28
constexpr amrex::Real a_rain
Definition: ERF_Constants.H:38
constexpr amrex::Real nzeros
Definition: ERF_Constants.H:58
constexpr amrex::Real a_snow
Definition: ERF_Constants.H:40
constexpr amrex::Real b_snow
Definition: ERF_Constants.H:41
constexpr amrex::Real erccoef
Definition: ERF_Constants.H:51
DirectionSelector< 2 > ZDir
Definition: ERF_DirectionSelector.H:38
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=0.)
Definition: ERF_EOS.H:84
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_esatw(amrex::Real t)
Definition: ERF_MicrophysicsUtils.H:64
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_esati(amrex::Real t)
Definition: ERF_MicrophysicsUtils.H:24
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real erf_gammafff(amrex::Real x)
Definition: ERF_MicrophysicsUtils.H:15
amrex::Geometry m_geom
Definition: ERF_Morrison.H:282
amrex::TableData< amrex::Real, 1 > evapg2
Definition: ERF_Morrison.H:320
amrex::TableData< amrex::Real, 1 > pres1d
Definition: ERF_Morrison.H:326
amrex::TableData< amrex::Real, 1 > zmid
Definition: ERF_Morrison.H:333
amrex::Real m_gOcp
Definition: ERF_Morrison.H:300
amrex::TableData< amrex::Real, 1 > accrgi
Definition: ERF_Morrison.H:317
amrex::TableData< amrex::Real, 1 > accrgc
Definition: ERF_Morrison.H:318
amrex::TableData< amrex::Real, 1 > tabs1d
Definition: ERF_Morrison.H:327
int nlev
Definition: ERF_Morrison.H:291
amrex::TableData< amrex::Real, 1 > gamaz
Definition: ERF_Morrison.H:332
amrex::TableData< amrex::Real, 1 > coefice
Definition: ERF_Morrison.H:314
int m_axis
Definition: ERF_Morrison.H:294
amrex::TableData< amrex::Real, 1 > accrsi
Definition: ERF_Morrison.H:312
amrex::TableData< amrex::Real, 1 > accrrc
Definition: ERF_Morrison.H:311
amrex::TableData< amrex::Real, 1 > evapg1
Definition: ERF_Morrison.H:319
amrex::TableData< amrex::Real, 1 > evapr1
Definition: ERF_Morrison.H:321
amrex::TableData< amrex::Real, 1 > evaps1
Definition: ERF_Morrison.H:315
amrex::TableData< amrex::Real, 1 > evaps2
Definition: ERF_Morrison.H:316
amrex::TableData< amrex::Real, 1 > rho1d
Definition: ERF_Morrison.H:325
amrex::TableData< amrex::Real, 1 > evapr2
Definition: ERF_Morrison.H:322
amrex::TableData< amrex::Real, 1 > accrsc
Definition: ERF_Morrison.H:313
Definition: ERF_PlaneAverage.H:14

Referenced by Update_Micro_Vars().

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

◆ Copy_Micro_to_State()

void Morrison::Copy_Micro_to_State ( amrex::MultiFab &  cons_in)
overridevirtual

Updates conserved and microphysics variables in the provided MultiFabs from the internal MultiFabs that store Microphysics module data.

Parameters
[out]consConserved variables
[out]qmoistqv, qc, qi, qr, qs, qg

Reimplemented from NullMoist.

16 {
17  // Get the temperature, density, theta, qt and qp from input
18  for ( MFIter mfi(cons,TilingIfNotGPU()); mfi.isValid(); ++mfi) {
19  const auto& box3d = mfi.tilebox();
20 
21  auto states_arr = cons.array(mfi);
22 
23  auto rho_arr = mic_fab_vars[MicVar_Morr::rho]->array(mfi);
24  auto theta_arr = mic_fab_vars[MicVar_Morr::theta]->array(mfi);
25 
26  auto qv_arr = mic_fab_vars[MicVar_Morr::qv]->array(mfi);
27  auto qc_arr = mic_fab_vars[MicVar_Morr::qcl]->array(mfi);
28  auto qi_arr = mic_fab_vars[MicVar_Morr::qci]->array(mfi);
29 
30  auto qpr_arr = mic_fab_vars[MicVar_Morr::qpr]->array(mfi);
31  auto qps_arr = mic_fab_vars[MicVar_Morr::qps]->array(mfi);
32  auto qpg_arr = mic_fab_vars[MicVar_Morr::qpg]->array(mfi);
33 
34  // get potential total density, temperature, qt, qp
35  ParallelFor( box3d, [=] AMREX_GPU_DEVICE (int i, int j, int k)
36  {
37  states_arr(i,j,k,RhoTheta_comp) = rho_arr(i,j,k)*theta_arr(i,j,k);
38 
39  states_arr(i,j,k,RhoQ1_comp) = rho_arr(i,j,k)*std::max(0.0,qv_arr(i,j,k));
40  states_arr(i,j,k,RhoQ2_comp) = rho_arr(i,j,k)*std::max(0.0,qc_arr(i,j,k));
41  states_arr(i,j,k,RhoQ3_comp) = rho_arr(i,j,k)*std::max(0.0,qi_arr(i,j,k));
42 
43  states_arr(i,j,k,RhoQ4_comp) = rho_arr(i,j,k)*std::max(0.0,qpr_arr(i,j,k));
44  states_arr(i,j,k,RhoQ5_comp) = rho_arr(i,j,k)*std::max(0.0,qps_arr(i,j,k));
45  states_arr(i,j,k,RhoQ6_comp) = rho_arr(i,j,k)*std::max(0.0,qpg_arr(i,j,k));
46  });
47  }
48 
49  // Fill interior ghost cells and periodic boundaries
50  cons.FillBoundary(m_geom.periodicity());
51 }
#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
@ qpg
Definition: ERF_Morrison.H:40
@ qps
Definition: ERF_Morrison.H:39
@ qpr
Definition: ERF_Morrison.H:38
@ cons
Definition: ERF_IndexDefines.H:140

Referenced by Update_State_Vars().

Here is the caller graph for this function:

◆ Copy_State_to_Micro()

void Morrison::Copy_State_to_Micro ( const amrex::MultiFab &  cons_in)
overridevirtual

Initializes the Microphysics module.

Parameters
[in]cons_inConserved variables input

Reimplemented from NullMoist.

90 {
91  // Get the temperature, density, theta, qt and qp from input
92  for ( MFIter mfi(cons_in); mfi.isValid(); ++mfi) {
93  const auto& box3d = mfi.growntilebox();
94 
95  auto states_array = cons_in.array(mfi);
96 
97  // Non-precipitating
98  auto qv_array = mic_fab_vars[MicVar_Morr::qv]->array(mfi);
99  auto qc_array = mic_fab_vars[MicVar_Morr::qcl]->array(mfi);
100  auto qi_array = mic_fab_vars[MicVar_Morr::qci]->array(mfi);
101  auto qn_array = mic_fab_vars[MicVar_Morr::qn]->array(mfi);
102  auto qt_array = mic_fab_vars[MicVar_Morr::qt]->array(mfi);
103 
104  // Precipitating
105  auto qpr_array = mic_fab_vars[MicVar_Morr::qpr]->array(mfi);
106  auto qps_array = mic_fab_vars[MicVar_Morr::qps]->array(mfi);
107  auto qpg_array = mic_fab_vars[MicVar_Morr::qpg]->array(mfi);
108  auto qp_array = mic_fab_vars[MicVar_Morr::qp]->array(mfi);
109 
110  auto rho_array = mic_fab_vars[MicVar_Morr::rho]->array(mfi);
111  auto theta_array = mic_fab_vars[MicVar_Morr::theta]->array(mfi);
112  auto tabs_array = mic_fab_vars[MicVar_Morr::tabs]->array(mfi);
113  auto pres_array = mic_fab_vars[MicVar_Morr::pres]->array(mfi);
114 
115  // Get pressure, theta, temperature, density, and qt, qp
116  ParallelFor( box3d, [=] AMREX_GPU_DEVICE (int i, int j, int k)
117  {
118  rho_array(i,j,k) = states_array(i,j,k,Rho_comp);
119  theta_array(i,j,k) = states_array(i,j,k,RhoTheta_comp)/states_array(i,j,k,Rho_comp);
120 
121  qv_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ1_comp)/states_array(i,j,k,Rho_comp));
122  qc_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ2_comp)/states_array(i,j,k,Rho_comp));
123  qi_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ3_comp)/states_array(i,j,k,Rho_comp));
124  qn_array(i,j,k) = qc_array(i,j,k) + qi_array(i,j,k);
125  qt_array(i,j,k) = qv_array(i,j,k) + qn_array(i,j,k);
126 
127  qpr_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ4_comp)/states_array(i,j,k,Rho_comp));
128  qps_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ5_comp)/states_array(i,j,k,Rho_comp));
129  qpg_array(i,j,k) = std::max(0.0,states_array(i,j,k,RhoQ6_comp)/states_array(i,j,k,Rho_comp));
130  qp_array(i,j,k) = qpr_array(i,j,k) + qps_array(i,j,k) + qpg_array(i,j,k);
131 
132  tabs_array(i,j,k) = getTgivenRandRTh(states_array(i,j,k,Rho_comp),
133  states_array(i,j,k,RhoTheta_comp),
134  qv_array(i,j,k));
135  pres_array(i,j,k) = getPgivenRTh(states_array(i,j,k,RhoTheta_comp), qv_array(i,j,k)) * 0.01;
136  });
137  }
138 }
#define Rho_comp
Definition: ERF_IndexDefines.H:36
@ qp
Definition: ERF_Morrison.H:37

Referenced by Update_Micro_Vars().

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

◆ Define()

void Morrison::Define ( SolverChoice sc)
inlineoverridevirtual

Reimplemented from NullMoist.

76  {
77  m_fac_cond = lcond / sc.c_p;
78  m_fac_fus = lfus / sc.c_p;
79  m_fac_sub = lsub / sc.c_p;
80  m_gOcp = CONST_GRAV / sc.c_p;
81  m_axis = sc.ave_plane;
82  m_rdOcp = sc.rdOcp;
83  }
constexpr amrex::Real lfus
Definition: ERF_Constants.H:67
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
amrex::Real rdOcp
Definition: ERF_DataStruct.H:711
amrex::Real c_p
Definition: ERF_DataStruct.H:710
int ave_plane
Definition: ERF_DataStruct.H:773

◆ IceFall()

void Morrison::IceFall ( const SolverChoice sc)

Sedimentation of cloud ice (A32)

12 {
13  Real dz = m_geom.CellSize(2);
14  Real dtn = dt;
15  Real coef = dtn/dz;
16 
17  auto domain = m_geom.Domain();
18  int k_lo = domain.smallEnd(2);
19  int k_hi = domain.bigEnd(2);
20 
27 
28  MultiFab fz;
29  IntVect ng = qcl->nGrowVect();
30  BoxArray ba = qcl->boxArray();
31  DistributionMapping dm = qcl->DistributionMap();
32  fz.define(convert(ba, IntVect(0,0,1)), dm, 1, ng);
33  fz.setVal(0.);
34 
35  for (MFIter mfi(fz, TileNoZ()); mfi.isValid(); ++mfi) {
36  auto qci_array = qci->array(mfi);
37  auto rho_array = rho->array(mfi);
38  auto fz_array = fz.array(mfi);
39 
40  const auto& box3d = mfi.tilebox();
41 
42  ParallelFor(box3d, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
43  {
44  Real rho_avg, qci_avg;
45  if (k==k_lo) {
46  rho_avg = rho_array(i,j,k);
47  qci_avg = qci_array(i,j,k);
48  } else if (k==k_hi+1) {
49  rho_avg = rho_array(i,j,k-1);
50  qci_avg = qci_array(i,j,k-1);
51  } else {
52  rho_avg = 0.5*(rho_array(i,j,k-1) + rho_array(i,j,k));
53  qci_avg = 0.5*(qci_array(i,j,k-1) + qci_array(i,j,k));
54  }
55  Real vt_ice = min( 0.4 , 8.66 * pow( (std::max(0.,qci_avg)+1.e-10) , 0.24) );
56 
57  // NOTE: Fz is the sedimentation flux from the advective operator.
58  // In the terrain-following coordinate system, the z-deriv in
59  // the divergence uses the normal velocity (Omega). However,
60  // there are no u/v components to the sedimentation velocity.
61  // Therefore, we simply end up with a division by detJ when
62  // evaluating the source term: dJinv * (flux_hi - flux_lo) * dzinv.
63  fz_array(i,j,k) = rho_avg*vt_ice*qci_avg;
64  });
65  }
66 
67  // Compute number of substeps from maximum terminal velocity
68  Real wt_max;
69  int n_substep;
70  auto const& ma_fz_arr = fz.const_arrays();
71  GpuTuple<Real> max = ParReduce(TypeList<ReduceOpMax>{},
72  TypeList<Real>{},
73  fz, IntVect(0),
74  [=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
75  -> GpuTuple<Real>
76  {
77  return { ma_fz_arr[box_no](i,j,k) };
78  });
79  wt_max = get<0>(max) + std::numeric_limits<Real>::epsilon();
80  n_substep = int( std::ceil(wt_max * coef / CFL_MAX) );
81  AMREX_ALWAYS_ASSERT(n_substep >= 1);
82  coef /= Real(n_substep);
83  dtn /= Real(n_substep);
84 
85  // Substep the vertical advection
86  for (int nsub(0); nsub<n_substep; ++nsub) {
87  for (MFIter mfi(*qci, TileNoZ()); mfi.isValid(); ++mfi) {
88  auto qci_array = qci->array(mfi);
89  auto qn_array = qn->array(mfi);
90  auto qt_array = qt->array(mfi);
91  auto rho_array = rho->array(mfi);
92  auto fz_array = fz.array(mfi);
93 
94  const auto dJ_array = (m_detJ_cc) ? m_detJ_cc->const_array(mfi) : Array4<const Real>{};
95 
96  const auto& tbx = mfi.tilebox();
97  const auto& tbz = mfi.tilebox(IntVect(0,0,1),IntVect(0));
98 
99  // Update vertical flux every substep
100  ParallelFor(tbz, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
101  {
102  Real rho_avg, qci_avg;
103  if (k==k_lo) {
104  rho_avg = rho_array(i,j,k);
105  qci_avg = qci_array(i,j,k);
106  } else if (k==k_hi+1) {
107  rho_avg = rho_array(i,j,k-1);
108  qci_avg = qci_array(i,j,k-1);
109  } else {
110  rho_avg = 0.5*(rho_array(i,j,k-1) + rho_array(i,j,k));
111  qci_avg = 0.5*(qci_array(i,j,k-1) + qci_array(i,j,k));
112  }
113  Real vt_ice = min( 0.4 , 8.66 * pow( (std::max(0.,qci_avg)+1.e-10) , 0.24) );
114 
115  // NOTE: Fz is the sedimentation flux from the advective operator.
116  // In the terrain-following coordinate system, the z-deriv in
117  // the divergence uses the normal velocity (Omega). However,
118  // there are no u/v components to the sedimentation velocity.
119  // Therefore, we simply end up with a division by detJ when
120  // evaluating the source term: dJinv * (flux_hi - flux_lo) * dzinv.
121  fz_array(i,j,k) = rho_avg*vt_ice*qci_avg;
122  });
123 
124  // Update precip every substep
125  ParallelFor(tbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
126  {
127  // Jacobian determinant
128  Real dJinv = (dJ_array) ? 1.0/dJ_array(i,j,k) : 1.0;
129 
130  //==================================================
131  // Cloud ice sedimentation (A32)
132  //==================================================
133  Real dqi = dJinv * (1.0/rho_array(i,j,k)) * ( fz_array(i,j,k+1) - fz_array(i,j,k) ) * coef;
134  dqi = std::max(-qci_array(i,j,k), dqi);
135 
136  // Add this increment to both non-precipitating and total water.
137  qci_array(i,j,k) += dqi;
138  qn_array(i,j,k) += dqi;
139  qt_array(i,j,k) += dqi;
140 
141  // NOTE: Sedimentation does not affect the potential temperature,
142  // but it does affect the liquid/ice static energy.
143  // No source to Theta occurs here.
144  });
145  } // mfi
146  } // nsub
147 }
AMREX_FORCE_INLINE amrex::IntVect TileNoZ()
Definition: ERF_TileNoZ.H:11
static constexpr amrex::Real CFL_MAX
Definition: ERF_Morrison.H:276
amrex::MultiFab * m_detJ_cc
Definition: ERF_Morrison.H:305
@ qcl
Definition: ERF_Kessler.H:29
@ tabs
Definition: ERF_Kessler.H:24
@ rho
Definition: ERF_Kessler.H:22
@ qt
Definition: ERF_Kessler.H:27

Referenced by Advance().

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

◆ Init()

void Morrison::Init ( const amrex::MultiFab &  cons_in,
const amrex::BoxArray &  grids,
const amrex::Geometry &  geom,
const amrex::Real &  dt_advance,
std::unique_ptr< amrex::MultiFab > &  z_phys_nd,
std::unique_ptr< amrex::MultiFab > &  detJ_cc 
)
overridevirtual

Initializes the Microphysics module.

Parameters
[in]cons_inConserved variables input
[in]qc_inCloud variables input
[in,out]qv_inVapor variables input
[in]qi_inIce variables input
[in]gridsThe boxes on which we will evolve the solution
[in]geomGeometry associated with these MultiFabs and grids
[in]dt_advanceTimestep for the advance

Reimplemented from NullMoist.

28 {
29  amrex::Abort("Morrison not actually implemented yet; this is SAM");
30 
31  dt = dt_advance;
32  m_geom = geom;
33  m_gtoe = grids;
34 
35  m_z_phys_nd = z_phys_nd.get();
36  m_detJ_cc = detJ_cc.get();
37 
38  MicVarMap.resize(m_qmoist_size);
40 
41  // initialize microphysics variables
42  for (auto ivar = 0; ivar < MicVar_Morr::NumVars; ++ivar) {
43  mic_fab_vars[ivar] = std::make_shared<MultiFab>(cons_in.boxArray(), cons_in.DistributionMap(),
44  1, cons_in.nGrowVect());
45  mic_fab_vars[ivar]->setVal(0.);
46  }
47 
48  // Set class data members
49  for ( MFIter mfi(cons_in, TileNoZ()); mfi.isValid(); ++mfi) {
50  const auto& box3d = mfi.tilebox();
51 
52  const auto& lo = lbound(box3d);
53  const auto& hi = ubound(box3d);
54 
55  nlev = box3d.length(2);
56  zlo = lo.z;
57  zhi = hi.z;
58 
59  // parameters
60  accrrc.resize({zlo}, {zhi});
61  accrsi.resize({zlo}, {zhi});
62  accrsc.resize({zlo}, {zhi});
63  coefice.resize({zlo}, {zhi});
64  evaps1.resize({zlo}, {zhi});
65  evaps2.resize({zlo}, {zhi});
66  accrgi.resize({zlo}, {zhi});
67  accrgc.resize({zlo}, {zhi});
68  evapg1.resize({zlo}, {zhi});
69  evapg2.resize({zlo}, {zhi});
70  evapr1.resize({zlo}, {zhi});
71  evapr2.resize({zlo}, {zhi});
72 
73  // data (input)
74  rho1d.resize({zlo}, {zhi});
75  pres1d.resize({zlo}, {zhi});
76  tabs1d.resize({zlo}, {zhi});
77  gamaz.resize({zlo}, {zhi});
78  zmid.resize({zlo}, {zhi});
79  }
80 }
amrex::Vector< int > MicVarMap
Definition: ERF_Morrison.H:279
amrex::MultiFab * m_z_phys_nd
Definition: ERF_Morrison.H:304
int m_qmoist_size
Definition: ERF_Morrison.H:270
int zlo
Definition: ERF_Morrison.H:291
amrex::BoxArray m_gtoe
Definition: ERF_Morrison.H:285
int zhi
Definition: ERF_Morrison.H:291
@ graup_accum
Definition: ERF_Morrison.H:44
@ NumVars
Definition: ERF_Morrison.H:46
@ rain_accum
Definition: ERF_Morrison.H:42
@ snow_accum
Definition: ERF_Morrison.H:43
Here is the call graph for this function:

◆ NewtonIterSat()

AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE amrex::Real Morrison::NewtonIterSat ( int &  i,
int &  j,
int &  k,
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 
)
inlinestatic
160  {
161  // Solution tolerance
162  amrex::Real tol = 1.0e-4;
163 
164  // Saturation moisture fractions
165  amrex::Real omn, domn;
166  amrex::Real qsat, dqsat;
167  amrex::Real qsatw, dqsatw;
168  amrex::Real qsati, dqsati;
169 
170  // Newton iteration vars
171  int niter;
172  amrex::Real fff, dfff, dtabs;
173  amrex::Real lstar, dlstar;
174  amrex::Real lstarw, lstari;
175  amrex::Real delta_qv, delta_qc, delta_qi;
176 
177  // Initial guess for temperature & pressure
178  amrex::Real tabs = tabs_array(i,j,k);
179  amrex::Real pres = pres_array(i,j,k);
180 
181  niter = 0;
182  dtabs = 1;
183  //==================================================
184  // Newton iteration to qv=qsat (cloud phase only)
185  //==================================================
186  do {
187  // Latent heats and their derivatives wrt to T
188  lstarw = fac_cond;
189  lstari = fac_fus;
190  domn = 0.0;
191 
192  // Saturation moisture fractions
193  erf_qsatw(tabs, pres, qsatw);
194  erf_qsati(tabs, pres, qsati);
195  erf_dtqsatw(tabs, pres, dqsatw);
196  erf_dtqsati(tabs, pres, dqsati);
197 
198  // Cloud ice not permitted (condensation & fusion)
199  if(tabs >= tbgmax) {
200  omn = 1.0;
201  }
202  // Cloud water not permitted (sublimation & fusion)
203  else if(tabs <= tbgmin) {
204  omn = 0.0;
205  lstarw = fac_sub;
206  }
207  // Mixed cloud phase (condensation & fusion)
208  else {
209  omn = an*tabs-bn;
210  domn = an;
211  }
212 
213  // Linear combination of each component
214  qsat = omn * qsatw + (1.0-omn) * qsati;
215  dqsat = omn * dqsatw + (1.0-omn) * dqsati
216  + domn * qsatw - domn * qsati;
217  lstar = omn * lstarw + (1.0-omn) * lstari;
218  dlstar = domn * lstarw - domn * lstari;
219 
220  // Function for root finding:
221  // 0 = -T_new + T_old + L_eff/C_p * (qv - qsat)
222  fff = -tabs + tabs_array(i,j,k) + lstar*(qv_array(i,j,k) - qsat);
223 
224  // Derivative of function (T_new iterated on)
225  dfff = -1.0 + dlstar*(qv_array(i,j,k) - qsat) - lstar*dqsat;
226 
227  // Update the temperature
228  dtabs = -fff/dfff;
229  tabs += dtabs;
230 
231  // Update iteration
232  niter = niter+1;
233  } while(std::abs(dtabs) > tol && niter < 20);
234 
235  // Update qsat from last iteration (dq = dq/dt * dt)
236  qsat += dqsat*dtabs;
237 
238  // Changes in each component
239  delta_qv = qv_array(i,j,k) - qsat;
240  delta_qc = std::max(-qc_array(i,j,k), delta_qv * omn);
241  delta_qi = std::max(-qi_array(i,j,k), delta_qv * (1.0-omn));
242 
243  // Partition the change in non-precipitating q
244  qv_array(i,j,k) = qsat;
245  qc_array(i,j,k) += delta_qc;
246  qi_array(i,j,k) += delta_qi;
247  qn_array(i,j,k) = qc_array(i,j,k) + qi_array(i,j,k);
248  qt_array(i,j,k) = qv_array(i,j,k) + qn_array(i,j,k);
249 
250  // Return to temperature
251  return tabs;
252  }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_dtqsatw(amrex::Real t, amrex::Real p, amrex::Real &dtqsatw)
Definition: ERF_MicrophysicsUtils.H:170
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void erf_dtqsati(amrex::Real t, amrex::Real p, amrex::Real &dtqsati)
Definition: ERF_MicrophysicsUtils.H:165
Here is the call graph for this function:

◆ Precip()

void Morrison::Precip ( const SolverChoice sc)

Autoconversion (A30), Accretion (A28), Evaporation (A24)

11 {
12  Real powr1 = (3.0 + b_rain) / 4.0;
13  Real powr2 = (5.0 + b_rain) / 8.0;
14  Real pows1 = (3.0 + b_snow) / 4.0;
15  Real pows2 = (5.0 + b_snow) / 8.0;
16  Real powg1 = (3.0 + b_grau) / 4.0;
17  Real powg2 = (5.0 + b_grau) / 8.0;
18 
19  auto accrrc_t = accrrc.table();
20  auto accrsc_t = accrsc.table();
21  auto accrsi_t = accrsi.table();
22  auto accrgc_t = accrgc.table();
23  auto accrgi_t = accrgi.table();
24  auto coefice_t = coefice.table();
25  auto evapr1_t = evapr1.table();
26  auto evapr2_t = evapr2.table();
27  auto evaps1_t = evaps1.table();
28  auto evaps2_t = evaps2.table();
29  auto evapg1_t = evapg1.table();
30  auto evapg2_t = evapg2.table();
31 
32  Real fac_cond = m_fac_cond;
33  Real fac_sub = m_fac_sub;
34  Real fac_fus = m_fac_fus;
35  Real rdOcp = m_rdOcp;
36 
37  Real eps = std::numeric_limits<Real>::epsilon();
38 
39  Real dtn = dt;
40 
41  // get the temperature, density, theta, qt and qp from input
42  for ( MFIter mfi(*(mic_fab_vars[MicVar_Morr::tabs]),TilingIfNotGPU()); mfi.isValid(); ++mfi) {
43  auto theta_array = mic_fab_vars[MicVar_Morr::theta]->array(mfi);
44  auto tabs_array = mic_fab_vars[MicVar_Morr::tabs]->array(mfi);
45  auto pres_array = mic_fab_vars[MicVar_Morr::pres]->array(mfi);
46 
47  // Non-precipitating
48  auto qv_array = mic_fab_vars[MicVar_Morr::qv]->array(mfi);
49  auto qcl_array = mic_fab_vars[MicVar_Morr::qcl]->array(mfi);
50  auto qci_array = mic_fab_vars[MicVar_Morr::qci]->array(mfi);
51  auto qn_array = mic_fab_vars[MicVar_Morr::qn]->array(mfi);
52  auto qt_array = mic_fab_vars[MicVar_Morr::qt]->array(mfi);
53 
54  // Precipitating
55  auto qpr_array = mic_fab_vars[MicVar_Morr::qpr]->array(mfi);
56  auto qps_array = mic_fab_vars[MicVar_Morr::qps]->array(mfi);
57  auto qpg_array = mic_fab_vars[MicVar_Morr::qpg]->array(mfi);
58  auto qp_array = mic_fab_vars[MicVar_Morr::qp]->array(mfi);
59 
60  const auto& box3d = mfi.tilebox();
61 
62  ParallelFor(box3d, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
63  {
64  //------- Autoconversion/accretion
65  Real omn, omp, omg;
66  Real qsat, qsatw, qsati;
67 
68  Real qcc, qii, qpr, qps, qpg;
69  Real dprc, dpsc, dpgc;
70  Real dpsi, dpgi;
71 
72  Real dqc, dqca, dqi, dqia, dqp;
73  Real dqpr, dqps, dqpg;
74 
75  Real auto_r, autos;
76  Real accrcr, accrcs, accris, accrcg, accrig;
77 
78  // Work to be done for autoc/accr or evap
79  if (qn_array(i,j,k)+qp_array(i,j,k) > 0.0) {
80  omn = std::max(0.0,std::min(1.0,(tabs_array(i,j,k)-tbgmin)*a_bg));
81  omp = std::max(0.0,std::min(1.0,(tabs_array(i,j,k)-tprmin)*a_pr));
82  omg = std::max(0.0,std::min(1.0,(tabs_array(i,j,k)-tgrmin)*a_gr));
83 
84  qcc = qcl_array(i,j,k);
85  qii = qci_array(i,j,k);
86 
87  qpr = qpr_array(i,j,k);
88  qps = qps_array(i,j,k);
89  qpg = qpg_array(i,j,k);
90 
91  //==================================================
92  // Autoconversion (A30/A31) and accretion (A27)
93  //==================================================
94  if (qn_array(i,j,k) > 0.0) {
95  accrcr = 0.0;
96  accrcs = 0.0;
97  accris = 0.0;
98  accrcg = 0.0;
99  accrig = 0.0;
100 
101  if (qcc > qcw0) {
102  auto_r = alphaelq;
103  } else {
104  auto_r = 0.0;
105  }
106 
107  if (qii > qci0) {
108  autos = betaelq*coefice_t(k);
109  } else {
110  autos = 0.0;
111  }
112 
113  if (omp > 0.001) {
114  accrcr = accrrc_t(k);
115  }
116 
117  if (omp < 0.999 && omg < 0.999) {
118  accrcs = accrsc_t(k);
119  accris = accrsi_t(k);
120  }
121 
122  if (omp < 0.999 && omg > 0.001) {
123  accrcg = accrgc_t(k);
124  accrig = accrgi_t(k);
125  }
126 
127  // Autoconversion & accretion (sink for cloud comps)
128  dqca = dtn * auto_r * (qcc-qcw0);
129  dprc = dtn * accrcr * qcc * std::pow(qpr, powr1);
130  dpsc = dtn * accrcs * qcc * std::pow(qps, pows1);
131  dpgc = dtn * accrcg * qcc * std::pow(qpg, powg1);
132 
133  dqia = dtn * autos * (qii-qci0);
134  dpsi = dtn * accris * qii * std::pow(qps, pows1);
135  dpgi = dtn * accrig * qii * std::pow(qpg, powg1);
136 
137  // Rescale sinks to avoid negative cloud fractions
138  dqc = dqca + dprc + dpsc + dpgc;
139  dqi = dqia + dpsi + dpgi;
140  Real scalec = std::min(qcl_array(i,j,k),dqc) / (dqc + eps);
141  Real scalei = std::min(qci_array(i,j,k),dqi) / (dqi + eps);
142  dqca *= scalec; dprc *= scalec; dpsc *= scalec; dpgc *= scalec;
143  dqia *= scalei; dpsi *= scalei; dpgi *= scalei;
144  dqc = dqca + dprc + dpsc + dpgc;
145  dqi = dqia + dpsi + dpgi;
146 
147  // NOTE: Autoconversion of cloud water and ice are sources
148  // to qp, while accretion is a source to an individual
149  // precipitating component (e.g., qpr/qps/qpg). So we
150  // only split autoconversion with omega. The omega
151  // splitting does imply a latent heat source.
152 
153  // Partition formed precip componentss
154  dqpr = (dqca + dqia) * omp + dprc;
155  dqps = (dqca + dqia) * (1.0 - omp) * (1.0 - omg) + dpsc + dpsi;
156  dqpg = (dqca + dqia) * (1.0 - omp) * omg + dpgc + dpgi;
157 
158  // Update the primitive state variables
159  qcl_array(i,j,k) -= dqc;
160  qci_array(i,j,k) -= dqi;
161  qpr_array(i,j,k) += dqpr;
162  qps_array(i,j,k) += dqps;
163  qpg_array(i,j,k) += dqpg;
164 
165  // Update the primitive derived vars
166  qn_array(i,j,k) = qcl_array(i,j,k) + qci_array(i,j,k);
167  qt_array(i,j,k) = qv_array(i,j,k) + qn_array(i,j,k);
168  qp_array(i,j,k) = qpr_array(i,j,k) + qps_array(i,j,k) + qpg_array(i,j,k);
169 
170  // Update temperature
171  tabs_array(i,j,k) += fac_fus * ( dqca * (1.0 - omp) - dqia * omp );
172 
173  // Update theta
174  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
175  }
176 
177  //==================================================
178  // Evaporation (A24)
179  //==================================================
180  erf_qsatw(tabs_array(i,j,k),pres_array(i,j,k),qsatw);
181  erf_qsati(tabs_array(i,j,k),pres_array(i,j,k),qsati);
182  qsat = qsatw * omn + qsati * (1.0-omn);
183  if((qp_array(i,j,k) > 0.0) && (qv_array(i,j,k) < qsat)) {
184 
185  dqpr = evapr1_t(k)*sqrt(qpr) + evapr2_t(k)*pow(qpr,powr2);
186  dqps = evaps1_t(k)*sqrt(qps) + evaps2_t(k)*pow(qps,pows2);
187  dqpg = evapg1_t(k)*sqrt(qpg) + evapg2_t(k)*pow(qpg,powg2);
188 
189  // NOTE: This is always a sink for precipitating comps
190  // since qv<qsat and thus (1 - qv/qsat)>0. If we are
191  // in a super-saturated state (qv>qsat) the Newton
192  // iterations in Cloud() will have handled condensation.
193  dqpr *= dtn * (1.0 - qv_array(i,j,k)/qsat);
194  dqps *= dtn * (1.0 - qv_array(i,j,k)/qsat);
195  dqpg *= dtn * (1.0 - qv_array(i,j,k)/qsat);
196 
197  // Limit to avoid negative moisture fractions
198  dqpr = std::min(qpr_array(i,j,k),dqpr);
199  dqps = std::min(qps_array(i,j,k),dqps);
200  dqpg = std::min(qpg_array(i,j,k),dqpg);
201  dqp = dqpr + dqps + dqpg;
202 
203  // Update the primitive state variables
204  qv_array(i,j,k) += dqp;
205  qpr_array(i,j,k) -= dqpr;
206  qps_array(i,j,k) -= dqps;
207  qpg_array(i,j,k) -= dqpg;
208 
209  // Update the primitive derived vars
210  qt_array(i,j,k) = qv_array(i,j,k) + qn_array(i,j,k);
211  qp_array(i,j,k) = qpr_array(i,j,k) + qps_array(i,j,k) + qpg_array(i,j,k);
212 
213  // Update temperature
214  tabs_array(i,j,k) -= fac_cond * dqpr + fac_sub * (dqps + dqpg);
215 
216  // Update theta
217  theta_array(i,j,k) = getThgivenPandT(tabs_array(i,j,k), 100.0*pres_array(i,j,k), rdOcp);
218  }
219  }
220  });
221  }
222 }
constexpr amrex::Real a_bg
Definition: ERF_Constants.H:77
constexpr amrex::Real a_gr
Definition: ERF_Constants.H:79
constexpr amrex::Real qci0
Definition: ERF_Constants.H:47
constexpr amrex::Real betaelq
Definition: ERF_Constants.H:49
constexpr amrex::Real alphaelq
Definition: ERF_Constants.H:48
constexpr amrex::Real qcw0
Definition: ERF_Constants.H:46
constexpr amrex::Real tprmin
Definition: ERF_Constants.H:33
constexpr amrex::Real tgrmin
Definition: ERF_Constants.H:35
constexpr amrex::Real a_pr
Definition: ERF_Constants.H:78

Referenced by Advance().

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

◆ PrecipFall()

void Morrison::PrecipFall ( const SolverChoice sc)

Precipitation fluxes P_{r/s/g} (A19)

Code modified from MorrisonXX, the C++ version of the Morrison code.

Parameters
[in]hydro_typeType selection for the precipitation advection hydrodynamics scheme (0-3)
17 {
18  Real rho_0 = 1.29;
19 
20  Real gamr3 = erf_gammafff(4.0+b_rain);
21  Real gams3 = erf_gammafff(4.0+b_snow);
22  Real gamg3 = erf_gammafff(4.0+b_grau);
23 
24  Real vrain = (a_rain*gamr3/6.0)*pow((PI*rhor*nzeror),-crain);
25  Real vsnow = (a_snow*gams3/6.0)*pow((PI*rhos*nzeros),-csnow);
26  Real vgrau = (a_grau*gamg3/6.0)*pow((PI*rhog*nzerog),-cgrau);
27 
28  auto dz = m_geom.CellSize(2);
29  Real dtn = dt;
30  Real coef = dtn/dz;
31 
32  auto domain = m_geom.Domain();
33  int k_lo = domain.smallEnd(2);
34  int k_hi = domain.bigEnd(2);
35 
46 
47  auto ba = tabs->boxArray();
48  auto dm = tabs->DistributionMap();
49  auto ngrow = tabs->nGrowVect();
50 
51  MultiFab fz;
52  fz.define(convert(ba, IntVect(0,0,1)), dm, 1, ngrow);
53 
54  // Precompute the vertical fluxes for CFL constraint
55  for (MFIter mfi(fz, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
56  auto qp_array = qp->array(mfi);
57  auto rho_array = rho->array(mfi);
58  auto tabs_array = tabs->array(mfi);
59  auto fz_array = fz.array(mfi);
60 
61  const auto& box3d = mfi.tilebox();
62 
63  ParallelFor(box3d, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
64  {
65  Real rho_avg, tab_avg, qp_avg;
66  if (k==k_lo) {
67  rho_avg = rho_array(i,j,k);
68  tab_avg = tabs_array(i,j,k);
69  qp_avg = qp_array(i,j,k);
70  } else if (k==k_hi+1) {
71  rho_avg = rho_array(i,j,k-1);
72  tab_avg = tabs_array(i,j,k-1);
73  qp_avg = qp_array(i,j,k-1);
74  } else {
75  rho_avg = 0.5*( rho_array(i,j,k-1) + rho_array(i,j,k));
76  tab_avg = 0.5*(tabs_array(i,j,k-1) + tabs_array(i,j,k));
77  qp_avg = 0.5*( qp_array(i,j,k-1) + qp_array(i,j,k));
78  }
79 
80  Real Pprecip = 0.0;
81  if(qp_avg > qp_threshold) {
82  Real omp, omg;
83  omp = std::max(0.0,std::min(1.0,(tab_avg-tprmin)*a_pr));
84  omg = std::max(0.0,std::min(1.0,(tab_avg-tgrmin)*a_gr));
85  Real qrr = omp*qp_avg;
86  Real qss = (1.0-omp)*(1.0-omg)*qp_avg;
87  Real qgg = (1.0-omp)*(omg)*qp_avg;
88  Pprecip = omp*vrain*std::pow(rho_avg*qrr,1.0+crain)
89  + (1.0-omp)*( (1.0-omg)*vsnow*std::pow(rho_avg*qss,1.0+csnow)
90  + omg *vgrau*std::pow(rho_avg*qgg,1.0+cgrau) );
91  }
92 
93  // NOTE: Fz is the sedimentation flux from the advective operator.
94  // In the terrain-following coordinate system, the z-deriv in
95  // the divergence uses the normal velocity (Omega). However,
96  // there are no u/v components to the sedimentation velocity.
97  // Therefore, we simply end up with a division by detJ when
98  // evaluating the source term: dJinv * (flux_hi - flux_lo) * dzinv.
99  fz_array(i,j,k) = Pprecip * std::sqrt(rho_0/rho_avg);
100  });
101  }
102 
103  // Compute number of substeps from maximum terminal velocity
104  Real wt_max;
105  int n_substep;
106  auto const& ma_fz_arr = fz.const_arrays();
107  GpuTuple<Real> max = ParReduce(TypeList<ReduceOpMax>{},
108  TypeList<Real>{},
109  fz, IntVect(0),
110  [=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
111  -> GpuTuple<Real>
112  {
113  return { ma_fz_arr[box_no](i,j,k) };
114  });
115  wt_max = get<0>(max) + std::numeric_limits<Real>::epsilon();
116  n_substep = int( std::ceil(wt_max * coef / CFL_MAX) );
117  AMREX_ALWAYS_ASSERT(n_substep >= 1);
118  coef /= Real(n_substep);
119  dtn /= Real(n_substep);
120 
121  // Substep the vertical advection
122  for (int nsub(0); nsub<n_substep; ++nsub) {
123  for (MFIter mfi(*qp, TileNoZ()); mfi.isValid(); ++mfi) {
124  auto qpr_array = qpr->array(mfi);
125  auto qps_array = qps->array(mfi);
126  auto qpg_array = qpg->array(mfi);
127  auto qp_array = qp->array(mfi);
128  auto rho_array = rho->array(mfi);
129  auto tabs_array = tabs->array(mfi);
130  auto fz_array = fz.array(mfi);
131 
132  auto rain_accum_array = rain_accum->array(mfi);
133  auto snow_accum_array = snow_accum->array(mfi);
134  auto graup_accum_array = graup_accum->array(mfi);
135 
136  const auto dJ_array = (m_detJ_cc) ? m_detJ_cc->const_array(mfi) : Array4<const Real>{};
137 
138  const auto& tbx = mfi.tilebox();
139  const auto& tbz = mfi.tilebox(IntVect(0,0,1),IntVect(0));
140 
141  // Update vertical flux every substep
142  ParallelFor(tbz, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
143  {
144  Real rho_avg, tab_avg, qp_avg;
145  if (k==k_lo) {
146  rho_avg = rho_array(i,j,k);
147  tab_avg = tabs_array(i,j,k);
148  qp_avg = qp_array(i,j,k);
149  } else if (k==k_hi+1) {
150  rho_avg = rho_array(i,j,k-1);
151  tab_avg = tabs_array(i,j,k-1);
152  qp_avg = qp_array(i,j,k-1);
153  } else {
154  rho_avg = 0.5*( rho_array(i,j,k-1) + rho_array(i,j,k));
155  tab_avg = 0.5*(tabs_array(i,j,k-1) + tabs_array(i,j,k));
156  qp_avg = 0.5*( qp_array(i,j,k-1) + qp_array(i,j,k));
157  }
158 
159  Real Pprecip = 0.0;
160  if(qp_avg > qp_threshold) {
161  Real omp, omg;
162  omp = std::max(0.0,std::min(1.0,(tab_avg-tprmin)*a_pr));
163  omg = std::max(0.0,std::min(1.0,(tab_avg-tgrmin)*a_gr));
164  Real qrr = omp*qp_avg;
165  Real qss = (1.0-omp)*(1.0-omg)*qp_avg;
166  Real qgg = (1.0-omp)*(omg)*qp_avg;
167  Pprecip = omp*vrain*std::pow(rho_avg*qrr,1.0+crain)
168  + (1.0-omp)*( (1.0-omg)*vsnow*std::pow(rho_avg*qss,1.0+csnow)
169  + omg *vgrau*std::pow(rho_avg*qgg,1.0+cgrau) );
170  }
171 
172  // NOTE: Fz is the sedimentation flux from the advective operator.
173  // In the terrain-following coordinate system, the z-deriv in
174  // the divergence uses the normal velocity (Omega). However,
175  // there are no u/v components to the sedimentation velocity.
176  // Therefore, we simply end up with a division by detJ when
177  // evaluating the source term: dJinv * (flux_hi - flux_lo) * dzinv.
178  fz_array(i,j,k) = Pprecip * std::sqrt(rho_0/rho_avg);
179 
180  if(k==k_lo){
181  Real omp, omg;
182  omp = std::max(0.0,std::min(1.0,(tab_avg-tprmin)*a_pr));
183  omg = std::max(0.0,std::min(1.0,(tab_avg-tgrmin)*a_gr));
184  rain_accum_array(i,j,k) = rain_accum_array(i,j,k) + rho_avg*(omp*qp_avg)*vrain*dtn/rhor*1000.0; // Divide by rho_water and convert to mm
185  snow_accum_array(i,j,k) = snow_accum_array(i,j,k) + rho_avg*(1.0-omp)*(1.0-omg)*qp_avg*vrain*dtn/rhos*1000.0; // Divide by rho_snow and convert to mm
186  graup_accum_array(i,j,k) = graup_accum_array(i,j,k) + rho_avg*(1.0-omp)*(omg)*qp_avg*vrain*dtn/rhog*1000.0; // Divide by rho_graupel and convert to mm
187  }
188  });
189 
190  // Update precip every substep
191  ParallelFor(tbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
192  {
193  // Jacobian determinant
194  Real dJinv = (dJ_array) ? 1.0/dJ_array(i,j,k) : 1.0;
195 
196  //==================================================
197  // Precipitating sedimentation (A19)
198  //==================================================
199  Real dqp = dJinv * (1.0/rho_array(i,j,k)) * ( fz_array(i,j,k+1) - fz_array(i,j,k) ) * coef;
200  Real omp, omg;
201  omp = std::max(0.0,std::min(1.0,(tabs_array(i,j,k)-tprmin)*a_pr));
202  omg = std::max(0.0,std::min(1.0,(tabs_array(i,j,k)-tgrmin)*a_gr));
203 
204  qpr_array(i,j,k) = std::max(0.0, qpr_array(i,j,k) + dqp*omp);
205  qps_array(i,j,k) = std::max(0.0, qps_array(i,j,k) + dqp*(1.0-omp)*(1.0-omg));
206  qpg_array(i,j,k) = std::max(0.0, qpg_array(i,j,k) + dqp*(1.0-omp)*omg);
207  qp_array(i,j,k) = qpr_array(i,j,k) + qps_array(i,j,k) + qpg_array(i,j,k);
208 
209  // NOTE: Sedimentation does not affect the potential temperature,
210  // but it does affect the liquid/ice static energy.
211  // No source to Theta occurs here.
212  });
213  } // mfi
214  } // nsub
215 }
constexpr amrex::Real csnow
Definition: ERF_Constants.H:82
constexpr amrex::Real cgrau
Definition: ERF_Constants.H:83
constexpr amrex::Real qp_threshold
Definition: ERF_Constants.H:60
constexpr amrex::Real crain
Definition: ERF_Constants.H:81
@ theta
Definition: ERF_MM5.H:20
@ qp
Definition: ERF_Kessler.H:31
@ rain_accum
Definition: ERF_Kessler.H:33

Referenced by Advance().

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

◆ Qmoist_Ptr()

amrex::MultiFab* Morrison::Qmoist_Ptr ( const int &  varIdx)
inlineoverridevirtual

Reimplemented from NullMoist.

130  {
131  AMREX_ALWAYS_ASSERT(varIdx < m_qmoist_size);
132  return mic_fab_vars[MicVarMap[varIdx]].get();
133  }

◆ Qmoist_Restart_Vars()

void Morrison::Qmoist_Restart_Vars ( const SolverChoice ,
std::vector< int > &  a_idx,
std::vector< std::string > &  a_names 
) const
inlineoverridevirtual

Reimplemented from NullMoist.

258  {
259  a_idx.clear();
260  a_names.clear();
261 
262  // NOTE: These are the indices to access into qmoist (not mic_fab_vars)
263  a_idx.push_back(0); a_names.push_back("RainAccum");
264  a_idx.push_back(1); a_names.push_back("SnowAccum");
265  a_idx.push_back(2); a_names.push_back("GraupAccum");
266  }

◆ Qmoist_Size()

int Morrison::Qmoist_Size ( )
inlineoverridevirtual

Reimplemented from NullMoist.

139 { return Morrison::m_qmoist_size; }

◆ Qstate_Size()

int Morrison::Qstate_Size ( )
inlineoverridevirtual

Reimplemented from NullMoist.

142 { return Morrison::m_qstate_size; }
int m_qstate_size
Definition: ERF_Morrison.H:273

◆ Update_Micro_Vars()

void Morrison::Update_Micro_Vars ( amrex::MultiFab &  cons_in)
inlineoverridevirtual

Reimplemented from NullMoist.

104  {
105  this->Copy_State_to_Micro(cons_in);
106  this->Compute_Coefficients();
107  }
void Copy_State_to_Micro(const amrex::MultiFab &cons_in) override
Definition: ERF_InitMorrison.cpp:89
void Compute_Coefficients()
Definition: ERF_InitMorrison.cpp:141
Here is the call graph for this function:

◆ Update_State_Vars()

void Morrison::Update_State_Vars ( amrex::MultiFab &  cons_in)
inlineoverridevirtual

Reimplemented from NullMoist.

111  {
112  this->Copy_Micro_to_State(cons_in);
113  }
void Copy_Micro_to_State(amrex::MultiFab &cons_in) override
Definition: ERF_UpdateMorrison.cpp:15
Here is the call graph for this function:

Member Data Documentation

◆ accrgc

amrex::TableData<amrex::Real, 1> Morrison::accrgc
private

◆ accrgi

amrex::TableData<amrex::Real, 1> Morrison::accrgi
private

◆ accrrc

amrex::TableData<amrex::Real, 1> Morrison::accrrc
private

◆ accrsc

amrex::TableData<amrex::Real, 1> Morrison::accrsc
private

◆ accrsi

amrex::TableData<amrex::Real, 1> Morrison::accrsi
private

◆ CFL_MAX

constexpr amrex::Real Morrison::CFL_MAX = 0.5
staticconstexprprivate

◆ coefice

amrex::TableData<amrex::Real, 1> Morrison::coefice
private

◆ dt

amrex::Real Morrison::dt
private

Referenced by Advance().

◆ evapg1

amrex::TableData<amrex::Real, 1> Morrison::evapg1
private

◆ evapg2

amrex::TableData<amrex::Real, 1> Morrison::evapg2
private

◆ evapr1

amrex::TableData<amrex::Real, 1> Morrison::evapr1
private

◆ evapr2

amrex::TableData<amrex::Real, 1> Morrison::evapr2
private

◆ evaps1

amrex::TableData<amrex::Real, 1> Morrison::evaps1
private

◆ evaps2

amrex::TableData<amrex::Real, 1> Morrison::evaps2
private

◆ gamaz

amrex::TableData<amrex::Real, 1> Morrison::gamaz
private

◆ m_axis

int Morrison::m_axis
private

Referenced by Define().

◆ m_detJ_cc

amrex::MultiFab* Morrison::m_detJ_cc
private

◆ m_fac_cond

amrex::Real Morrison::m_fac_cond
private

Referenced by Define().

◆ m_fac_fus

amrex::Real Morrison::m_fac_fus
private

Referenced by Define().

◆ m_fac_sub

amrex::Real Morrison::m_fac_sub
private

Referenced by Define().

◆ m_geom

amrex::Geometry Morrison::m_geom
private

◆ m_gOcp

amrex::Real Morrison::m_gOcp
private

Referenced by Define().

◆ m_gtoe

amrex::BoxArray Morrison::m_gtoe
private

◆ m_qmoist_size

int Morrison::m_qmoist_size = 3
private

Referenced by Qmoist_Ptr(), and Qmoist_Size().

◆ m_qstate_size

int Morrison::m_qstate_size = 6
private

Referenced by Qstate_Size().

◆ m_rdOcp

amrex::Real Morrison::m_rdOcp
private

Referenced by Define().

◆ m_z_phys_nd

amrex::MultiFab* Morrison::m_z_phys_nd
private

◆ mic_fab_vars

amrex::Array<FabPtr, MicVar_Morr::NumVars> Morrison::mic_fab_vars
private

Referenced by Qmoist_Ptr().

◆ MicVarMap

amrex::Vector<int> Morrison::MicVarMap
private

Referenced by Qmoist_Ptr().

◆ nlev

int Morrison::nlev
private

◆ pres1d

amrex::TableData<amrex::Real, 1> Morrison::pres1d
private

◆ qn1d

amrex::TableData<amrex::Real, 1> Morrison::qn1d
private

◆ qt1d

amrex::TableData<amrex::Real, 1> Morrison::qt1d
private

◆ qv1d

amrex::TableData<amrex::Real, 1> Morrison::qv1d
private

◆ rho1d

amrex::TableData<amrex::Real, 1> Morrison::rho1d
private

◆ tabs1d

amrex::TableData<amrex::Real, 1> Morrison::tabs1d
private

◆ zhi

int Morrison::zhi
private

◆ zlo

int Morrison::zlo
private

◆ zmid

amrex::TableData<amrex::Real, 1> Morrison::zmid
private

The documentation for this class was generated from the following files: