Cantera
2.1.2
|
Newton iterator for multi-domain, one-dimensional problems. More...
#include <MultiNewton.h>
Public Member Functions | |
MultiNewton (int sz) | |
size_t | size () |
void | step (doublereal *x, doublereal *step, OneDim &r, MultiJac &jac, int loglevel) |
Compute the undamped Newton step. More... | |
doublereal | boundStep (const doublereal *x0, const doublereal *step0, const OneDim &r, int loglevel) |
Return the factor by which the undamped Newton step 'step0' must be multiplied in order to keep all solution components in all domains between their specified lower and upper bounds. More... | |
int | dampStep (const doublereal *x0, const doublereal *step0, doublereal *x1, doublereal *step1, doublereal &s1, OneDim &r, MultiJac &jac, int loglevel, bool writetitle) |
On entry, step0 must contain an undamped Newton step for the solution x0. More... | |
doublereal | norm2 (const doublereal *x, const doublereal *step, OneDim &r) const |
Compute the weighted 2-norm of step . More... | |
int | solve (doublereal *x0, doublereal *x1, OneDim &r, MultiJac &jac, int loglevel) |
Find the solution to F(X) = 0 by damped Newton iteration. More... | |
void | setOptions (int maxJacAge=5) |
Set options. More... | |
void | resize (size_t points) |
Change the problem size. More... | |
Protected Member Functions | |
doublereal * | getWorkArray () |
Get a pointer to an array of length m_n for temporary work space. More... | |
void | releaseWorkArray (doublereal *work) |
Release a work array by pushing its pointer onto the stack of available arrays. More... | |
Protected Attributes | |
std::vector< doublereal * > | m_workarrays |
int | m_maxAge |
size_t | m_nv |
size_t | m_np |
size_t | m_n |
doublereal | m_elapsed |
Private Attributes | |
char | m_buf [100] |
Newton iterator for multi-domain, one-dimensional problems.
Used by class OneDim.
Definition at line 22 of file MultiNewton.h.
Compute the undamped Newton step.
The residual function is evaluated at x
, but the Jacobian is not recomputed.
Definition at line 198 of file MultiNewton.cpp.
References Domain1D::componentName(), OneDim::domain(), OneDim::eval(), Cantera::int2str(), Domain1D::loc(), Domain1D::nComponents(), OneDim::nDomains(), Cantera::npos, OneDim::pointDomain(), OneDim::size(), BandMatrix::solve(), and OneDim::start().
Referenced by MultiNewton::dampStep(), and MultiNewton::solve().
doublereal boundStep | ( | const doublereal * | x0, |
const doublereal * | step0, | ||
const OneDim & | r, | ||
int | loglevel | ||
) |
Return the factor by which the undamped Newton step 'step0' must be multiplied in order to keep all solution components in all domains between their specified lower and upper bounds.
Definition at line 258 of file MultiNewton.cpp.
References OneDim::domain(), OneDim::nDomains(), and OneDim::start().
Referenced by MultiNewton::dampStep().
int dampStep | ( | const doublereal * | x0, |
const doublereal * | step0, | ||
doublereal * | x1, | ||
doublereal * | step1, | ||
doublereal & | s1, | ||
OneDim & | r, | ||
MultiJac & | jac, | ||
int | loglevel, | ||
bool | writetitle | ||
) |
On entry, step0 must contain an undamped Newton step for the solution x0.
This method attempts to find a damping coefficient such that the next undamped step would have a norm smaller than that of step0. If successful, the new solution after taking the damped step is returned in x1, and the undamped step at x1 is returned in step1.
Definition at line 270 of file MultiNewton.cpp.
References MultiJac::age(), MultiNewton::boundStep(), Cantera::DampFactor, Cantera::int2str(), Cantera::NDAMP, MultiJac::nEvals(), MultiNewton::norm2(), Cantera::SmallNumber, OneDim::ssnorm(), MultiNewton::step(), and Cantera::writelog().
Referenced by MultiNewton::solve().
doublereal norm2 | ( | const doublereal * | x, |
const doublereal * | step, | ||
OneDim & | r | ||
) | const |
Compute the weighted 2-norm of step
.
Definition at line 184 of file MultiNewton.cpp.
References OneDim::domain(), OneDim::nDomains(), OneDim::size(), and OneDim::start().
Referenced by MultiNewton::dampStep().
Find the solution to F(X) = 0 by damped Newton iteration.
On entry, x0 contains an initial estimate of the solution. On successful return, x1 contains the converged solution.
Definition at line 365 of file MultiNewton.cpp.
References MultiJac::age(), MultiNewton::dampStep(), DATA_PTR, MultiJac::eval(), OneDim::eval(), MultiNewton::getWorkArray(), MultiJac::incrementAge(), Cantera::int2str(), MultiJac::nEvals(), Cantera::npos, OneDim::rdt(), MultiNewton::releaseWorkArray(), OneDim::ssnorm(), MultiNewton::step(), and Cantera::writelog().
Referenced by OneDim::solve().
|
inline |
void resize | ( | size_t | points | ) |
Change the problem size.
Definition at line 175 of file MultiNewton.cpp.
Referenced by OneDim::resize().
|
protected |
Get a pointer to an array of length m_n for temporary work space.
Definition at line 465 of file MultiNewton.cpp.
Referenced by MultiNewton::solve().
|
protected |
Release a work array by pushing its pointer onto the stack of available arrays.
Definition at line 478 of file MultiNewton.cpp.
Referenced by MultiNewton::solve().