Skip to content

Commit

Permalink
[Reactor] Use right preconditioning by default
Browse files Browse the repository at this point in the history
Using right preconditioning provides a more reliable performance benefit
even after the ignition event, allowing the solver to take reasonable
timesteps and showing a CPU-time benefit even for a single reactor with
the 100-species n-dodecane mechanism.
  • Loading branch information
speth committed Aug 30, 2022
1 parent 4dfbfab commit 2ec692c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samples/python/reactors/preconditioned_integration.py
Expand Up @@ -11,7 +11,7 @@
import matplotlib.pyplot as plt
from timeit import default_timer

def integrate_reactor(n_reactors=15, preconditioner=True):
def integrate_reactor(n_reactors=1, preconditioner=True):
"""
Compare the integrations of a preconditioned reactor network and a
non-preconditioned reactor network. Increase the number of reactors in the
Expand Down
2 changes: 1 addition & 1 deletion src/numerics/AdaptivePreconditioner.cpp
Expand Up @@ -11,7 +11,7 @@ namespace Cantera

AdaptivePreconditioner::AdaptivePreconditioner()
{
setPreconditionerSide("left");
setPreconditionerSide("right");
}

void AdaptivePreconditioner::setValue(size_t row, size_t col, double value)
Expand Down
4 changes: 3 additions & 1 deletion test/python/test_reactor.py
Expand Up @@ -1042,11 +1042,13 @@ class TestIdealGasConstPressureMoleReactor(TestIdealGasConstPressureReactor):

def create_reactors(self, **kwargs):
super().create_reactors(**kwargs)
self.net2.preconditioner = ct.AdaptivePreconditioner()
self.precon = ct.AdaptivePreconditioner()
self.net2.preconditioner = self.precon
self.net2.derivative_settings = {"skip-third-bodies":True, "skip-falloff":True}

def test_get_solver_type(self):
self.create_reactors()
assert self.precon.side == "right"
self.assertEqual(self.net2.linear_solver_type, "GMRES")

def test_with_surface_reactions(self):
Expand Down

0 comments on commit 2ec692c

Please sign in to comment.