From 02c1caf8faadb532e2236ebce2310eef401eed60 Mon Sep 17 00:00:00 2001 From: Chiel van Heerwaarden Date: Thu, 24 Oct 2024 14:03:09 +0200 Subject: [PATCH] Compiling code and excessive allocations for rt absorbance fields. --- include_rt/Fluxes_rt.h | 4 +- src_cuda_rt/Fluxes_rt.cu | 65 +++--------------------- src_test/Radiation_solver_bw.cu | 89 +++++++++++++++++---------------- src_test/Radiation_solver_rt.cu | 25 +++++---- src_test/test_rte_rrtmgp_rt.cu | 45 +++++++++-------- 5 files changed, 93 insertions(+), 135 deletions(-) diff --git a/include_rt/Fluxes_rt.h b/include_rt/Fluxes_rt.h index 43071d8..ffdb65e 100644 --- a/include_rt/Fluxes_rt.h +++ b/include_rt/Fluxes_rt.h @@ -58,7 +58,7 @@ class Fluxes_rt class Fluxes_broadband_rt : public Fluxes_rt { public: - Fluxes_broadband_rt(const int ncol_x, const int ncol_y, const int nlev); + Fluxes_broadband_rt(const int ncol_x, const int ncol_y, const int n_z, const int nlev); virtual ~Fluxes_broadband_rt() {}; virtual void net_flux(); @@ -113,7 +113,7 @@ class Fluxes_broadband_rt : public Fluxes_rt class Fluxes_byband_rt : public Fluxes_broadband_rt { public: - Fluxes_byband_rt(const int ncol_x, const int ncol_y, const int nlev, const int nbnd); + Fluxes_byband_rt(const int ncol_x, const int ncol_y, const int n_z, const int nlev, const int nbnd); virtual ~Fluxes_byband_rt() {}; virtual void reduce( diff --git a/src_cuda_rt/Fluxes_rt.cu b/src_cuda_rt/Fluxes_rt.cu index 8a5ad35..e99e0af 100644 --- a/src_cuda_rt/Fluxes_rt.cu +++ b/src_cuda_rt/Fluxes_rt.cu @@ -116,61 +116,8 @@ namespace } } -//namespace rrtmgp_kernel_launcher -//{ -// -// void sum_broadband( -// int ncol, int nlev, int ngpt, -// const Array& spectral_flux, Array& broadband_flux) -// { -// rrtmgp_kernels::sum_broadband( -// &ncol, &nlev, &ngpt, -// const_cast(spectral_flux.ptr()), -// broadband_flux.ptr()); -// } -// -// -// void net_broadband( -// int ncol, int nlev, -// const Array& broadband_flux_dn, const Array& broadband_flux_up, -// Array& broadband_flux_net) -// { -// rrtmgp_kernels::net_broadband_precalc( -// &ncol, &nlev, -// const_cast(broadband_flux_dn.ptr()), -// const_cast(broadband_flux_up.ptr()), -// broadband_flux_net.ptr()); -// } -// -// -// void sum_byband( -// int ncol, int nlev, int ngpt, int nbnd, -// const Array& band_lims, -// const Array& spectral_flux, -// Array& byband_flux) -// { -// rrtmgp_kernels::sum_byband( -// &ncol, &nlev, &ngpt, &nbnd, -// const_cast(band_lims.ptr()), -// const_cast(spectral_flux.ptr()), -// byband_flux.ptr()); -// } -// -// -// void net_byband( -// int ncol, int nlev, int nband, -// const Array& byband_flux_dn, const Array& byband_flux_up, -// Array& byband_flux_net) -// { -// rrtmgp_kernels::net_byband_precalc( -// &ncol, &nlev, &nband, -// const_cast(byband_flux_dn.ptr()), -// const_cast(byband_flux_up.ptr()), -// byband_flux_net.ptr()); -// } - - -Fluxes_broadband_rt::Fluxes_broadband_rt(const int ncol_x, const int ncol_y, const int nlev) : + +Fluxes_broadband_rt::Fluxes_broadband_rt(const int ncol_x, const int ncol_y, const int n_z, const int nlev) : flux_up ({ncol_x*ncol_y, nlev}), flux_dn ({ncol_x*ncol_y, nlev}), flux_dn_dir ({ncol_x*ncol_y, nlev}), @@ -180,8 +127,8 @@ Fluxes_broadband_rt::Fluxes_broadband_rt(const int ncol_x, const int ncol_y, con flux_sfc_dir({ncol_x, ncol_y}), flux_sfc_dif({ncol_x, ncol_y}), flux_sfc_up ({ncol_x, ncol_y}), - flux_abs_dir({ncol_x, ncol_y, nlev-1}), - flux_abs_dif({ncol_x, ncol_y, nlev-1}) + flux_abs_dir({ncol_x, ncol_y, n_z}), + flux_abs_dif({ncol_x, ncol_y, n_z}) {} @@ -259,8 +206,8 @@ void Fluxes_broadband_rt::reduce( } -Fluxes_byband_rt::Fluxes_byband_rt(const int ncol_x, const int ncol_y, const int nlev, const int nbnd) : - Fluxes_broadband_rt(ncol_x, ncol_y, nlev), +Fluxes_byband_rt::Fluxes_byband_rt(const int ncol_x, const int ncol_y, const int n_z, const int nlev, const int nbnd) : + Fluxes_broadband_rt(ncol_x, ncol_y, n_z, nlev), bnd_flux_up ({ncol_x * ncol_y, nlev, nbnd}), bnd_flux_dn ({ncol_x * ncol_y, nlev, nbnd}), bnd_flux_dn_dir({ncol_x * ncol_y, nlev, nbnd}), diff --git a/src_test/Radiation_solver_bw.cu b/src_test/Radiation_solver_bw.cu index 6d10d4d..4cf3e99 100644 --- a/src_test/Radiation_solver_bw.cu +++ b/src_test/Radiation_solver_bw.cu @@ -508,6 +508,9 @@ void Radiation_solver_longwave::solve_gpu( Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, Array_gpu& lw_bnd_flux_up, Array_gpu& lw_bnd_flux_dn, Array_gpu& lw_bnd_flux_net) { + throw std::runtime_error("Longwave raytracing is not implemented"); + + /* const int n_col = p_lay.dim(1); const int n_lay = p_lay.dim(2); const int n_lev = p_lev.dim(2); @@ -624,10 +627,10 @@ void Radiation_solver_longwave::solve_gpu( } } } + */ } - Float get_x(const Float wv) { const Float a = (wv - Float(442.0)) * ((wv < Float(442.0)) ? Float(0.0624) : Float(0.0374)); @@ -744,10 +747,10 @@ void Radiation_solver_shortwave::load_mie_tables( const int n_bnd_sw = this->get_n_bnd_gpu(); const int n_re = mie_nc.get_dimension_size("r_eff"); const int n_mie = mie_nc.get_dimension_size("n_ang"); - + Array mie_cdf(mie_nc.get_variable("phase_cdf", {n_bnd_sw, n_mie}), {n_mie, 1, n_bnd_sw}); Array mie_ang(mie_nc.get_variable("phase_cdf_angle", {n_bnd_sw, n_re, n_mie}), {n_mie, n_re, 1, n_bnd_sw}); - + Array mie_phase(mie_nc.get_variable("phase", {n_bnd_sw, n_re, n_mie}), {n_mie, n_re, 1, n_bnd_sw}); Array mie_phase_ang(mie_nc.get_variable("phase_angle", {n_mie}), {n_mie}); @@ -757,7 +760,7 @@ void Radiation_solver_shortwave::load_mie_tables( this->mie_phase_bb = mie_phase; this->mie_phase_angs_bb = mie_phase_ang; } - + if (switch_image) { Netcdf_file mie_nc(file_name_mie_im, Netcdf_mode::Read); @@ -765,7 +768,7 @@ void Radiation_solver_shortwave::load_mie_tables( const int n_re = mie_nc.get_dimension_size("r_eff"); const int n_mie = mie_nc.get_dimension_size("n_ang"); const int n_sub = mie_nc.get_dimension_size("sub_band"); - + Array mie_cdf(mie_nc.get_variable("phase_cdf", {n_bnd_sw, n_sub, n_mie}), {n_mie, n_sub, n_bnd_sw}); Array mie_ang(mie_nc.get_variable("phase_cdf_angle", {n_bnd_sw, n_sub, n_re, n_mie}), {n_mie, n_re, n_sub, n_bnd_sw}); @@ -777,7 +780,7 @@ void Radiation_solver_shortwave::load_mie_tables( this->mie_phase = mie_phase; this->mie_phase_angs = mie_phase_ang; - + } } @@ -874,13 +877,13 @@ void Radiation_solver_shortwave::solve_gpu( } Array_gpu albedo; if (!switch_lu_albedo) albedo = sfc_alb.subset({{ {band, band}, {1, n_col}}}); - + if (!tune_step && (! (band == 10 || band == 11 || band ==12))) continue; - + const Float solar_source_band = kdist_gpu->band_source(band_limits_gpt({1,band}), band_limits_gpt({2,band})); - + constexpr int n_col_block = 1<<14; // 2^14 - + Array_gpu toa_src_temp({n_col_block}); auto gas_optics_subset = [&]( const int col_s, const int n_col_subset) @@ -899,27 +902,27 @@ void Radiation_solver_shortwave::solve_gpu( toa_src_temp, col_dry); }; - + const int n_blocks = n_col / n_col_block; const int n_col_residual = n_col % n_col_block; - + std::unique_ptr optical_props_block = std::make_unique(n_col_block, n_lay, *kdist_gpu); - + for (int n=0; n 0) { const int col_s = n_blocks*n_col_block; gas_optics_subset(col_s, n_col_residual); } - + if (tune_step) return; - + toa_src.fill(toa_src_temp({1}) * tsi_scaling({1})); if (switch_cloud_optics) { @@ -932,11 +935,11 @@ void Radiation_solver_shortwave::solve_gpu( rel, rei, *cloud_optical_props); - + if (switch_delta_cloud) cloud_optical_props->delta_scale(); } - + // Add the cloud optical props to the gas optical properties. add_to( dynamic_cast(*optical_props), @@ -948,7 +951,7 @@ void Radiation_solver_shortwave::solve_gpu( Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, cloud_optical_props->get_ssa().ptr()); Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, cloud_optical_props->get_g().ptr()); } - + if (switch_aerosol_optics) { if (band > previous_band) @@ -959,11 +962,11 @@ void Radiation_solver_shortwave::solve_gpu( aerosol_concs_subset, rh, p_lev, *aerosol_optical_props); - + if (switch_delta_aerosol) aerosol_optical_props->delta_scale(); } - + // Add the aerosol optical props to the gas optical properties. add_to( dynamic_cast(*optical_props), @@ -975,61 +978,61 @@ void Radiation_solver_shortwave::solve_gpu( Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, aerosol_optical_props->get_ssa().ptr()); Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, aerosol_optical_props->get_g().ptr()); } - - + + /* rrtmgp's bands are quite broad, we divide each spectral band in three equally broad spectral intervals and run each g-point for each spectral interval, using the mean rayleigh scattering coefficient of each spectral interval in stead of RRTMGP's rayleigh scattering coefficients. The contribution of each spectral interval to the spectral band is based on the integrated (<>) Planck source function: / , with a sun temperature of 5778 K. This is not entirely accurate because the sun is not a black body radiatior, but the approximations comes close enough. - + */ - + // number of intervals const Array& band_limits_wn(this->kdist_gpu->get_band_lims_wavenumber()); const int nwv = n_sub; - + const Float wv1 = 1. / band_limits_wn({2,band}) * Float(1.e7); const Float wv2 = 1. / band_limits_wn({1,band}) * Float(1.e7); const Float dwv = (wv2-wv1)/Float(nwv); - + // const Float total_planck = Planck_integrator(wv1,wv2); - + for (int iwv=0; iwv xyz_factor({3}); xyz_factor({1}) = xyz_irradiance(wv1_sub,wv2_sub,&get_x); xyz_factor({2}) = xyz_irradiance(wv1_sub,wv2_sub,&get_y); xyz_factor({3}) = xyz_irradiance(wv1_sub,wv2_sub,&get_z); Array_gpu xyz_factor_gpu(xyz_factor); - + if (switch_lu_albedo) { if (albedo.size() == 0) albedo.set_dims({1, n_col}); spectral_albedo(n_col, wv1, wv2, land_use_map, albedo); } - + const Float zenith_angle = std::acos(mu0({1})); const Float azimuth_angle = azi({1}); - + if (switch_cloud_mie) { mie_cdfs_sub = mie_cdfs.subset({{ {1, n_mie}, {iwv+1,iwv+1}, {band, band} }}); mie_angs_sub = mie_angs.subset({{ {1, n_mie}, {1, n_re}, {iwv+1,iwv+1}, {band, band} }}); mie_phase_sub = mie_phase.subset({{ {1, n_mie}, {1, n_re}, {iwv+1,iwv+1}, {band, band} }}); } - + raytracer.trace_rays( igpt, photons_per_pixel, n_lay, @@ -1059,18 +1062,18 @@ void Radiation_solver_shortwave::solve_gpu( gas_concs.get_vmr("h2o"), camera, flux_camera); - + raytracer.add_xyz_camera( camera, xyz_factor_gpu, flux_camera, XYZ); - + } previous_band = band; } - } - + } + if (switch_cloud_cam) { cloud_optics_gpu->cloud_optics( @@ -1080,13 +1083,13 @@ void Radiation_solver_shortwave::solve_gpu( rel, rei, *cloud_optical_props); - + raytracer.accumulate_clouds( grid_d, grid_cells, lwp, iwp, - dynamic_cast(*cloud_optical_props).get_tau(), + dynamic_cast(*cloud_optical_props).get_tau(), camera, liwp_cam, tauc_cam, @@ -1136,7 +1139,7 @@ void Radiation_solver_shortwave::solve_gpu_bb( const int n_mie = (switch_cloud_mie) ? this->mie_angs_bb.dim(1) : 0; const int n_re = (switch_cloud_mie) ? this->mie_angs_bb.dim(2) : 0; - + const int cam_nx = radiance.dim(1); const int cam_ny = radiance.dim(2); const Bool top_at_1 = p_lay({1, 1}) < p_lay({1, n_lay}); @@ -1342,13 +1345,13 @@ void Radiation_solver_shortwave::solve_gpu_bb( rel, rei, *cloud_optical_props); - + raytracer.accumulate_clouds( grid_d, grid_cells, lwp, iwp, - dynamic_cast(*cloud_optical_props).get_tau(), + dynamic_cast(*cloud_optical_props).get_tau(), camera, liwp_cam, tauc_cam, diff --git a/src_test/Radiation_solver_rt.cu b/src_test/Radiation_solver_rt.cu index 90b4c8b..49348a2 100644 --- a/src_test/Radiation_solver_rt.cu +++ b/src_test/Radiation_solver_rt.cu @@ -384,6 +384,7 @@ Radiation_solver_longwave::Radiation_solver_longwave( load_and_init_cloud_optics(file_name_cloud)); } + void Radiation_solver_longwave::solve_gpu( const bool switch_fluxes, const bool switch_cloud_optics, @@ -401,6 +402,10 @@ void Radiation_solver_longwave::solve_gpu( Array_gpu& lw_flux_up, Array_gpu& lw_flux_dn, Array_gpu& lw_flux_net, Array_gpu& lw_gpt_flux_up, Array_gpu& lw_gpt_flux_dn, Array_gpu& lw_gpt_flux_net) { + + throw std::runtime_error("Longwave raytracing is not implemented"); + + /* const int n_col = p_lay.dim(1); const int n_lay = p_lay.dim(2); const int n_lev = p_lev.dim(2); @@ -524,6 +529,7 @@ void Radiation_solver_longwave::solve_gpu( } } } + */ } Radiation_solver_shortwave::Radiation_solver_shortwave( @@ -585,8 +591,8 @@ void Radiation_solver_shortwave::solve_gpu( const Array_gpu& rel, const Array_gpu& rei, 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, @@ -647,7 +653,7 @@ void Radiation_solver_shortwave::solve_gpu( const Array& band_limits_gpt(this->kdist_gpu->get_band_lims_gpoint()); int previous_band = 0; - + for (int igpt=1; igpt<=n_gpt; ++igpt) { int band = 0; @@ -669,9 +675,9 @@ void Radiation_solver_shortwave::solve_gpu( { // Run the gas_optics on a subset. kdist_gpu->gas_optics( - igpt, - col_s, - n_col_subset, + igpt, + col_s, + n_col_subset, n_col, p_lay, p_lev, @@ -701,7 +707,7 @@ void Radiation_solver_shortwave::solve_gpu( } toa_src.fill(toa_src_temp({1}) * tsi_scaling({1})); - + if (switch_aerosol_optics) { if (band > previous_band) @@ -727,7 +733,7 @@ void Radiation_solver_shortwave::solve_gpu( Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, aerosol_optical_props->get_ssa().ptr()); Gas_optics_rrtmgp_kernels_cuda_rt::zero_array(n_col, n_lay, aerosol_optical_props->get_g().ptr()); } - + if (switch_cloud_optics) { if (band > previous_band) @@ -768,10 +774,11 @@ void Radiation_solver_shortwave::solve_gpu( aer_ssa_out = aerosol_optical_props->get_ssa(); aer_asy_out = aerosol_optical_props->get_g(); } + if (switch_fluxes) { std::unique_ptr fluxes = - std::make_unique(grid_cells.x, grid_cells.y, n_lev); + std::make_unique(grid_cells.x, grid_cells.y, grid_cells.z, n_lev); rte_sw.rte_sw( optical_props, diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 384a2fa..fc7f204 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -235,7 +235,7 @@ 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" }} }; + {"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."}}, @@ -288,9 +288,9 @@ void solve_radiation(int argc, char** argv) const int n_col = n_col_x * n_col_y; const int n_lay = input_nc.get_dimension_size("lay"); const int n_lev = input_nc.get_dimension_size("lev"); - + const int n_z_in = input_nc.get_dimension_size("z"); - + // Number of vertical levels in the raytrace grid. // We add 1 layer on top, in which we add integrated optical properties between TOD and TOA, // unless the ray tracer extends until TOA. @@ -301,7 +301,7 @@ void solve_radiation(int argc, char** argv) Array grid_y(input_nc.get_variable("y", {n_col_y}), {n_col_y}); Array grid_yh(input_nc.get_variable("yh", {n_col_y+1}), {n_col_y+1}); Array grid_z(input_nc.get_variable("z", {n_z_in}), {n_z_in}); - + const Vector grid_cells = {n_col_x, n_col_y, n_z}; const Vector grid_d = {grid_xh({2}) - grid_xh({1}), grid_yh({2}) - grid_yh({1}), grid_z({2}) - grid_z({1})}; const Vector kn_grid = {input_nc.get_variable("ngrid_x"), @@ -313,7 +313,7 @@ void solve_radiation(int argc, char** argv) Array t_lay(input_nc.get_variable("t_lay", {n_lay, n_col_y, n_col_x}), {n_col, n_lay}); Array p_lev(input_nc.get_variable("p_lev", {n_lev, n_col_y, n_col_x}), {n_col, n_lev}); Array t_lev(input_nc.get_variable("t_lev", {n_lev, n_col_y, n_col_x}), {n_col, n_lev}); - + // Fetch the col_dry in case present. Array col_dry; if (input_nc.variable_exists("col_dry")) @@ -706,6 +706,7 @@ void solve_radiation(int argc, char** argv) sw_flux_dn .set_dims({n_col, n_lev}); sw_flux_dn_dir.set_dims({n_col, n_lev}); sw_flux_net .set_dims({n_col, n_lev}); + if (switch_raytracing) { rt_flux_tod_up .set_dims({n_col_x, n_col_y}); @@ -879,7 +880,7 @@ void solve_radiation(int argc, char** argv) nc_aer_tau.insert(sw_aer_tau_cpu.v(), {0, 0, 0}); nc_aer_ssa.insert(sw_aer_ssa_cpu.v(), {0, 0, 0}); nc_aer_asy.insert(sw_aer_asy_cpu.v(), {0, 0, 0}); - + nc_tot_tau.add_attribute("long_name","Total optical depth at g-point "+std::to_string(single_gpt)); nc_tot_ssa.add_attribute("long_name","Total single scattering albedo at g-point "+std::to_string(single_gpt)); nc_cld_tau.add_attribute("long_name","Cloud optical depth at g-point "+std::to_string(single_gpt)); @@ -888,7 +889,7 @@ void solve_radiation(int argc, char** argv) nc_aer_tau.add_attribute("long_name","Aerosol optical depth at g-point "+std::to_string(single_gpt)); nc_aer_ssa.add_attribute("long_name","Aerosol single scattering albedo at g-point "+std::to_string(single_gpt)); nc_aer_asy.add_attribute("long_name","Aerosol asymmetry parameter at g-point "+std::to_string(single_gpt)); - + nc_tot_tau.add_attribute("units", "-"); nc_tot_ssa.add_attribute("units", "-"); nc_cld_tau.add_attribute("units", "-"); @@ -897,7 +898,7 @@ void solve_radiation(int argc, char** argv) nc_aer_tau.add_attribute("units", "-"); nc_aer_ssa.add_attribute("units", "-"); nc_aer_asy.add_attribute("units", "-"); - + } if (switch_fluxes) @@ -914,16 +915,16 @@ void solve_radiation(int argc, char** argv) 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"); - + if (switch_raytracing) { auto nc_rt_flux_tod_up = output_nc.add_variable("rt_flux_tod_up", {"y","x"}); @@ -940,22 +941,22 @@ void solve_radiation(int argc, char** argv) nc_rt_flux_abs_dir.insert(rt_flux_abs_dir_cpu.v(), {0,0,0}); nc_rt_flux_abs_dif.insert(rt_flux_abs_dif_cpu.v(), {0,0,0}); - + nc_rt_flux_tod_up.add_attribute("long_name","Upwelling shortwave top-of-domain fluxes (Monte Carlo ray tracer)"); nc_rt_flux_tod_up.add_attribute("units","W m-2"); - + nc_rt_flux_sfc_dir.add_attribute("long_name","Downwelling direct shortwave surface fluxes (Monte Carlo ray tracer)"); nc_rt_flux_sfc_dir.add_attribute("units","W m-2"); - + nc_rt_flux_sfc_dif.add_attribute("long_name","Downwelling diffuse shortwave surface fluxes (Monte Carlo ray tracer)"); nc_rt_flux_sfc_dif.add_attribute("units","W m-2"); - + nc_rt_flux_sfc_up.add_attribute("long_name","Upwelling shortwave surface fluxes (Monte Carlo ray tracer)"); nc_rt_flux_sfc_up.add_attribute("units","W m-2"); - + nc_rt_flux_abs_dir.add_attribute("long_name","Absorbed direct shortwave fluxes (Monte Carlo ray tracer)"); nc_rt_flux_abs_dir.add_attribute("units","W m-3"); - + nc_rt_flux_abs_dif.add_attribute("long_name","Absorbed diffuse shortwave fluxes (Monte Carlo ray tracer)"); nc_rt_flux_abs_dif.add_attribute("units","W m-3"); @@ -973,16 +974,16 @@ void solve_radiation(int argc, char** argv) nc_sw_gpt_flux_dn .insert(sw_gpt_flux_dn_cpu .v(), {0, 0, 0}); nc_sw_gpt_flux_dn_dir.insert(sw_gpt_flux_dn_dir_cpu.v(), {0, 0, 0}); nc_sw_gpt_flux_net .insert(sw_gpt_flux_net_cpu .v(), {0, 0, 0}); - + nc_sw_gpt_flux_up.add_attribute("long_name","Upwelling shortwave fluxes for g-point "+std::to_string(single_gpt)+" (TwoStream solver)"); nc_sw_gpt_flux_up.add_attribute("units","W m-2"); - + nc_sw_gpt_flux_dn.add_attribute("long_name","Downwelling shortwave fluxes for g-point "+std::to_string(single_gpt)+" (TwoStream solver)"); nc_sw_gpt_flux_dn.add_attribute("units","W m-2"); - + nc_sw_gpt_flux_dn_dir.add_attribute("long_name","Downwelling direct shortwave fluxes for g-point "+std::to_string(single_gpt)+" (TwoStream solver)"); nc_sw_gpt_flux_dn_dir.add_attribute("units","W m-2"); - + nc_sw_gpt_flux_net.add_attribute("long_name","Net shortwave fluxes for g-point "+std::to_string(single_gpt)+" (TwoStream solver)"); nc_sw_gpt_flux_net.add_attribute("units","W m-2"); }