592 real2d solar_irradiance_by_gpt(
"solar_irradiance_by_gpt",
ncol,
nswgpts);
596 int1d day_indices(
"day_indices",
ncol), night_indices(
"night_indices",
ncol);
598 real1d coszrs_day(
"coszrs_day",
ncol);
600 real2d pmid_day(
"pmid_day",
ncol,
nlev);
601 real2d tmid_day(
"tmid_day",
ncol,
nlev);
602 real2d pint_day(
"pint_day",
ncol,
nlev+1);
624 real solar_declination;
643 int1d nday(
"nday",1);
644 int1d nnight(
"nnight", 1);
645 yakl::memset(nday, 0);
646 yakl::memset(nnight, 0);
647 parallel_for(SimpleBounds<1>(
ncol), YAKL_LAMBDA (
int icol)
649 if (day_indices(icol) > 0) nday(1)++;
650 if (night_indices(icol) > 0) nnight(1)++;
653 AMREX_ASSERT(nday(1) + nnight(1) ==
ncol);
655 intHost1d num_day(
"num_day",1);
656 intHost1d num_night(
"num_night",1);
657 nday.deep_copy_to(num_day);
658 nnight.deep_copy_to(num_night);
661 if (num_day(1) == 0) {
664 yakl::memset(
qrs, 0.);
665 yakl::memset(
qrsc, 0.);
670 parallel_for(SimpleBounds<2>(num_day(1),
nlev), YAKL_LAMBDA (
int iday,
int ilev)
673 auto icol = day_indices(iday);
674 tmid_day(iday,ilev) =
tmid(icol,ilev);
675 pmid_day(iday,ilev) =
pmid(icol,ilev);
676 pint_day(iday,ilev) =
pint(icol,ilev);
678 parallel_for(SimpleBounds<1>(num_day(1)), YAKL_LAMBDA (
int iday)
681 auto icol = day_indices(iday);
684 coszrs_day(iday) =
coszrs(icol);
685 AMREX_ASSERT(coszrs_day(iday) > 0.0);
687 parallel_for(SimpleBounds<3>(num_day(1),
nlev,
nswgpts), YAKL_LAMBDA (
int iday,
int ilev,
int igpt)
689 auto icol = day_indices(iday);
690 cld_tau_gpt_day(iday,ilev,igpt) = cld_tau_gpt(icol,ilev,igpt);
691 cld_ssa_gpt_day(iday,ilev,igpt) = cld_ssa_gpt(icol,ilev,igpt);
692 cld_asm_gpt_day(iday,ilev,igpt) = cld_asm_gpt(icol,ilev,igpt);
694 parallel_for(SimpleBounds<2>(num_day(1),
nswbands), YAKL_LAMBDA (
int iday,
int ibnd)
697 auto icol = day_indices(iday);
698 albedo_dir_day(ibnd,iday) =
albedo_dir(ibnd,icol);
699 albedo_dif_day(ibnd,iday) =
albedo_dif(ibnd,icol);
702 parallel_for(SimpleBounds<3>(num_day(1),
nlev,
nswbands), YAKL_LAMBDA (
int iday,
int ilev,
int ibnd)
704 auto icol = day_indices(iday);
705 aer_tau_bnd_day(iday,ilev,ibnd) = aer_tau_bnd(icol,ilev,ibnd);
706 aer_ssa_bnd_day(iday,ilev,ibnd) = aer_ssa_bnd(icol,ilev,ibnd);
707 aer_asm_bnd_day(iday,ilev,ibnd) = aer_asm_bnd(icol,ilev,ibnd);
714 FluxesByband fluxes_clrsky_day, fluxes_allsky_day;
720 yakl::memset(cld_tau_gpt_rad, 0.);
721 yakl::memset(cld_ssa_gpt_rad, 0.);
722 yakl::memset(cld_asm_gpt_rad, 0.);
724 yakl::memset(aer_tau_bnd_rad, 0.);
725 yakl::memset(aer_ssa_bnd_rad, 0.);
726 yakl::memset(aer_asm_bnd_rad, 0.);
728 parallel_for(SimpleBounds<3>(num_day(1),
nlev,
nswgpts), YAKL_LAMBDA (
int iday,
int ilev,
int igpt)
730 cld_tau_gpt_rad(iday,ilev,igpt) = cld_tau_gpt_day(iday,ilev,igpt);
731 cld_ssa_gpt_rad(iday,ilev,igpt) = cld_ssa_gpt_day(iday,ilev,igpt);
732 cld_asm_gpt_rad(iday,ilev,igpt) = cld_asm_gpt_day(iday,ilev,igpt);
735 parallel_for(SimpleBounds<3>(num_day(1),
nlev,
ngas), YAKL_LAMBDA (
int iday,
int ilev,
int igas)
737 auto icol = day_indices(iday);
738 gas_vmr_day(igas,iday,ilev) =
gas_vmr(igas,icol,ilev);
741 parallel_for(SimpleBounds<3>(num_day(1),
nlev,
nswbands), YAKL_LAMBDA (
int iday,
int ilev,
int ibnd)
743 aer_tau_bnd_rad(iday,ilev,ibnd) = aer_tau_bnd_day(iday,ilev,ibnd);
744 aer_ssa_bnd_rad(iday,ilev,ibnd) = aer_ssa_bnd_day(iday,ilev,ibnd);
745 aer_asm_bnd_rad(iday,ilev,ibnd) = aer_asm_bnd_day(iday,ilev,ibnd);
750 tmid_day, pint_day, coszrs_day, albedo_dir_day, albedo_dif_day,
751 cld_tau_gpt_rad, cld_ssa_gpt_rad, cld_asm_gpt_rad, aer_tau_bnd_rad, aer_ssa_bnd_rad, aer_asm_bnd_rad,
752 fluxes_allsky_day.flux_up , fluxes_allsky_day.flux_dn , fluxes_allsky_day.flux_net , fluxes_allsky_day.flux_dn_dir ,
753 fluxes_allsky_day.bnd_flux_up, fluxes_allsky_day.bnd_flux_dn, fluxes_allsky_day.bnd_flux_net, fluxes_allsky_day.bnd_flux_dn_dir,
754 fluxes_clrsky_day.flux_up , fluxes_clrsky_day.flux_dn , fluxes_clrsky_day.flux_net , fluxes_clrsky_day.flux_dn_dir ,
755 fluxes_clrsky_day.bnd_flux_up, fluxes_clrsky_day.bnd_flux_dn, fluxes_clrsky_day.bnd_flux_net, fluxes_clrsky_day.bnd_flux_dn_dir,
764 fluxes_allsky.flux_dn,
768 fluxes_allsky.flux_dn,
AMREX_GPU_HOST AMREX_FORCE_INLINE void shr_orb_decl(const amrex::Real &calday, const amrex::Real &eccen, const amrex::Real &mvelpp, const amrex::Real &lambm0, const amrex::Real &obliqr, amrex::Real &delta, amrex::Real &eccf)
Definition: ERF_Orbit.H:52
static constexpr amrex::Real obliqr
Definition: ERF_Radiation.H:131
void set_daynight_indices(const real1d &coszrs, const int1d &day_indices, const int1d &night_indices)
Definition: ERF_Radiation.cpp:831
static constexpr amrex::Real eccen
Definition: ERF_Radiation.H:130
static constexpr amrex::Real lambm0
Definition: ERF_Radiation.H:133
real1d coszrs
Definition: ERF_Radiation.H:256
static constexpr amrex::Real mvelpp
Definition: ERF_Radiation.H:132
void run_shortwave_rrtmgp(int ngas, int ncol, int nlay, const real3d &gas_vmr, const real2d &pmid, const real2d &tmid, const real2d &pint, const real1d &coszrs, const real2d &albedo_dir, const real2d &albedo_dif, const real3d &cld_tau_gpt, const real3d &cld_ssa_gpt, const real3d &cld_asm_gpt, const real3d &aer_tau_bnd, const real3d &aer_ssa_bnd, const real3d &aer_asm_bnd, const real2d &allsky_flux_up, const real2d &allsky_flux_dn, const real2d &allsky_flux_net, const real2d &allsky_flux_dn_dir, const real3d &allsky_bnd_flux_up, const real3d &allsky_bnd_flux_dn, const real3d &allsky_bnd_flux_net, const real3d &allsky_bnd_flux_dn_dir, const real2d &clrsky_flux_up, const real2d &clrsky_flux_dn, const real2d &clrsky_flux_net, const real2d &clrsky_flux_dn_dir, const real3d &clrsky_bnd_flux_up, const real3d &clrsky_bnd_flux_dn, const real3d &clrsky_bnd_flux_net, const real3d &clrsky_bnd_flux_dn_dir, double tsi_scaling)
Definition: ERF_RunShortWaveRRTMGP.cpp:4
void expand_day_fluxes(const FluxesByband &daytime_fluxes, FluxesByband &expanded_fluxes, const int1d &day_indices)
Definition: ERF_Radiation.cpp:52
void initial_fluxes(int nz, int nlay, int nbands, FluxesByband &fluxes)
Definition: ERF_Radiation.cpp:39