Skip to content

Commit 04229a3

Browse files
committed
Aerosol_concs not passed as reference to tilt function
1 parent e373eba commit 04229a3

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

include_tilt/tilt_utils.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,35 @@ void post_process_output(const std::vector<ColumnResult>& col_results,
4545
const bool switch_liq_cloud_optics,
4646
const bool switch_ice_cloud_optics);
4747

48-
void restore_bkg_profile(const int n_x, const int n_y,
48+
void restore_bkg_profile(const int n_x, const int n_y,
4949
const int n_full,
50-
const int n_tilt,
51-
const int bkg_start,
50+
const int n_tilt,
51+
const int bkg_start,
5252
std::vector<Float>& var,
5353
std::vector<Float>& var_w_bkg);
5454

55-
void restore_bkg_profile_bundle(const int n_col_x, const int n_col_y,
56-
const int n_lay, const int n_lev,
57-
const int n_lay_tot, const int n_lev_tot,
55+
void restore_bkg_profile_bundle(const int n_col_x, const int n_col_y,
56+
const int n_lay, const int n_lev,
57+
const int n_lay_tot, const int n_lev_tot,
5858
const int n_z_in, const int n_zh_in,
59-
const int bkg_start_z, const int bkg_start_zh,
60-
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
61-
Array<Float,2>* lwp_copy, Array<Float,2>* iwp_copy, Array<Float,2>* rel_copy, Array<Float,2>* dei_copy, Array<Float,2>* rh_copy,
59+
const int bkg_start_z, const int bkg_start_zh,
60+
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
61+
Array<Float,2>* lwp_copy, Array<Float,2>* iwp_copy, Array<Float,2>* rel_copy, Array<Float,2>* dei_copy, Array<Float,2>* rh_copy,
6262
Gas_concs& gas_concs_copy, Aerosol_concs& aerosol_concs_copy,
63-
Array<Float,2>* p_lay, Array<Float,2>* t_lay, Array<Float,2>* p_lev, Array<Float,2>* t_lev,
64-
Array<Float,2>* lwp, Array<Float,2>* iwp, Array<Float,2>* rel, Array<Float,2>* dei, Array<Float,2>* rh,
65-
Gas_concs& gas_concs, Aerosol_concs& aerosol_concs,
63+
Array<Float,2>* p_lay, Array<Float,2>* t_lay, Array<Float,2>* p_lev, Array<Float,2>* t_lev,
64+
Array<Float,2>* lwp, Array<Float,2>* iwp, Array<Float,2>* rel, Array<Float,2>* dei, Array<Float,2>* rh,
65+
Gas_concs& gas_concs, Aerosol_concs& aerosol_concs,
6666
std::vector<std::string> gas_names, std::vector<std::string> aerosol_names,
6767
bool switch_liq_cloud_optics, bool switch_ice_cloud_optics, bool switch_aerosol_optics
6868
);
6969

70-
void compress_columns_weighted_avg(const int n_x, const int n_y,
71-
const int n_out,
70+
void compress_columns_weighted_avg(const int n_x, const int n_y,
71+
const int n_out,
7272
const int n_tilt,
7373
const int compress_lay_start_idx,
7474
std::vector<Float>& var, std::vector<Float>& var_weighting);
7575

76-
void compress_columns_p_or_t(const int n_x, const int n_y,
76+
void compress_columns_p_or_t(const int n_x, const int n_y,
7777
const int n_out_lay, const int n_tilt,
7878
const int compress_lay_start_idx,
7979
std::vector<Float>& var_lev, std::vector<Float>& var_lay);
@@ -82,16 +82,16 @@ void tilt_fields(const int n_z_in, const int n_zh_in, const int n_col_x, const i
8282
const int n_z_tilt, const int n_zh_tilt, const int n_col,
8383
const Array<Float,1> zh, const Array<Float,1> z,
8484
const Array<Float,1> zh_tilt, const Array<ijk,1> path,
85-
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
86-
Array<Float,2>* rh_copy,
85+
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
86+
Array<Float,2>* rh_copy,
8787
Gas_concs& gas_concs_copy, const std::vector<std::string> gas_names,
8888
Aerosol_concs& aerosol_concs_copy, const std::vector<std::string> aerosol_names, const bool switch_aerosol_optics
8989
);
9090

9191
void compress_fields(const int compress_lay_start_idx, const int n_col_x, const int n_col_y,
9292
const int n_z_in, const int n_zh_in, const int n_z_tilt,
93-
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
94-
Array<Float,2>* rh_copy,
93+
Array<Float,2>* p_lay_copy, Array<Float,2>* t_lay_copy, Array<Float,2>* p_lev_copy, Array<Float,2>* t_lev_copy,
94+
Array<Float,2>* rh_copy,
9595
Gas_concs& gas_concs_copy, std::vector<std::string> gas_names,
9696
Aerosol_concs& aerosol_concs_copy, std::vector<std::string> aerosol_names, const bool switch_aerosol_optics);
9797

@@ -114,11 +114,11 @@ void tica_tilt(const Float sza, const Float azi,
114114
const int n_col_x, const int n_col_y, const int n_col,
115115
const int n_lay, const int n_lev, const int n_z_in, const int n_zh_in ,
116116
Array<Float,1> xh, Array<Float,1> yh, Array<Float,1> zh, Array<Float,1> z,
117-
Array<Float,2> p_lay, Array<Float,2> t_lay, Array<Float,2> p_lev, Array<Float,2> t_lev,
118-
Array<Float,2> lwp, Array<Float,2> iwp, Array<Float,2> rel, Array<Float,2> dei, Array<Float,2> rh,
117+
Array<Float,2> p_lay, Array<Float,2> t_lay, Array<Float,2> p_lev, Array<Float,2> t_lev,
118+
Array<Float,2> lwp, Array<Float,2> iwp, Array<Float,2> rel, Array<Float,2> dei, Array<Float,2> rh,
119119
Gas_concs gas_concs, Aerosol_concs aerosol_concs,
120-
Array<Float,2>& p_lay_out, Array<Float,2>& t_lay_out, Array<Float,2>& p_lev_out, Array<Float,2>& t_lev_out,
121-
Array<Float,2>& lwp_out, Array<Float,2>& iwp_out, Array<Float,2>& rel_out, Array<Float,2>& dei_out, Array<Float,2>& rh_out,
122-
Gas_concs& gas_concs_out, Aerosol_concs aerosol_concs_out,
120+
Array<Float,2>& p_lay_out, Array<Float,2>& t_lay_out, Array<Float,2>& p_lev_out, Array<Float,2>& t_lev_out,
121+
Array<Float,2>& lwp_out, Array<Float,2>& iwp_out, Array<Float,2>& rel_out, Array<Float,2>& dei_out, Array<Float,2>& rh_out,
122+
Gas_concs& gas_concs_out, Aerosol_concs& aerosol_concs_out,
123123
std::vector<std::string> gas_names, std::vector<std::string> aerosol_names,
124124
bool switch_cloud_optics, bool switch_liq_cloud_optics, bool switch_ice_cloud_optics, bool switch_aerosol_optics);

src_test/test_rte_rrtmgp_rt.cu

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,18 @@ void solve_radiation(int argc, char** argv)
545545
iwp = iwp_out;
546546
dei = dei_out;
547547

548+
if (switch_aerosol_optics)
549+
{
550+
rh_out.expand_dims({n_col, n_lay});
551+
rh = rh_out;
552+
aerosol_concs = aerosol_concs_out;
553+
}
554+
548555
p_lay = p_lay_out;
549556
p_lev = p_lev_out;
550557
t_lay = t_lay_out;
551558
t_lev = t_lev_out;
552559
gas_concs = gas_concs_out;
553-
aerosol_concs = aerosol_concs_out;
554560

555561
}
556562

@@ -963,7 +969,7 @@ void solve_radiation(int argc, char** argv)
963969
lwp_gpu, iwp_gpu,
964970
rel_gpu, dei_gpu,
965971
rh,
966-
aerosol_concs,
972+
aerosol_concs_gpu,
967973
sw_tot_tau, sw_tot_ssa,
968974
sw_cld_tau, sw_cld_ssa, sw_cld_asy,
969975
sw_aer_tau, sw_aer_ssa, sw_aer_asy,

src_tilt/tilt_utils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ void compress_columns_weighted_avg(const int n_x, const int n_y,
380380
#pragma omp parallel for
381381
for (int ilay = compress_lay_start_idx; ilay < n_out; ++ilay)
382382
{
383+
383384
const int in_offset = ilay - compress_lay_start_idx;
384385
const int i_lay_in = (compress_lay_start_idx + 2 * in_offset);
385386
int num_inputs;
@@ -815,7 +816,7 @@ void tica_tilt(
815816
Gas_concs gas_concs, Aerosol_concs aerosol_concs,
816817
Array<Float,2>& p_lay_out, Array<Float,2>& t_lay_out, Array<Float,2>& p_lev_out, Array<Float,2>& t_lev_out,
817818
Array<Float,2>& lwp_out, Array<Float,2>& iwp_out, Array<Float,2>& rel_out, Array<Float,2>& dei_out, Array<Float,2>& rh_out,
818-
Gas_concs& gas_concs_out, Aerosol_concs aerosol_concs_out,
819+
Gas_concs& gas_concs_out, Aerosol_concs& aerosol_concs_out,
819820
std::vector<std::string> gas_names, std::vector<std::string> aerosol_names,
820821
bool switch_cloud_optics, bool switch_liq_cloud_optics, bool switch_ice_cloud_optics, bool switch_aerosol_optics
821822
)

0 commit comments

Comments
 (0)