[1D] Switch to "steady mode" before attempting steady-state solve
The solver could previously get left in transient mode if an exception occurred during time stepping, making it impossible to make a new attempt at solving the steady-state problem.
This commit is contained in:
parent
85c3bf5ba6
commit
9353a79da2
2 changed files with 8 additions and 4 deletions
|
|
@ -301,6 +301,10 @@ void OneDim::initTimeInteg(doublereal dt, doublereal* x)
|
|||
|
||||
void OneDim::setSteadyMode()
|
||||
{
|
||||
if (m_rdt == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_rdt = 0.0;
|
||||
m_jac->updateTransient(m_rdt, m_mask.data());
|
||||
|
||||
|
|
@ -384,10 +388,6 @@ doublereal OneDim::timeStep(int nsteps, doublereal dt, doublereal* x,
|
|||
}
|
||||
}
|
||||
|
||||
// Prepare to solve the steady problem.
|
||||
setSteadyMode();
|
||||
newton().setOptions(m_ss_jac_age);
|
||||
|
||||
// return the value of the last stepsize, which may be smaller
|
||||
// than the initial stepsize
|
||||
return dt;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "cantera/oneD/Sim1D.h"
|
||||
#include "cantera/oneD/MultiJac.h"
|
||||
#include "cantera/oneD/StFlow.h"
|
||||
#include "cantera/oneD/MultiNewton.h"
|
||||
#include "cantera/numerics/funcs.h"
|
||||
#include "cantera/base/xml.h"
|
||||
|
||||
|
|
@ -244,6 +245,9 @@ void Sim1D::solve(int loglevel, bool refine_grid)
|
|||
writeline('.', 78, true, true);
|
||||
}
|
||||
while (!ok) {
|
||||
// Attempt to solve the steady problem
|
||||
setSteadyMode();
|
||||
newton().setOptions(m_ss_jac_age);
|
||||
debuglog("Attempt Newton solution of steady-state problem...", loglevel);
|
||||
int status = newtonSolve(loglevel-1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue