Cantera  2.5.1
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)
 
 MultiNewton (const MultiNewton &)=delete
 
MultiNewtonoperator= (const MultiNewton &)=delete
 
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().

◆ 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().

◆ 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(), and OneDim::start().

◆ 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(), Cantera::debuglog(), MultiJac::eval(), OneDim::eval(), MultiJac::incrementAge(), MultiJac::nEvals(), Cantera::npos, OneDim::rdt(), MultiJac::setAge(), OneDim::ssnorm(), and Cantera::writelog().

◆ setOptions()

void setOptions ( int  maxJacAge = 5)
inline

Set options.

Definition at line 68 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.

Member Data Documentation

◆ m_x

vector_fp m_x
protected

Work arrays of size m_n used in solve().

Definition at line 77 of file MultiNewton.h.

◆ m_n

size_t m_n
protected

number of variables

Definition at line 82 of file MultiNewton.h.


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