Skip to content

Commit 1ae5151

Browse files
committed
fix sstp for var dt
1 parent a0d35de commit 1ae5151

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/impl/particles_impl.ipp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ namespace libcloudphxx
167167
// is a constant, external pressure profile used? (e.g. anelastic model)
168168
bool const_p;
169169

170-
// is it allowed to do condensation substepping, if not, some memory can be saved
171-
bool allow_sstp_cond;
170+
// is it allowed to do substepping, if not, some memory can be saved
171+
bool allow_sstp_cond,
172+
allow_sstp_chem;
172173

173174
// timestep counter
174175
n_t stp_ctr;
@@ -335,6 +336,7 @@ namespace libcloudphxx
335336
SGS_mix_len(_opts_init.SGS_mix_len),
336337
adve_scheme(_opts_init.adve_scheme),
337338
allow_sstp_cond(_opts_init.sstp_cond > 1 || _opts_init.variable_dt_switch),
339+
allow_sstp_chem(_opts_init.sstp_chem > 1 || _opts_init.variable_dt_switch),
338340
pure_const_multi (((_opts_init.sd_conc) == 0) && (_opts_init.sd_const_multi > 0 || _opts_init.dry_sizes.size() > 0)) // coal prob can be greater than one only in sd_conc simulations
339341
{
340342

src/impl/particles_impl_sstp.ipp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace libcloudphxx
1414
template <typename real_t, backend_t device>
1515
void particles_t<real_t, device>::impl::sstp_save()
1616
{
17-
if (opts_init.sstp_cond == 1) return;
17+
if (!allow_sstp_cond) return;
1818

1919
const int n = 4;
2020
thrust_device::vector<real_t>
@@ -41,7 +41,7 @@ namespace libcloudphxx
4141
template <typename real_t, backend_t device>
4242
void particles_t<real_t, device>::impl::init_sstp()
4343
{
44-
if (opts_init.sstp_cond == 1 || !opts_init.exact_sstp_cond) return;
44+
if (!allow_sstp_cond || !opts_init.exact_sstp_cond) return;
4545

4646
const int n = 4;
4747
thrust_device::vector<real_t>
@@ -62,7 +62,7 @@ namespace libcloudphxx
6262
const int &step
6363
)
6464
{
65-
if (opts_init.sstp_cond == 1) return;
65+
if (sstp_cond == 1) return;
6666

6767
namespace arg = thrust::placeholders;
6868

@@ -73,7 +73,7 @@ namespace libcloudphxx
7373

7474
for (int ix = 0; ix < (var_rho ? n : n-1); ++ix)
7575
{
76-
const real_t sstp = opts_init.sstp_cond;
76+
const real_t sstp = sstp_cond;
7777
if (step == 0)
7878
{
7979
// sstp_tmp_scl = dscl_adv (i.e. delta, i.e. new - old)
@@ -109,7 +109,7 @@ namespace libcloudphxx
109109
const int &step
110110
)
111111
{
112-
if (opts_init.sstp_cond == 1) return;
112+
if (sstp_cond == 1) return;
113113

114114
namespace arg = thrust::placeholders;
115115

@@ -121,7 +121,7 @@ namespace libcloudphxx
121121

122122
for (int ix = 0; ix < (const_p ? n : n-1); ++ix)
123123
{
124-
const real_t sstp = opts_init.sstp_cond;
124+
const real_t sstp = sstp_cond;
125125
if (step == 0)
126126
{
127127
// sstp_tmp_scl = dscl_adv (i.e. delta, i.e. new - old)

src/impl/particles_impl_sstp_chem.ipp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace libcloudphxx
1414
template <typename real_t, backend_t device>
1515
void particles_t<real_t, device>::impl::sstp_save_chem()
1616
{
17-
if (opts_init.sstp_chem == 1) return;
17+
if (!allow_sstp_chem) return;
1818

1919
const int n = 6;
2020
thrust_device::vector<real_t>
@@ -35,7 +35,7 @@ namespace libcloudphxx
3535
template <typename real_t, backend_t device>
3636
void particles_t<real_t, device>::impl::init_sstp_chem()
3737
{
38-
if (opts_init.sstp_chem == 1) return;
38+
if (!allow_sstp_chem) return;
3939

4040
// memory allocation
4141
sstp_tmp_chem_0.resize(n_cell);
@@ -54,7 +54,7 @@ namespace libcloudphxx
5454
const int &step
5555
)
5656
{
57-
if (opts_init.sstp_chem == 1) return;
57+
if (!allow_sstp_chem) return;
5858

5959
namespace arg = thrust::placeholders;
6060

@@ -68,7 +68,7 @@ namespace libcloudphxx
6868

6969
for (int ix = 0; ix < (var_rho ? n : n-1); ++ix)
7070
{
71-
const real_t sstp = opts_init.sstp_chem;
71+
const real_t sstp = sstp_chem;
7272
if (step == 0)
7373
{
7474
// sstp_tmp_scl = dscl_adv (i.e. delta, i.e. new - old)

0 commit comments

Comments
 (0)