31 real2d raer(
"raer",ncol,nlev);
32 real2d cldn(
"cldn",ncol,nlev);
33 real3d dgncur_a(
"dgncur",ncol,nlev,nmodes);
34 real3d dgncur_awet(
"dgncur_awet",ncol,nlev,nmodes);
35 real3d wetdens(
"wetdens",ncol,nlev,nmodes);
36 real3d qaerwat(
"qaerwat",ncol,nlev,nmodes);
38 real2d dryvolmr(
"dryvolmr",ncol,nlev);
40 real spechygro, spechygro_1;
46 real2d rh(
"rh",ncol,nlev);
50 real2d aerosol_water(
"aerosol_water",ncol,nlev);
55 real3d naer(
"naer",ncol,nlev,nmodes);
56 real3d dryvol(
"dryvol",ncol,nlev,nmodes);
57 real3d drymass(
"drymass",ncol,nlev,nmodes);
58 real3d dryrad(
"dryrad",ncol,nlev,nmodes);
59 real3d wetrad(
"wetrad",ncol,nlev,nmodes);
60 real3d wetvol(
"wetvol",ncol,nlev,nmodes);
61 real3d wtrvol(
"wtrvol",ncol,nlev,nmodes);
62 real1d rhcrystal(
"rhcrystal",nmodes);
63 real1d rhdeliques(
"rhdeliques",nmodes);
64 real1d specdens_1(
"specdens_1",nmodes);
65 real3d maer(
"maer",ncol,nlev,nmodes);
66 real3d hygro(
"hygro",ncol,nlev,nmodes);
80 yakl::memset(maer, 0.0);
81 yakl::memset(hygro, 0.);
84 compute_wetdens =
true;
86 dgncur_a = dgnumdry_m;
87 dgncur_awet = dgnumwet_m;
92 for (
auto m = 1; m <= nmodes; ++m) {
93 yakl::memset(dryvolmr, 0.);
96 consti.
get_mode_props(list_idx, m-1, sigmag, rhcrystal(m), rhdeliques(m));
101 for(
auto l = 0; l < nspec; ++l) {
109 specdens_1(m) = specdens;
110 spechygro_1 = spechygro;
114 for(
auto k = top_lev; k <= nlev; ++k) {
115 for(
auto i = 1; i <= ncol; ++i) {
117 maer(i,k,m) = maer(i,k,m) + duma;
118 dumb = duma/specdens;
119 dryvolmr(i,k) = dryvolmr(i,k) + dumb;
120 hygro(i,k,m) = hygro(i,k,m) + dumb*spechygro;
127 for(
auto k = top_lev; k <= nlev; ++k) {
128 for(
auto i = 1; i <= ncol; ++i) {
130 if (dryvolmr(i,k) > 1.0e-30) {
131 hygro(i,k,m) = hygro(i,k,m)/dryvolmr(i,k);
133 hygro(i,k,m) = spechygro_1;
137 v2ncur_a = 1. / ( (
PI/6.)*(std::pow(dgncur_a(i,k,m),3.))*std::exp(4.5*std::pow(alnsg, 2.)) );
139 naer(i,k,m) = dryvolmr(i,k)*v2ncur_a;
146 if (maer(i,k,m) > 1.0e-31) {
147 drydens = maer(i,k,m)/dryvolmr(i,k);
152 dryvol(i,k,m) = 1.0/v2ncur_a;
153 drymass(i,k,m) = drydens*dryvol(i,k,m);
154 dryrad(i,k,m) = std::pow((dryvol(i,k,m)/
pi43),
third);
160 bool has_clear_rh =
false;
164 for(
auto k = top_lev; k <= nlev; --k) {
165 for(
auto i = 1; i <= ncol; ++i) {
166 rh(i,k) = clear_rh_in(i,k);
168 amrex::Print() <<
"modal_aero_wateruptake_dr: clear_rh_in is negative - rh:" << rh(i,k);
172 rh(i,k) = std::min(rh(i,k), 0.98);
177 for(
auto k = top_lev; k <= nlev; ++k) {
178 for(
auto i = 1; i <= ncol; ++i) {
180 if (qs(i) > h2ommr(i,k)) {
181 rh(i,k) = h2ommr(i,k)/qs(i);
186 rh(i,k) = std::max(rh(i,k), 0.0);
187 rh(i,k) = std::min(rh(i,k), 0.98);
188 if (cldn(i,k) < 0.998) {
189 rh(i,k) = (rh(i,k) - cldn(i,k)) / (1.0 - cldn(i,k));
191 rh(i,k) = std::max(rh(i,k), 0.0);
198 rhcrystal, rhdeliques, dryrad,
200 wetrad, wetvol, wtrvol);
202 for(
auto m = 1; m <= nmodes; ++m) {
203 for(
auto k = top_lev; k <= nlev; ++k) {
204 for(
auto i = 1; i <= ncol; ++i) {
206 dgncur_awet(i,k,m) = dgncur_a(i,k,m) * (wetrad(i,k,m)/dryrad(i,k,m));
207 qaerwat(i,k,m) =
rhoh2o*naer(i,k,m)*wtrvol(i,k,m);
210 if(compute_wetdens) {
211 if (wetvol(i,k,m) > 1.0e-30) {
212 wetdens(i,k,m) = (drymass(i,k,m) +
rhoh2o*wtrvol(i,k,m))/wetvol(i,k,m);
215 wetdens(i,k,m) = specdens_1(m);
constexpr amrex::Real rhoh2o
Definition: ERF_Constants.H:94
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
void get_mode_nspec(int list_idx, int m_idx, int &nspec) const
Definition: ERF_Mam4_constituents.H:394
void rad_cnst_get_mam_mmr_by_idx(int list_idx, int mode_idx, int spec_idx, const std::string &phase, real2d &mmr) const
Definition: ERF_Mam4_constituents.H:639
void get_mam_density_aer(int list_idx, int mode_idx, int spec_idx, real &density_aer) const
Definition: ERF_Mam4_constituents.H:889
void get_mam_hygro_aer(int list_idx, int mode_idx, int spec_idx, real &hygro_aer) const
Definition: ERF_Mam4_constituents.H:903
void get_mode_props(int list_idx, int mode_idx, real &sigmag, real &rhcrystal, real &rhdeliques) const
Definition: ERF_Mam4_constituents.H:808
constexpr static real pi43
Definition: ERF_Modal_aero_wateruptake.H:21
constexpr static real huge_real
Definition: ERF_Modal_aero_wateruptake.H:22
static void modal_aero_wateruptake_sub(int ncol, int nlev, int nmodes, int top_lev, const real1d &rhcrystal, const real1d &rhdeliques, const real3d &dryrad, const real3d &hygro, const real2d &rh, const real3d &dryvol, const real3d &wetrad, const real3d &wetvol, const real3d &wtrvol)
Definition: ERF_Modal_aero_wateruptake.H:225
AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE void qsat(const amrex::Real &t, const amrex::Real &p, amrex::Real &es, amrex::Real &qs, amrex::Real *gam=nullptr, amrex::Real *dqsdt=nullptr, amrex::Real *enthalpy=nullptr)
Definition: ERF_Water_vapor_saturation.H:152