Skip to content

Commit 613390f

Browse files
author
Menno Veerman
committed
work in progress updating the backward tracing
1 parent e6e36a8 commit 613390f

File tree

10 files changed

+987
-691
lines changed

10 files changed

+987
-691
lines changed

include_rt/Raytracer_bw.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,50 @@ class Raytracer_bw
2020

2121
void trace_rays(
2222
const Int photons_to_shoot,
23-
const int n_col_x, const int n_col_y, const int n_z, const int n_lay,
23+
const int n_col_x, const int n_col_y, const int n_lay,
2424
const Float dx_grid, const Float dy_grid, const Float dz_grid,
2525
const Array_gpu<Float,1>& z_lev,
2626
const Optical_props_2str_rt& optical_props,
2727
const Optical_props_2str_rt& cloud_optical_props,
2828
const Array_gpu<Float,2>& surface_albedo,
2929
const Float zenith_angle,
3030
const Float azimuth_angle,
31-
const Array_gpu<Float,1>& toa_src,
31+
const Float tod_inc_direct,
32+
const Float tod_inc_diffuse.
3233
const Float toa_factor,
3334
const Float rayleigh,
3435
const Array_gpu<Float,2>& col_dry,
3536
const Array_gpu<Float,2>& vmr_h2o,
3637
const Array_gpu<Float,1>& cam_data,
3738
Array_gpu<Float,2>& flux_camera);
3839

40+
void trace_rays_bb(
41+
const Int photons_to_shoot,
42+
const int ncol_x, const int ncol_y, const int nz, const int nlay,
43+
const Float dx_grid, const Float dy_grid, const Float dz_grid,
44+
const Array_gpu<Float,2>& tau_gas,
45+
const Array_gpu<Float,2>& ssa_gas,
46+
const Array_gpu<Float,2>& asy_gas,
47+
const Array_gpu<Float,2>& tau_cloud,
48+
const Array_gpu<Float,2>& surface_albedo,
49+
const Float zenith_angle,
50+
const Float azimuth_angle,
51+
const Float tod_inc_direct,
52+
const Float tod_inc_diffuse,
53+
const Array_gpu<Float,1>& cam_data,
54+
Array_gpu<Float,2>& flux_camera);
55+
3956
void add_xyz_camera(
4057
const int cam_nx, const int cam_ny,
4158
const Array_gpu<Float,1>& xyz_factor,
4259
const Array_gpu<Float,2>& flux_camera,
4360
Array_gpu<Float,3>& XYZ);
44-
61+
4562
void normalize_xyz_camera(
4663
const int cam_nx, const int cam_ny,
4764
const Float total_source,
4865
Array_gpu<Float,3>& XYZ);
49-
66+
5067
private:
5168

5269
};

include_rt/raytracer_kernels_bw.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
#ifdef RTE_RRTMGP_SINGLE_PRECISION
99
//using Float = float;
1010
constexpr int block_size= 512;
11-
constexpr int grid_size = 512;
11+
constexpr int grid_size = 1024;
1212
#else
1313
//using Float = double;
1414
constexpr int block_size = 512;
1515
constexpr int grid_size = 256;
1616
#endif
1717
using Int = unsigned long long;
18-
constexpr int ngrid_h = 30;
19-
constexpr int ngrid_v = 71;
18+
constexpr int ngrid_x = 20;
19+
constexpr int ngrid_y = 20;
20+
constexpr int ngrid_z = 35;
2021
constexpr Float k_null_gas_min = Float(1.e-3);
2122

2223

@@ -48,12 +49,12 @@ void ray_tracer_kernel_bw(
4849
int* __restrict__ counter,
4950
const int cam_nx, const int cam_ny, const Float* __restrict__ cam_data,
5051
const Optics_ext* __restrict__ k_ext, const Optics_scat* __restrict__ ssa_asy,
51-
const Optics_ext* __restrict__ k_ext_bg, const Optics_scat* __restrict__ ssa_asy_bg,
52-
const Float* __restrict__ z_lev_bg,
5352
const Float* __restrict__ surface_albedo,
5453
const Float mu,
54+
const Float bg_trans,
55+
const Float tod_frac_diffuse,
5556
const Float x_size, const Float y_size, const Float z_size,
5657
const Float dx_grid, const Float dy_grid, const Float dz_grid,
5758
const Float dir_x, const Float dir_y, const Float dir_z,
58-
const int itot, const int jtot, const int ktot, const int kbg);
59+
const int itot, const int jtot, const int ktot);
5960
#endif

include_test/Radiation_solver_bw.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Radiation_solver_longwave
8383

8484
int get_n_gpt_gpu() const { return this->kdist_gpu->get_ngpt(); };
8585
int get_n_bnd_gpu() const { return this->kdist_gpu->get_nband(); };
86-
86+
8787
Array<int,2> get_band_lims_gpoint_gpu() const
8888
{ return this->kdist_gpu->get_band_lims_gpoint(); }
8989

@@ -159,11 +159,29 @@ class Radiation_solver_shortwave
159159
const Array_gpu<Float,1>& cam_data,
160160
Array_gpu<Float,3>& XYZ);
161161

162+
#ifdef __CUDACC__
163+
void solve_gpu_bb(
164+
const bool switch_cloud_optics,
165+
const bool switch_output_bnd_fluxes,
166+
const Int ray_count,
167+
const Gas_concs_gpu& gas_concs,
168+
const Array_gpu<Float,2>& p_lay, const Array_gpu<Float,2>& p_lev,
169+
const Array_gpu<Float,2>& t_lay, const Array_gpu<Float,2>& t_lev,
170+
const Array_gpu<Float,1>& z_lev,
171+
const Array_gpu<Float,1>& grid_dims,
172+
Array_gpu<Float,2>& col_dry,
173+
const Array_gpu<Float,2>& sfc_alb_dir, const Array_gpu<Float,2>& sfc_alb_dif,
174+
const Array_gpu<Float,1>& tsi_scaling, const Array_gpu<Float,1>& mu0,
175+
const Array_gpu<Float,2>& lwp, const Array_gpu<Float,2>& iwp,
176+
const Array_gpu<Float,2>& rel, const Array_gpu<Float,2>& rei,
177+
const Array_gpu<Float,1>& cam_data,
178+
Array_gpu<Float,2>& radiance);
179+
162180
int get_n_gpt_gpu() const { return this->kdist_gpu->get_ngpt(); };
163181
int get_n_bnd_gpu() const { return this->kdist_gpu->get_nband(); };
164182

165183
Float get_tsi_gpu() const { return this->kdist_gpu->get_tsi(); };
166-
184+
167185
Array<int,2> get_band_lims_gpoint_gpu() const
168186
{ return this->kdist_gpu->get_band_lims_gpoint(); }
169187

0 commit comments

Comments
 (0)