File kernel/src/simulationTools/Hem5OSI.hpp

Contents

File kernel/src/simulationTools/Hem5OSI.hpp#

Go to the source code of this file

Hem5OSI solver (from E.

Hairer software lists)

Defines

HEM5_ATOL_DEFAULT#
HEM5_RTOL_DEFAULT#

Functions

TYPEDEF_SPTR(Hem5OSI_impl)#
class Hem5OSI : public OneStepIntegrator
#include <Hem5OSI.hpp>

Hem5OSI solver (odepack)

Many parameters are required as input/output for LSODAR. See the documentation of this function in externals/odepack/opkdmain.f to have a full description of these parameters.

Most of them are read-only parameters (ie can not be set by user).

Except:
  • jt: Jacobian type indicator (1 means a user-supplied full Jacobian, 2 means an internally generated full Jacobian).

    Default = 2.

  • itol, rtol and atol

    ITOL = an indicator for the type of error control.

    RTOL = a relative error tolerance parameter, either a scalar or array of length NEQ.

    ATOL = an absolute error tolerance parameter, either a scalar or an array of length NEQ. Input only.

Public Types

enum Hem5OSI_ds_workVector_id#

Values:

enumerator FREE#
enumerator WORK_LENGTH#
enum Hem5OSI_interaction_workVector_id#

Values:

enumerator OSNSP_RHS#
enumerator WORK_INTERACTION_LENGTH#
enum Hem5OSI_interaction_workBlockVector_id#

Values:

enumerator xfree#
enumerator BLOCK_WORK_LENGTH#

Public Functions

Hem5OSI()

constructor from a minimum set of data

inline ~Hem5OSI()

destructor

inline const std::vector<integer> intData() const

get vector of integer parameters for lsodar

Returns:

a vector<integer>

inline integer intData(unsigned int i) const

get _intData[i]

Parameters:

i – index

Returns:

an integer

inline void setIntData(unsigned int i, int newValue)

set _intData[i]

Parameters:
  • i – index

  • newValue

inline const SA::doublereal getRtol() const

get relative tolerance parameter for Hem5

Returns:

a doublereal*

inline const SA::doublereal getAtol() const

get absolute tolerance parameter for Hem5

Returns:

a doublereal*

inline int getMaxNstep() const

get the maximum number of steps for one call

Returns:

an interger

inline const SA::doublereal getRwork() const

get real work vector parameter for lsodar

Returns:

a doublereal*

inline SA::integer getIwork() const

get iwork

Returns:

a pointer to integer

void setTol(integer itol, SA::doublereal rtol, SA::doublereal atol)

set itol, rtol and atol (tolerance parameters for Hem5)

Parameters:
  • itol – integer (itol value)

  • rtol – doublereal * (rtol)

  • atol – doublereal * (atol)

void setTol(integer itol, doublereal rtol, doublereal atol)

set itol, rtol and atol (scalar tolerance parameters for Hem5)

Parameters:
  • itol – integer (itol value)

  • rtol – double (rtol)

  • atol – double (atol)

void setMaxNstep(integer nstepmax)

set the maximul number of steps for one call of Hem5OSI

Parameters:

nstepmax – an integer

void setMaxStepSize(doublereal maxstepsize)

set the minimum and maximum step sizes

Parameters:

maxstepsize – double (maximul step size)

void updateIntData()

update _intData

void updateData()

update doubleData and iwork memory size, when changes occur in _intData.

void fillqWork(integer *sizex, doublereal *x)

fill qWork with a doublereal

Parameters:
  • sizex – integer*, size of x array

  • x – doublereal* x:array of double

void fillvWork(integer *sizex, doublereal *x)

fill vWork with a doublereal

Parameters:
  • sizex – integer*, size of x array

  • x – doublereal* x:array of double

void computeRhs(double)

compute rhs(t) for all dynamical systems in the set

void computeJacobianRhs(double)

compute jacobian of the rhs at time t for all dynamical systems in the set

unsigned int numberOfConstraints()#
void f(integer *sizeOfX, doublereal *time, doublereal *x, doublereal *xdot)#
void g(integer *nEq, doublereal *time, doublereal *x, integer *ng, doublereal *gOut)#
void jacobianfx(integer*, doublereal*, doublereal*, integer*, integer*, doublereal*, integer*)#
virtual void initialize() override

initialization of the integrator

virtual void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) override

initialization of the work vectors and matrices (properties) related to one dynamical system on the graph and needed by the osi

Parameters:
  • t – time of initialization

  • ds – the dynamical system

virtual void initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties &interProp, DynamicalSystemsGraph &DSG) override

initialization of the work vectors and matrices (properties) related to one interaction on the graph and needed by the osi

Parameters:
  • inter – the interaction

  • interProp – the properties on the graph

  • DSG – the dynamical systems graph

inline virtual unsigned int numberOfIndexSets() const override

get the number of index sets required for the simulation

Returns:

unsigned int

virtual void integrate(double &tinit, double &tend, double &tout, int &idid) override

integrate the system, between tinit and tend (->iout=true), with possible stop at tout (->iout=false)

Parameters:
  • tinit – initial time

  • tend – end time

  • tout – real end time

  • idid – in-out parameter, input: 1 for first call, else 2. Output: 2 if no root was found, else 3.

virtual void updateState(const unsigned int level) override

update the state of the DynamicalSystems attached to this Integrator

Parameters:

level – level of interest for the dynamics

inline virtual void prepareNewtonIteration(double time) override#
virtual void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp) override

integrates the Interaction linked to this integrator, without taking non-smooth effects into account

Parameters:
  • vertex_inter – of the interaction graph

  • osnsp – pointer to OneStepNSProblem

inline virtual SiconosVector &osnsp_rhs(InteractionsGraph::VDescriptor &vertex_inter, InteractionsGraph &indexSet) override

return the workVector corresponding to the right hand side of the OneStepNonsmooth problem

virtual void display() override

print the data to the screen

ACCEPT_STD_VISITORS()#

Public Members

SP::Hem5OSI_impl _impl#

Private Functions

ACCEPT_SERIALIZATION(Hem5OSI)#

Private Members

std::vector<integer> _intData#

vector of integer data for the integrator _intData[0] NQ size of the position vector q _intData[1] NV size of the velocity vector v NQ >= NQ _intData[2] NU size of the external dynamic vector u _intData[3] NL size of the Lagrange multiplier vector lambda _intData[4] ITOL indicates whether RTOL and ATOL are scalar (ITOL=0), or array of dimension NQ + NV + NU (ITOL=1) _intData[5] IOUT selects the dense output formula _intData[6] LWK length of real array rwork _intData[7] LIWK length of integer array iwork See hem5.f

integer _idid#
SA::doublereal rtol#

relative tolerance

SA::doublereal atol#

absolute tolerance

SA::doublereal rwork#

real work array

SA::integer iwork#

integer work array

doublereal _timeStep#
SP::BlockVector _qWork#

temporary vector to save q values

SP::BlockVector _vWork#

temporary vector to save v values

SP::BlockVector _uWork#

temporary vector to save v values

SP::BlockVector _aWork#

temporary vector to save a values

SP::BlockVector _lambdaWork#

temporary vector to save lambda values

SP::BlockVector _forcesWork#

temporary vector to save forces values

SP::SiconosVector _qtmp#
SP::SiconosVector _vtmp#
SP::SiconosVector _utmp#
SP::SiconosVector _atmp#
SP::SiconosVector _lambdatmp#
SP::SiconosVector _forcestmp#

Friends

friend struct _NSLEffectOnFreeOutput
friend class Hem5OSI_impl