Robotran C Documentation
Macros | Functions | Variables
rosenbrock.c File Reference

This file implements the functions of the Rosenbrock integration method in C. Specific functions implementation of the algorithm. More...

#include "nrfct.h"
#include "integrator.h"
#include "useful_functions.h"
#include "mbs_rosenbrock.h"
#include "mbs_message.h"
#include "mbs_errors_names.h"

Macros

#define ROSENBROCK_USEFUL
 
#define Shampine_Parameters
 
#define SAFETY   0.9
 
#define GROW   1.5
 
#define PGROW   -0.25
 
#define SHRNK   0.5
 
#define PSHRNK   (-1.0/3.0)
 
#define ERRCON   0.1296
 
#define GAM   0.5
 
#define A21   2.0
 
#define A31   1.92
 
#define A32   0.24
 
#define C21   -8.0
 
#define C31   14.88
 
#define C32   2.4
 
#define C41   (-0.896)
 
#define C42   (-0.432)
 
#define C43   (-0.4)
 
#define B1   (19.0/9.0)
 
#define B2   0.5
 
#define B3   (25.0/108.0)
 
#define B4   (125.0/108.0)
 
#define E1   (17.0/54.0)
 
#define E2   (7.0/36.0)
 
#define E3   0.0
 
#define E4   (125.0/108.0)
 
#define C1X   0.5
 
#define C2X   (-1.5)
 
#define C3X   2.42
 
#define C4X   0.116
 
#define A2X   1.0
 
#define A3X   0.6
 

Functions

int rosenbrock (int n, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), double *x, double y[], double eps, double hmax, double htry, long nmax, double dydx[], double yscal[], double *hnext, MbsData *s, MbsDirdyn *dd, double *hdid)
 Fourth-order Rosenbrock step for integrating stiff problems, with monitoring of local truncation error to adjust stepsize. More...
 

Variables

static double dmaxarg1
 
static double dmaxarg2
 
static double dminarg1
 
static double dminarg2
 

Detailed Description

This file implements the functions of the Rosenbrock integration method in C. Specific functions implementation of the algorithm.

Creation date: December 2017

Author
Olivier Lantsoght

Modification date: April 2018 \modified by Sebastien Timmermans

@source H. H. Rosenbrock, "Some general implicit processes for the numerical solution of differential equations", The Computer Journal (1963) 5(4): 329-330 Shampine, L.F. 1982, ACM Transactions on Mathematical Software, vol. 8, pp. 93–113

(c) Universite catholique de Louvain

Macro Definition Documentation

◆ A21

#define A21   2.0

◆ A2X

#define A2X   1.0

◆ A31

#define A31   1.92

◆ A32

#define A32   0.24

◆ A3X

#define A3X   0.6

◆ B1

#define B1   (19.0/9.0)

◆ B2

#define B2   0.5

◆ B3

#define B3   (25.0/108.0)

◆ B4

#define B4   (125.0/108.0)

◆ C1X

#define C1X   0.5

◆ C21

#define C21   -8.0

◆ C2X

#define C2X   (-1.5)

◆ C31

#define C31   14.88

◆ C32

#define C32   2.4

◆ C3X

#define C3X   2.42

◆ C41

#define C41   (-0.896)

◆ C42

#define C42   (-0.432)

◆ C43

#define C43   (-0.4)

◆ C4X

#define C4X   0.116

◆ E1

#define E1   (17.0/54.0)

◆ E2

#define E2   (7.0/36.0)

◆ E3

#define E3   0.0

◆ E4

#define E4   (125.0/108.0)

◆ ERRCON

#define ERRCON   0.1296

◆ GAM

#define GAM   0.5

◆ GROW

#define GROW   1.5

◆ PGROW

#define PGROW   -0.25

◆ PSHRNK

#define PSHRNK   (-1.0/3.0)

◆ ROSENBROCK_USEFUL

#define ROSENBROCK_USEFUL

◆ SAFETY

#define SAFETY   0.9

◆ Shampine_Parameters

#define Shampine_Parameters

◆ SHRNK

#define SHRNK   0.5

Function Documentation

◆ rosenbrock()

int rosenbrock ( int  n,
int(*)(double, double[], double[], MbsData *, MbsDirdyn *)  derivs,
double *  x,
double  y[],
double  eps,
double  hmax,
double  htry,
long  nmax,
double  dydx[],
double  yscal[],
double *  hnext,
MbsData s,
MbsDirdyn dd,
double *  hdid 
)

Fourth-order Rosenbrock step for integrating stiff problems, with monitoring of local truncation error to adjust stepsize.

Input are the dependent variable vector y[1..n] and its derivative dydx[1..n] at the starting value of the independent variable x. WARNING: this feature has not been heavily tested !

@source: H. H. Rosenbrock, "Some general implicit processes for the numerical solution of differential equations", The Computer Journal (1963) 5(4): 329-330 Shampine, L.F. 1982, ACM Transactions on Mathematical Software, vol. 8, pp. 93–113

Parameters
nDimension of y
derivsThe function computing f'
xValue of x
yInitial y values, index starting at 0
epsThe required accuracy
hmaxThe maximum stepsize allowed
htryThe stepsize to be attempted
nmaxThe maximal number of allowed steps to reach tolerances
dydxInitial y derivative values, index starting at 0
yscalThe vector [0..n-1] against which the error is scaled, index starting at 0
hnextThe estimated next stepsize
sThe MbsData structure of the model on which dirdyn analysis is computed.
ddThe MbsDirdyn structure related to the integration.
hdidThe stepsize that was actually accomplished
Returns
error_code Return a negative number if something went wrong, 0 otherwise

calls an external function

Variable Documentation

◆ dmaxarg1

double dmaxarg1
static

◆ dmaxarg2

double dmaxarg2
static

◆ dminarg1

double dminarg1
static

◆ dminarg2

double dminarg2
static