Cantera  2.3.0
Public Member Functions | Protected Attributes | List of all members
MultiNewton Class Reference

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 Attributes

vector_fp m_x
 Work arrays of size m_n used in solve(). More...
 
vector_fp m_stp
 
vector_fp m_stp1
 
int m_maxAge
 
size_t m_n
 number of variables More...
 
doublereal m_elapsed
 

Detailed Description

Newton iterator for multi-domain, one-dimensional problems.

Used by class OneDim.

Definition at line 19 of file MultiNewton.h.

Member Function Documentation

◆ step()

void step ( doublereal *  x,
doublereal *  step,
OneDim r,
MultiJac jac,
int  loglevel 
)

Compute the undamped Newton step.

The residual function is evaluated at x, but the Jacobian is not recomputed.

Definition at line 162 of file MultiNewton.cpp.

References Domain1D::componentName(), OneDim::domain(), OneDim::eval(), BandMatrix::info(), Domain1D::nComponents(), OneDim::nDomains(), Cantera::npos, OneDim::size(), BandMatrix::solve(), and OneDim::start().

Referenced by MultiNewton::norm2(), and MultiNewton::solve().

◆ boundStep()

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 196 of file MultiNewton.cpp.

References OneDim::domain(), OneDim::nDomains(), and OneDim::start().

◆ 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 208 of file MultiNewton.cpp.

References Cantera::writelog().

Referenced by MultiNewton::solve().

◆ norm2()

doublereal norm2 ( const doublereal *  x,
const doublereal *  step,
OneDim r 
) const

Compute the weighted 2-norm of step.

Definition at line 149 of file MultiNewton.cpp.

References OneDim::domain(), OneDim::nDomains(), OneDim::size(), OneDim::start(), and MultiNewton::step().

◆ solve()

int solve ( doublereal *  x0,
doublereal *  x1,
OneDim r,
MultiJac jac,
int  loglevel 
)

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 289 of file MultiNewton.cpp.

References MultiJac::age(), MultiNewton::dampStep(), Cantera::debuglog(), MultiJac::eval(), OneDim::eval(), MultiJac::incrementAge(), MultiNewton::m_n, MultiNewton::m_x, MultiJac::nEvals(), Cantera::npos, OneDim::rdt(), MultiJac::setAge(), OneDim::ssnorm(), MultiNewton::step(), and Cantera::writelog().

◆ setOptions()

void setOptions ( int  maxJacAge = 5)
inline

Set options.

Definition at line 66 of file MultiNewton.h.

Referenced by OneDim::timeStep().

◆ resize()

void resize ( size_t  points)

Change the problem size.

Definition at line 141 of file MultiNewton.cpp.

References MultiNewton::m_n, and MultiNewton::m_x.

Member Data Documentation

◆ m_x

vector_fp m_x
protected

Work arrays of size m_n used in solve().

Definition at line 75 of file MultiNewton.h.

Referenced by MultiNewton::resize(), and MultiNewton::solve().

◆ m_n

size_t m_n
protected

number of variables

Definition at line 80 of file MultiNewton.h.

Referenced by MultiNewton::resize(), and MultiNewton::solve().


The documentation for this class was generated from the following files: