330 real2d air_density(
"air_density",
ncol,
nlev);
332 real2d specmmr(
"specmmr",
ncol,
nlev);
333 real1d specrefindex_real(
"specrefindex_real",
nswbands);
334 real1d specrefindex_im(
"specrefindex_im",
nswbands);
335 std::string spectype;
338 amrex::ignore_unused(volf);
340 real2d dgnumwet(
"dgnumwet",
ncol,
nlev);
341 real2d qaerwat(
"qaerwat",
ncol,
nlev);
342 real2d wetdens(
"wetdens",
ncol,
nlev);
345 real2d radsurf(
"radsurf",
ncol,
nlev);
346 real2d logradsurf(
"logradsurf",
ncol,
nlev);
349 real1d refr(
"refr",
ncol);
350 real1d refi(
"refi",
ncol);
351 real1d crefin_real(
"crefin_real",
ncol);
352 real1d crefin_im(
"crefin_im",
ncol);
361 real1d vol(
"vol",
ncol);
362 real1d dryvol(
"dryvol",
ncol);
363 real1d watervol(
"watervol",
ncol);
364 real1d wetvol(
"wetvol",
ncol);
366 int1d itab(
"itab",
ncol), jtab(
"jtab",
ncol);
367 real1d ttab(
"ttab",
ncol), utab(
"utab",
ncol);
369 real1d pext(
"pext",
ncol);
370 real1d specpext(
"specpext",
ncol);
371 real1d dopaer(
"dopaer",
ncol);
372 real1d pabs(
"pabs",
ncol);
373 real1d pasm(
"pasm",
ncol);
374 real1d palb(
"palb",
ncol);
377 yakl::memset(tauxar, 0.);
378 yakl::memset(wa, 0.);
379 yakl::memset(ga, 0.);
380 yakl::memset(fa, 0.);
389 parallel_for(SimpleBounds<2>(
ncol,
nlev), YAKL_LAMBDA (
int i,
int k)
391 mass(i,k) = pdeldry(i,k)*
rga;
392 air_density(i,k) = pmid(i,k)/(
rair*temperature(i,k));
399 amrex::Print() <<
"Radiation diagnostic calls are not supported for prescribed aerosols\n";
412 for(
auto m = 1; m <=
nmodes; ++m) {
413 parallel_for(SimpleBounds<2>(
ncol,
nlev), YAKL_LAMBDA (
int icol,
int ilev)
415 dgnumwet(icol,ilev) =
dgnumwet_m(icol,ilev,m);
416 qaerwat(icol,ilev) =
qaerwat_m(icol,ilev,m);
421 refitabsw, extpsw, abspsw, asmpsw);
429 for(
auto isw = 1; isw <=
nswbands; ++isw) {
432 yakl::memset(crefin_real, 0.);
433 yakl::memset(crefin_im , 0.);
434 yakl::memset(dryvol , 0.);
437 for(
auto l = 0; l <
nspec; ++l) {
438 real specdens = 1.0e-20;
441 specrefindex_real, specrefindex_im);
442 for(
auto i = 1; i <=
ncol; ++i) {
443 vol(i) = specmmr(i,k)/specdens;
444 dryvol(i) = dryvol(i) + vol(i);
445 crefin_real(i) = crefin_real(i) + vol(i)*specrefindex_real(isw);
446 crefin_im(i) = crefin_im(i) + vol(i)*specrefindex_im(isw);
450 for(
auto i = 1; i <=
ncol; ++i) {
451 watervol(i) = qaerwat(i,k)/
rhoh2o;
452 wetvol(i) = watervol(i) + dryvol(i);
453 if (watervol(i) < 0.) {
454 if (std::abs(watervol(i)) > 1.e-1*wetvol(i)) {
455 amrex::Print() <<
"watervol,wetvol=" << watervol(i) <<
"; " << wetvol(i) << std::endl;
458 wetvol(i) = dryvol(i);
461 crefin_real(i) = crefin_real(i)+watervol(i)*
crefwswr(isw);
462 crefin_real(i) = crefin_real(i)/std::max(wetvol(i),1.e-60);
463 crefin_im(i) = crefin_im(i)+watervol(i)*
crefwswi(isw);
464 crefin_im(i) = crefin_im(i)/std::max(wetvol(i),1.e-60);
465 refr(i) = crefin_real(i);
466 refi(i) = std::abs(crefin_im(i));
474 real1d refitabswr(
"refitabswr",
prefi);
475 real1d refrtabswr(
"refrtabswr",
prefr);
477 parallel_for(SimpleBounds<3>(
ncoef,
prefr,
prefi), YAKL_LAMBDA (
int icoef,
int irefr,
int irefi)
479 extpswr(icoef,irefr,irefi) = extpsw(icoef,irefr,irefi,isw);
480 abspswr(icoef,irefr,irefi) = abspsw(icoef,irefr,irefi,isw);
481 asmpswr(icoef,irefr,irefi) = asmpsw(icoef,irefr,irefi,isw);
482 refitabswr(irefi) = refitabsw(irefi,isw);
483 refrtabswr(irefr) = refrtabsw(irefr,isw);
486 yakl::memset(itab, 0);
488 refrtabswr, refitabswr, itab, jtab, ttab, utab, cext);
490 refrtabswr, refitabswr, itab, jtab, ttab, utab, cabs);
492 refrtabswr, refitabswr, itab, jtab, ttab, utab, casm);
495 for(
auto i=1; i <=
ncol; ++i) {
496 if (logradsurf(i,k) <=
xrmax) {
497 pext(i) = 0.5*cext(i,1);
498 for(
auto nc = 2; nc <=
ncoef; ++nc) {
499 pext(i) = pext(i) + cheb(nc,i,k)*cext(i,nc);
501 pext(i) = std::exp(pext(i));
503 pext(i) = 1.5/(radsurf(i,k)*
rhoh2o);
507 specpext(i) = pext(i);
508 pext(i) = pext(i)*wetvol(i)*
rhoh2o;
509 pabs(i) = 0.5*cabs(i,1);
510 pasm(i) = 0.5*casm(i,1);
511 for(
auto nc = 2; nc <=
ncoef; ++nc) {
512 pabs(i) = pabs(i) + cheb(nc,i,k)*cabs(i,nc);
513 pasm(i) = pasm(i) + cheb(nc,i,k)*casm(i,nc);
515 pabs(i) = pabs(i)*wetvol(i)*
rhoh2o;
516 pabs(i) = std::max(0.,pabs(i));
517 pabs(i) = std::min(pext(i),pabs(i));
518 palb(i) = 1.-pabs(i)/std::max(pext(i),1.e-40);
519 dopaer(i) = pext(i)*mass(i,k);
522 for (
auto i = 1; i <=
ncol; ++i) {
523 if ((dopaer(i) <= -1.e-10) || (dopaer(i) >= 30.)) {
524 if (dopaer(i) <= -1.e-10)
525 amrex::Print() <<
"ERROR: Negative aerosol optical depth in this layer.\n";
529 amrex::Print() <<
"WARNING: Aerosol optical depth is unreasonably high in this layer.\n";
532 for(
auto l = 1; l <
nspec; ++l) {
533 real specdens = 1.0e-20;
536 volf = specmmr(i,k)/specdens;
538 if (dopaer(i) < -1.e-10) {
539 amrex::Print() <<
"*** halting with error!\n";
545 for(
auto i=1; i <=
ncol; ++i) {
546 tauxar(i,k,isw) = tauxar(i,k,isw) + dopaer(i);
547 wa(i,k,isw) = wa(i,k,isw) + dopaer(i)*palb(i);
548 ga(i,k,isw) = ga(i,k,isw) + dopaer(i)*palb(i)*pasm(i);
549 fa(i,k,isw) = fa(i,k,isw) + dopaer(i)*palb(i)*pasm(i)*pasm(i);
constexpr amrex::Real rair
Definition: ERF_Constants.H:69
void modal_size_parameters(real sigma_logr_aer, const real2d &dgnumwet, const real2d &radsurf, const real2d &logradsurf, const real3d &cheb)
Definition: ERF_Mam4_aero.H:130
void get_mam_props_sw(int list_idx, int mode_idx, int spec_idx, real &density_aer, real1d &refindex_real_aer_sw, real1d &refindex_im_aer_sw) const
Definition: ERF_Mam4_constituents.H:939