NOX Development
|
LOCA's Homotopy Algorithm. More...
#include <LOCA_Homotopy_Group.H>
Public Member Functions | |
Group (Teuchos::ParameterList &locaSublist, const Teuchos::RCP< LOCA::GlobalData > &global_data, const Teuchos::RCP< LOCA::Homotopy::AbstractGroup > &g, double scaleRandom=1.0, double scaleInitialGuess=0.0) | |
Constructor to set the base group and generate the "%Stepper" sublist for homotopy continuation. | |
Group (Teuchos::ParameterList &locaSublist, const Teuchos::RCP< LOCA::GlobalData > &global_data, const Teuchos::RCP< LOCA::Homotopy::AbstractGroup > &g, const NOX::Abstract::Vector &randomVector) | |
Constructor with a user supplied random vector. | |
Group (const Group &source, NOX::CopyType type=NOX::DeepCopy) | |
Copy constructor. | |
virtual | ~Group () |
Destructor. | |
Implementation of NOX::Abstract::Group virtual methods | |
virtual NOX::Abstract::Group & | operator= (const NOX::Abstract::Group &source) |
Assignment operator. | |
virtual Teuchos::RCP< NOX::Abstract::Group > | clone (NOX::CopyType type=NOX::DeepCopy) const |
Cloning function. | |
virtual void | setX (const NOX::Abstract::Vector &y) |
Set the solution vector, x, to y. | |
virtual void | computeX (const NOX::Abstract::Group &g, const NOX::Abstract::Vector &d, double step) |
Compute this.x = grp.x + step * d. | |
virtual NOX::Abstract::Group::ReturnType | computeF () |
Compute the homotopy residual $g$. | |
virtual NOX::Abstract::Group::ReturnType | computeJacobian () |
Compute the Jacobian derivative of the homotopy residual $g$. | |
virtual NOX::Abstract::Group::ReturnType | computeGradient () |
Compute gradient of homotopy residual $g$. | |
virtual NOX::Abstract::Group::ReturnType | computeNewton (Teuchos::ParameterList ¶ms) |
Compute Newton direction using applyJacobianInverse. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Computes the homotopy Jacobian vector product. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Computes the homotopy Jacobian-transpose vector product. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianInverse (Teuchos::ParameterList ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Applies the inverse of the homotopy Jacobian matrix. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianMultiVector (const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
Applies Jacobian for homotopy system. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianTransposeMultiVector (const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
Applies Jacobian-transpose for homotopy system. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianInverseMultiVector (Teuchos::ParameterList ¶ms, const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
Applies Jacobian inverse for homotopy system. | |
virtual bool | isF () const |
Return true if the homotopy residual ![]() | |
virtual bool | isJacobian () const |
Return true if the homotopy Jacobian is valid. | |
virtual bool | isGradient () const |
Return true if the homotopy gradient is valid. | |
virtual bool | isNewton () const |
Return true if the homotopy Newton direction is valid. | |
virtual const NOX::Abstract::Vector & | getX () const |
Return homotopy solution vector ![]() | |
virtual const NOX::Abstract::Vector & | getF () const |
Return homotopy residual ![]() | |
virtual double | getNormF () const |
Return 2-norm of ![]() | |
virtual const NOX::Abstract::Vector & | getGradient () const |
Return homotopy gradient. | |
virtual const NOX::Abstract::Vector & | getNewton () const |
Return homotopy Newton direction. | |
virtual Teuchos::RCP< const NOX::Abstract::Vector > | getXPtr () const |
Return homotopy solution vector ![]() | |
virtual Teuchos::RCP< const NOX::Abstract::Vector > | getFPtr () const |
Return homotopy residual ![]() | |
virtual Teuchos::RCP< const NOX::Abstract::Vector > | getGradientPtr () const |
Return homotopy gradient. | |
virtual Teuchos::RCP< const NOX::Abstract::Vector > | getNewtonPtr () const |
Return homotopy Newton direction. | |
Implementation of LOCA::Extended::MultiAbstractGroup | |
virtual methods | |
virtual Teuchos::RCP< const LOCA::MultiContinuation::AbstractGroup > | getUnderlyingGroup () const |
Return underlying group. | |
virtual Teuchos::RCP< LOCA::MultiContinuation::AbstractGroup > | getUnderlyingGroup () |
Return underlying group. | |
![]() | |
AbstractGroup () | |
Default constructor. | |
virtual | ~AbstractGroup () |
Destructor. | |
virtual double | computeScaledDotProduct (const NOX::Abstract::Vector &a, const NOX::Abstract::Vector &b) const |
Compute a scaled dot product. | |
virtual void | scaleVector (NOX::Abstract::Vector &x) const |
Scales a vector using scaling vector. | |
![]() | |
Group () | |
Constructor. | |
virtual | ~Group () |
Destructor. | |
virtual NOX::Abstract::Group & | operator= (const NOX::Abstract::Group &source)=0 |
Copies the source group into this group. | |
virtual void | setX (const NOX::Abstract::Vector &y)=0 |
Set the solution vector x to y. | |
virtual void | computeX (const NOX::Abstract::Group &grp, const NOX::Abstract::Vector &d, double step)=0 |
Compute x = grp.x + step * d. | |
virtual NOX::Abstract::Group::ReturnType | computeF ()=0 |
Compute and store F(x). | |
virtual NOX::Abstract::Group::ReturnType | computeJacobian () |
Compute and store Jacobian. | |
virtual NOX::Abstract::Group::ReturnType | computeGradient () |
Compute and store gradient. | |
virtual NOX::Abstract::Group::ReturnType | computeNewton (Teuchos::ParameterList ¶ms) |
Compute the Newton direction, using parameters for the linear solve. | |
virtual NOX::Abstract::Group::ReturnType | applyRightPreconditioning (bool useTranspose, Teuchos::ParameterList ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Apply right preconditiong to the given input vector. | |
virtual NOX::Abstract::Group::ReturnType | applyRightPreconditioningMultiVector (bool useTranspose, Teuchos::ParameterList ¶ms, const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
applyRightPreconditioning for multiple right-hand sides | |
virtual const NOX::Abstract::Vector & | getScaledX () const |
virtual void | logLastLinearSolveStats (NOX::SolverStats &stats) const |
Adds statistics from last linear solve to the SovlerStats object. | |
virtual NOX::Abstract::Group::ReturnType | getNormLastLinearSolveResidual (double &residual) const |
Return the norm of the last linear solve residual as the result of either a call to computeNewton() or applyJacobianInverse(). | |
![]() | |
MultiAbstractGroup () | |
Default constructor. | |
virtual | ~MultiAbstractGroup () |
Destructor. | |
virtual Teuchos::RCP< const LOCA::MultiContinuation::AbstractGroup > | getBaseLevelUnderlyingGroup () const |
Return base-level underlying group. | |
virtual Teuchos::RCP< LOCA::MultiContinuation::AbstractGroup > | getBaseLevelUnderlyingGroup () |
Return base-level underlying group. | |
Implementation of LOCA::MultiContinuation::AbstractGroup | |
virtual methods | |
Teuchos::RCP< LOCA::GlobalData > | globalData |
Pointer LOCA global data object. | |
Teuchos::RCP< LOCA::Homotopy::AbstractGroup > | grpPtr |
Stores the underlying loca group. | |
Teuchos::RCP< NOX::Abstract::Vector > | gVecPtr |
Stores the homotopy residual vector, ![]() | |
Teuchos::RCP< NOX::Abstract::Vector > | randomVecPtr |
Stores the random Vector, ![]() | |
Teuchos::RCP< NOX::Abstract::Vector > | newtonVecPtr |
Stores the homotopy Newton vector, ![]() | |
Teuchos::RCP< NOX::Abstract::Vector > | gradVecPtr |
bool | isValidF |
Is residual vector valid. | |
bool | isValidJacobian |
Is Jacobian matrix valid. | |
bool | isValidNewton |
Is Newton vector valid. | |
bool | isValidGradient |
Is gradient vector valid. | |
LOCA::ParameterVector | paramVec |
Copy of the ParameterVector for the underlying grpPtr. | |
double | conParam |
Value of the homotopy continuation parameter. | |
int | conParamID |
Continuatioin parameter ID number from the ParameterVector. | |
const std::string | conParamLabel |
Contains the std::string used to identify the homotopy parameter in the ParameterVector object. | |
bool | augmentJacForHomotopyNotImplemented |
Tracks whether the LOCA::Homotopy::Group method augmentJacobianForHomotopy is implemented. If not, the augmentation is applied during the applyJacobian assuming a matrix-free implementation. | |
virtual void | copy (const NOX::Abstract::Group &source) |
Assignment. | |
virtual void | setParamsMulti (const std::vector< int > ¶mIDs, const NOX::Abstract::MultiVector::DenseMatrix &vals) |
Set parameters indexed by (integer) paramIDs. | |
virtual void | setParams (const ParameterVector &p) |
Set the parameter vector in the group to p. | |
virtual void | setParam (int paramID, double val) |
Set parameter indexed by paramID. | |
virtual void | setParam (std::string paramID, double val) |
Set parameter indexed by paramID. | |
virtual const ParameterVector & | getParams () const |
Return a const reference to the paramter vector owned by the group. | |
virtual double | getParam (int paramID) const |
Return copy of parameter indexed by paramID. | |
virtual double | getParam (std::string paramID) const |
Return copy of parameter indexed by paramID. | |
virtual NOX::Abstract::Group::ReturnType | computeDfDpMulti (const std::vector< int > ¶mIDs, NOX::Abstract::MultiVector &dfdp, bool isValidF) |
virtual void | preProcessContinuationStep (LOCA::Abstract::Iterator::StepStatus stepStatus) |
Perform any preprocessing before a continuation step starts. | |
virtual void | postProcessContinuationStep (LOCA::Abstract::Iterator::StepStatus stepStatus) |
Perform any postprocessing after a continuation step finishes. | |
virtual void | projectToDraw (const NOX::Abstract::Vector &x, double *px) const |
Projects solution to a few scalars for multiparameter continuation. | |
virtual int | projectToDrawDimension () const |
Returns the dimension of the project to draw array. | |
virtual void | printSolution (const double conParam) const |
Function to print out solution and continuation parameter after successful continuation step. | |
virtual void | printSolution (const NOX::Abstract::Vector &x_, const double conParam) const |
Function to print out solution and continuation parameter after successful continuation step. | |
void | resetIsValidFlags () |
Reset the isValid flags to false. | |
void | setStepperParameters (Teuchos::ParameterList ¶ms) |
Creates and sets the "Stepper" parameter sublist. | |
Additional Inherited Members | |
![]() | |
enum | ReturnType { Ok , NotDefined , BadDependency , NotConverged , Failed } |
The computation of, say, the Newton direction in computeNewton() may fail in many different ways, so we have included a variety of return codes to describe the failures. Of course, we also have a code for success. More... | |
LOCA's Homotopy Algorithm.
The HomotopyGroup is a concrete implementation of the LOCA::Continuation::AbstractGroup that modifies the set of nonlinear equations to be solved to allow for Homotopy to be applied to the system. This object should be used in conjunction with the LOCA::Stepper object to drive the continuation. This algorithm solves a system of nonlinear equations supplied by the user (
The modified system of equations,
where
This group requires the loca Stepper for continuation from
References:
LOCA::Homotopy::Group::Group | ( | Teuchos::ParameterList & | locaSublist, |
const Teuchos::RCP< LOCA::GlobalData > & | global_data, | ||
const Teuchos::RCP< LOCA::Homotopy::AbstractGroup > & | g, | ||
double | scaleRandom = 1.0 , |
||
double | scaleInitialGuess = 0.0 |
||
) |
Constructor to set the base group and generate the "%Stepper" sublist for homotopy continuation.
The locaSublist variable is the "LOCA" sublist (of type Teuchos::ParameterList) that will be used in loca continuation runs.
The variables scalarRandomVector and scalarInitialGuess are used to give some control over the generation of the random vector. In certain instances we have seen the random vector force the solution to a set of variables that are unphysical and could break the function evaluations (cause them to return nan). For example, in heat transfer problems, the temperature could be the dependent variable. If the solution vector has an unphysical temperature ( the random vector could force the temperature to negative or near zero values for the solution at
where
IMPORTANT: For homotopy to work correctly you should not change the starting and stopping parameter values (0.0 and 1.0 respectively) set in the "%Stepper" sublist.
References LOCA::ParameterVector::addParameter(), conParam, conParamID, conParamLabel, LOCA::ParameterVector::getIndex(), grpPtr, paramVec, randomVecPtr, resetIsValidFlags(), and setStepperParameters().
|
virtual |
Destructor.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Computes the homotopy Jacobian vector product.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::BadDependency, and NOX::Abstract::Vector::update().
|
virtual |
Applies the inverse of the homotopy Jacobian matrix.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Applies Jacobian inverse for homotopy system.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Applies Jacobian for homotopy system.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::BadDependency, and NOX::Abstract::MultiVector::update().
|
virtual |
Computes the homotopy Jacobian-transpose vector product.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::BadDependency, and NOX::Abstract::Vector::update().
|
virtual |
Applies Jacobian-transpose for homotopy system.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::BadDependency, and NOX::Abstract::MultiVector::update().
|
virtual |
Cloning function.
Implements NOX::Abstract::Group.
|
virtual |
Compute
Implements LOCA::MultiContinuation::AbstractGroup.
References NOX::Abstract::MultiVector::subView(), and NOX::Abstract::MultiVector::update().
|
virtual |
Compute the homotopy residual $g$.
Implements NOX::Abstract::Group.
References NOX::Abstract::Group::Ok.
|
virtual |
Compute gradient of homotopy residual $g$.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::Ok, and NOX::ShapeCopy.
|
virtual |
Compute the Jacobian derivative of the homotopy residual $g$.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::NotDefined, and NOX::Abstract::Group::Ok.
|
virtual |
Compute Newton direction using applyJacobianInverse.
Reimplemented from NOX::Abstract::Group.
References NOX::Abstract::Group::Ok, and NOX::ShapeCopy.
|
virtual |
Compute this.x = grp.x + step * d.
Implements NOX::Abstract::Group.
References computeX(), and grpPtr.
Referenced by computeX().
|
virtual |
Assignment.
Implements LOCA::MultiContinuation::AbstractGroup.
References augmentJacForHomotopyNotImplemented, conParam, conParamID, globalData, gradVecPtr, grpPtr, gVecPtr, isValidF, isValidGradient, isValidJacobian, isValidNewton, newtonVecPtr, paramVec, and randomVecPtr.
|
virtual |
Return homotopy residual
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy residual
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy gradient.
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy gradient.
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy Newton direction.
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy Newton direction.
Implements NOX::Abstract::Group.
|
virtual |
Return 2-norm of
Implements NOX::Abstract::Group.
|
virtual |
Return copy of parameter indexed by paramID.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Return copy of parameter indexed by paramID.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Return a const reference to the paramter vector owned by the group.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Return underlying group.
Implements LOCA::Extended::MultiAbstractGroup.
|
virtual |
Return underlying group.
Implements LOCA::Extended::MultiAbstractGroup.
|
virtual |
Return homotopy solution vector
Implements NOX::Abstract::Group.
|
virtual |
Return homotopy solution vector
Implements NOX::Abstract::Group.
|
virtual |
Return true
if the homotopy residual
Implements NOX::Abstract::Group.
|
virtual |
Return true
if the homotopy gradient is valid.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Return true
if the homotopy Jacobian is valid.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Return true
if the homotopy Newton direction is valid.
Reimplemented from NOX::Abstract::Group.
|
virtual |
Assignment operator.
Implements NOX::Abstract::Group.
|
virtual |
Perform any postprocessing after a continuation step finishes.
The stepStatus
argument indicates whether the step was successful.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Perform any preprocessing before a continuation step starts.
The stepStatus
argument indicates whether the previous step was successful.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Function to print out solution and continuation parameter after successful continuation step.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
References NOX::Utils::StepperDetails.
|
virtual |
Function to print out solution and continuation parameter after successful continuation step.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
References NOX::Utils::StepperDetails.
|
virtual |
Projects solution to a few scalars for multiparameter continuation.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Returns the dimension of the project to draw array.
Reimplemented from LOCA::MultiContinuation::AbstractGroup.
|
protected |
Reset the isValid flags to false.
This is called when the solution vector or parameter vector is changed.
Referenced by Group().
|
virtual |
Set parameter indexed by paramID.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Set parameter indexed by paramID.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Set the parameter vector in the group to p.
Implements LOCA::MultiContinuation::AbstractGroup.
References LOCA::ParameterVector::getValue().
|
virtual |
Set parameters indexed by (integer) paramIDs.
Implements LOCA::MultiContinuation::AbstractGroup.
|
virtual |
Set the solution vector, x, to y.
Implements NOX::Abstract::Group.
|
protected |
|
protected |
|
protected |
Copy of the ParameterVector for the underlying grpPtr.
We copy this and then add the homotopy parameter to the list.