32 OneDim(std::vector<Domain1D*> domains);
52 int solve(doublereal* x0, doublereal* x1,
int loglevel);
64 size_t domainIndex(
const std::string& name);
69 if (n >= m_dom.size()) {
70 throw IndexError(
"OneDim::checkDomainIndex",
"domains", n,
79 if (m_dom.size() > nn) {
87 if (m_dom[i]->nComponents()) {
88 return m_dom[i]->loc();
124 std::tuple<std::string, size_t, std::string>
component(
size_t i);
148 doublereal
ssnorm(doublereal* x, doublereal* r);
159 bool transient()
const {
160 return (
m_rdt != 0.0);
165 return (
m_rdt == 0.0);
187 void eval(
size_t j,
double* x,
double* r, doublereal
rdt=-1.0,
214 double timeStep(
int nsteps,
double dt,
double* x,
215 double* r,
int loglevel);
217 void resetBadValues(
double* x);
228 void save(
const std::string& fname, std::string
id,
229 const std::string& desc, doublereal* sol,
int loglevel);
231 AnyMap serialize(
const double* soln)
const;
234 void setMinTimeStep(doublereal tmin) {
237 void setMaxTimeStep(doublereal tmax) {
240 void setTimeStepFactor(doublereal tfactor) {
256 void setJacAge(
int ss_age,
int ts_age=-1);
291 return m_funcElapsed;
329 void evalSSJacobian(doublereal* x, doublereal* xnew);
345 std::vector<Domain1D*> m_dom, m_connect, m_bulk;
348 std::vector<size_t> m_nvars;
349 std::vector<size_t> m_loc;
354 int m_ss_jac_age, m_ts_jac_age;
371 doublereal m_evaltime;
372 std::vector<size_t> m_gridpts;
Base class for one-dimensional domains.
Base class for 'functor' classes that evaluate a function of one variable.
An array index is out of range.
Class MultiJac evaluates the Jacobian of a system of equations defined by a residual function supplie...
Newton iterator for multi-domain, one-dimensional problems.
Container class for multiple-domain 1D problems.
size_t start(size_t i) const
The index of the start of domain i in the solution vector.
int m_nsteps
Number of time steps taken in the current call to solve()
void checkDomainIndex(size_t n) const
Check that the specified domain index is in range.
vector_int m_timeSteps
Number of time steps taken in each call to solve() (for example, for each successive grid refinement)
doublereal m_rdt
reciprocal of time step
size_t m_size
solution vector size
int m_nsteps_max
Maximum number of timesteps allowed per call to solve()
virtual void resize()
Call after one or more grids has changed size, for example after being refined.
const vector_int & evalCountStats()
Return number of non-Jacobian function evaluations made in each call to solve()
std::unique_ptr< MultiJac > m_jac
Jacobian evaluator.
void saveStats()
Save statistics on function and Jacobian evaluation, and reset the counters.
size_t size() const
Total solution vector length;.
doublereal ssnorm(doublereal *x, doublereal *r)
Steady-state max norm (infinity norm) of the residual evaluated using solution x.
size_t loc(size_t jg)
Location in the solution vector of the first component of global point jg.
size_t nDomains() const
Number of domains.
const vector_fp & evalTimeStats()
Return CPU time spent on non-Jacobian function evaluations in each call to solve()
Domain1D * right()
Pointer to right-most domain (last added).
std::tuple< std::string, size_t, std::string > component(size_t i)
Return the domain, local point index, and component name for the i-th component of the global solutio...
doublereal m_tmin
minimum timestep size
const vector_int & jacobianCountStats()
Return number of Jacobian evaluations made in each call to solve()
size_t bandwidth() const
Jacobian bandwidth.
double timeStep(int nsteps, double dt, double *x, double *r, int loglevel)
void eval(size_t j, double *x, double *r, doublereal rdt=-1.0, int count=1)
Evaluate the multi-domain residual function.
const vector_int & timeStepStats()
Return number of time steps taken in each call to solve()
void setTimeStepCallback(Func1 *callback)
Set a function that will be called after each successful timestep.
Func1 * m_interrupt
Function called at the start of every call to eval.
void checkDomainArraySize(size_t nn) const
Check that an array size is at least nDomains().
void setMaxTimeStepCount(int nmax)
Set the maximum number of timeteps allowed before successful steady-state solve.
void initTimeInteg(doublereal dt, doublereal *x)
Prepare for time stepping beginning with solution x and timestep dt.
size_t nVars(size_t jg)
Number of solution components at global point jg.
std::unique_ptr< MultiNewton > m_newt
Newton iterator.
size_t m_bw
Jacobian bandwidth.
bool m_jac_ok
if true, Jacobian is current
int maxTimeStepCount() const
Return the maximum number of timeteps allowed before successful steady-state solve.
Domain1D * pointDomain(size_t i)
Return a pointer to the domain global point i belongs to.
doublereal m_tmax
maximum timestep size
void addDomain(Domain1D *d)
Add a domain. Domains are added left-to-right.
size_t points()
Total number of points.
MultiJac & jacobian()
Return a reference to the Jacobian evaluator.
void writeStats(int printTime=1)
Write statistics about the number of iterations and Jacobians at each grid level.
void clearStats()
Clear saved statistics.
const std::vector< size_t > & gridSizeStats()
Return total grid size in each call to solve()
Func1 * m_time_step_callback
User-supplied function called after each successful timestep.
doublereal m_tfactor
factor time step is multiplied by if time stepping fails ( < 1 )
Domain1D & domain(size_t i) const
Return a reference to domain i.
int solve(doublereal *x0, doublereal *x1, int loglevel)
Solve F(x) = 0, where F(x) is the multi-domain residual function.
Domain1D * left()
Pointer to left-most domain (first added).
bool steady() const
True if steady mode.
const vector_fp & jacobianTimeStats()
Return CPU time spent evaluating Jacobians in each call to solve()
MultiNewton & newton()
Return a reference to the Newton iterator.
void setInterrupt(Func1 *interrupt)
Set a function that will be called every time eval is called.
doublereal rdt() const
Reciprocal of the time step.
Namespace for the Cantera kernel.
std::vector< int > vector_int
Vector of ints.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.