Project Chrono: chrono::ChNonlinearSolver Class Reference

Static Public Member Functions | List of all members
chrono::ChNonlinearSolver Class Reference

## Description

Solver for systems of nonlinear equations.

The solver is provided as a static function, so it can be called without the need of creating a class instance. That is, you just need to type: ChNonlinearSolver::NewtonRaphson(etc...)

`#include <ChNlsolver.h>`

## Static Public Member Functions
static void | JacobianCompute (void(*m_func)(ChVectorRef mx, ChVectorRef res, void *my_data), ChVectorRef mx, ChVectorRef res, void *my_data, ChMatrixRef mJ, double diff_step)
| Function which computes the jacobian matrix of a nonlinear vectorial function (i.e.
static double | NewtonRaphson (void(*m_func)(ChVectorRef mx, ChVectorRef res, void *my_data), void(*m_jacob)(ChVectorRef mx, ChMatrixRef mJ, void *my_data), ChVectorRef mx, void *my_data, int maxiters, double tolerance)
| Static function which solves numerically a set of N nonlinear equations in N unknowns.

## Member Function Documentation

## ◆ JacobianCompute()

void chrono::ChNonlinearSolver::JacobianCompute | ( | void(* | m_func )(ChVectorRef mx, ChVectorRef res, void *my_data),
|  | ChVectorRef | mx,
|  | ChVectorRef | res,
|  | void * | my_data,
|  | ChMatrixRef | mJ,
|  | double | diff_step )
| static

Function which computes the jacobian matrix of a nonlinear vectorial function (i.e.

set of N scalar functions) respect to M variables. It is used internally by NewtonRaphson, but it can also be used by the user. If you want to use JacobianCompute, remember that matrices mJ, mx and res must be already allocated with the correct sizes (i.e. mJ(N,M), mx(M), res(N) ) Also, res must be already computed, for current mx, and mx must be the current state in which the jacobian is desired.

## ◆ NewtonRaphson()

double chrono::ChNonlinearSolver::NewtonRaphson | ( | void(* | m_func )(ChVectorRef mx, ChVectorRef res, void *my_data),
|  | void(* | m_jacob )(ChVectorRef mx, ChMatrixRef mJ, void *my_data),
|  | ChVectorRef | mx,
|  | void * | my_data,
|  | int | maxiters,
|  | double | tolerance )
| static

Static function which solves numerically a set of N nonlinear equations in N unknowns.

You must pass the address of the function m_func() which computes the residuals values of the nonlinear equations (being zero when satisfied). Your m_func must return the N residuals in the column matrix 'res', given the values of the variables in column 'mx', each time it is called -no need to create res and mx inside your m_func!!! Also, the generic pointer my_data is passed to my_func just for your convenience, for auxiliary data. You can pass the m_jacob() function address if you have a fast custom routine to compute the jacobian mJ at mx, otherwise set it to NULL and a generic numerical method will be used by default.

Returns
  Return value is norm of residual vector (should be near zero after root finding).

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

- D:/W/B/src/chrono-9.0.1/src/chrono/solver/ChNlsolver.h
- D:/W/B/src/chrono-9.0.1/src/chrono/solver/ChNlsolver.cpp