From aae9952daa5038e0b2d2d62fcfecf081d4d04dd8 Mon Sep 17 00:00:00 2001 From: "Aaron M. Lattanzi" <103702284+AMLattanzi@users.noreply.github.com> Date: Tue, 23 Apr 2024 19:47:36 -0700 Subject: [PATCH] More bounds fixes. (#1590) --- Source/Radiation/Radiation.cpp | 39 +++++++++++++----------- Source/Radiation/Run_longwave_rrtmgp.cpp | 26 ++++++++-------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Source/Radiation/Radiation.cpp b/Source/Radiation/Radiation.cpp index 61fba0ed7..aa2ac16f1 100644 --- a/Source/Radiation/Radiation.cpp +++ b/Source/Radiation/Radiation.cpp @@ -263,35 +263,38 @@ void Radiation::run () real1d coszrs("coszrs", ncol); // Pointers to fields on the physics buffer - real2d cld("cld", ncol, nlev), cldfsnow("cldfsnow", ncol, nlev), - iclwp("iclwp", ncol, nlev), iciwp("iciwp", ncol, nlev), - icswp("icswp", ncol, nlev), dei("dei", ncol, nlev), - des("des", ncol, nlev), lambdac("lambdac", ncol, nlev), - mu("mu", ncol, nlev), rei("rei", ncol, nlev), rel("rel", ncol, nlev); + real2d cld("cld" , ncol, nlev), cldfsnow("cldfsnow", ncol, nlev), + iclwp("iclwp", ncol, nlev), iciwp("iciwp" , ncol, nlev), + icswp("icswp", ncol, nlev), dei("dei" , ncol, nlev), + des("des" , ncol, nlev), lambdac("lambdac" , ncol, nlev), + mu("mu" , ncol, nlev), rei("rei" , ncol, nlev), + rel("rel" , ncol, nlev); // Cloud, snow, and aerosol optical properties real3d cld_tau_gpt_sw("cld_tau_gpt_sw", ncol, nlev, nswgpts), - cld_ssa_gpt_sw("cld_ssa_gpt_sw", ncol, nlev, nswgpts), - cld_asm_gpt_sw("cld_asm_gpt_sw", ncol, nlev, nswgpts); + cld_ssa_gpt_sw("cld_ssa_gpt_sw", ncol, nlev, nswgpts), + cld_asm_gpt_sw("cld_asm_gpt_sw", ncol, nlev, nswgpts); + real3d cld_tau_bnd_sw("cld_tau_bnd_sw", ncol, nlev, nswbands), - cld_ssa_bnd_sw("cld_ssa_bnd_sw", ncol, nlev, nswbands), - cld_asm_bnd_sw("cld_asm_bnd_sw", ncol, nlev, nswbands); + cld_ssa_bnd_sw("cld_ssa_bnd_sw", ncol, nlev, nswbands), + cld_asm_bnd_sw("cld_asm_bnd_sw", ncol, nlev, nswbands); real3d aer_tau_bnd_sw("aer_tau_bnd_sw", ncol, nlev, nswbands), - aer_ssa_bnd_sw("aer_ssa_bnd_sw", ncol, nlev, nswbands), - aer_asm_bnd_sw("aer_asm_bnd_sw", ncol, nlev, nswbands); + aer_ssa_bnd_sw("aer_ssa_bnd_sw", ncol, nlev, nswbands), + aer_asm_bnd_sw("aer_asm_bnd_sw", ncol, nlev, nswbands); real3d cld_tau_bnd_lw("cld_tau_bnd_lw", ncol, nlev, nlwbands), - aer_tau_bnd_lw("aer_tau_bnd_lw", ncol, nlev, nlwbands); + aer_tau_bnd_lw("aer_tau_bnd_lw", ncol, nlev, nlwbands); + real3d cld_tau_gpt_lw("cld_tau_gpt_lw", ncol, nlev, nlwgpts); // NOTE: these are diagnostic only real3d liq_tau_bnd_sw("liq_tau_bnd_sw", ncol, nlev, nswbands), - ice_tau_bnd_sw("ice_tau_bnd_sw", ncol, nlev, nswbands), - snw_tau_bnd_sw("snw_tau_bnd_sw", ncol, nlev, nswbands); + ice_tau_bnd_sw("ice_tau_bnd_sw", ncol, nlev, nswbands), + snw_tau_bnd_sw("snw_tau_bnd_sw", ncol, nlev, nswbands); real3d liq_tau_bnd_lw("liq_tau_bnd_lw", ncol, nlev, nlwbands), - ice_tau_bnd_lw("ice_tau_bnd_lw", ncol, nlev, nlwbands), - snw_tau_bnd_lw("snw_tau_bnd_lw", ncol, nlev, nlwbands); + ice_tau_bnd_lw("ice_tau_bnd_lw", ncol, nlev, nlwbands), + snw_tau_bnd_lw("snw_tau_bnd_lw", ncol, nlev, nlwbands); // Gas volume mixing ratios real3d gas_vmr("gas_vmr", ngas, ncol, nlev); @@ -706,7 +709,7 @@ void Radiation::radiation_driver_lw (int ncol, int nlev, FluxesByband& fluxes_allsky, const real2d& qrl, const real2d& qrlc) { real3d cld_tau_gpt_rad("cld_tau_gpt_rad", ncol, nlev+1, nlwgpts); - real3d aer_tau_bnd_rad("aer_tau_bnd-rad", ncol, nlev+1, nlwgpts); + real3d aer_tau_bnd_rad("aer_tau_bnd_rad", ncol, nlev+1, nlwgpts); // Surface emissivity needed for longwave real2d surface_emissivity("surface_emissivity", nlwbands, ncol); @@ -726,7 +729,7 @@ void Radiation::radiation_driver_lw (int ncol, int nlev, yakl::memset(cld_tau_gpt_rad, 0.); yakl::memset(aer_tau_bnd_rad, 0.); - parallel_for(SimpleBounds<3>(ncol, nlev, nswgpts), YAKL_LAMBDA (int icol, int ilev, int igpt) + parallel_for(SimpleBounds<3>(ncol, nlev, nlwgpts), YAKL_LAMBDA (int icol, int ilev, int igpt) { cld_tau_gpt_rad(icol,ilev,igpt) = cld_tau_gpt(icol,ilev,igpt); aer_tau_bnd_rad(icol,ilev,igpt) = aer_tau_bnd(icol,ilev,igpt); diff --git a/Source/Radiation/Run_longwave_rrtmgp.cpp b/Source/Radiation/Run_longwave_rrtmgp.cpp index d66a6719f..ddab671ff 100644 --- a/Source/Radiation/Run_longwave_rrtmgp.cpp +++ b/Source/Radiation/Run_longwave_rrtmgp.cpp @@ -98,12 +98,13 @@ void Rrtmgp::run_longwave_rrtmgp (int ngas, int ncol, int nlay, // Do the clearsky calculation before adding in clouds FluxesByband fluxes_clrsky; - fluxes_clrsky.flux_up = real2d("clrsky_flux_up", ncol, nlay+1); // clrsky_flux_up; - fluxes_clrsky.flux_dn = real2d("clrsky_flux_up", ncol, nlay+1); //clrsky_flux_dn; - fluxes_clrsky.flux_net = real2d("clrsky_flux_up", ncol, nlay+1); //clrsky_flux_net; - fluxes_clrsky.bnd_flux_up = real3d("clrsky_flux_up", ncol, nlay+1, nlwbands); //clrsky_bnd_flux_up; - fluxes_clrsky.bnd_flux_dn = real3d("clrsky_flux_up", ncol, nlay+1, nlwbands); //clrsky_bnd_flux_dn; - fluxes_clrsky.bnd_flux_net = real3d("clrsky_flux_up", ncol, nlay+1, nlwbands); //clrsky_bnd_flux_net; + fluxes_clrsky.flux_up = real2d("clrsky_flux_up" , ncol, nlay+1); // clrsky_flux_up; + fluxes_clrsky.flux_dn = real2d("clrsky_flux_dn" , ncol, nlay+1); //clrsky_flux_dn; + fluxes_clrsky.flux_net = real2d("clrsky_flux_net", ncol, nlay+1); //clrsky_flux_net; + fluxes_clrsky.bnd_flux_up = real3d("clrsky_bnd_flux_up" , ncol, nlay+1, nlwbands); //clrsky_bnd_flux_up; + fluxes_clrsky.bnd_flux_dn = real3d("clrsky_bnd_flux_dn" , ncol, nlay+1, nlwbands); //clrsky_bnd_flux_dn; + fluxes_clrsky.bnd_flux_net = real3d("clrsky_bnd_flux_net", ncol, nlay+1, nlwbands); //clrsky_bnd_flux_net; + rte_lw(max_gauss_pts, gauss_Ds, gauss_wts, combined_optics, top_at_1, lw_sources, emis_sfc, fluxes_clrsky); // Copy fluxes back out of FluxesByband object @@ -125,12 +126,13 @@ void Rrtmgp::run_longwave_rrtmgp (int ngas, int ncol, int nlay, // Call LW flux driver FluxesByband fluxes_allsky; - fluxes_allsky.flux_up = real2d("flux_up", ncol, nlay+1); //allsky_flux_up; - fluxes_allsky.flux_dn = real2d("flux_dn", ncol, nlay+1); //allsky_flux_dn; - fluxes_allsky.flux_net = real2d("flux_net", ncol, nlay+1); //allsky_flux_net; - fluxes_allsky.bnd_flux_up = real3d("flux_up", ncol, nlay+1, nlwbands); //allsky_bnd_flux_up; - fluxes_allsky.bnd_flux_dn = real3d("flux_dn", ncol, nlay+1, nlwbands); //allsky_bnd_flux_dn; - fluxes_allsky.bnd_flux_net = real3d("flux_net", ncol, nlay+1, nlwbands); //allsky_bnd_flux_net; + fluxes_allsky.flux_up = real2d("allsky_flux_up" , ncol, nlay+1); //allsky_flux_up; + fluxes_allsky.flux_dn = real2d("allsky_flux_dn" , ncol, nlay+1); //allsky_flux_dn; + fluxes_allsky.flux_net = real2d("allsky_flux_net", ncol, nlay+1); //allsky_flux_net; + fluxes_allsky.bnd_flux_up = real3d("allsky_bnd_flux_up" , ncol, nlay+1, nlwbands); //allsky_bnd_flux_up; + fluxes_allsky.bnd_flux_dn = real3d("allsky_bnd_flux_dn" , ncol, nlay+1, nlwbands); //allsky_bnd_flux_dn; + fluxes_allsky.bnd_flux_net = real3d("allsky_bnd_flux_net", ncol, nlay+1, nlwbands); //allsky_bnd_flux_net; + rte_lw(max_gauss_pts, gauss_Ds, gauss_wts, combined_optics, top_at_1, lw_sources, emis_sfc, fluxes_allsky); // Copy fluxes back out of FluxesByband object