siconos.kernel.FirstOrderNonLinearDS (Python class)

class siconos.kernel.FirstOrderNonLinearDS(*args)[source]

Bases: siconos.kernel.DynamicalSystem

General First Order Non Linear Dynamical Systems - \(M(t) \dot{x} = f(x,t,z) + r, \quad x(t_0) = x_0\).

This class defines and computes a generic n-dimensional dynamical system of the form :

\(M \dot x = f(x,t,z) + r, \quad x(t_0) = x_0\)

where

  • \(x \in R^{n}\) is the state.
  • \(M \in R^{n\times n}\) a “mass matrix”
  • \(r \in R^{n}\) the input due to the Non Smooth Interaction.
  • \(z \in R^{zSize}\) is a vector of arbitrary algebraic variables, some sort of discret state. For example, z may be used to set some perturbation parameters, to control the system (z set by actuators) and so on.
  • \(f : R^{n} \times R \mapsto R^{n}\) the vector field.

By default, the DynamicalSystem is considered to be an Initial Value Problem (IVP) and the initial conditions are given by \(x(t_0)=x_0\) To define a Boundary Value Problem, a pointer on a BoundaryCondition must be set.

The right-hand side and its jacobian (from base classe) are defined as

\[\begin{split}rhs &=& \dot x = M^{-1}(f(x,t,z)+ r) \\ jacobianRhsx &=& \nabla_x rhs(x,t,z) = M^{-1}\nabla_x f(x,t,z)\end{split}\]

The following operators can be plugged, in the usual way (see User Guide)

  • \(f(x,t,z)\)
  • \(\nabla_x f(x,t,z)\)
  • \(M(t)\)

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/FirstOrderNonLinearDS.hpp.

Constructors

FirstOrderNonLinearDS(array_like (np.float64, 1D) newX0)

constructor from initial state, leads to \(\dot x = r\)

Parameters:
  • newX0 – initial state
  • **Warning** (you need to set explicitely the plugin for f and its jacobian if) – needed (e.g. if used with an EventDriven scheme)
FirstOrderNonLinearDS(array_like (np.float64, 1D) newX0, str fPlugin, str jacobianfxPlugin)

constructor from initial state and f (plugins), \(\dot x = f(x, t, z) + r\)

Parameters:
  • newX0 – initial state
  • fPlugin – name of the plugin function to be used for f(x,t,z)
  • jacobianfxPlugin – name of the plugin to be used for the jacobian of f(x,t,z)
FirstOrderNonLinearDS(FirstOrderNonLinearDS FONLDS)

Copy constructor.

Parameters:FONLDS – the FirstOrderNonLinearDS to copy
M() -> array_like (np.float64, 2D)[source]

returns a pointer to M, matrix coeff.

on left-hand side

computeJacobianRhsx(double time) → None[source]

update \(\nabla_x rhs\) for the current state

Parameters:time – of interest
computeJacobianfx(double time, array_like (np.float64, 1D) state) → None[source]

Default function to compute \(\nabla_x f: (x,t) \in R^{n} \times R \mapsto R^{n \times n}\) with x different from current saved state.

Parameters:
  • time – instant used in the computations
  • state – a SiconosVector to store the resuting value
computeM(double time) → None[source]

Default function to compute \(M: (x,t)\).

Parameters:time – time instant used in the computations
computeRhs(double time) → None[source]

update right-hand side for the current state

Parameters:time – of interest
computef(double time, array_like (np.float64, 1D) state) → None[source]

Default function to compute \(f: (x,t)\).

Parameters:
  • time – time instant used in the computations function to compute \(f: (x,t)\)
  • time – time instant used in the computations
  • state – x value
display() → None[source]

print the data of the dynamical system on the standard output

f() -> array_like (np.float64, 1D)[source]

returns f(x,t,z) (pointer link)

fold() -> array_like (np.float64, 1D)[source]

returns previous value of rhs –>OSI Related!!

getInvM() -> array_like (np.float64, 2D)[source]

get a copy of the LU factorisation of M operator

Returns:SimpleMatrix
getPluginF() → PluggedObject[source]

Get _pluginf.

Returns:a SP::PluggedObject
getPluginJacxf() → PluggedObject[source]

Get _pluginJacxf.

Returns:a SP::PluggedObject
getPluginM() → PluggedObject[source]

Get _pluginM.

Returns:a SP::PluggedObject
initMemory(int steps) → None[source]

initialize the SiconosMemory objects: reserve memory for i vectors in memory and reset all to zero.

Parameters:steps – the size of the SiconosMemory (i)
initRhs(double time) → None[source]

allocate (if needed) and compute rhs and its jacobian.

Parameters:time – of initialization
initializeNonSmoothInput(int level) → None[source]

set nonsmooth input to zero

Parameters:level – input-level to be initialized.
invM() -> array_like (np.float64, 2D)[source]

get the inverse of LU fact.

of M operator (pointer link)

Returns:pointer to a SiconosMatrix
jacobianfx() -> array_like (np.float64, 2D)[source]

get jacobian of f(x,t,z) with respect to x (pointer link)

Returns:SP::SiconosMatrix
rMemory() → SiconosMemory[source]

get all the values of the state vector r stored in memory

Returns:a memory vector
resetAllNonSmoothParts() → None[source]

reset non-smooth part of the rhs (i.e.

r), for all ‘levels’

resetNonSmoothPart(int level) → None[source]

set nonsmooth part of the rhs (i.e.

  1. to zero for a given level
Parameters:level
setComputeFFunction(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

setComputeFFunction(str pluginPath, str functionName) → None[source]

to set a specified function to compute f(x,t)

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – the function name to use in this library
  • Exceptions
  • ----------
  • SiconosSharedLibraryException
setComputeFFunction(FPtr1 fct) → None[source]

set a specified function to compute the vector f

Parameters:fct – a pointer on the plugin function
setComputeJacobianfxFunction(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

setComputeJacobianfxFunction(str pluginPath, str functionName) → None[source]

to set a specified function to compute jacobianfx

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – function name to use in this library
  • Exceptions
  • ----------
  • SiconosSharedLibraryException
setComputeJacobianfxFunction(FPtr1 fct) → None[source]

set a specified function to compute jacobianfx

Parameters:fct – a pointer on the plugin function
setComputeMFunction(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

setComputeMFunction(str pluginPath, str functionName) → None[source]

to set a specified function to compute M

Parameters:
  • pluginPath – the complete path to the plugin
  • functionName – function name to use in this library
  • Exceptions
  • ----------
  • SiconosSharedLibraryException
setComputeMFunction(FPtr1 fct) → None[source]

set a specified function to compute M

Parameters:fct – a pointer on the plugin function
setFPtr(array_like (np.float64, 1D) newPtr) → None[source]

set f(x,t,z) (pointer link)

Parameters:newPtr – a SP::SiconosVector
setJacobianfxPtr(array_like (np.float64, 2D) newPtr) → None[source]

set jacobian of f(x,t,z) with respect to x (pointer link)

Parameters:newPtr – the new value
setMPtr(array_like (np.float64, 2D) newM) → None[source]

set M, matrix coeff of left-hand side (pointer link)

Parameters:newM – the new M matrix
swapInMemory() → None[source]

push the current values of x and r in memory (index 0 of memory is the last inserted vector) xMemory and rMemory,

updatePlugins(double time) → None[source]

Call all plugged-function to initialize plugged-object values.

Parameters:time – value