From d20476df8ec12525081047a19e722da2a2e49edd Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 7 Mar 2013 18:51:27 +0000 Subject: [PATCH] [Cython/1D] Fixed setting of steady and transient tolerances Previously, the transient tolerances were being used to solve the steady-state problem. --- .../cython/cantera/examples/onedim/adiabatic_flame.py | 2 +- .../cython/cantera/examples/onedim/diffusion_flame.py | 2 +- interfaces/cython/cantera/onedim.pyx | 4 ++-- interfaces/cython/cantera/test/test_onedim.py | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py index 516e19a91..eb3b9d042 100644 --- a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py +++ b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py @@ -12,7 +12,7 @@ reactants = 'H2:1.1, O2:1, AR:5' # premixed gas composition initial_grid = [0.0, 0.001, 0.01, 0.02, 0.029, 0.03] # m tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem -tol_ts = [1.0e-4, 1.0e-10] # [rtol atol] for time stepping +tol_ts = [1.0e-4, 1.0e-13] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 8) refine_grid = True # 'True' to enable refinement, 'False' to disable diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py index ceb33b8b3..327ea493e 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py @@ -20,7 +20,7 @@ comp_f = 'C2H6:1' # fuel composition initial_grid = np.linspace(0, 0.02, 6) tol_ss = [1.0e-5, 1.0e-12] # [rtol, atol] for steady-state problem -tol_ts = [5.0e-4, 1.0e-9] # [rtol, atol] for time stepping +tol_ts = [5.0e-4, 1.0e-11] # [rtol, atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 5) refine_grid = 1 # 1 to enable refinement, 0 to disable diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index 8f0b9da21..a0796ae8f 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -77,7 +77,7 @@ cdef class Domain1D: unspecified components. The keyword *Y* can be used to stand for all species mass fractions in flow domains. """ - self._set_tolerances(0, default, Y, kwargs) + self._set_tolerances(1, default, Y, kwargs) def set_transient_tolerances(self, *, default=None, Y=None, **kwargs): """ @@ -89,7 +89,7 @@ cdef class Domain1D: unspecified components. The keyword *Y* can be used to stand for all species mass fractions in flow domains. """ - self._set_tolerances(1, default, Y, kwargs) + self._set_tolerances(-1, default, Y, kwargs) def _set_tolerances(self, is_transient, default, Y, components): if default is not None: diff --git a/interfaces/cython/cantera/test/test_onedim.py b/interfaces/cython/cantera/test/test_onedim.py index 2a9f16c4d..9e68e0841 100644 --- a/interfaces/cython/cantera/test/test_onedim.py +++ b/interfaces/cython/cantera/test/test_onedim.py @@ -49,8 +49,8 @@ class TestOnedim(utilities.CanteraTest): class TestFreeFlame(utilities.CanteraTest): - tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem - tol_ts = [1.0e-4, 1.0e-10] # [rtol atol] for time stepping + tol_ss = [1.0e-5, 1.0e-14] # [rtol atol] for steady-state problem + tol_ts = [1.0e-4, 1.0e-11] # [rtol atol] for time stepping def create_sim(self, p, Tin, reactants): @@ -265,8 +265,8 @@ class TestDiffusionFlame(utilities.CanteraTest): oxidizer='O2:0.2, AR:0.8', T_ox=300, mdot_ox=0.72): initial_grid = np.linspace(0, 0.02, 6) # m - tol_ss = [1.0e-5, 1.0e-12] # [rtol, atol] for steady-state problem - tol_ts = [5.0e-4, 1.0e-9] # [rtol, atol] for time stepping + tol_ss = [2.0e-5, 1.0e-11] # [rtol, atol] for steady-state problem + tol_ts = [5.0e-4, 1.0e-11] # [rtol, atol] for time stepping # IdealGasMix object used to compute mixture properties self.gas = ct.Solution('h2o2.xml', 'ohmech')