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