From d26088bc8685de793b1a610e0f8995ee60a45e16 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Mon, 10 May 2021 18:57:04 +0200 Subject: [PATCH] fix explicit Euler --- PySDM/backends/numba/impl/_chemistry_methods.py | 8 ++++---- PySDM/backends/numba/impl/_physics_methods.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/PySDM/backends/numba/impl/_chemistry_methods.py b/PySDM/backends/numba/impl/_chemistry_methods.py index 69a88f9b5..214a7a4f6 100644 --- a/PySDM/backends/numba/impl/_chemistry_methods.py +++ b/PySDM/backends/numba/impl/_chemistry_methods.py @@ -142,10 +142,10 @@ def oxidation_body(n_sd, cell_ids, do_chemistry_flag, explicit_euler, pH2H, ): continue - explicit_euler(moles_O3[i:i+1], a, dconc_dt_O3) - explicit_euler(moles_S_IV[i:i+1], a, dconc_dt_S_IV) - explicit_euler(moles_S_VI[i:i+1], a, dconc_dt_S_VI) - explicit_euler(moles_H2O2[i:i+1], a, dconc_dt_H2O2) + moles_O3[i] = explicit_euler(moles_O3[i], a, dconc_dt_O3) + moles_S_IV[i] = explicit_euler(moles_S_IV[i], a, dconc_dt_S_IV) + moles_S_VI[i] = explicit_euler(moles_S_VI[i], a, dconc_dt_S_VI) + moles_H2O2[i] = explicit_euler(moles_H2O2[i], a, dconc_dt_H2O2) # @numba.njit(**{**conf.JIT_FLAGS, **{'parallel': False}}) # TODO #440 def chem_recalculate_drop_data(self, dissociation_factors, equilibrium_consts, cell_id, pH): diff --git a/PySDM/backends/numba/impl/_physics_methods.py b/PySDM/backends/numba/impl/_physics_methods.py index 785f120d7..8e434ac3e 100644 --- a/PySDM/backends/numba/impl/_physics_methods.py +++ b/PySDM/backends/numba/impl/_physics_methods.py @@ -21,8 +21,7 @@ def __init__(self): @numba.njit(**{**conf.JIT_FLAGS, 'fastmath': self.formulae.fastmath}) def explicit_euler_body(y, dt, dy_dt): - for i in prange(y.shape[0]): - y[i] = explicit_euler(y[i], dt, dy_dt) + y[:] = explicit_euler(y, dt, dy_dt) self.explicit_euler_body = explicit_euler_body @numba.njit(**{**conf.JIT_FLAGS, 'fastmath': self.formulae.fastmath})