Skip to content

Commit c7ef9cd

Browse files
committed
Merge branch 'kida-1d' of github.com:pdziekan/libcloudphxx into kida-1d
2 parents a53d6aa + 44cf5f2 commit c7ef9cd

33 files changed

+473
-253
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ target_include_directories(cloudphxx_lgrngn
111111
#target_compile_options(cloudphxx_lgrngn PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -Wextra>)
112112
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
113113

114-
# enabling c++11
115-
target_compile_features(cloudphxx_lgrngn PUBLIC cxx_std_11)
114+
# enabling c++14
115+
target_compile_features(cloudphxx_lgrngn PUBLIC cxx_std_14)
116116
# config-specific flags
117117
target_compile_options(cloudphxx_lgrngn PRIVATE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: -g -Og -DTHRUST_DEBUG>)
118118
target_compile_options(cloudphxx_lgrngn PRIVATE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELWITHDEBINFO>>: -Ofast -march=native>)
@@ -332,7 +332,7 @@ file(WRITE "${tmpdir}/test.cpp" "
332332
chem_stepper.do_step(rhs(), v, 0, 1);
333333
}
334334
")
335-
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-std=c++11" "test.cpp" "-I${Boost_INCLUDE_DIR}" "-I${THRUST_INCLUDE_DIR}" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status ERROR_VARIABLE msg)
335+
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-std=c++14" "test.cpp" "-I${Boost_INCLUDE_DIR}" "-I${THRUST_INCLUDE_DIR}" WORKING_DIRECTORY ${tmpdir} RESULT_VARIABLE status ERROR_VARIABLE msg)
336336
if (NOT status EQUAL 0)
337337
message(FATAL_ERROR "${pfx}: c++ compiler failed\n ${msg}")
338338
endif()

bindings/python/lib.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ BOOST_PYTHON_MODULE(libcloudphxx)
250250
.def_readwrite("turb_adve", &lgr::opts_t<real_t>::turb_adve)
251251
.def_readwrite("turb_cond", &lgr::opts_t<real_t>::turb_cond)
252252
.def_readwrite("turb_coal", &lgr::opts_t<real_t>::turb_coal)
253+
.def_readwrite("dt", &lgr::opts_t<real_t>::dt)
253254
;
254255
bp::class_<lgr::opts_init_t<real_t>>("opts_init_t")
255256
.add_property("dry_distros", &lgrngn::get_dd<real_t>, &lgrngn::set_dd<real_t>)
@@ -305,10 +306,12 @@ BOOST_PYTHON_MODULE(libcloudphxx)
305306
.def_readwrite("chem_rho", &lgr::opts_init_t<real_t>::chem_rho)
306307
.def_readwrite("RH_max", &lgr::opts_init_t<real_t>::RH_max)
307308
.def_readwrite("rng_seed", &lgr::opts_init_t<real_t>::rng_seed)
309+
.def_readwrite("rng_seed_init", &lgr::opts_init_t<real_t>::rng_seed_init)
308310
.def_readwrite("diag_incloud_time", &lgr::opts_init_t<real_t>::diag_incloud_time)
309311
.add_property("w_LS", &lgrngn::get_w_LS<real_t>, &lgrngn::set_w_LS<real_t>)
310312
.add_property("SGS_mix_len", &lgrngn::get_SGS_mix_len<real_t>, &lgrngn::set_SGS_mix_len<real_t>)
311313
.add_property("kernel_parameters", &lgrngn::get_kp<real_t>, &lgrngn::set_kp<real_t>)
314+
.def_readwrite("variable_dt_switch", &lgr::opts_init_t<real_t>::variable_dt_switch)
312315
;
313316
bp::class_<lgr::particles_proto_t<real_t>/*, boost::noncopyable*/>("particles_proto_t")
314317
.add_property("opts_init", &lgrngn::get_oi<real_t>)

include/libcloudph++/lgrngn/opts.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ namespace libcloudphxx
2828
// process toggling for chemistry
2929
bool chem_dsl, chem_dsc, chem_rct;
3030

31+
// overriding dt from opts_init
32+
real_t dt;
33+
3134
// ctor with defaults (C++03 compliant) ...
3235
opts_t() :
3336
adve(true), sedi(true), subs(false), cond(true), coal(true), src(false), rcyc(false),
3437
chem_dsl(false), chem_dsc(false), chem_rct(false),
3538
turb_adve(false), turb_cond(false), turb_coal(false),
36-
RH_max(44) // :) (anything greater than 1.1 would be enough
39+
RH_max(44), // :) (anything greater than 1.1 would be enough
40+
dt(-1) // negative means that we do not override dt in this step
3741
{
3842
}
3943
};

include/libcloudph++/lgrngn/opts_init.hpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ namespace libcloudphxx
6464
// should aerosol concentration init be independent of rhod (assumed to be in cm^{-3} and not at STP)
6565
bool aerosol_independent_of_rhod;
6666

67+
// is it allowed to change dt during simulation through opts.dt
68+
bool variable_dt_switch;
69+
6770
// or, alternatively to sd_conc_mean, multiplicity of all SDs = const
6871
unsigned long long sd_const_multi;
6972

@@ -100,17 +103,16 @@ namespace libcloudphxx
100103
// coalescence kernel parameters
101104
std::vector<real_t> kernel_parameters;
102105

103-
// chem
104106
bool chem_switch, // if false no chemical reactions throughout the whole simulation (no memory allocation)
105107
coal_switch, // if false no coalescence throughout the whole simulation
106108
sedi_switch, // if false no sedimentation throughout the whole simulation
107109
subs_switch, // if false no subsidence throughout the whole simulation
108110
src_switch, // if false no source throughout the whole simulation
109-
exact_sstp_cond, // if true, use per-particle sstp_cond logic, if false, use per-cell
110111
turb_adve_switch, // if true, turbulent motion of SDs is modeled
111112
turb_cond_switch, // if true, turbulent condensation of SDs is modeled
112-
turb_coal_switch; // if true, turbulent coalescence kernels can be used
113-
113+
turb_coal_switch, // if true, turbulent coalescence kernels can be used
114+
exact_sstp_cond; // if true, use per-particle sstp_cond logic, if false, use per-cell
115+
114116
int sstp_chem;
115117
real_t chem_rho;
116118

@@ -121,7 +123,8 @@ namespace libcloudphxx
121123
real_t RH_max;
122124

123125
// rng seed
124-
int rng_seed;
126+
int rng_seed,
127+
rng_seed_init; // seed used to init SD (positions and dry sizes)
125128

126129
// no of GPUs per MPI node to use, 0 for all available
127130
int dev_count;
@@ -168,6 +171,7 @@ namespace libcloudphxx
168171
RH_max(.95), // value seggested in Lebo and Seinfeld 2011
169172
chem_rho(0), // dry particle density //TODO add checking if the user gave a different value (np w init) (was 1.8e-3)
170173
rng_seed(44),
174+
rng_seed_init(rng_seed),
171175
terminal_velocity(vt_t::undefined),
172176
kernel(kernel_t::undefined),
173177
adve_scheme(as_t::implicit),
@@ -186,7 +190,8 @@ namespace libcloudphxx
186190
diag_incloud_time(false),
187191
no_ccn_at_init(false),
188192
open_side_walls(false),
189-
periodic_topbot_walls(false)
193+
periodic_topbot_walls(false),
194+
variable_dt_switch(false)
190195
{}
191196

192197
// dtor (just to silence -Winline warnings)

include/libcloudph++/lgrngn/particles.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ namespace libcloudphxx
102102
virtual void diag_chem(const enum common::chem::chem_species_t&) { assert(false); }
103103
virtual void diag_precip_rate() { assert(false); }
104104
virtual void diag_kappa_mom(const int&) { assert(false); }
105+
virtual void diag_up_mom(const int&) { assert(false); }
106+
virtual void diag_vp_mom(const int&) { assert(false); }
107+
virtual void diag_wp_mom(const int&) { assert(false); }
105108
virtual void diag_incloud_time_mom(const int&) { assert(false); } // requires opts_init.diag_incloud_time==true
106109
virtual void diag_max_rw() { assert(false); }
107110
virtual void diag_vel_div() { assert(false); }
@@ -190,6 +193,9 @@ namespace libcloudphxx
190193
void diag_dry_mom(const int &k);
191194
void diag_wet_mom(const int &k);
192195
void diag_kappa_mom(const int &k);
196+
void diag_up_mom(const int&);
197+
void diag_vp_mom(const int&);
198+
void diag_wp_mom(const int&);
193199
void diag_incloud_time_mom(const int &k);
194200
void diag_wet_mass_dens(const real_t&, const real_t&);
195201

@@ -292,6 +298,9 @@ namespace libcloudphxx
292298
void diag_dry_mom(const int &k);
293299
void diag_wet_mom(const int &k);
294300
void diag_kappa_mom(const int&);
301+
void diag_up_mom(const int&);
302+
void diag_vp_mom(const int&);
303+
void diag_wp_mom(const int&);
295304
void diag_incloud_time_mom(const int&);
296305
void diag_wet_mass_dens(const real_t&, const real_t&);
297306
real_t *outbuf();

models/kinematic_2D/tests/paper_GMD_2015/fig_a/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ add_test(travis_2D_kin_cloud_dims_blk bash -c "
5959
add_test(travis_2D_kin_cloud_diff_blk_1m bash -c "
6060
for dir in travis_out_blk_1m; do
6161
echo 'comparing const.h5' &&
62-
h5diff --delta=2e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
62+
h5diff --delta=3e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
6363
echo 'comparing timestep0000000000.h5' &&
6464
h5diff --delta=2e-5 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rv &&
6565
h5diff --delta=2e-5 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rr &&
@@ -76,7 +76,7 @@ add_test(travis_2D_kin_cloud_diff_blk_1m bash -c "
7676
add_test(travis_2D_kin_cloud_diff_blk_2m bash -c "
7777
for dir in travis_out_blk_2m; do
7878
echo 'comparing const.h5'
79-
h5diff --delta=2e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
79+
h5diff --delta=3e-7 -v2 $dir/const.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/const.h5 &&
8080
echo 'comparing timestep0000000000.h5' &&
8181
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rv &&
8282
h5diff --relative=1e-9 -v2 $dir/timestep0000000000.h5 ${CMAKE_CURRENT_SOURCE_DIR}/refdata/$dir/timestep0000000000.h5 /rr &&

src/detail/config.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ namespace libcloudphxx
2828
// range of beard77fast bins:
2929
const real_t vt0_ln_r_min, vt0_ln_r_max;
3030

31+
const real_t bcond_tolerance = 2e-4; // [m]; error tolerance for position near bcond after distmem copy
32+
3133
// ctor
3234
config():
3335
vt0_ln_r_min(log(5e-7)),

src/detail/ran_with_mpi.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace
66
{
77
return (
88
// mpich
9-
std::getenv("PMI_RANK") != NULL ||
9+
std::getenv("PMI_RANK") != NULL && std::atoi(std::getenv("PMI_SIZE")) > 1 ||
1010
// openmpi
11-
std::getenv("OMPI_COMM_WORLD_RANK") != NULL ||
11+
std::getenv("OMPI_COMM_WORLD_RANK") != NULL && std::atoi(std::getenv("OMPI_COMM_WORLD_SIZE")) > 1 ||
1212
// lam
13-
std::getenv("LAMRANK") != NULL ||
13+
std::getenv("LAMRANK") != NULL && std::atoi(std::getenv("LAMSIZE")) > 1 ||
1414
// mvapich2
15-
std::getenv("MV2_COMM_WORLD_RANK") != NULL
15+
std::getenv("MV2_COMM_WORLD_RANK") != NULL && std::atoi(std::getenv("MV2_COMM_WORLD_SIZE")) > 1
1616
);
1717
}
1818
};

0 commit comments

Comments
 (0)