mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[Reactor] Do not use argument to step/advance to set the max time step
Allow CVODES to take arbitrarily large timesteps by default. If a maximum time step is desired, it can be set explicitly.
This commit is contained in:
@@ -249,7 +249,10 @@ protected:
|
||||
vector_fp m_atol;
|
||||
doublereal m_rtol, m_rtolsens;
|
||||
doublereal m_atols, m_atolsens;
|
||||
|
||||
//! Maximum integrator internal timestep. Default of 0.0 means infinity.
|
||||
doublereal m_maxstep;
|
||||
|
||||
int m_maxErrTestFails;
|
||||
bool m_verbose;
|
||||
size_t m_ntotpar;
|
||||
|
||||
@@ -378,6 +378,7 @@ class TestReactor(utilities.CanteraTest):
|
||||
# (constant T) we can compare with an analytical solution for
|
||||
# the mass of each reactor as a function of time
|
||||
self.make_reactors(P1=10*ct.one_atm)
|
||||
self.net.rtol = 1e-11
|
||||
self.r1.energy_enabled = False
|
||||
self.r2.energy_enabled = False
|
||||
valve = ct.Valve(self.r1, self.r2)
|
||||
|
||||
@@ -14,7 +14,7 @@ ReactorNet::ReactorNet() :
|
||||
m_integ(0), m_time(0.0), m_init(false), m_integrator_init(false),
|
||||
m_nv(0), m_rtol(1.0e-9), m_rtolsens(1.0e-4),
|
||||
m_atols(1.0e-15), m_atolsens(1.0e-4),
|
||||
m_maxstep(-1.0), m_maxErrTestFails(0),
|
||||
m_maxstep(0.0), m_maxErrTestFails(0),
|
||||
m_verbose(false), m_ntotpar(0)
|
||||
{
|
||||
m_integ = newIntegrator("CVODE");
|
||||
@@ -113,9 +113,6 @@ void ReactorNet::reinitialize()
|
||||
void ReactorNet::advance(doublereal time)
|
||||
{
|
||||
if (!m_init) {
|
||||
if (m_maxstep < 0.0) {
|
||||
m_maxstep = time - m_time;
|
||||
}
|
||||
initialize();
|
||||
} else if (!m_integrator_init) {
|
||||
reinitialize();
|
||||
@@ -128,9 +125,6 @@ void ReactorNet::advance(doublereal time)
|
||||
double ReactorNet::step(doublereal time)
|
||||
{
|
||||
if (!m_init) {
|
||||
if (m_maxstep < 0.0) {
|
||||
m_maxstep = time - m_time;
|
||||
}
|
||||
initialize();
|
||||
} else if (!m_integrator_init) {
|
||||
reinitialize();
|
||||
|
||||
Reference in New Issue
Block a user