Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Source/PhysicsInterfaces/Radiation/ERF_RRTMGP_Interface.H
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ rrtmgp_main (const int ncol, const int nlay,
real1d_k& t_sfc , real1d_k& sfc_emis , real1d_k& lw_src,
real2d_k& lwp , real2d_k& iwp ,
real2d_k& rel , real2d_k& rei , real2d_k& cldfrac,
real3d_k& aer_tau_sw , real3d_k& aer_ssa_sw , real3d_k& aer_asm_sw,
real3d_k& aer_tau_lw ,
real3d_k& cld_tau_sw_bnd, real3d_k& cld_tau_lw_bnd,
real3d_k& cld_tau_sw_gpt, real3d_k& cld_tau_lw_gpt,
real2d_k& sw_flux_up , real2d_k& sw_flux_dn , real2d_k& sw_flux_dn_dir,
real2d_k& lw_flux_up , real2d_k& lw_flux_dn ,
real2d_k& sw_clnclrsky_flux_up, real2d_k& sw_clnclrsky_flux_dn, real2d_k& sw_clnclrsky_flux_dn_dir,
Expand Down
90 changes: 38 additions & 52 deletions Source/PhysicsInterfaces/Radiation/ERF_RRTMGP_Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,6 @@ rrtmgp_main (const int ncol, const int nlay,
real1d_k& t_sfc , real1d_k& sfc_emis , real1d_k& lw_src,
real2d_k& lwp, real2d_k& iwp,
real2d_k& rel, real2d_k& rei, real2d_k& cldfrac,
real3d_k& /*aer_tau_sw*/, real3d_k& /*aer_ssa_sw*/, real3d_k& /*aer_asm_sw*/,
real3d_k& /*aer_tau_lw*/,
real3d_k& /*cld_tau_sw_bnd*/, real3d_k& /*cld_tau_lw_bnd*/,
real3d_k& /*cld_tau_sw_gpt*/, real3d_k& /*cld_tau_lw_gpt*/,
real2d_k& sw_flux_up, real2d_k& sw_flux_dn, real2d_k& sw_flux_dn_dir,
real2d_k& lw_flux_up, real2d_k& lw_flux_dn,
real2d_k& sw_clnclrsky_flux_up, real2d_k& sw_clnclrsky_flux_dn, real2d_k& sw_clnclrsky_flux_dn_dir,
Expand Down Expand Up @@ -457,24 +453,8 @@ rrtmgp_main (const int ncol, const int nlay,
optical_props1_t aerosol_lw;
aerosol_sw.init(k_dist_sw_k->get_band_lims_wavenumber());
aerosol_sw.alloc_2str(ncol, nlay);
/*
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay, nswbands}),
KOKKOS_LAMBDA (int icol, int ilay, int ibnd)
{
aerosol_sw.tau(icol,ilay,ibnd) = aer_tau_sw(icol,ilay,ibnd);
aerosol_sw.ssa(icol,ilay,ibnd) = aer_ssa_sw(icol,ilay,ibnd);
aerosol_sw.g (icol,ilay,ibnd) = aer_asm_sw(icol,ilay,ibnd);
});
*/
aerosol_lw.init(k_dist_lw_k->get_band_lims_wavenumber());
aerosol_lw.alloc_1scl(ncol, nlay);
/*
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay, nlwbands}),
KOKKOS_LAMBDA (int icol, int ilay, int ibnd)
{
aerosol_lw.tau(icol,ilay,ibnd) = aer_tau_lw(icol,ilay,ibnd);
});
*/

// Convert cloud physical properties to optical properties for input to RRTMGP
optical_props2_t clouds_sw = get_cloud_optics_sw(ncol, nlay,
Expand All @@ -483,9 +463,6 @@ rrtmgp_main (const int ncol, const int nlay,
optical_props1_t clouds_lw = get_cloud_optics_lw(ncol, nlay,
*cloud_optics_lw_k, *k_dist_lw_k,
lwp, iwp, rel, rei);
//Kokkos::deep_copy(cld_tau_sw_bnd, clouds_sw.tau);
//Kokkos::deep_copy(cld_tau_lw_bnd, clouds_lw.tau);

// Do subcolumn sampling to map bands -> gpoints based on cloud fraction and overlap assumption;
// This implements the Monte Carlo Independent Column Approximation by mapping only a single
// subcolumn (cloud state) to each gpoint.
Expand All @@ -497,21 +474,6 @@ rrtmgp_main (const int ncol, const int nlay,
auto clouds_lw_gpt = get_subsampled_clouds(ncol, nlay, nlwbands, nlwgpts,
clouds_lw, *k_dist_lw_k, cldfrac, p_lay);

/*
// Copy cloud properties to outputs (is this needed, or can we just use pointers?)
// Alternatively, just compute and output a subcolumn cloud mask
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay, nswgpts}),
KOKKOS_LAMBDA (int icol, int ilay, int igpt)
{
cld_tau_sw_gpt(icol,ilay,igpt) = clouds_sw_gpt.tau(icol,ilay,igpt);
});
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay, nlwgpts}),
KOKKOS_LAMBDA (int icol, int ilay, int igpt)
{
cld_tau_lw_gpt(icol,ilay,igpt) = clouds_lw_gpt.tau(icol,ilay,igpt);
});
*/

// Do shortwave
rrtmgp_sw(ncol, nlay,
*k_dist_sw_k, p_lay, t_lay, p_lev, t_lev, gas_concs,
Expand Down Expand Up @@ -651,16 +613,28 @@ rrtmgp_sw (const int ncol,
flux_up (icol,ilev) = 0;
flux_dn (icol,ilev) = 0;
flux_dn_dir(icol,ilev) = 0;
clnclrsky_flux_up (icol,ilev) = 0;
clnclrsky_flux_dn (icol,ilev) = 0;
clnclrsky_flux_dn_dir(icol,ilev) = 0;
clrsky_flux_up (icol,ilev) = 0;
clrsky_flux_dn (icol,ilev) = 0;
clrsky_flux_dn_dir(icol,ilev) = 0;
clnsky_flux_up (icol,ilev) = 0;
clnsky_flux_dn (icol,ilev) = 0;
clnsky_flux_dn_dir(icol,ilev) = 0;
});
if (extra_clnclrsky_diag) {
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0, 0}, {ncol, nlay+1}),
KOKKOS_LAMBDA (int icol, int ilev)
{
clnclrsky_flux_up (icol,ilev) = 0;
clnclrsky_flux_dn (icol,ilev) = 0;
clnclrsky_flux_dn_dir(icol,ilev) = 0;
});
}
if (extra_clnsky_diag) {
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0, 0}, {ncol, nlay+1}),
KOKKOS_LAMBDA (int icol, int ilev)
{
clnsky_flux_up (icol,ilev) = 0;
clnsky_flux_dn (icol,ilev) = 0;
clnsky_flux_dn_dir(icol,ilev) = 0;
});
}
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay+1, nbnd}),
KOKKOS_LAMBDA (int icol, int ilev, int ibnd)
{
Expand Down Expand Up @@ -933,15 +907,27 @@ rrtmgp_lw (const int ncol,
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0, 0}, {ncol, nlay+1}),
KOKKOS_LAMBDA (int icol, int ilev)
{
flux_up(icol, ilev) = 0;
flux_dn(icol, ilev) = 0;
clnclrsky_flux_up(icol, ilev) = 0;
clnclrsky_flux_dn(icol, ilev) = 0;
clrsky_flux_up(icol, ilev) = 0;
clrsky_flux_dn(icol, ilev) = 0;
clnsky_flux_up(icol, ilev) = 0;
clnsky_flux_dn(icol, ilev) = 0;
flux_up(icol, ilev) = 0;
flux_dn(icol, ilev) = 0;
clrsky_flux_up(icol, ilev) = 0;
clrsky_flux_dn(icol, ilev) = 0;
});
if (extra_clnclrsky_diag) {
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0, 0}, {ncol, nlay+1}),
KOKKOS_LAMBDA (int icol, int ilev)
{
clnclrsky_flux_up(icol, ilev) = 0;
clnclrsky_flux_dn(icol, ilev) = 0;
});
}
if (extra_clnsky_diag) {
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0, 0}, {ncol, nlay+1}),
KOKKOS_LAMBDA (int icol, int ilev)
{
clnsky_flux_up(icol, ilev) = 0;
clnsky_flux_dn(icol, ilev) = 0;
});
}
Kokkos::parallel_for(Kokkos::MDRangePolicy<Kokkos::Rank<3>>({0, 0, 0}, {ncol, nlay+1, nbnd}),
KOKKOS_LAMBDA (int icol, int ilev, int ibnd)
{
Expand Down
31 changes: 18 additions & 13 deletions Source/PhysicsInterfaces/Radiation/ERF_Radiation.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public:
// Destructor
~Radiation ()
{
// Release k-distribution data and memory pool
if (rrtmgp::initialized) {
rrtmgp::rrtmgp_finalize();
}
// Note that Kokkos is now finalized in main.cpp
}

Expand Down Expand Up @@ -322,8 +326,11 @@ private:
// Offsets for MultiFab <-> KOKKOS transfer
amrex::Vector<int> m_col_offsets;

// Whether we use aerosol forcing in radiation
bool m_do_aerosol_rad = true;
// Whether we use aerosol forcing in radiation.
// Aerosol plumbing is currently not implemented; this hook is retained so a
// future aerosol scheme can wire in without reintroducing the parameter.
// Setting it true today triggers an abort in the Radiation constructor.
bool m_do_aerosol_rad = false;

// Whether we do extra aerosol forcing calls
bool m_extra_clnsky_diag = false;
Expand Down Expand Up @@ -363,6 +370,9 @@ private:
// Rad frequency in number of steps
int m_rad_freq_in_steps = 1;

// Number of columns to process per RRTMGP chunk (controls peak memory)
int m_ncol_chunk = 5000;

// Whether or not to do subcolumn sampling of cloud state for MCICA
bool m_do_subcol_sampling = true;

Expand Down Expand Up @@ -442,21 +452,16 @@ private:
real2d_k sfc_alb_dir;
real2d_k sfc_alb_dif;

// 2d size (ncol, nlwbands)
real2d_k emis_sfc;

// Aerosol optical properties. Dormant scaffolding kept so a future aerosol
// coupling (e.g. SPA, prescribed aerosol climatology) can populate these
// without re-adding members. Only allocated when m_do_aerosol_rad is true,
// which currently aborts in the constructor; when aerosol coupling is
// wired in, remove the abort and pass these into rrtmgp_main.
//
// 3d size (ncol, nlay, n[sw,lw]bands)
real3d_k aero_tau_sw;
real3d_k aero_ssa_sw;
real3d_k aero_g_sw;
real3d_k aero_tau_lw;

// 3d size (ncol, nlay, n[sw,lw]bnds)
real3d_k cld_tau_sw_bnd;
real3d_k cld_tau_lw_bnd;

// 3d size (ncol, nlay, n[sw,lw]gpts)
real3d_k cld_tau_sw_gpt;
real3d_k cld_tau_lw_gpt;
};
#endif
Loading
Loading