[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:
Ray Speth
2015-06-11 12:30:52 -04:00
parent fa90d095f0
commit 392b0f5692
3 changed files with 5 additions and 7 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -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();