Skip to content

Commit cd40b51

Browse files
committed
add only-liquid and only-ice options to bw ray tracer. Throw errors in mie scattering is switched on without disabling ice optics
1 parent b494884 commit cd40b51

File tree

2 files changed

+41
-27
lines changed

2 files changed

+41
-27
lines changed

src_test/test_rte_rrtmgp_bw.cu

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@ void read_and_set_aer(
104104
}
105105
}
106106

107-
108-
109-
110-
111-
112-
113-
114-
115-
116-
117-
118-
119-
120107
void configure_memory_pool(int nlays, int ncols, int nchunks, int ngpts, int nbnds)
121108
{
122109
/* Heuristic way to set up memory pool queues */
@@ -239,7 +226,9 @@ void solve_radiation(int argc, char** argv)
239226
{"longwave" , { false, "Enable computation of longwave radiation." }},
240227
{"fluxes" , { true, "Enable computation of fluxes." }},
241228
{"raytracing" , { true, "Use raytracing for flux computation." }},
242-
{"cloud-optics" , { false, "Enable cloud optics." }},
229+
{"cloud-optics" , { false, "Enable cloud optics (both liquid and ice)." }},
230+
{"liq-cloud-optics" , { false, "liquid only cloud optics." }},
231+
{"ice-cloud-optics" , { false, "ice only cloud optics." }},
243232
{"cloud-mie" , { false, "mie cloud droplet scattering." }},
244233
{"aerosol-optics" , { false, "Enable aerosol optics." }},
245234
{"output-optical" , { false, "Enable output of optical properties." }},
@@ -260,7 +249,9 @@ void solve_radiation(int argc, char** argv)
260249
const bool switch_shortwave = command_line_options.at("shortwave" ).first;
261250
const bool switch_longwave = command_line_options.at("longwave" ).first;
262251
const bool switch_fluxes = command_line_options.at("fluxes" ).first;
263-
const bool switch_cloud_optics = command_line_options.at("cloud-optics" ).first;
252+
bool switch_cloud_optics = command_line_options.at("cloud-optics" ).first;
253+
bool switch_liq_cloud_optics = command_line_options.at("liq-cloud-optics" ).first;
254+
bool switch_ice_cloud_optics = command_line_options.at("ice-cloud-optics" ).first;
264255
const bool switch_cloud_mie = command_line_options.at("cloud-mie" ).first;
265256
const bool switch_aerosol_optics = command_line_options.at("aerosol-optics" ).first;
266257
const bool switch_output_optical = command_line_options.at("output-optical" ).first;
@@ -280,6 +271,22 @@ void solve_radiation(int argc, char** argv)
280271
throw std::runtime_error(error);
281272
}
282273

274+
if (switch_cloud_optics)
275+
{
276+
switch_liq_cloud_optics = true;
277+
switch_ice_cloud_optics = true;
278+
}
279+
if (switch_liq_cloud_optics || switch_ice_cloud_optics)
280+
{
281+
switch_cloud_optics = true;
282+
}
283+
284+
if (switch_cloud_mie && switch_ice_cloud_optics)
285+
{
286+
std::string error = "Thou shall not use mie tables as long as ice optics are enabled";
287+
throw std::runtime_error(error);
288+
}
289+
283290
// Print the options to the screen.
284291
print_command_line_options(command_line_options);
285292

@@ -385,17 +392,23 @@ void solve_radiation(int argc, char** argv)
385392

386393
if (switch_cloud_optics || switch_cloud_cam)
387394
{
388-
lwp.set_dims({n_col, n_lay});
389-
lwp = std::move(input_nc.get_variable<Float>("lwp", {n_lay, n_col_y, n_col_x}));
395+
if (switch_liq_cloud_optics)
396+
{
397+
lwp.set_dims({n_col, n_lay});
398+
lwp = std::move(input_nc.get_variable<Float>("lwp", {n_lay, n_col_y, n_col_x}));
390399

391-
iwp.set_dims({n_col, n_lay});
392-
iwp = std::move(input_nc.get_variable<Float>("iwp", {n_lay, n_col_y, n_col_x}));
400+
rel.set_dims({n_col, n_lay});
401+
rel = std::move(input_nc.get_variable<Float>("rel", {n_lay, n_col_y, n_col_x}));
402+
}
393403

394-
rel.set_dims({n_col, n_lay});
395-
rel = std::move(input_nc.get_variable<Float>("rel", {n_lay, n_col_y, n_col_x}));
404+
if(switch_ice_cloud_optics)
405+
{
406+
iwp.set_dims({n_col, n_lay});
407+
iwp = std::move(input_nc.get_variable<Float>("iwp", {n_lay, n_col_y, n_col_x}));
396408

397-
dei.set_dims({n_col, n_lay});
398-
dei = std::move(input_nc.get_variable<Float>("dei", {n_lay, n_col_y, n_col_x}));
409+
dei.set_dims({n_col, n_lay});
410+
dei = std::move(input_nc.get_variable<Float>("dei", {n_lay, n_col_y, n_col_x}));
411+
}
399412
}
400413
else
401414
{

src_test/test_rte_rrtmgp_rt.cu

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +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-
//}
303+
if (switch_cloud_mie && switch_ice_cloud_optics)
304+
{
305+
std::string error = "Thou shall not use mie tables as long as ice optics are enabled";
306+
throw std::runtime_error(error);
307+
}
307308

308309
// Print the options to the screen.
309310
print_command_line_options(command_line_switches, command_line_ints);

0 commit comments

Comments
 (0)