Represent the mathematical function to be solved by a Newton-Raphson solver. See documentation of @BaseNonLinearFunction
The function is r(x) = [r1(x), r2(x)] with x = [position, velocity] r_1(x) = \sum_{j=0}^s a_j \text{position}_j - h \sum_{j=0}^s b_j \text{velocity}_j r_2(x) = \sum_{j=0}^s a_j M \text{velocity}_j - h \sum_{j=0}^s b_j \text{force}_j
Public Attributes | |
std::size_t | order = 1 |
sofa::type::vector< SReal > | a_coef |
sofa::type::vector< SReal > | b_coef |
SReal | dt = 0 |
SReal | rayleighStiffness = 0 |
SReal | rayleighMass = 0 |
sofa::simulation::common::MechanicalOperations & | mop |
simulation::common::VectorOperations & | vop |
sofa::type::vector< core::MultiVecCoordId > | position |
sofa::type::vector< core::MultiVecDerivId > | velocity |
sofa::type::vector< core::MultiVecDerivId > | force |
core::MultiVecDerivId | r1 |
core::MultiVecDerivId | r2 |
core::MultiVecDerivId | dx |
core::MultiVecDerivId | dv |
core::MultiVecDerivId | rhs |
core::behavior::LinearSolver * | linearSolver { nullptr } |
Public Member Functions | |
void | evaluateCurrentGuess () override |
SReal | squaredNormLastEvaluation () override |
void | computeGradientFromCurrentGuess () override |
void | updateGuessFromLinearSolution (SReal alpha) override |
void | solveLinearEquation () override |
void | computeDxFromDv () |
SReal | squaredNormDx () override |
SReal | squaredLastEvaluation () override |
ResidualFunction (sofa::simulation::common::MechanicalOperations &mop, simulation::common::VectorOperations &vop) | |
![]() | |
virtual | ~BaseNonLinearFunction ()=default |
virtual void | startNewtonIteration () |
virtual void | endNewtonIteration () |
sofa::type::vector<SReal> sofa::component::odesolver::backward::ResidualFunction::a_coef |
sofa::type::vector<SReal> sofa::component::odesolver::backward::ResidualFunction::b_coef |
SReal sofa::component::odesolver::backward::ResidualFunction::dt = 0 |
core::MultiVecDerivId sofa::component::odesolver::backward::ResidualFunction::dv |
core::MultiVecDerivId sofa::component::odesolver::backward::ResidualFunction::dx |
sofa::type::vector<core::MultiVecDerivId> sofa::component::odesolver::backward::ResidualFunction::force |
core::behavior::LinearSolver* sofa::component::odesolver::backward::ResidualFunction::linearSolver { nullptr } |
sofa::simulation::common::MechanicalOperations& sofa::component::odesolver::backward::ResidualFunction::mop |
std::size_t sofa::component::odesolver::backward::ResidualFunction::order = 1 |
sofa::type::vector<core::MultiVecCoordId> sofa::component::odesolver::backward::ResidualFunction::position |
core::MultiVecDerivId sofa::component::odesolver::backward::ResidualFunction::r1 |
core::MultiVecDerivId sofa::component::odesolver::backward::ResidualFunction::r2 |
SReal sofa::component::odesolver::backward::ResidualFunction::rayleighMass = 0 |
SReal sofa::component::odesolver::backward::ResidualFunction::rayleighStiffness = 0 |
core::MultiVecDerivId sofa::component::odesolver::backward::ResidualFunction::rhs |
sofa::type::vector<core::MultiVecDerivId> sofa::component::odesolver::backward::ResidualFunction::velocity |
simulation::common::VectorOperations& sofa::component::odesolver::backward::ResidualFunction::vop |
|
inline |
|
inline |
|
inlineoverridevirtual |
Compute the gradient internally. It is not necessary to share this gradient with the outside
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Evaluation of the function where the input is the current guess. If the function is called for the first time, then it is called on the initial guess. The evaluation is computed internally. It is not necessary to share this evaluation with the outside.
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Solve the linear equation from a Newton iteration, i.e. it computes (x^{i+1}-x^i). It is solved internally. It is not necessary to share the result with the outside
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Compute ||x^{i+1}||^2
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Compute ||x^{i+1}-x^i||^2
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Returns the squared norm of the last evaluation of the function
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.
|
inlineoverridevirtual |
Once (x^{i+1}-x^i) has been computed, the result is used internally to update the current guess. It computes x^{i+1} += alpha * dx, where dx is the result of the linear system. It is not necessary to share the result with the Newton-Raphson method.
Implements sofa::component::odesolver::backward::newton_raphson::BaseNonLinearFunction.