Skip to content

Commit d12778a

Browse files
authored
Merge pull request #58 from magpowell/tica_fix
TICA fixes
2 parents 99c83d9 + 60c6f1b commit d12778a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src_test/test_rte_rrtmgp_rt.cu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ void solve_radiation(int argc, char** argv)
300300
switch_independent_column = true;
301301
}
302302

303+
if (switch_tica && switch_aerosol_optics) {
304+
std::string error = "Aerosol optics are not supported in TICA mode"; // NOTE: Aersol optics with TICA has significant errors at high SZA.
305+
throw std::runtime_error(error);
306+
}
307+
303308
// Print the options to the screen.
304309
print_command_line_options(command_line_switches, command_line_ints);
305310

@@ -544,6 +549,7 @@ void solve_radiation(int argc, char** argv)
544549
t_lay = t_lay_out;
545550
t_lev = t_lev_out;
546551
gas_concs = gas_concs_out;
552+
aerosol_concs = aerosol_concs_out;
547553

548554
}
549555

src_tilt/tilt_utils.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,24 @@ void tilt_fields(const int n_z_in, const int n_zh_in, const int n_col_x, const i
569569
t_lev_copy->expand_dims({n_col, n_zh_tilt});
570570
p_lay_copy->expand_dims({n_col, n_z_tilt});
571571
p_lev_copy->expand_dims({n_col, n_zh_tilt});
572+
573+
for (int ilay=0; ilay<n_zh_tilt; ++ilay) {
574+
for (int iy=0; iy<n_col_y; ++iy) {
575+
for (int ix=0; ix<n_col_x; ++ix) {
576+
if (ilay > 0) {
577+
const int curr_idx = ix + iy*n_col_x + ilay*n_col_x*n_col_y;
578+
const int prev_idx = ix + iy*n_col_x + (ilay-1)*n_col_x*n_col_y;
579+
if (p_lev_copy->v()[curr_idx] == p_lev_copy->v()[prev_idx]) {
580+
p_lev_copy->v()[curr_idx] = p_lev_copy->v()[prev_idx] * 0.99999;
581+
}
582+
else if (p_lev_copy->v()[curr_idx] > p_lev_copy->v()[prev_idx])
583+
{
584+
throw std::runtime_error("Pressure INCREASED at layer " + std::to_string(ilay));
585+
}
586+
}
587+
}
588+
}
589+
}
572590
}
573591

574592
void compress_fields(const int compress_lay_start_idx, const int n_col_x, const int n_col_y,
@@ -1019,7 +1037,7 @@ void tica_tilt(
10191037
for (int k = 0; k < num_inputs; ++k)
10201038
{
10211039
int in_idx = (i_lay_in + k);
1022-
avg += var_rel_out[in_idx];
1040+
avg += var_rel_tmp[in_idx];
10231041
}
10241042
var_rel_out[ilay] = avg / num_inputs;
10251043
}

0 commit comments

Comments
 (0)