From d4aa235d6a7e85afaff8513dffe2398fa2f66a2a Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 11:29:50 +0100 Subject: [PATCH 1/7] rename single-phase kernels, remove l_or_i prefix in single-phase kernels and write in output tau directly as we do not need to sum liquid and ice, saving one temporary array, read ncol/nlay from optical props input --- src_cuda_rt/Cloud_optics_rt.cu | 219 +++++++++++++++++++++------------ 1 file changed, 138 insertions(+), 81 deletions(-) diff --git a/src_cuda_rt/Cloud_optics_rt.cu b/src_cuda_rt/Cloud_optics_rt.cu index 5c19f60..c2f1f6e 100644 --- a/src_cuda_rt/Cloud_optics_rt.cu +++ b/src_cuda_rt/Cloud_optics_rt.cu @@ -87,9 +87,8 @@ namespace } __global__ - void combine_and_store_kernel_single_phase(const int ncol, const int nlay, const Float tmin, - Float* __restrict__ tau, - const Float* __restrict__ l_or_i_tau, const Float* __restrict__ l_or_i_taussa) + void store_single_phase_kernel(const int ncol, const int nlay, const Float tmin, + Float* __restrict__ tau, const Float* taussa) { const int icol = blockIdx.x*blockDim.x + threadIdx.x; const int ilay = blockIdx.y*blockDim.y + threadIdx.y; @@ -97,9 +96,8 @@ namespace if ( (icol < ncol) && (ilay < nlay) ) { const int idx = icol + ilay*ncol; - const Float tau_t = (l_or_i_tau[idx] - l_or_i_taussa[idx]); - tau[idx] = tau_t; + tau[idx] -= taussa[idx]; } } @@ -126,9 +124,9 @@ namespace } __global__ - void combine_and_store_kernel_single_phase(const int ncol, const int nlay, const Float tmin, + void store_single_phase_kernel(const int ncol, const int nlay, const Float tmin, Float* __restrict__ tau, Float* __restrict__ ssa, Float* __restrict__ g, - const Float* __restrict__ l_or_i_tau, const Float* __restrict__ l_or_i_taussa, const Float* __restrict__ l_or_i_taussag + const Float* __restrict__ taussa, const Float* __restrict__ taussag ) { const int icol = blockIdx.x*blockDim.x + threadIdx.x; @@ -137,13 +135,9 @@ namespace if ( (icol < ncol) && (ilay < nlay) ) { const int idx = icol + ilay*ncol; - const Float tau_t = l_or_i_tau[idx]; - const Float taussa = l_or_i_taussa[idx]; - const Float taussag = l_or_i_taussag[idx]; - tau[idx] = tau_t; - ssa[idx] = taussa / max(tau_t, tmin); - g[idx] = taussag/ max(taussa, tmin); + ssa[idx] = taussa[idx] / max(tau[idx], tmin); + g[idx] = taussag[idx] / max(taussa[idx], tmin); } } @@ -221,19 +215,8 @@ void Cloud_optics_rt::cloud_optics( const Array_gpu& reliq, const Array_gpu& reice, Optical_props_2str_rt& optical_props) { - int ncol = -1; - int nlay = -1; - if (clwp.ptr() != nullptr) - { - ncol = clwp.dim(1); - nlay = clwp.dim(2); - Optical_props_2str_rt clouds_liq(ncol, nlay, optical_props); - } else if (ciwp.ptr() != nullptr) - { - ncol = ciwp.dim(1); - nlay = ciwp.dim(2); - Optical_props_2str_rt clouds_ice(ncol, nlay, optical_props); - } + int ncol = optical_props.get_tau().dim(1); + int nlay = optical_props.get_tau().dim(2); // Set the mask. constexpr Float mask_min_value = Float(0.); @@ -247,33 +230,60 @@ void Cloud_optics_rt::cloud_optics( dim3 block_m_gpu(block_col_m, block_lay_m); - // Temporary arrays for storage. + // Temporary arrays for storage, liquid and ice seperately if both are present Array_gpu liqmsk({0, 0}); Array_gpu ltau ({0, 0}); Array_gpu ltaussa ({0, 0}); Array_gpu ltaussag({0, 0}); + Array_gpu icemsk({0, 0}); Array_gpu itau ({0, 0}); Array_gpu itaussa ({0, 0}); Array_gpu itaussag({0, 0}); - if (clwp.ptr() != nullptr){ + + // Temporary arrays for storage, only on set needed if either liquid or ice is present + Array_gpu msk({0, 0}); + Array_gpu taussa ({0, 0}); + Array_gpu taussag({0, 0}); + + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) + { liqmsk.set_dims({ncol, nlay}); ltau.set_dims({ncol, nlay}); ltaussa.set_dims({ncol, nlay}); ltaussag.set_dims({ncol, nlay}); - - set_mask<<>>( - ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); - } - if (ciwp.ptr() != nullptr){ + icemsk.set_dims({ncol, nlay}); itau.set_dims({ncol, nlay}); itaussa.set_dims({ncol, nlay}); itaussag.set_dims({ncol, nlay}); + set_mask<<>>( + ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); + set_mask<<>>( ncol, nlay, mask_min_value, icemsk.ptr(), ciwp.ptr()); } + else if (clwp.ptr() != nullptr) + { + msk.set_dims({ncol, nlay}); + taussa.set_dims({ncol, nlay}); + taussag.set_dims({ncol, nlay}); + + set_mask<<>>( + ncol, nlay, mask_min_value, msk.ptr(), clwp.ptr()); + } + else if (ciwp.ptr() != nullptr) + { + msk.set_dims({ncol, nlay}); + taussa.set_dims({ncol, nlay}); + taussag.set_dims({ncol, nlay}); + + set_mask<<>>( + ncol, nlay, mask_min_value, msk.ptr(), ciwp.ptr()); + } + + const int block_col = 64; const int block_lay = 1; const int grid_col = ncol/block_col + (ncol%block_col > 0); @@ -282,23 +292,41 @@ void Cloud_optics_rt::cloud_optics( dim3 grid_gpu(grid_col, grid_lay); dim3 block_gpu(block_col, block_lay); - // Liquid water - if (clwp.ptr() != nullptr){ + // Liquid water and ice + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) + { compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, liqmsk.ptr(), clwp.ptr(), reliq.ptr(), this->liq_nsteps, this->liq_step_size, this->radliq_lwr, this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); - } - - // Ice. - if (ciwp.ptr() != nullptr){ + compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), this->ice_nsteps, this->ice_step_size, this->radice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); } + // liquid only + else if (clwp.ptr() != nullptr) + { + compute_from_table_kernel<<>>( + ncol, nlay, ibnd-1, msk.ptr(), clwp.ptr(), reliq.ptr(), + this->liq_nsteps, this->liq_step_size, this->radliq_lwr, + this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), + this->lut_asyliq_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); + } + // Ice only + else if (ciwp.ptr() != nullptr) + { + compute_from_table_kernel<<>>( + ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), reice.ptr(), + this->ice_nsteps, this->ice_step_size, this->radice_lwr, + this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), + this->lut_asyice_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); + } + + constexpr Float eps = std::numeric_limits::epsilon(); if ((ciwp.ptr() != nullptr) && (clwp.ptr() != nullptr)) { @@ -307,18 +335,20 @@ void Cloud_optics_rt::cloud_optics( optical_props.get_tau().ptr(), optical_props.get_ssa().ptr(), optical_props.get_g().ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); - } else if(ciwp.ptr() == nullptr) + } + else if (clwp.ptr() != nullptr) { - combine_and_store_kernel_single_phase<<>>( + store_single_phase_kernel<<>>( ncol, nlay, eps, optical_props.get_tau().ptr(), optical_props.get_ssa().ptr(), optical_props.get_g().ptr(), - ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); - } else if (clwp.ptr() == nullptr) + taussa.ptr(), taussag.ptr()); + } + else if (ciwp.ptr() != nullptr) { - combine_and_store_kernel_single_phase<<>>( + store_single_phase_kernel<<>>( ncol, nlay, eps, optical_props.get_tau().ptr(), optical_props.get_ssa().ptr(), optical_props.get_g().ptr(), - itau.ptr(), itaussa.ptr(), itaussag.ptr()); + taussa.ptr(), taussag.ptr()); } } @@ -330,19 +360,8 @@ void Cloud_optics_rt::cloud_optics( const Array_gpu& reliq, const Array_gpu& reice, Optical_props_1scl_rt& optical_props) { - int ncol = -1; - int nlay = -1; - if (clwp.ptr() != nullptr) - { - ncol = clwp.dim(1); - nlay = clwp.dim(2); - Optical_props_1scl_rt clouds_liq(ncol, nlay, optical_props); - } else if (ciwp.ptr() != nullptr) - { - ncol = ciwp.dim(1); - nlay = ciwp.dim(2); - Optical_props_1scl_rt clouds_ice(ncol, nlay, optical_props); - } + const int ncol = optical_props.get_tau().dim(1); + const int nlay = optical_props.get_tau().dim(2); // Set the mask. constexpr Float mask_min_value = Float(0.); @@ -355,36 +374,58 @@ void Cloud_optics_rt::cloud_optics( dim3 grid_m_gpu(grid_col_m, grid_lay_m); dim3 block_m_gpu(block_col_m, block_lay_m); - // Temporary arrays for storage. + // Temporary arrays for storage, liquid and ice seperately if both are present Array_gpu liqmsk({0, 0}); Array_gpu ltau ({0, 0}); Array_gpu ltaussa ({0, 0}); Array_gpu ltaussag({0, 0}); + Array_gpu icemsk({0, 0}); Array_gpu itau ({0, 0}); Array_gpu itaussa ({0, 0}); Array_gpu itaussag({0, 0}); - - if (clwp.ptr() != nullptr) + + // Temporary arrays for storage, only on set needed if either liquid or ice is present + Array_gpu msk({0, 0}); + Array_gpu taussa ({0, 0}); + Array_gpu taussag({0, 0}); + + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) { liqmsk.set_dims({ncol, nlay}); ltau.set_dims({ncol, nlay}); ltaussa.set_dims({ncol, nlay}); ltaussag.set_dims({ncol, nlay}); - - set_mask<<>>( - ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); - } - if (ciwp.ptr() != nullptr) - { + icemsk.set_dims({ncol, nlay}); itau.set_dims({ncol, nlay}); itaussa.set_dims({ncol, nlay}); itaussag.set_dims({ncol, nlay}); + set_mask<<>>( + ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); + set_mask<<>>( ncol, nlay, mask_min_value, icemsk.ptr(), ciwp.ptr()); } + else if (clwp.ptr() != nullptr) + { + msk.set_dims({ncol, nlay}); + taussa.set_dims({ncol, nlay}); + taussag.set_dims({ncol, nlay}); + + set_mask<<>>( + ncol, nlay, mask_min_value, msk.ptr(), clwp.ptr()); + } + else if (ciwp.ptr() != nullptr) + { + msk.set_dims({ncol, nlay}); + taussa.set_dims({ncol, nlay}); + taussag.set_dims({ncol, nlay}); + + set_mask<<>>( + ncol, nlay, mask_min_value, msk.ptr(), ciwp.ptr()); + } const int block_col = 64; const int block_lay = 1; @@ -395,23 +436,39 @@ void Cloud_optics_rt::cloud_optics( dim3 grid_gpu(grid_col, grid_lay); dim3 block_gpu(block_col, block_lay); - // Liquid water - if (clwp.ptr() != nullptr){ + // Liquid water and ice + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) + { compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, liqmsk.ptr(), clwp.ptr(), reliq.ptr(), this->liq_nsteps, this->liq_step_size, this->radliq_lwr, this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); - } - - // Ice. - if (ciwp.ptr() != nullptr){ + compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), this->ice_nsteps, this->ice_step_size, this->radice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); } + // Liquid only + else if (clwp.ptr() != nullptr) + { + compute_from_table_kernel<<>>( + ncol, nlay, ibnd-1, msk.ptr(), clwp.ptr(), reliq.ptr(), + this->liq_nsteps, this->liq_step_size, this->radliq_lwr, + this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), + this->lut_asyliq_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); + } + // Ice. + else if (ciwp.ptr() != nullptr) + { + compute_from_table_kernel<<>>( + ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), reice.ptr(), + this->ice_nsteps, this->ice_step_size, this->radice_lwr, + this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), + this->lut_asyice_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); + } constexpr Float eps = std::numeric_limits::epsilon(); if ((ciwp.ptr() != nullptr) && (clwp.ptr() != nullptr)) @@ -421,18 +478,18 @@ void Cloud_optics_rt::cloud_optics( optical_props.get_tau().ptr(), ltau.ptr(), ltaussa.ptr(), itau.ptr(), itaussa.ptr()); - } else if(ciwp.ptr() == nullptr) + } + else if(clwp.ptr() != nullptr) { - combine_and_store_kernel_single_phase<<>>( + store_single_phase_kernel<<>>( ncol, nlay, eps, - optical_props.get_tau().ptr(), - ltau.ptr(), ltaussa.ptr()); - } else if(clwp.ptr() == nullptr) + optical_props.get_tau().ptr(), taussa.ptr()); + } + else if(ciwp.ptr() != nullptr) { - combine_and_store_kernel_single_phase<<>>( + store_single_phase_kernel<<>>( ncol, nlay, eps, - optical_props.get_tau().ptr(), - itau.ptr(), itaussa.ptr()); + optical_props.get_tau().ptr(), taussa.ptr()); } From 12afb31ddb9de781cfe213041f6ad990b1ded35b Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 11:46:26 +0100 Subject: [PATCH 2/7] 1) remove override sza/azi options as these angles are provided through the input files, we prefer to keep the slowly growing command line somewhat consise. 2) rename 'disable-2s' (default False) cmd line option to 'two-stream' (default True) --- include_test/Radiation_solver_rt.h | 2 +- src_test/Radiation_solver_rt.cu | 6 +-- src_test/test_rte_rrtmgp_rt.cu | 62 ++++++++---------------------- 3 files changed, 19 insertions(+), 51 deletions(-) diff --git a/include_test/Radiation_solver_rt.h b/include_test/Radiation_solver_rt.h index 4d59a97..10abced 100644 --- a/include_test/Radiation_solver_rt.h +++ b/include_test/Radiation_solver_rt.h @@ -99,7 +99,7 @@ class Radiation_solver_shortwave #ifdef __CUDACC__ void solve_gpu( const bool switch_fluxes, - const bool switch_disable_2s, + const bool switch_twostream, const bool switch_raytracing, const bool switch_independent_column, const bool switch_cloud_optics, diff --git a/src_test/Radiation_solver_rt.cu b/src_test/Radiation_solver_rt.cu index 883fe8e..aa9eddb 100644 --- a/src_test/Radiation_solver_rt.cu +++ b/src_test/Radiation_solver_rt.cu @@ -567,7 +567,7 @@ void Radiation_solver_shortwave::load_mie_tables( void Radiation_solver_shortwave::solve_gpu( const bool switch_fluxes, - const bool switch_disable_2s, + const bool switch_twostream, const bool switch_raytracing, const bool switch_independent_column, const bool switch_cloud_optics, @@ -637,7 +637,7 @@ void Radiation_solver_shortwave::solve_gpu( if (switch_fluxes) { - if (!switch_disable_2s) + if (switch_twostream) { Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_lev, grid_cells.y, grid_cells.x, sw_flux_up.ptr()); Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_lev, grid_cells.y, grid_cells.x, sw_flux_dn.ptr()); @@ -840,7 +840,7 @@ void Radiation_solver_shortwave::solve_gpu( } (*fluxes).net_flux(); - if (!switch_disable_2s) + if (switch_twostream) { Gpt_combine_kernels_cuda_rt::add_from_gpoint( n_col, n_lev, sw_flux_up.ptr(), sw_flux_dn.ptr(), sw_flux_dn_dir.ptr(), sw_flux_net.ptr(), diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 20d43f7..0df423a 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -227,7 +227,7 @@ void solve_radiation(int argc, char** argv) {"shortwave" , { true, "Enable computation of shortwave radiation."}}, {"longwave" , { false, "Enable computation of longwave radiation." }}, {"fluxes" , { true, "Enable computation of fluxes." }}, - {"disable-2s" , { false, "use raytracing onlu for flux computation. must be passed with raytracing" }}, + {"two-stream" , { true, "Run two-stream solver for to obtain 1D fluxes" }}, {"raytracing" , { true, "Use raytracing for flux computation. '--raytracing 256': use 256 rays per pixel" }}, {"independent-column", { false, "run raytracer in independent column mode"}}, {"cloud-optics" , { false, "Enable cloud optics (both liquid and ice)."}}, @@ -238,15 +238,11 @@ void solve_radiation(int argc, char** argv) {"single-gpt" , { false, "Output optical properties and fluxes for a single g-point. '--single-gpt 100': output 100th g-point" }}, {"profiling" , { false, "Perform additional profiling run." }}, {"delta-cloud" , { false, "delta-scaling of cloud optical properties" }}, - {"delta-aerosol" , { false, "delta-scaling of aerosol optical properties" }} , - {"override-sza" , { false, "override provided value of sza in input file. IN DEGREES. '--override-sza 50': use a sza of 50 degrees" }}, - {"override-azi" , { false, "override provided value of azi in input file. IN DEGREES. '--override-azi 240': use of azi of 240 degrees" }}}; + {"delta-aerosol" , { false, "delta-scaling of aerosol optical properties" }}}; std::map> command_line_ints { {"raytracing", {32, "Number of rays initialised at TOD per pixel per quadraute."}}, - {"single-gpt", {1 , "g-point to store optical properties and fluxes of" }}, - {"override-sza", {0, "solar zenith angle (theta) in degrees."}}, - {"override-azi", {0, "Solar azimuth angle in degrees."}} }; + {"single-gpt", {1 , "g-point to store optical properties and fluxes of" }}}; if (parse_command_line_options(command_line_switches, command_line_ints, argc, argv)) return; @@ -254,7 +250,7 @@ void solve_radiation(int argc, char** argv) const bool switch_shortwave = command_line_switches.at("shortwave" ).first; const bool switch_longwave = command_line_switches.at("longwave" ).first; const bool switch_fluxes = command_line_switches.at("fluxes" ).first; - const bool switch_disable_2s = command_line_switches.at("disable-2s" ).first; + const bool switch_twostream = command_line_switches.at("two-stream" ).first; const bool switch_raytracing = command_line_switches.at("raytracing" ).first; const bool switch_independent_column= command_line_switches.at("independent-column").first; bool switch_cloud_optics = command_line_switches.at("cloud-optics" ).first; @@ -266,8 +262,6 @@ void solve_radiation(int argc, char** argv) const bool switch_profiling = command_line_switches.at("profiling" ).first; const bool switch_delta_cloud = command_line_switches.at("delta-cloud" ).first; const bool switch_delta_aerosol = command_line_switches.at("delta-aerosol" ).first; - const bool override_sza = command_line_switches.at("override-sza" ).first; - const bool override_azi = command_line_switches.at("override-azi" ).first; Int photons_per_pixel = Int(command_line_ints.at("raytracing").first); if (Float(int(std::log2(Float(photons_per_pixel)))) != std::log2(Float(photons_per_pixel))) @@ -282,7 +276,7 @@ void solve_radiation(int argc, char** argv) throw std::runtime_error(error); } - if (switch_disable_2s && !switch_raytracing) { + if (!switch_twostream && !switch_raytracing) { std::string error = "cannot disable two-stream for flux calculation without turning ray tracing on"; throw std::runtime_error(error); } @@ -301,21 +295,9 @@ void solve_radiation(int argc, char** argv) print_command_line_options(command_line_switches, command_line_ints); int single_gpt = command_line_ints.at("single-gpt").first; - int sza_deg = Int(command_line_ints.at("override-sza").first); - int azi_deg = Int(command_line_ints.at("override-azi").first); Status::print_message("Using "+ std::to_string(photons_per_pixel) + " rays per pixel"); - if (override_sza) - { - Status::print_message("Using SZA of "+ std::to_string(sza_deg) + " degrees"); - } - - if (override_azi) - { - Status::print_message("Using azi of "+ std::to_string(azi_deg) + " degrees"); - } - ////// READ THE ATMOSPHERIC DATA ////// Status::print_message("Reading atmospheric input data from NetCDF."); @@ -392,7 +374,8 @@ void solve_radiation(int argc, char** argv) if (switch_cloud_optics) { - if(switch_liq_cloud_optics){ + if(switch_liq_cloud_optics) + { lwp.set_dims({n_col, n_lay}); lwp = std::move(input_nc.get_variable("lwp", {n_lay, n_col_y, n_col_x})); @@ -400,7 +383,8 @@ void solve_radiation(int argc, char** argv) rel = std::move(input_nc.get_variable("rel", {n_lay, n_col_y, n_col_x})); } - if(switch_ice_cloud_optics){ + if(switch_ice_cloud_optics) + { iwp.set_dims({n_col, n_lay}); iwp = std::move(input_nc.get_variable("iwp", {n_lay, n_col_y, n_col_x})); @@ -682,24 +666,8 @@ void solve_radiation(int argc, char** argv) rad_sw.load_mie_tables("mie_lut_broadband.nc"); } - Array mu0({n_col}); - Array azi({n_col}); - - if (override_sza) { - Float mu0_in = cosf(sza_deg * 3.14159f / 180.0f); - for (int icol=1; icol<=n_col; ++icol) - mu0({icol}) = mu0_in; - } else { - mu0 = input_nc.get_variable("mu0", {n_col_y, n_col_x}); - } - - if (override_azi) { - Float azi_in = azi_deg * 3.14159f / 180.0f; - for (int icol=1; icol<=n_col; ++icol) - azi({icol}) = azi_in; - } else { - azi = input_nc.get_variable("azi", {n_col_y, n_col_x}); - } + Array mu0(input_nc.get_variable("mu0", {n_col_y, n_col_x}), {n_col}); + Array azi(input_nc.get_variable("azi", {n_col_y, n_col_x}), {n_col}); Array sfc_alb_dir(input_nc.get_variable("sfc_alb_dir", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col}); Array sfc_alb_dif(input_nc.get_variable("sfc_alb_dif", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col}); @@ -761,7 +729,7 @@ void solve_radiation(int argc, char** argv) if (switch_fluxes) { - if(!switch_disable_2s) + if(switch_twostream) { sw_flux_up .set_dims({n_col, n_lev}); sw_flux_dn .set_dims({n_col, n_lev}); @@ -828,7 +796,7 @@ void solve_radiation(int argc, char** argv) rad_sw.solve_gpu( switch_fluxes, - switch_disable_2s, + switch_twostream, switch_raytracing, switch_independent_column, switch_cloud_optics, @@ -966,7 +934,7 @@ void solve_radiation(int argc, char** argv) if (switch_fluxes) { - if (!switch_disable_2s) + if (switch_twostream) { auto nc_sw_flux_up = output_nc.add_variable("sw_flux_up" , {"lev", "y", "x"}); auto nc_sw_flux_dn = output_nc.add_variable("sw_flux_dn" , {"lev", "y", "x"}); @@ -1032,7 +1000,7 @@ void solve_radiation(int argc, char** argv) if (switch_single_gpt) { - if (!switch_disable_2s) + if (switch_twostream) { auto nc_sw_gpt_flux_up = output_nc.add_variable("sw_gpt_flux_up" , {"lev", "y", "x"}); auto nc_sw_gpt_flux_dn = output_nc.add_variable("sw_gpt_flux_dn" , {"lev", "y", "x"}); From 1e0c426a1f60bf74c8591f85bbbc76f019525f86 Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 11:49:17 +0100 Subject: [PATCH 3/7] add missing spaces --- src_test/test_rte_rrtmgp_rt.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 0df423a..32858c6 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -374,7 +374,7 @@ void solve_radiation(int argc, char** argv) if (switch_cloud_optics) { - if(switch_liq_cloud_optics) + if (switch_liq_cloud_optics) { lwp.set_dims({n_col, n_lay}); lwp = std::move(input_nc.get_variable("lwp", {n_lay, n_col_y, n_col_x})); @@ -383,7 +383,7 @@ void solve_radiation(int argc, char** argv) rel = std::move(input_nc.get_variable("rel", {n_lay, n_col_y, n_col_x})); } - if(switch_ice_cloud_optics) + if (switch_ice_cloud_optics) { iwp.set_dims({n_col, n_lay}); iwp = std::move(input_nc.get_variable("iwp", {n_lay, n_col_y, n_col_x})); From 74b7837b50a31d4a9c3cea43d86313065dd24f3a Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 11:54:57 +0100 Subject: [PATCH 4/7] small clean up --- src_cuda_rt/Cloud_optics_rt.cu | 38 ++++++++++++------------ src_kernels_cuda_rt/raytracer_kernels.cu | 4 +-- src_test/test_rte_rrtmgp_rt.cu | 6 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src_cuda_rt/Cloud_optics_rt.cu b/src_cuda_rt/Cloud_optics_rt.cu index c2f1f6e..61e87df 100644 --- a/src_cuda_rt/Cloud_optics_rt.cu +++ b/src_cuda_rt/Cloud_optics_rt.cu @@ -235,24 +235,24 @@ void Cloud_optics_rt::cloud_optics( Array_gpu ltau ({0, 0}); Array_gpu ltaussa ({0, 0}); Array_gpu ltaussag({0, 0}); - + Array_gpu icemsk({0, 0}); Array_gpu itau ({0, 0}); Array_gpu itaussa ({0, 0}); Array_gpu itaussag({0, 0}); - + // Temporary arrays for storage, only on set needed if either liquid or ice is present Array_gpu msk({0, 0}); Array_gpu taussa ({0, 0}); Array_gpu taussag({0, 0}); - + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) { liqmsk.set_dims({ncol, nlay}); ltau.set_dims({ncol, nlay}); ltaussa.set_dims({ncol, nlay}); ltaussag.set_dims({ncol, nlay}); - + icemsk.set_dims({ncol, nlay}); itau.set_dims({ncol, nlay}); itaussa.set_dims({ncol, nlay}); @@ -260,7 +260,7 @@ void Cloud_optics_rt::cloud_optics( set_mask<<>>( ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); - + set_mask<<>>( ncol, nlay, mask_min_value, icemsk.ptr(), ciwp.ptr()); } @@ -300,7 +300,7 @@ void Cloud_optics_rt::cloud_optics( this->liq_nsteps, this->liq_step_size, this->radliq_lwr, this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); - + compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), this->ice_nsteps, this->ice_step_size, this->radice_lwr, @@ -325,8 +325,8 @@ void Cloud_optics_rt::cloud_optics( this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); } - - + + constexpr Float eps = std::numeric_limits::epsilon(); if ((ciwp.ptr() != nullptr) && (clwp.ptr() != nullptr)) { @@ -348,7 +348,7 @@ void Cloud_optics_rt::cloud_optics( store_single_phase_kernel<<>>( ncol, nlay, eps, optical_props.get_tau().ptr(), optical_props.get_ssa().ptr(), optical_props.get_g().ptr(), - taussa.ptr(), taussag.ptr()); + taussa.ptr(), taussag.ptr()); } } @@ -362,7 +362,7 @@ void Cloud_optics_rt::cloud_optics( { const int ncol = optical_props.get_tau().dim(1); const int nlay = optical_props.get_tau().dim(2); - + // Set the mask. constexpr Float mask_min_value = Float(0.); const int block_col_m = 16; @@ -379,24 +379,24 @@ void Cloud_optics_rt::cloud_optics( Array_gpu ltau ({0, 0}); Array_gpu ltaussa ({0, 0}); Array_gpu ltaussag({0, 0}); - + Array_gpu icemsk({0, 0}); Array_gpu itau ({0, 0}); Array_gpu itaussa ({0, 0}); Array_gpu itaussag({0, 0}); - + // Temporary arrays for storage, only on set needed if either liquid or ice is present Array_gpu msk({0, 0}); Array_gpu taussa ({0, 0}); Array_gpu taussag({0, 0}); - + if ((clwp.ptr() != nullptr) && (ciwp.ptr() != nullptr)) { liqmsk.set_dims({ncol, nlay}); ltau.set_dims({ncol, nlay}); ltaussa.set_dims({ncol, nlay}); ltaussag.set_dims({ncol, nlay}); - + icemsk.set_dims({ncol, nlay}); itau.set_dims({ncol, nlay}); itaussa.set_dims({ncol, nlay}); @@ -404,7 +404,7 @@ void Cloud_optics_rt::cloud_optics( set_mask<<>>( ncol, nlay, mask_min_value, liqmsk.ptr(), clwp.ptr()); - + set_mask<<>>( ncol, nlay, mask_min_value, icemsk.ptr(), ciwp.ptr()); } @@ -444,7 +444,7 @@ void Cloud_optics_rt::cloud_optics( this->liq_nsteps, this->liq_step_size, this->radliq_lwr, this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); - + compute_from_table_kernel<<>>( ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), this->ice_nsteps, this->ice_step_size, this->radice_lwr, @@ -459,7 +459,7 @@ void Cloud_optics_rt::cloud_optics( this->liq_nsteps, this->liq_step_size, this->radliq_lwr, this->lut_extliq_gpu.ptr(), this->lut_ssaliq_gpu.ptr(), this->lut_asyliq_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); - } + } // Ice. else if (ciwp.ptr() != nullptr) { @@ -478,13 +478,13 @@ void Cloud_optics_rt::cloud_optics( optical_props.get_tau().ptr(), ltau.ptr(), ltaussa.ptr(), itau.ptr(), itaussa.ptr()); - } + } else if(clwp.ptr() != nullptr) { store_single_phase_kernel<<>>( ncol, nlay, eps, optical_props.get_tau().ptr(), taussa.ptr()); - } + } else if(ciwp.ptr() != nullptr) { store_single_phase_kernel<<>>( diff --git a/src_kernels_cuda_rt/raytracer_kernels.cu b/src_kernels_cuda_rt/raytracer_kernels.cu index a4e3ca3..fb1a46e 100644 --- a/src_kernels_cuda_rt/raytracer_kernels.cu +++ b/src_kernels_cuda_rt/raytracer_kernels.cu @@ -222,7 +222,7 @@ void ray_tracer_kernel( photon.position.x += dx; photon.position.y += dy; } - + const Float dz = photon.direction.z * (s_min + d_max); photon.position.z += dz; @@ -339,7 +339,7 @@ void ray_tracer_kernel( { Float dz = photon.direction.z * dn; photon.position.z = (dz > 0) ? min(photon.position.z + dz, (k_n+1) * kn_grid_d.z - s_min) : max(photon.position.z + dz, (k_n) * kn_grid_d.z + s_min); - + if (!independent_column) { Float dx = photon.direction.x * dn; diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 32858c6..190c338 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -373,7 +373,7 @@ void solve_radiation(int argc, char** argv) if (switch_cloud_optics) { - + if (switch_liq_cloud_optics) { lwp.set_dims({n_col, n_lay}); @@ -958,7 +958,7 @@ void solve_radiation(int argc, char** argv) nc_sw_flux_net.add_attribute("long_name","Net shortwave fluxes (TwoStream solver)"); nc_sw_flux_net.add_attribute("units","W m-2"); - } + } if (switch_raytracing) { @@ -999,7 +999,7 @@ void solve_radiation(int argc, char** argv) if (switch_single_gpt) - { + { if (switch_twostream) { auto nc_sw_gpt_flux_up = output_nc.add_variable("sw_gpt_flux_up" , {"lev", "y", "x"}); From 807bd87bee7580f8bf2e47890f81b207f482b120 Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 12:28:36 +0100 Subject: [PATCH 5/7] change all references to ice effective radius to ice effective diameter. Not working yet, still needs to be linked to most recent rrtmgp-data --- allsky/allsky_init.py | 16 ++++++------ include/Cloud_optics.h | 20 +++++++------- include_rt/Cloud_optics_rt.h | 12 ++++----- include_test/Radiation_solver.h | 8 +++--- include_test/Radiation_solver_bw.h | 14 +++++----- include_test/Radiation_solver_rt.h | 8 +++--- rfmip/rfmip_init.py | 28 ++++++++++---------- rrtmgp-data | 2 +- rte-rrtmgp | 2 +- src/Cloud_optics.cpp | 20 +++++++------- src_cuda/Cloud_optics.cu | 20 +++++++------- src_cuda_rt/Cloud_optics_rt.cu | 28 ++++++++++---------- src_test/Radiation_solver.cpp | 16 ++++++------ src_test/Radiation_solver.cu | 16 ++++++------ src_test/Radiation_solver_bw.cu | 24 ++++++++--------- src_test/Radiation_solver_rt.cu | 16 ++++++------ src_test/test_rte_rrtmgp.cpp | 26 +++++++++--------- src_test/test_rte_rrtmgp.cu | 30 ++++++++++----------- src_test/test_rte_rrtmgp_bw.cu | 42 +++++++++++++++--------------- src_test/test_rte_rrtmgp_rt.cu | 14 +++++----- 20 files changed, 181 insertions(+), 181 deletions(-) diff --git a/allsky/allsky_init.py b/allsky/allsky_init.py index 727dd8a..8aaae85 100644 --- a/allsky/allsky_init.py +++ b/allsky/allsky_init.py @@ -31,7 +31,7 @@ def calc_p_q_T(z): i_above_zt = np.where(z > z_trop) q[i_above_zt] = q_t - + T_0 = 300. Tv_0 = (1. + 0.608*q_0)*T_0 @@ -51,16 +51,16 @@ def calc_p_q_T(z): Tv = T * (1. + 0.608*q) # T = Tv / (1. + 0.608*q) - + g = 9.79764 Rd = 287.04 p0 = 101480. p = p0 * (Tv / Tv_0)**(g/(Rd*gamma)) - + p_tmp = p0 * (Tv/Tv_0)**(g/(Rd*gamma)) \ * np.exp( -( (g*(z-z_trop)) / (Rd*Tv) ) ) - + p[i_above_zt] = p_tmp[i_above_zt] return p, q, T @@ -159,13 +159,13 @@ def calc_p_q_T(z): nc_lwp = nc_file.createVariable('lwp', float_type, ('lay', 'y', 'x')) nc_iwp = nc_file.createVariable('iwp', float_type, ('lay', 'y', 'x')) nc_rel = nc_file.createVariable('rel', float_type, ('lay', 'y', 'x')) -nc_rei = nc_file.createVariable('rei', float_type, ('lay', 'y', 'x')) +nc_dei = nc_file.createVariable('dei', float_type, ('lay', 'y', 'x')) min_rel, max_rel = 2.5, 21.5 -min_rei, max_rei = 10., 180. +min_dei, max_dei = 10., 180. rel_val = 0.5*(min_rel + max_rel) -rei_val = 0.5*(min_rei + max_rei) +dei_val = 0.5*(min_dei + max_dei) cloud_flag = (np.arange(1, n_col_x+1)%3 > 0) cloud_mask = np.where((nc_p_lay[:,:,:] > 1.e4) & (nc_p_lay[:,:,:] < 9.e4) & cloud_flag[None, None,:], True, False) @@ -173,6 +173,6 @@ def calc_p_q_T(z): nc_lwp[:,:,:] = np.where(cloud_mask & (nc_T_lay[:,:,:] > 263.), 10., 0.) nc_iwp[:,:,:] = np.where(cloud_mask & (nc_T_lay[:,:,:] < 273.), 10., 0.) nc_rel[:,:,:] = np.where(nc_lwp[:,:,:] > 0., rel_val, 0.) -nc_rei[:,:,:] = np.where(nc_iwp[:,:,:] > 0., rei_val, 0.) +nc_dei[:,:,:] = np.where(nc_iwp[:,:,:] > 0., dei_val, 0.) nc_file.close() diff --git a/include/Cloud_optics.h b/include/Cloud_optics.h index 8192765..f3a4b83 100644 --- a/include/Cloud_optics.h +++ b/include/Cloud_optics.h @@ -41,18 +41,18 @@ class Cloud_optics : public Optical_props Cloud_optics( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice); void cloud_optics( const Array& clwp, const Array& ciwp, - const Array& reliq, const Array& reice, + const Array& reliq, const Array& deice, Optical_props_1scl& optical_props); void cloud_optics( const Array& clwp, const Array& ciwp, - const Array& reliq, const Array& reice, + const Array& reliq, const Array& deice, Optical_props_2str& optical_props); private: @@ -64,8 +64,8 @@ class Cloud_optics : public Optical_props // Lookup table constants. Float radliq_lwr; Float radliq_upr; - Float radice_lwr; - Float radice_upr; + Float diamice_lwr; + Float diamice_upr; // Lookup table coefficients. Array lut_extliq; @@ -84,18 +84,18 @@ class Cloud_optics_gpu : public Optical_props_gpu Cloud_optics_gpu( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice); void cloud_optics( const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_1scl_gpu& optical_props); void cloud_optics( const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_2str_gpu& optical_props); private: @@ -107,8 +107,8 @@ class Cloud_optics_gpu : public Optical_props_gpu // Lookup table constants. Float radliq_lwr; Float radliq_upr; - Float radice_lwr; - Float radice_upr; + Float diamice_lwr; + Float diamice_upr; // Lookup table coefficients. Array lut_extliq; diff --git a/include_rt/Cloud_optics_rt.h b/include_rt/Cloud_optics_rt.h index 39e613f..d83c9b5 100644 --- a/include_rt/Cloud_optics_rt.h +++ b/include_rt/Cloud_optics_rt.h @@ -32,27 +32,27 @@ // Forward declarations. class Optical_props_rt; -#ifdef USECUDA +#ifdef USECUDA class Cloud_optics_rt : public Optical_props_rt { public: Cloud_optics_rt( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice); void cloud_optics( const int ibnd, const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_1scl_rt& optical_props); void cloud_optics( const int ibnd, const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_2str_rt& optical_props); private: @@ -64,8 +64,8 @@ class Cloud_optics_rt : public Optical_props_rt // Lookup table constants. Float radliq_lwr; Float radliq_upr; - Float radice_lwr; - Float radice_upr; + Float diamice_lwr; + Float diamice_upr; // Lookup table coefficients. Array lut_extliq; diff --git a/include_test/Radiation_solver.h b/include_test/Radiation_solver.h index 83f5e39..0ad9bd3 100644 --- a/include_test/Radiation_solver.h +++ b/include_test/Radiation_solver.h @@ -54,7 +54,7 @@ class Radiation_solver_longwave const Array& col_dry, const Array& t_sfc, const Array& emis_sfc, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, Array& tau, Array& lay_source, Array& lev_source, Array& sfc_source, Array& lw_flux_up, Array& lw_flux_dn, Array& lw_flux_net, @@ -81,7 +81,7 @@ class Radiation_solver_longwave const Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -151,7 +151,7 @@ class Radiation_solver_shortwave const Array& sfc_alb_dir, const Array& sfc_alb_dif, const Array& tsi_scaling, const Array& mu0, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, const Array& rh, const Aerosol_concs& aerosol_concs, Array& tau, Array& ssa, Array& g, @@ -188,7 +188,7 @@ class Radiation_solver_shortwave const Array_gpu& sfc_alb_dir, const Array_gpu& sfc_alb_dif, const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, Array_gpu& tau, Array_gpu& ssa, Array_gpu& g, diff --git a/include_test/Radiation_solver_bw.h b/include_test/Radiation_solver_bw.h index 3072a1b..3e597de 100644 --- a/include_test/Radiation_solver_bw.h +++ b/include_test/Radiation_solver_bw.h @@ -58,7 +58,7 @@ class Radiation_solver_longwave const Array& col_dry, const Array& t_sfc, const Array& emis_sfc, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, Array& tau, Array& lay_source, Array& lev_source_inc, Array& lev_source_dec, Array& sfc_source, Array& lw_flux_up, Array& lw_flux_dn, Array& lw_flux_net, @@ -76,7 +76,7 @@ class Radiation_solver_longwave Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source_inc, Array_gpu& lev_source_dec, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -136,7 +136,7 @@ class Radiation_solver_shortwave const Array& sfc_alb, const Array& tsi_scaling, const Array& mu0, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, Array& tau, Array& ssa, Array& g, Array& toa_src, Array& sw_flux_up, Array& sw_flux_dn, @@ -174,7 +174,7 @@ class Radiation_solver_shortwave const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& land_use_map, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, @@ -209,7 +209,7 @@ class Radiation_solver_shortwave const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& land_use_map, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, @@ -250,12 +250,12 @@ class Radiation_solver_shortwave Array_gpu mie_cdfs_bb; Array_gpu mie_angs_bb; Array_gpu mie_phase_bb; - + Array_gpu mie_phase_angs; Array_gpu mie_cdfs; Array_gpu mie_angs; Array_gpu mie_phase; - + #endif }; #endif diff --git a/include_test/Radiation_solver_rt.h b/include_test/Radiation_solver_rt.h index 10abced..7d28b36 100644 --- a/include_test/Radiation_solver_rt.h +++ b/include_test/Radiation_solver_rt.h @@ -54,7 +54,7 @@ class Radiation_solver_longwave Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source_inc, Array_gpu& lev_source_dec, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -121,11 +121,11 @@ class Radiation_solver_shortwave const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, - Array_gpu& tot_tau_out, Array_gpu& tot_ssa_out, - Array_gpu& cld_tau_out, Array_gpu& cld_ssa_out, Array_gpu& cld_asy_out, + Array_gpu& tot_tau_out, Array_gpu& tot_ssa_out, + Array_gpu& cld_tau_out, Array_gpu& cld_ssa_out, Array_gpu& cld_asy_out, Array_gpu& aer_tau_out, Array_gpu& aer_ssa_out, Array_gpu& aer_asy_out, Array_gpu& sw_flux_up, Array_gpu& sw_flux_dn, Array_gpu& sw_flux_dn_dir, Array_gpu& sw_flux_net, diff --git a/rfmip/rfmip_init.py b/rfmip/rfmip_init.py index 75cc8dc..409a631 100644 --- a/rfmip/rfmip_init.py +++ b/rfmip/rfmip_init.py @@ -12,7 +12,7 @@ # Save all the input data to NetCDF nc_file = nc.Dataset('rte_rrtmgp_input_expt_{:02d}.nc'.format(expt), mode='w', datamodel='NETCDF4', clobber=True) nc_file_rfmip = nc.Dataset('multiple_input4MIPs_radiation_RFMIP_UColorado-RFMIP-1-2_none.nc', mode='r', datamodel='NETCDF4', clobber=False) - + # Create a group for the radiation and set up the values. nc_file.createDimension('lay', nc_file_rfmip.dimensions['layer'].size) nc_file.createDimension('lev', nc_file_rfmip.dimensions['level'].size) @@ -20,12 +20,12 @@ nc_file.createDimension('x', nc_file_rfmip.dimensions['site'].size) nc_file.createDimension('band_lw', band_lw) nc_file.createDimension('band_sw', band_sw) - + nc_pres_layer = nc_file.createVariable('p_lay', float_type, ('lay', 'y', 'x')) nc_pres_level = nc_file.createVariable('p_lev', float_type, ('lev', 'y', 'x')) nc_temp_layer = nc_file.createVariable('t_lay', float_type, ('lay', 'y', 'x')) nc_temp_level = nc_file.createVariable('t_lev', float_type, ('lev', 'y', 'x')) - + nc_pres_layer[:,:,:] = nc_file_rfmip.variables['pres_layer'][:,:].transpose() nc_pres_level[:,:,:] = nc_file_rfmip.variables['pres_level'][:,:].transpose() @@ -35,25 +35,25 @@ nc_temp_layer[:,:,:] = (nc_file_rfmip.variables['temp_layer'][expt,:,:]).transpose() nc_temp_level[:,:,:] = (nc_file_rfmip.variables['temp_level'][expt,:,:]).transpose() - + nc_surface_emissivity = nc_file.createVariable('emis_sfc', float_type, ('y', 'x', 'band_lw')) nc_surface_temperature = nc_file.createVariable('t_sfc', float_type, ('y', 'x')) - + nc_surface_emissivity[:,:] = np.tile( (nc_file_rfmip.variables['surface_emissivity'][:]) [:,None], (1, band_lw) ) nc_surface_temperature[:,:] = nc_file_rfmip.variables['surface_temperature'][expt,:] - + nc_surface_albedo_dir = nc_file.createVariable('sfc_alb_dir', float_type, ('y', 'x', 'band_sw')) nc_surface_albedo_dif = nc_file.createVariable('sfc_alb_dif', float_type, ('y', 'x', 'band_sw')) - + nc_surface_albedo_dir[:,:,:] = np.tile( (nc_file_rfmip.variables['surface_albedo'][:]) [:,None], (1, band_sw) ) nc_surface_albedo_dif[:,:,:] = np.tile( (nc_file_rfmip.variables['surface_albedo'][:]) [:,None], (1, band_sw) ) - + nc_mu0 = nc_file.createVariable('mu0', float_type, ('y', 'x')) nc_mu0[:,:] = np.maximum(0., np.cos( np.deg2rad(nc_file_rfmip.variables['solar_zenith_angle'][:]) ) ) - + nc_tsi = nc_file.createVariable('tsi', float_type, ('y', 'x')) nc_tsi[:,:] = nc_file_rfmip.variables['total_solar_irradiance'][:] - + nc_h2o = nc_file.createVariable('vmr_h2o' , float_type, ('lay', 'y', 'x')) nc_o3 = nc_file.createVariable('vmr_o3' , float_type, ('lay', 'y', 'x')) nc_co2 = nc_file.createVariable('vmr_co2' , float_type) @@ -77,7 +77,7 @@ # Profiles nc_h2o[:,:,:] = nc_file_rfmip.variables['water_vapor'][expt,:,:].transpose() * float(nc_file_rfmip.variables['water_vapor'].units) nc_o3 [:,:,:] = nc_file_rfmip.variables['ozone'][expt,:,:].transpose() * float(nc_file_rfmip.variables['ozone'].units) - + # Constants nc_co2 [:] = nc_file_rfmip.variables['carbon_dioxide_GM'][expt] * float(nc_file_rfmip.variables['carbon_dioxide_GM'].units) nc_n2o [:] = nc_file_rfmip.variables['nitrous_oxide_GM'][expt] * float(nc_file_rfmip.variables['nitrous_oxide_GM'].units) @@ -100,13 +100,13 @@ # CvH: To be removed if settings can be set. nc_lwp = nc_file.createVariable('lwp', float_type, ('lay', 'y', 'x')) nc_iwp = nc_file.createVariable('iwp', float_type, ('lay', 'y', 'x')) - nc_rel = nc_file.createVariable('rei', float_type, ('lay', 'y', 'x')) - nc_rei = nc_file.createVariable('rel', float_type, ('lay', 'y', 'x')) + nc_rel = nc_file.createVariable('dei', float_type, ('lay', 'y', 'x')) + nc_dei = nc_file.createVariable('rel', float_type, ('lay', 'y', 'x')) nc_lwp[:,:,:] = 0. nc_iwp[:,:,:] = 0. nc_rel[:,:,:] = 0. - nc_rei[:,:,:] = 0. + nc_dei[:,:,:] = 0. # CvH end. nc_file_rfmip.close() diff --git a/rrtmgp-data b/rrtmgp-data index 34967d6..df02975 160000 --- a/rrtmgp-data +++ b/rrtmgp-data @@ -1 +1 @@ -Subproject commit 34967d68703e682305ec4da72ee22bbe1f11b198 +Subproject commit df02975ab93165b34a59f0d04b4ae6148fe5127c diff --git a/rte-rrtmgp b/rte-rrtmgp index 41c5fcd..9caac5e 160000 --- a/rte-rrtmgp +++ b/rte-rrtmgp @@ -1 +1 @@ -Subproject commit 41c5fcd950fed09b8afe186dede266824eca7fd3 +Subproject commit 9caac5ec3ceab9a295699a2abb58809a9dca87de diff --git a/src/Cloud_optics.cpp b/src/Cloud_optics.cpp index ca30f75..017e61a 100644 --- a/src/Cloud_optics.cpp +++ b/src/Cloud_optics.cpp @@ -29,7 +29,7 @@ Cloud_optics::Cloud_optics( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice) : Optical_props(band_lims_wvn) @@ -40,13 +40,13 @@ Cloud_optics::Cloud_optics( this->liq_nsteps = nsize_liq; this->ice_nsteps = nsize_ice; this->liq_step_size = (radliq_upr - radliq_lwr) / (nsize_liq - Float(1.)); - this->ice_step_size = (radice_upr - radice_lwr) / (nsize_ice - Float(1.)); + this->ice_step_size = (diamice_upr - diamice_lwr) / (nsize_ice - Float(1.)); // Load LUT constants. this->radliq_lwr = radliq_lwr; this->radliq_upr = radliq_upr; - this->radice_lwr = radice_lwr; - this->radice_upr = radice_upr; + this->diamice_lwr = diamice_lwr; + this->diamice_upr = diamice_upr; // Load LUT coefficients. this->lut_extliq = lut_extliq; @@ -110,7 +110,7 @@ void compute_all_from_table( // Two-stream variant of cloud optics. void Cloud_optics::cloud_optics( const Array& clwp, const Array& ciwp, - const Array& reliq, const Array& reice, + const Array& reliq, const Array& deice, Optical_props_2str& optical_props) { const int ncol = clwp.dim(1); @@ -148,8 +148,8 @@ void Cloud_optics::cloud_optics( // Ice. compute_all_from_table( - ncol, nlay, nbnd, icemsk, ciwp, reice, - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, nbnd, icemsk, ciwp, deice, + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice, this->lut_ssaice, this->lut_asyice, itau, itaussa, itaussag); @@ -175,7 +175,7 @@ void Cloud_optics::cloud_optics( // 1scl variant of cloud optics. void Cloud_optics::cloud_optics( const Array& clwp, const Array& ciwp, - const Array& reliq, const Array& reice, + const Array& reliq, const Array& deice, Optical_props_1scl& optical_props) { const int ncol = clwp.dim(1); @@ -213,8 +213,8 @@ void Cloud_optics::cloud_optics( // Ice. compute_all_from_table( - ncol, nlay, nbnd, icemsk, ciwp, reice, - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, nbnd, icemsk, ciwp, deice, + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice, this->lut_ssaice, this->lut_asyice, itau, itaussa, itaussag); diff --git a/src_cuda/Cloud_optics.cu b/src_cuda/Cloud_optics.cu index 487fb20..8b56a85 100644 --- a/src_cuda/Cloud_optics.cu +++ b/src_cuda/Cloud_optics.cu @@ -130,7 +130,7 @@ namespace Cloud_optics_gpu::Cloud_optics_gpu( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice) : Optical_props_gpu(band_lims_wvn) @@ -141,13 +141,13 @@ Cloud_optics_gpu::Cloud_optics_gpu( this->liq_nsteps = nsize_liq; this->ice_nsteps = nsize_ice; this->liq_step_size = (radliq_upr - radliq_lwr) / (nsize_liq - Float(1.)); - this->ice_step_size = (radice_upr - radice_lwr) / (nsize_ice - Float(1.)); + this->ice_step_size = (diamice_upr - diamice_lwr) / (nsize_ice - Float(1.)); // Load LUT constants. this->radliq_lwr = radliq_lwr; this->radliq_upr = radliq_upr; - this->radice_lwr = radice_lwr; - this->radice_upr = radice_upr; + this->diamice_lwr = diamice_lwr; + this->diamice_upr = diamice_upr; // Load LUT coefficients. this->lut_extliq = lut_extliq; @@ -180,7 +180,7 @@ Cloud_optics_gpu::Cloud_optics_gpu( // Two-stream variant of cloud optics. void Cloud_optics_gpu::cloud_optics( const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_2str_gpu& optical_props) { const int ncol = clwp.dim(1); @@ -238,8 +238,8 @@ void Cloud_optics_gpu::cloud_optics( // Ice. compute_from_table_kernel<<>>( - ncol, nlay, nbnd, icemsk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, nbnd, icemsk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); @@ -256,7 +256,7 @@ void Cloud_optics_gpu::cloud_optics( // 1scl variant of cloud optics. void Cloud_optics_gpu::cloud_optics( const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_1scl_gpu& optical_props) { const int ncol = clwp.dim(1); @@ -314,8 +314,8 @@ void Cloud_optics_gpu::cloud_optics( // Ice. compute_from_table_kernel<<>>( - ncol, nlay, nbnd, icemsk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, nbnd, icemsk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); diff --git a/src_cuda_rt/Cloud_optics_rt.cu b/src_cuda_rt/Cloud_optics_rt.cu index 61e87df..d0fe10a 100644 --- a/src_cuda_rt/Cloud_optics_rt.cu +++ b/src_cuda_rt/Cloud_optics_rt.cu @@ -161,7 +161,7 @@ namespace Cloud_optics_rt::Cloud_optics_rt( const Array& band_lims_wvn, const Float radliq_lwr, const Float radliq_upr, const Float radliq_fac, - const Float radice_lwr, const Float radice_upr, const Float radice_fac, + const Float diamice_lwr, const Float diamice_upr, const Float diamice_fac, const Array& lut_extliq, const Array& lut_ssaliq, const Array& lut_asyliq, const Array& lut_extice, const Array& lut_ssaice, const Array& lut_asyice) : Optical_props_rt(band_lims_wvn) @@ -172,13 +172,13 @@ Cloud_optics_rt::Cloud_optics_rt( this->liq_nsteps = nsize_liq; this->ice_nsteps = nsize_ice; this->liq_step_size = (radliq_upr - radliq_lwr) / (nsize_liq - Float(1.)); - this->ice_step_size = (radice_upr - radice_lwr) / (nsize_ice - Float(1.)); + this->ice_step_size = (diamice_upr - diamice_lwr) / (nsize_ice - Float(1.)); // Load LUT constants. this->radliq_lwr = radliq_lwr; this->radliq_upr = radliq_upr; - this->radice_lwr = radice_lwr; - this->radice_upr = radice_upr; + this->diamice_lwr = diamice_lwr; + this->diamice_upr = diamice_upr; // Load LUT coefficients. this->lut_extliq = lut_extliq; @@ -212,7 +212,7 @@ Cloud_optics_rt::Cloud_optics_rt( void Cloud_optics_rt::cloud_optics( const int ibnd, const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_2str_rt& optical_props) { int ncol = optical_props.get_tau().dim(1); @@ -302,8 +302,8 @@ void Cloud_optics_rt::cloud_optics( this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); compute_from_table_kernel<<>>( - ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); } @@ -320,8 +320,8 @@ void Cloud_optics_rt::cloud_optics( else if (ciwp.ptr() != nullptr) { compute_from_table_kernel<<>>( - ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); } @@ -357,7 +357,7 @@ void Cloud_optics_rt::cloud_optics( void Cloud_optics_rt::cloud_optics( const int ibnd, const Array_gpu& clwp, const Array_gpu& ciwp, - const Array_gpu& reliq, const Array_gpu& reice, + const Array_gpu& reliq, const Array_gpu& deice, Optical_props_1scl_rt& optical_props) { const int ncol = optical_props.get_tau().dim(1); @@ -446,8 +446,8 @@ void Cloud_optics_rt::cloud_optics( this->lut_asyliq_gpu.ptr(), ltau.ptr(), ltaussa.ptr(), ltaussag.ptr()); compute_from_table_kernel<<>>( - ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, ibnd-1, icemsk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), itau.ptr(), itaussa.ptr(), itaussag.ptr()); } @@ -464,8 +464,8 @@ void Cloud_optics_rt::cloud_optics( else if (ciwp.ptr() != nullptr) { compute_from_table_kernel<<>>( - ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), reice.ptr(), - this->ice_nsteps, this->ice_step_size, this->radice_lwr, + ncol, nlay, ibnd-1, msk.ptr(), ciwp.ptr(), deice.ptr(), + this->ice_nsteps, this->ice_step_size, this->diamice_lwr, this->lut_extice_gpu.ptr(), this->lut_ssaice_gpu.ptr(), this->lut_asyice_gpu.ptr(), optical_props.get_tau().ptr(), taussa.ptr(), taussag.ptr()); } diff --git a/src_test/Radiation_solver.cpp b/src_test/Radiation_solver.cpp index 3f128b2..8a11c6a 100644 --- a/src_test/Radiation_solver.cpp +++ b/src_test/Radiation_solver.cpp @@ -302,9 +302,9 @@ namespace Float radliq_upr = coef_nc.get_variable("radliq_upr"); Float radliq_fac = coef_nc.get_variable("radliq_fac"); - Float radice_lwr = coef_nc.get_variable("radice_lwr"); - Float radice_upr = coef_nc.get_variable("radice_upr"); - Float radice_fac = coef_nc.get_variable("radice_fac"); + Float diamice_lwr = coef_nc.get_variable("diamice_lwr"); + Float diamice_upr = coef_nc.get_variable("diamice_upr"); + Float diamice_fac = coef_nc.get_variable("diamice_fac"); Array lut_extliq( coef_nc.get_variable("lut_extliq", {n_band, n_size_liq}), {n_size_liq, n_band}); @@ -323,7 +323,7 @@ namespace return Cloud_optics( band_lims_wvn, radliq_lwr, radliq_upr, radliq_fac, - radice_lwr, radice_upr, radice_fac, + diamice_lwr, diamice_upr, diamice_fac, lut_extliq, lut_ssaliq, lut_asyliq, lut_extice, lut_ssaice, lut_asyice); } @@ -392,7 +392,7 @@ void Radiation_solver_longwave::solve( const Array& col_dry, const Array& t_sfc, const Array& emis_sfc, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, Array& tau, Array& lay_source, Array& lev_source, Array& sfc_source, Array& lw_flux_up, Array& lw_flux_dn, Array& lw_flux_net, @@ -476,7 +476,7 @@ void Radiation_solver_longwave::solve( lwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), iwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), rel.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), - rei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), + dei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), *cloud_optical_props_subset_in); // cloud->delta_scale(); @@ -657,7 +657,7 @@ void Radiation_solver_shortwave::solve( const Array& sfc_alb_dir, const Array& sfc_alb_dif, const Array& tsi_scaling, const Array& mu0, const Array& lwp, const Array& iwp, - const Array& rel, const Array& rei, + const Array& rel, const Array& dei, const Array& rh, const Aerosol_concs& aerosol_concs, Array& tau, Array& ssa, Array& g, @@ -755,7 +755,7 @@ void Radiation_solver_shortwave::solve( lwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), iwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), rel.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), - rei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), + dei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), *cloud_optical_props_subset_in); if (switch_delta_cloud) diff --git a/src_test/Radiation_solver.cu b/src_test/Radiation_solver.cu index 33200e0..7b7dee6 100644 --- a/src_test/Radiation_solver.cu +++ b/src_test/Radiation_solver.cu @@ -337,9 +337,9 @@ namespace Float radliq_upr = coef_nc.get_variable("radliq_upr"); Float radliq_fac = coef_nc.get_variable("radliq_fac"); - Float radice_lwr = coef_nc.get_variable("radice_lwr"); - Float radice_upr = coef_nc.get_variable("radice_upr"); - Float radice_fac = coef_nc.get_variable("radice_fac"); + Float diamice_lwr = coef_nc.get_variable("diamice_lwr"); + Float diamice_upr = coef_nc.get_variable("diamice_upr"); + Float diamice_fac = coef_nc.get_variable("diamice_fac"); Array lut_extliq( coef_nc.get_variable("lut_extliq", {n_band, n_size_liq}), {n_size_liq, n_band}); @@ -358,7 +358,7 @@ namespace return Cloud_optics_gpu( band_lims_wvn, radliq_lwr, radliq_upr, radliq_fac, - radice_lwr, radice_upr, radice_fac, + diamice_lwr, diamice_upr, diamice_fac, lut_extliq, lut_ssaliq, lut_asyliq, lut_extice, lut_ssaice, lut_asyice); } @@ -427,7 +427,7 @@ void Radiation_solver_longwave::solve_gpu( const Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -503,7 +503,7 @@ void Radiation_solver_longwave::solve_gpu( lwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), iwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), rel.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), - rei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), + dei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), *cloud_optical_props_subset_in); //cloud->delta_scale(); @@ -695,7 +695,7 @@ void Radiation_solver_shortwave::solve_gpu( const Array_gpu& sfc_alb_dir, const Array_gpu& sfc_alb_dif, const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, Array_gpu& tau, Array_gpu& ssa, Array_gpu& g, @@ -779,7 +779,7 @@ void Radiation_solver_shortwave::solve_gpu( lwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), iwp.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), rel.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), - rei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), + dei.subset({{ {col_s_in, col_e_in}, {1, n_lay} }}), *cloud_optical_props_subset_in); if (switch_delta_cloud) diff --git a/src_test/Radiation_solver_bw.cu b/src_test/Radiation_solver_bw.cu index 4cf3e99..cf18aeb 100644 --- a/src_test/Radiation_solver_bw.cu +++ b/src_test/Radiation_solver_bw.cu @@ -412,9 +412,9 @@ namespace Float radliq_upr = coef_nc.get_variable("radliq_upr"); Float radliq_fac = coef_nc.get_variable("radliq_fac"); - Float radice_lwr = coef_nc.get_variable("radice_lwr"); - Float radice_upr = coef_nc.get_variable("radice_upr"); - Float radice_fac = coef_nc.get_variable("radice_fac"); + Float diamice_lwr = coef_nc.get_variable("diamice_lwr"); + Float diamice_upr = coef_nc.get_variable("diamice_upr"); + Float diamice_fac = coef_nc.get_variable("diamice_fac"); Array lut_extliq( coef_nc.get_variable("lut_extliq", {n_band, n_size_liq}), {n_size_liq, n_band}); @@ -433,7 +433,7 @@ namespace return Cloud_optics_rt( band_lims_wvn, radliq_lwr, radliq_upr, radliq_fac, - radice_lwr, radice_upr, radice_fac, + diamice_lwr, diamice_upr, diamice_fac, lut_extliq, lut_ssaliq, lut_asyliq, lut_extice, lut_ssaice, lut_asyice); } @@ -502,7 +502,7 @@ void Radiation_solver_longwave::solve_gpu( Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source_inc, Array_gpu& lev_source_dec, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -570,7 +570,7 @@ void Radiation_solver_longwave::solve_gpu( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); // cloud->delta_scale(); @@ -809,7 +809,7 @@ void Radiation_solver_shortwave::solve_gpu( const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& land_use_map, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, @@ -933,7 +933,7 @@ void Radiation_solver_shortwave::solve_gpu( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); if (switch_delta_cloud) @@ -1081,7 +1081,7 @@ void Radiation_solver_shortwave::solve_gpu( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); raytracer.accumulate_clouds( @@ -1120,7 +1120,7 @@ void Radiation_solver_shortwave::solve_gpu_bb( const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& land_use_map, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, @@ -1231,7 +1231,7 @@ void Radiation_solver_shortwave::solve_gpu_bb( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); if (switch_delta_cloud) @@ -1343,7 +1343,7 @@ void Radiation_solver_shortwave::solve_gpu_bb( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); raytracer.accumulate_clouds( diff --git a/src_test/Radiation_solver_rt.cu b/src_test/Radiation_solver_rt.cu index aa9eddb..f12a3de 100644 --- a/src_test/Radiation_solver_rt.cu +++ b/src_test/Radiation_solver_rt.cu @@ -307,9 +307,9 @@ namespace Float radliq_upr = coef_nc.get_variable("radliq_upr"); Float radliq_fac = coef_nc.get_variable("radliq_fac"); - Float radice_lwr = coef_nc.get_variable("radice_lwr"); - Float radice_upr = coef_nc.get_variable("radice_upr"); - Float radice_fac = coef_nc.get_variable("radice_fac"); + Float diamice_lwr = coef_nc.get_variable("diamice_lwr"); + Float diamice_upr = coef_nc.get_variable("diamice_upr"); + Float diamice_fac = coef_nc.get_variable("diamice_fac"); Array lut_extliq( coef_nc.get_variable("lut_extliq", {n_band, n_size_liq}), {n_size_liq, n_band}); @@ -328,7 +328,7 @@ namespace return Cloud_optics_rt( band_lims_wvn, radliq_lwr, radliq_upr, radliq_fac, - radice_lwr, radice_upr, radice_fac, + diamice_lwr, diamice_upr, diamice_fac, lut_extliq, lut_ssaliq, lut_asyliq, lut_extice, lut_ssaice, lut_asyice); } @@ -396,7 +396,7 @@ void Radiation_solver_longwave::solve_gpu( Array_gpu& col_dry, const Array_gpu& t_sfc, const Array_gpu& emis_sfc, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, Array_gpu& tau, Array_gpu& lay_source, Array_gpu& lev_source_inc, Array_gpu& lev_source_dec, Array_gpu& sfc_source, Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, @@ -465,7 +465,7 @@ void Radiation_solver_longwave::solve_gpu( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); // cloud->delta_scale(); @@ -589,7 +589,7 @@ void Radiation_solver_shortwave::solve_gpu( const Array_gpu& tsi_scaling, const Array_gpu& mu0, const Array_gpu& azi, const Array_gpu& lwp, const Array_gpu& iwp, - const Array_gpu& rel, const Array_gpu& rei, + const Array_gpu& rel, const Array_gpu& dei, const Array_gpu& rh, const Aerosol_concs_gpu& aerosol_concs, Array_gpu& tot_tau_out, Array_gpu& tot_ssa_out, @@ -747,7 +747,7 @@ void Radiation_solver_shortwave::solve_gpu( lwp, iwp, rel, - rei, + dei, *cloud_optical_props); if (switch_delta_cloud) diff --git a/src_test/test_rte_rrtmgp.cpp b/src_test/test_rte_rrtmgp.cpp index 2e0c459..1ac9c04 100644 --- a/src_test/test_rte_rrtmgp.cpp +++ b/src_test/test_rte_rrtmgp.cpp @@ -254,7 +254,7 @@ void solve_radiation(int argc, char** argv) Array lwp; Array iwp; Array rel; - Array rei; + Array dei; if (switch_cloud_optics) { @@ -267,8 +267,8 @@ void solve_radiation(int argc, char** argv) rel.set_dims({n_col, n_lay}); rel = std::move(input_nc.get_variable("rel", {n_lay, n_col_y, n_col_x})); - rei.set_dims({n_col, n_lay}); - rei = std::move(input_nc.get_variable("rei", {n_lay, n_col_y, n_col_x})); + dei.set_dims({n_col, n_lay}); + dei = std::move(input_nc.get_variable("dei", {n_lay, n_col_y, n_col_x})); } Array rh; @@ -377,7 +377,7 @@ void solve_radiation(int argc, char** argv) col_dry, t_sfc, emis_sfc, lwp, iwp, - rel, rei, + rel, dei, lw_tau, lay_source, lev_source, sfc_source, lw_flux_up, lw_flux_dn, lw_flux_net, lw_bnd_flux_up, lw_bnd_flux_dn, lw_bnd_flux_net); @@ -537,7 +537,7 @@ void solve_radiation(int argc, char** argv) sfc_alb_dir, sfc_alb_dif, tsi_scaling, mu0, lwp, iwp, - rel, rei, + rel, dei, rh, aerosol_concs, sw_tau, ssa, g, @@ -590,16 +590,16 @@ void solve_radiation(int argc, char** argv) nc_sw_flux_dn .insert(sw_flux_dn .v(), {0, 0, 0}); nc_sw_flux_dn_dir.insert(sw_flux_dn_dir.v(), {0, 0, 0}); nc_sw_flux_net .insert(sw_flux_net .v(), {0, 0, 0}); - + nc_sw_flux_up.add_attribute("long_name","Upwelling shortwave fluxes (TwoStream solver)"); nc_sw_flux_up.add_attribute("units","W m-2"); - + nc_sw_flux_dn.add_attribute("long_name","Downwelling shortwave fluxes (TwoStream solver)"); nc_sw_flux_dn.add_attribute("units","W m-2"); - + nc_sw_flux_dn_dir.add_attribute("long_name","Downwelling direct shortwave fluxes (TwoStream solver)"); nc_sw_flux_dn_dir.add_attribute("units","W m-2"); - + nc_sw_flux_net.add_attribute("long_name","Net shortwave fluxes (TwoStream solver)"); nc_sw_flux_net.add_attribute("units","W m-2"); @@ -614,16 +614,16 @@ void solve_radiation(int argc, char** argv) nc_sw_bnd_flux_dn .insert(sw_bnd_flux_dn .v(), {0, 0, 0, 0}); nc_sw_bnd_flux_dn_dir.insert(sw_bnd_flux_dn_dir.v(), {0, 0, 0, 0}); nc_sw_bnd_flux_net .insert(sw_bnd_flux_net .v(), {0, 0, 0, 0}); - + nc_sw_bnd_flux_up.add_attribute("long_name","Upwelling shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_up.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_dn.add_attribute("long_name","Downwelling shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_dn.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_dn_dir.add_attribute("long_name","Downwelling direct shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_dn_dir.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_net.add_attribute("long_name","Net shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_net.add_attribute("units","W m-2"); } diff --git a/src_test/test_rte_rrtmgp.cu b/src_test/test_rte_rrtmgp.cu index 76ae4c6..f4df364 100644 --- a/src_test/test_rte_rrtmgp.cu +++ b/src_test/test_rte_rrtmgp.cu @@ -282,7 +282,7 @@ void solve_radiation(int argc, char** argv) Array lwp; Array iwp; Array rel; - Array rei; + Array dei; if (switch_cloud_optics) { @@ -295,8 +295,8 @@ void solve_radiation(int argc, char** argv) rel.set_dims({n_col, n_lay}); rel = std::move(input_nc.get_variable("rel", {n_lay, n_col_y, n_col_x})); - rei.set_dims({n_col, n_lay}); - rei = std::move(input_nc.get_variable("rei", {n_lay, n_col_y, n_col_x})); + dei.set_dims({n_col, n_lay}); + dei = std::move(input_nc.get_variable("dei", {n_lay, n_col_y, n_col_x})); } Array rh; @@ -426,7 +426,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); cudaDeviceSynchronize(); cudaEvent_t start; @@ -447,7 +447,7 @@ void solve_radiation(int argc, char** argv) col_dry_gpu, t_sfc_gpu, emis_sfc_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, lw_tau, lay_source, lev_source, sfc_source, lw_flux_up, lw_flux_dn, lw_flux_net, lw_bnd_flux_up, lw_bnd_flux_dn, lw_bnd_flux_net); @@ -636,7 +636,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); Array_gpu rh_gpu(rh); Aerosol_concs_gpu aerosol_concs_gpu(aerosol_concs); @@ -664,7 +664,7 @@ void solve_radiation(int argc, char** argv) sfc_alb_dir_gpu, sfc_alb_dif_gpu, tsi_scaling_gpu, mu0_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, rh_gpu, aerosol_concs_gpu, sw_tau, ssa, g, @@ -749,16 +749,16 @@ void solve_radiation(int argc, char** argv) nc_sw_flux_dn .insert(sw_flux_dn_cpu .v(), {0, 0, 0}); nc_sw_flux_dn_dir.insert(sw_flux_dn_dir_cpu.v(), {0, 0, 0}); nc_sw_flux_net .insert(sw_flux_net_cpu .v(), {0, 0, 0}); - + nc_sw_flux_up.add_attribute("long_name","Upwelling shortwave fluxes (TwoStream solver)"); nc_sw_flux_up.add_attribute("units","W m-2"); - + nc_sw_flux_dn.add_attribute("long_name","Downwelling shortwave fluxes (TwoStream solver)"); nc_sw_flux_dn.add_attribute("units","W m-2"); - + nc_sw_flux_dn_dir.add_attribute("long_name","Downwelling direct shortwave fluxes (TwoStream solver)"); nc_sw_flux_dn_dir.add_attribute("units","W m-2"); - + nc_sw_flux_net.add_attribute("long_name","Net shortwave fluxes (TwoStream solver)"); nc_sw_flux_net.add_attribute("units","W m-2"); @@ -773,16 +773,16 @@ void solve_radiation(int argc, char** argv) nc_sw_bnd_flux_dn .insert(sw_bnd_flux_dn_cpu .v(), {0, 0, 0, 0}); nc_sw_bnd_flux_dn_dir.insert(sw_bnd_flux_dn_dir_cpu.v(), {0, 0, 0, 0}); nc_sw_bnd_flux_net .insert(sw_bnd_flux_net_cpu .v(), {0, 0, 0, 0}); - + nc_sw_bnd_flux_up.add_attribute("long_name","Upwelling shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_up.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_dn.add_attribute("long_name","Downwelling shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_dn.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_dn_dir.add_attribute("long_name","Downwelling direct shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_dn_dir.add_attribute("units","W m-2"); - + nc_sw_bnd_flux_net.add_attribute("long_name","Net shortwave fluxes per spectral band (TwoStream solver)"); nc_sw_bnd_flux_net.add_attribute("units","W m-2"); } diff --git a/src_test/test_rte_rrtmgp_bw.cu b/src_test/test_rte_rrtmgp_bw.cu index 852ce34..5377434 100644 --- a/src_test/test_rte_rrtmgp_bw.cu +++ b/src_test/test_rte_rrtmgp_bw.cu @@ -279,7 +279,7 @@ void solve_radiation(int argc, char** argv) std::string error = "No longwave radiation implemented in the ray tracer"; throw std::runtime_error(error); } - + // Print the options to the screen. print_command_line_options(command_line_options); @@ -382,7 +382,7 @@ void solve_radiation(int argc, char** argv) Array lwp; Array iwp; Array rel; - Array rei; + Array dei; if (switch_cloud_optics || switch_cloud_cam) { @@ -391,12 +391,12 @@ void solve_radiation(int argc, char** argv) iwp.set_dims({n_col, n_lay}); iwp = std::move(input_nc.get_variable("iwp", {n_lay, n_col_y, n_col_x})); - + rel.set_dims({n_col, n_lay}); rel = std::move(input_nc.get_variable("rel", {n_lay, n_col_y, n_col_x})); - rei.set_dims({n_col, n_lay}); - rei = std::move(input_nc.get_variable("rei", {n_lay, n_col_y, n_col_x})); + dei.set_dims({n_col, n_lay}); + dei = std::move(input_nc.get_variable("dei", {n_lay, n_col_y, n_col_x})); } else { @@ -525,7 +525,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); cudaDeviceSynchronize(); cudaEvent_t start; @@ -546,7 +546,7 @@ void solve_radiation(int argc, char** argv) col_dry_gpu, t_sfc_gpu, emis_sfc_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, lw_tau, lay_source, lev_source_inc, lev_source_dec, sfc_source, lw_flux_up, lw_flux_dn, lw_flux_net, lw_bnd_flux_up, lw_bnd_flux_dn, lw_bnd_flux_net); @@ -690,11 +690,11 @@ void solve_radiation(int argc, char** argv) { XYZ.set_dims({camera.nx, camera.ny, 3}); } - + if (switch_cloud_mie) rad_sw.load_mie_tables("mie_lut_broadband.nc", "mie_lut_visualisation.nc", switch_broadband, switch_image); - - + + Array_gpu liwp_cam; Array_gpu tauc_cam; Array_gpu dist_cam; @@ -707,7 +707,7 @@ void solve_radiation(int argc, char** argv) dist_cam.set_dims({camera.nx, camera.ny}); zen_cam.set_dims({camera.nx, camera.ny}); } - + // Solve the radiation. Status::print_message("Solving the shortwave radiation."); @@ -726,7 +726,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); Array_gpu rh_gpu(rh); Aerosol_concs_gpu aerosol_concs_gpu(aerosol_concs); @@ -763,7 +763,7 @@ void solve_radiation(int argc, char** argv) tsi_scaling_gpu, mu0_gpu, azi_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, land_use_map_gpu, rh_gpu, aerosol_concs, @@ -800,7 +800,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); Array_gpu rh_gpu(rh); Aerosol_concs_gpu aerosol_concs_gpu(aerosol_concs); @@ -838,7 +838,7 @@ void solve_radiation(int argc, char** argv) tsi_scaling_gpu, mu0_gpu, azi_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, land_use_map_gpu, rh_gpu, aerosol_concs, @@ -899,7 +899,7 @@ void solve_radiation(int argc, char** argv) auto nc_sw_band_lims_wvn = output_nc.add_variable("sw_band_lims_wvn", {"band_sw", "pair"}); nc_sw_band_lims_wvn.insert(rad_sw.get_band_lims_wavenumber_gpu().v(), {0, 0}); - + if (switch_broadband) { Array radiance_cpu(radiance); @@ -916,7 +916,7 @@ void solve_radiation(int argc, char** argv) auto nc_xyz = output_nc.add_variable("XYZ", {"n","y","x"}); nc_xyz.insert(xyz_cpu.v(), {0, 0, 0}); - + nc_xyz.add_attribute("long_name", "X Y Z tristimulus values"); } } @@ -927,19 +927,19 @@ void solve_radiation(int argc, char** argv) Array tauc_cam_cpu(tauc_cam); Array dist_cam_cpu(dist_cam); Array zen_cam_cpu(zen_cam); - + auto nc_var_liwp = output_nc.add_variable("liq_ice_wp_cam", {"y","x"}); nc_var_liwp.insert(liwp_cam_cpu.v(), {0, 0}); nc_var_liwp.add_attribute("long_name", "accumulated liquid+ice water path"); - + auto nc_var_tauc = output_nc.add_variable("tau_cld_cam", {"y","x"}); nc_var_tauc.insert(tauc_cam_cpu.v(), {0, 0}); nc_var_tauc.add_attribute("long_name", "accumulated cloud optical depth (441-615nm band)"); - + auto nc_var_dist = output_nc.add_variable("dist_cld_cam", {"y","x"}); nc_var_dist.insert(dist_cam_cpu.v(), {0, 0}); nc_var_dist.add_attribute("long_name", "distance to first cloudy cell"); - + auto nc_var_csza = output_nc.add_variable("zen_cam", {"y","x"}); nc_var_csza.insert(zen_cam_cpu.v(), {0, 0}); nc_var_csza.add_attribute("long_name", "zenith angle of camera pixel"); diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 190c338..35def54 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -369,7 +369,7 @@ void solve_radiation(int argc, char** argv) Array lwp; Array iwp; Array rel; - Array rei; + Array dei; if (switch_cloud_optics) { @@ -388,8 +388,8 @@ void solve_radiation(int argc, char** argv) iwp.set_dims({n_col, n_lay}); iwp = std::move(input_nc.get_variable("iwp", {n_lay, n_col_y, n_col_x})); - rei.set_dims({n_col, n_lay}); - rei = std::move(input_nc.get_variable("rei", {n_lay, n_col_y, n_col_x})); + dei.set_dims({n_col, n_lay}); + dei = std::move(input_nc.get_variable("dei", {n_lay, n_col_y, n_col_x})); } } @@ -530,7 +530,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); cudaDeviceSynchronize(); @@ -552,7 +552,7 @@ void solve_radiation(int argc, char** argv) col_dry_gpu, t_sfc_gpu, emis_sfc_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, lw_tau, lay_source, lev_source_inc, lev_source_dec, sfc_source, lw_flux_up, lw_flux_dn, lw_flux_net, lw_gpt_flux_up, lw_gpt_flux_dn, lw_gpt_flux_net); @@ -781,7 +781,7 @@ void solve_radiation(int argc, char** argv) Array_gpu lwp_gpu(lwp); Array_gpu iwp_gpu(iwp); Array_gpu rel_gpu(rel); - Array_gpu rei_gpu(rei); + Array_gpu dei_gpu(dei); Array_gpu rh_gpu(rh); Aerosol_concs_gpu aerosol_concs_gpu(aerosol_concs); @@ -817,7 +817,7 @@ void solve_radiation(int argc, char** argv) sfc_alb_dir_gpu, sfc_alb_dif_gpu, tsi_scaling_gpu, mu0_gpu, azi_gpu, lwp_gpu, iwp_gpu, - rel_gpu, rei_gpu, + rel_gpu, dei_gpu, rh, aerosol_concs, sw_tot_tau, sw_tot_ssa, From da60ee519535e43456ae3e52bb093ddbe0cbc18c Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 13:10:38 +0100 Subject: [PATCH 6/7] new submodules after git decided to overwrite them again --- rrtmgp-data | 2 +- rte-rrtmgp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rrtmgp-data b/rrtmgp-data index df02975..34967d6 160000 --- a/rrtmgp-data +++ b/rrtmgp-data @@ -1 +1 @@ -Subproject commit df02975ab93165b34a59f0d04b4ae6148fe5127c +Subproject commit 34967d68703e682305ec4da72ee22bbe1f11b198 diff --git a/rte-rrtmgp b/rte-rrtmgp index 9caac5e..41c5fcd 160000 --- a/rte-rrtmgp +++ b/rte-rrtmgp @@ -1 +1 @@ -Subproject commit 9caac5ec3ceab9a295699a2abb58809a9dca87de +Subproject commit 41c5fcd950fed09b8afe186dede266824eca7fd3 From c1bb890725bc1d489aaa944be29055543b27b01f Mon Sep 17 00:00:00 2001 From: Menno Date: Thu, 19 Dec 2024 13:15:19 +0100 Subject: [PATCH 7/7] update rrtmgp-data to develop branch that contains cloud LUTs with radice renamed to diamice" --- rrtmgp-data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rrtmgp-data b/rrtmgp-data index 34967d6..7add57b 160000 --- a/rrtmgp-data +++ b/rrtmgp-data @@ -1 +1 @@ -Subproject commit 34967d68703e682305ec4da72ee22bbe1f11b198 +Subproject commit 7add57b8449eec23902c36b37b379f0af23cb369