diff --git a/include/cantera/oneD/Domain1D.h b/include/cantera/oneD/Domain1D.h index 7d77c46a5..43a6727c4 100644 --- a/include/cantera/oneD/Domain1D.h +++ b/include/cantera/oneD/Domain1D.h @@ -146,10 +146,11 @@ public: m_name.resize(m_nv,""); m_max.resize(m_nv, 0.0); m_min.resize(m_nv, 0.0); - m_rtol_ss.resize(m_nv, 1.0e-8); - m_atol_ss.resize(m_nv, 1.0e-15); - m_rtol_ts.resize(m_nv, 1.0e-8); - m_atol_ts.resize(m_nv, 1.0e-15); + // Default error tolerances for all domains + m_rtol_ss.resize(m_nv, 1.0e-4); + m_atol_ss.resize(m_nv, 1.0e-9); + m_rtol_ts.resize(m_nv, 1.0e-4); + m_atol_ts.resize(m_nv, 1.0e-11); m_points = np; m_z.resize(np, 0.0); m_slast.resize(m_nv * m_points, 0.0); diff --git a/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py b/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py index 90284e6ef..fd5b5d5f3 100644 --- a/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py +++ b/interfaces/cython/cantera/examples/kinetics/extract_submechanism.py @@ -63,10 +63,6 @@ def solve_flame(gas): sim.reactants.mdot = 0.12 # kg/m^2/s sim.products.mdot = 0.06 # kg/m^2/s - sim.flame.set_steady_tolerances(default=[1.0e-7, 1.0e-13]) - sim.flame.set_transient_tolerances(default=[1.0e-7, 1.0e-11]) - sim.set_initial_guess() - sim.energy_enabled = False sim.solve(0, refine_grid=False) sim.set_refine_criteria(ratio=3, slope=0.1, curve=0.2) diff --git a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py index 628542fbf..d86c0f3e6 100644 --- a/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py +++ b/interfaces/cython/cantera/examples/onedim/adiabatic_flame.py @@ -12,8 +12,6 @@ Tin = 300.0 # unburned gas temperature [K] reactants = 'H2:1.1, O2:1, AR:5' # premixed gas composition width = 0.03 # m -tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem -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 @@ -24,9 +22,6 @@ gas.TPX = Tin, p, reactants # Flame object f = ct.FreeFlame(gas, width=width) -f.flame.set_steady_tolerances(default=tol_ss) -f.flame.set_transient_tolerances(default=tol_ts) - f.show_solution() # Solve with the energy equation disabled diff --git a/interfaces/cython/cantera/examples/onedim/burner_flame.py b/interfaces/cython/cantera/examples/onedim/burner_flame.py index 6ead53d37..9fc0d0675 100644 --- a/interfaces/cython/cantera/examples/onedim/burner_flame.py +++ b/interfaces/cython/cantera/examples/onedim/burner_flame.py @@ -11,8 +11,6 @@ mdot = 0.06 reactants = 'H2:1.5, O2:1, AR:7' # premixed gas composition width = 0.5 # 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 loglevel = 1 # amount of diagnostic output (0 to 5) refine_grid = 1 # 1 to enable refinement, 0 to disable @@ -23,8 +21,6 @@ f = ct.BurnerFlame(gas, width=width) f.burner.mdot = mdot f.set_initial_guess() -f.flame.set_steady_tolerances(default=tol_ss) -f.flame.set_transient_tolerances(default=tol_ts) f.show_solution() f.energy_enabled = False diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py index a6b0d6b4e..9dd81f9fd 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame.py @@ -18,9 +18,6 @@ comp_f = 'C2H6:1' # fuel composition width = 0.02 # Distance between inlets is 2 cm -tol_ss = [1.0e-5, 1.0e-12] # [rtol, atol] for steady-state problem -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 @@ -43,10 +40,6 @@ f.oxidizer_inlet.mdot = mdot_o f.oxidizer_inlet.X = comp_o f.oxidizer_inlet.T = tin_o -# Set error tolerances -f.flame.set_steady_tolerances(default=tol_ss) -f.flame.set_transient_tolerances(default=tol_ts) - # Set the boundary emissivities f.set_boundary_emissivities(0.0, 0.0) # Turn radiation off diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py index f69312797..966a4d88a 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame_batch.py @@ -50,13 +50,8 @@ f.oxidizer_inlet.mdot = 3.0 # kg/m^2/s f.oxidizer_inlet.X = 'O2:1' f.oxidizer_inlet.T = 300 # K -# Define relative and absolute error tolerances -f.flame.set_steady_tolerances(default=[1.0e-5, 1.0e-12]) -f.flame.set_transient_tolerances(default=[5.0e-4, 1.0e-11]) - # Set refinement parameters, if used f.set_refine_criteria(ratio=3.0, slope=0.1, curve=0.2, prune=0.03) -f.set_grid_min(1e-20) # Define a limit for the maximum temperature below which the flame is # considered as extinguished and the computation is aborted diff --git a/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py b/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py index 38edee4e1..ff1a97b4f 100644 --- a/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py +++ b/interfaces/cython/cantera/examples/onedim/diffusion_flame_extinction.py @@ -43,15 +43,10 @@ f.oxidizer_inlet.mdot = 3.0 # kg/m^2/s f.oxidizer_inlet.X = 'O2:1' f.oxidizer_inlet.T = 500 # K -# Define relative and absolute error tolerances -f.flame.set_steady_tolerances(default=[1.0e-5, 1.0e-12]) -f.flame.set_transient_tolerances(default=[5.0e-4, 1.0e-11]) - # Enable refinement refine = True # Set refinement parameters f.set_refine_criteria(ratio=3.0, slope=0.1, curve=0.2, prune=0.03) -f.set_grid_min(1e-20) # Define a limit for the maximum temperature below which the flame is # considered as extinguished and the computation is aborted diff --git a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py index 1cc132bd0..9bdff179f 100644 --- a/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py +++ b/interfaces/cython/cantera/examples/onedim/flame_fixed_T.py @@ -16,8 +16,6 @@ comp = 'CH4:0.65, O2:1, N2:3.76' # premixed gas composition # The solution domain is chosen to be 1 cm width = 0.01 # m -tol_ss = [1.0e-5, 1.0e-9] # [rtol atol] for steady-state problem -tol_ts = [1.0e-5, 1.0e-4] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 5) refine_grid = True # 'True' to enable refinement @@ -46,9 +44,6 @@ zloc /= max(zloc) # set the temperature profile to the values read in f.flame.set_fixed_temp_profile(zloc, tvalues) -f.flame.set_steady_tolerances(default=tol_ss) -f.flame.set_transient_tolerances(default=tol_ts) - # show the initial estimate for the solution f.show_solution() diff --git a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py index 5e075285b..169deecbd 100644 --- a/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py +++ b/interfaces/cython/cantera/examples/onedim/premixed_counterflow_flame.py @@ -18,8 +18,6 @@ rxnmech = 'h2o2.cti' # reaction mechanism file comp = 'H2:1.6, O2:1, AR:7' # premixed gas composition width = 0.2 # m -tol_ss = [1.0e-7, 1.0e-13] # [rtol atol] for steady-state problem -tol_ts = [1.0e-7, 1.0e-11] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 5) # Grid refinement parameters @@ -41,8 +39,6 @@ sim = ct.CounterflowPremixedFlame(gas=gas, width=width) sim.reactants.mdot = mdot_reactants sim.products.mdot = mdot_products -sim.flame.set_steady_tolerances(default=tol_ss) -sim.flame.set_transient_tolerances(default=tol_ts) sim.set_initial_guess() # assume adiabatic equilibrium products sim.show_solution() diff --git a/interfaces/cython/cantera/examples/onedim/stagnation_flame.py b/interfaces/cython/cantera/examples/onedim/stagnation_flame.py index fc2146833..291c05e68 100644 --- a/interfaces/cython/cantera/examples/onedim/stagnation_flame.py +++ b/interfaces/cython/cantera/examples/onedim/stagnation_flame.py @@ -34,8 +34,6 @@ comp = 'H2:1.8, O2:1, AR:7' # premixed gas composition # The solution domain is chosen to be 20 cm width = 0.2 # m -tol_ss = [1.0e-5, 1.0e-13] # [rtol atol] for steady-state problem -tol_ts = [1.0e-4, 1.0e-9] # [rtol atol] for time stepping loglevel = 1 # amount of diagnostic output (0 to 5) refine_grid = True @@ -62,8 +60,6 @@ sim.inlet.mdot = mdot[0] # set the surface state sim.surface.T = tsurf -sim.flame.set_steady_tolerances(default=tol_ss) -sim.flame.set_transient_tolerances(default=tol_ts) sim.set_grid_min(1e-4) sim.energy_enabled = False diff --git a/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py b/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py index 6a3d47f82..81e8f2584 100644 --- a/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py +++ b/interfaces/cython/cantera/examples/surface_chemistry/catalytic_combustion.py @@ -33,10 +33,6 @@ comp2 = 'CH4:0.095, O2:0.21, N2:0.78, AR:0.01' # The inlet/surface separation is 10 cm. width = 0.1 # m -# numerical parameters -tol_ss = [1.0e-5, 1.0e-9] # [rtol, atol] for steady-state problem -tol_ts = [1.0e-4, 1.0e-9] # [rtol, atol] for time stepping - loglevel = 1 # amount of diagnostic output (0 to 5) refine_grid = True # enable or disable refinement @@ -74,10 +70,6 @@ sim.inlet.T = tinlet sim.inlet.X = comp1 sim.surface.T = tsurf -# Set error tolerances -sim.flame.set_steady_tolerances(default=tol_ss) -sim.flame.set_transient_tolerances(default=tol_ts) - # Show the initial solution estimate sim.show_solution() diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index 9a9ee138f..ba991e7da 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -74,10 +74,6 @@ StFlow::StFlow(IdealGasPhase* ph, size_t nsp, size_t points) : setBounds(4+k, -1.0e-7, 1.0e5); } - //-------------------- default error tolerances ---------------- - setTransientTolerances(1.0e-8, 1.0e-15); - setSteadyTolerances(1.0e-8, 1.0e-15); - //-------------------- grid refinement ------------------------- m_refiner->setActive(0, false); m_refiner->setActive(1, false); diff --git a/src/oneD/boundaries1D.cpp b/src/oneD/boundaries1D.cpp index b8e74a468..90aa19cf7 100644 --- a/src/oneD/boundaries1D.cpp +++ b/src/oneD/boundaries1D.cpp @@ -112,10 +112,6 @@ void Inlet1D::init() setBounds(0, -1e5, 1e5); // mdot setBounds(1, 200.0, 1e5); // T - // set tolerances - setSteadyTolerances(1e-4, 1e-5); - setTransientTolerances(1e-4, 1e-5); - // if a flow domain is present on the left, then this must be a right inlet. // Note that an inlet object can only be a terminal object - it cannot have // flows on both the left and right @@ -265,10 +261,6 @@ string Empty1D::componentName(size_t n) const void Empty1D::init() { setBounds(0, -1.0, 1.0); - - // set tolerances - setSteadyTolerances(1e-4, 1e-4); - setTransientTolerances(1e-4, 1e-4); } void Empty1D::eval(size_t jg, doublereal* xg, doublereal* rg, @@ -317,10 +309,6 @@ void Symm1D::init() { _init(1); setBounds(0, -1.0, 1.0); - - // set tolerances - setSteadyTolerances(1e-4, 1e-4); - setTransientTolerances(1e-4, 1e-4); } void Symm1D::eval(size_t jg, doublereal* xg, doublereal* rg, integer* diagg, @@ -395,9 +383,6 @@ void Outlet1D::init() _init(1); setBounds(0, -1.0, 1.0); - // set tolerances - setSteadyTolerances(1e-4, 1e-4); - setTransientTolerances(1e-4, 1e-4); if (m_flow_right) { m_flow_right->setViscosityFlag(false); } @@ -509,10 +494,6 @@ void OutletRes1D::init() // set bounds (dummy) setBounds(0, -1.0, 1.0); - // set tolerances - setSteadyTolerances(1e-4, 1e-4); - setTransientTolerances(1e-4, 1e-4); - if (m_flow_left) { m_flow = m_flow_left; } else if (m_flow_right) { @@ -639,10 +620,6 @@ void Surf1D::init() _init(1); // set bounds (T) setBounds(0, 200.0, 1e5); - - // set tolerances - setSteadyTolerances(1e-4, 1e-4); - setTransientTolerances(1e-4, 1e-4); } void Surf1D::eval(size_t jg, doublereal* xg, doublereal* rg, @@ -719,10 +696,6 @@ void ReactingSurf1D::init() for (size_t n = 0; n < m_nsp; n++) { setBounds(n+1, -1.0e-5, 2.0); } - setSteadyTolerances(1.0e-5, 1.0e-9); - setTransientTolerances(1.0e-5, 1.0e-9); - setSteadyTolerances(1.0e-5, 1.0e-4, 0); - setTransientTolerances(1.0e-5, 1.0e-4, 0); } void ReactingSurf1D::resetBadValues(double* xg) {