version 0.4.1
Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF > Class Template Reference

Newton-Raphson solver with subsidiary function. More...

#include <ikarus/solver/nonlinearsolver/newtonraphsonwithscalarsubsidiaryfunction.hh>

Inheritance diagram for Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >:
[legend]

Public Types

using Settings = NewtonRaphsonWithSubsidiaryFunctionSettings
 Compile-time boolean indicating if the linear solver satisfies the non-linear solver concept. More...
 
using ValueType = typename NLO::template ParameterValue< 0 >
 Type representing the update function. More...
 
using UpdateFunctionType = UF
 
using NonLinearOperator = NLO
 Type of the non-linear operator. More...
 

Public Member Functions

template<typename LS2 = LS, typename UF2 = UF>
 NewtonRaphsonWithSubsidiaryFunction (const NLO &nonLinearOperator, LS2 &&linearSolver={}, UF2 &&updateFunction={})
 Constructor for NewtonRaphsonWithSubsidiaryFunction. More...
 
void setup (const Settings &settings)
 Setup the Newton-Raphson solver with subsidiary function. More...
 
template<typename SolutionType = NoPredictor, typename SubsidiaryType >
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v<SolutionType, std::remove_cvref_t<typename NLO::ValueType>>
NonLinearSolverInformation solve (SubsidiaryType &&subsidiaryFunction, SubsidiaryArgs &subsidiaryArgs, const SolutionType &dxPredictor=NoPredictor{})
 Solve the nonlinear system using the Newton-Raphson method with subsidiary function. More...
 
auto & nonLinearOperator ()
 Access the nonlinear operator. More...
 
void subscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for a specific message type. More...
 
void subscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Subscribe an observer to receive notifications for all message types. More...
 
void subscribeAll (std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > > observers)
 Subscribe multiple observers to receive notifications for all message types. More...
 
void unSubscribe (NonLinearSolverMessages message, std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for a specific message type. More...
 
void unSubscribeAll (std::shared_ptr< IObserver< NonLinearSolverMessages > > observer)
 Unsubscribe an observer from receiving notifications for all message types. More...
 
void notify (NonLinearSolverMessages message)
 Notify observers about a specific message type. More...
 
void notify (NonLinearSolverMessages message, ScalarType val)
 Notify observers about a specific message type with a floating-point value. More...
 
void notify (NonLinearSolverMessages message, int val)
 Notify observers about a specific message type with an integer value. More...
 
void notify (NonLinearSolverMessages message, const std::string &val)
 Notify observers about a specific message type with a string value. More...
 
void notify (NonLinearSolverMessages message, int val1, double val2)
 Notify observers about a specific message type with an integer and a double value. More...
 
void notify (NonLinearSolverMessages message, int val1, const std::string &val2)
 Notify observers about a specific message type with an integer value and a string value. More...
 
void notify (NonLinearSolverMessages message, Eigen::VectorX< ScalarType > vec)
 Notify observers about a specific message type with an Eigen::VectorX. More...
 
void notify (MT message)
 
void notify (MT message, ScalarType val)
 
void notify (MT message, int val)
 
void notify (MT message, const std::string &val)
 
void notify (MT message, int val1, double val2)
 
void notify (MT message, int val1, const std::string &val2)
 
void notify (MT message, Eigen::VectorX< ScalarType > vec)
 

Static Public Attributes

static constexpr bool isLinearSolver
 Type representing the parameter vector of the nonlinear operator. More...
 

Detailed Description

template<typename NLO, typename LS, typename UF>
class Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >

This class provides a Newton-Raphson solver for solving nonlinear systems with a subsidiary function. It uses a linear solver to handle the linear system arising in each iteration.

Template Parameters
NLOType of the nonlinear operator.
LSType of the linear solver used internally (default is SolverDefault).
UFType of the update function (default is UpdateDefault).

Member Typedef Documentation

◆ NonLinearOperator

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::NonLinearOperator = NLO

◆ Settings

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::Settings = NewtonRaphsonWithSubsidiaryFunctionSettings

◆ UpdateFunctionType

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::UpdateFunctionType = UF

◆ ValueType

template<typename NLO , typename LS , typename UF >
using Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::ValueType = typename NLO::template ParameterValue<0>

Constructor & Destructor Documentation

◆ NewtonRaphsonWithSubsidiaryFunction()

template<typename NLO , typename LS , typename UF >
template<typename LS2 = LS, typename UF2 = UF>
Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::NewtonRaphsonWithSubsidiaryFunction ( const NLO &  nonLinearOperator,
LS2 &&  linearSolver = {},
UF2 &&  updateFunction = {} 
)
inlineexplicit
Parameters
nonLinearOperatorNonlinear operator to solve.
linearSolverLinear solver used internally (default is SolverDefault).
updateFunctionUpdate function (default is UpdateDefault).

Member Function Documentation

◆ nonLinearOperator()

template<typename NLO , typename LS , typename UF >
auto & Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::nonLinearOperator ( )
inline
Returns
Reference to the nonlinear operator.

◆ notify() [1/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message)
inherited

◆ notify() [2/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
const std::string &  val 
)
inherited

◆ notify() [3/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited

◆ notify() [4/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val 
)
inherited

◆ notify() [5/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
const std::string &  val2 
)
inherited

◆ notify() [6/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
int  val1,
double  val2 
)
inherited

◆ notify() [7/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( MT  message,
ScalarType  val 
)
inherited

◆ notify() [8/14]

Parameters
messageThe message type to notify about.

◆ notify() [9/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
const std::string &  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe string value to be sent with the notification.

◆ notify() [10/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
Eigen::VectorX< ScalarType >  vec 
)
inherited
Template Parameters
ScalarTypeThe type of the elements in the Eigen::VectorX.
Parameters
messageThe message type to notify about.
vecThe Eigen::VectorX to be sent with the notification.

◆ notify() [11/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val 
)
inherited
Parameters
messageThe message type to notify about.
valThe integer value to be sent with the notification.

◆ notify() [12/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
const std::string &  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The string value to be sent with the notification.

◆ notify() [13/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
int  val1,
double  val2 
)
inherited
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The double value to be sent with the notification.

◆ notify() [14/14]

void Ikarus::IObservable< NonLinearSolverMessages >::notify ( NonLinearSolverMessages  message,
ScalarType  val 
)
inherited
Template Parameters
ScalarTypeThe type of the floating-point value.
Parameters
messageThe message type to notify about.
valThe floating-point value to be sent with the notification.

◆ setup()

template<typename NLO , typename LS , typename UF >
void Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::setup ( const Settings settings)
inline
Parameters
p_settingsSettings for the solver.

◆ solve()

template<typename NLO , typename LS , typename UF >
template<typename SolutionType = NoPredictor, typename SubsidiaryType >
requires std::is_same_v<SolutionType, NoPredictor> || std::is_convertible_v<SolutionType, std::remove_cvref_t<typename NLO::ValueType>>
NonLinearSolverInformation Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::solve ( SubsidiaryType &&  subsidiaryFunction,
SubsidiaryArgs subsidiaryArgs,
const SolutionType &  dxPredictor = NoPredictor{} 
)
inline
Template Parameters
SolutionTypeType of the solution predictor (default is NoPredictor).
SubsidiaryTypeType of the subsidiary function.
Parameters
subsidiaryFunctionSubsidiary function to be solved.
subsidiaryArgsAdditional arguments for the subsidiary function.
dxPredictorPredictor for the solution increment (default is NoPredictor).
Returns
Information about the solution process.

Initializations

Determine Fext0 It is assumed that Fext = Fext0 * lambda such that dRdlambda = Fext0 Generalization for Fext0 = Fext0(lambda) is not implemented

Iterative solving scheme

Two-step solving procedure

◆ subscribe()

void Ikarus::IObservable< MT >::subscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to subscribe to.
observerThe observer to be subscribed.

◆ subscribeAll() [1/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::initializer_list< std::shared_ptr< IObserver< NonLinearSolverMessages > > >  observers)
inherited
Parameters
observersList of observers to be subscribed.

◆ subscribeAll() [2/2]

void Ikarus::IObservable< NonLinearSolverMessages >::subscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be subscribed.

◆ unSubscribe()

void Ikarus::IObservable< MT >::unSubscribe ( NonLinearSolverMessages  message,
std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer 
)
inherited
Parameters
messageThe message type to unsubscribe from.
observerThe observer to be unsubscribed.

◆ unSubscribeAll()

void Ikarus::IObservable< MT >::unSubscribeAll ( std::shared_ptr< IObserver< NonLinearSolverMessages > >  observer)
inherited
Parameters
observerThe observer to be unsubscribed.

Member Data Documentation

◆ isLinearSolver

template<typename NLO , typename LS , typename UF >
constexpr bool Ikarus::NewtonRaphsonWithSubsidiaryFunction< NLO, LS, UF >::isLinearSolver
staticconstexpr
Initial value:
=
Concept to check if a linear solver implements all the needed functions for given vector and matrix t...
Definition: concepts.hh:215

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