Class OneStepNSProblem

Defined in Program listing for file kernel/src/simulationTools/OneStepNSProblem.hpp

class OneStepNSProblem

Non Smooth Problem Formalization and Simulation.

This is an abstract class, that provides an interface to define a non smooth problem:

  • a formulation (ie the way the problem is written)
  • a solver (algorithm and solving formulation, that can be different from problem formulation)
  • routines to compute the problem solution.

Two types of problem formulation are available :

  • Quadratic Problem
  • Linear Problem

See derived classes (QP and LinearOSNS) for details.

For Linear problems, the following formulations exists:

  • Linear Complementarity (LCP)
  • Mixed Linear Complementarity (MLCP)
  • Affine Variational Inequalities (AVI)
  • FrictionContact
  • Relay
  • Equality
  • GenericMechanical
  • OSNSMultipleImpact
  • GlobalFrictionContact (unstable)

The usual way to build and initialize a one-step nonsmooth problem is :

  • call constructor with the id of the required Numerics solver. (see Solver class or Numerics documentation for details on algorithm name and parameters).
  • initialize(simulation) Initialize process is usually done through model->initialize(simulation). See Examples for practical details.

Subclassed by QP

Public Functions

OneStepNSProblem(int numericsSolverId)

constructor with a solver from Numerics

  • numericsSolverId: id of numerics solver, see Numerics for the meaning

virtual ~OneStepNSProblem()


virtual int compute(double time) = 0

To run the solver for ns problem.

int information about the solver convergence.
  • time: current time

virtual void computeDiagonalInteractionBlock(const InteractionsGraph::VDescriptor &vd) = 0

compute diagonal Interaction block

  • vd: a vertex descriptor

virtual void computeInteractionBlock(const InteractionsGraph::EDescriptor &ed) = 0

compute extra-diagonal interactionBlock-matrix

  • ed: an edge descriptor

virtual void displayBlocks(SP::InteractionsGraph indexSet)

Display the set of blocks for a given indexSet.

  • indexSet: the concerned index set

SP::SimpleMatrix getOSIMatrix(OneStepIntegrator &osi, SP::DynamicalSystem ds)

get the OSI-related matrices used to compute the current InteractionBlock (Ex: for MoreauJeanOSI, W)

the required matrix.
  • osi: the OSI of the concerned dynamical system
  • ds: the concerned dynamical system

unsigned int getSizeOutput() const

returns the dimension of the nonsmooth problem

bool hasBeenUpdated()

bool _hasBeenUpdated

bool hasInteractions() const

Check if the OSNSPb has interactions.

bool = true if the osnsp has interactions, i.e. indexSet(_indexSetLevel)->size >0

unsigned int indexSetLevel() const

get indexSetLevel

an unsigned int

virtual void initialize(SP::Simulation sim)

initialize the problem(compute topology …)

  • sim: the simulation, owner of this OSNSPB

unsigned int inputOutputLevel() const

get the Input/Output level

an unsigned int

unsigned int maxSize() const

get maximum value allowed for the dimension of the problem

an unsigned int

SP::SolverOptions numericsSolverOptions() const

To get the SolverOptions structure.

, the numerics structure used to save solver parameters

virtual void postCompute() = 0

post treatment for output of the solver

virtual bool preCompute(double time) = 0

prepare data of the osns for solving

true if the computation of the OSNS has to be carry on, false otherwise
  • time: the current time

void setHasBeenUpdated(bool v)

  • v: to set _hasBeenUpdated.

void setIndexSetLevel(unsigned int newVal)

set the value of level min

  • newVal: an unsigned int

void setInputOutputLevel(unsigned int newVal)

set the value of Input/Output level

  • newVal: an unsigned int

void setMaxSize(const unsigned int newVal)

set the value of maxSize

  • newVal: an unsigned int

void setNumericsVerboseMode(bool vMode)

Turn on/off verbose mode in numerics solver.

void setSimulationPtr(SP::Simulation newS)

set the Simulation of the OneStepNSProblem


virtual void setSolverId(int solverId)

change the solver type.

This requires a reset of the Solveroption struct

  • solverId: the new solver

SP::Simulation simulation() const

get the simulation which owns this nonsmooth problem

a pointer on Simulation

virtual void updateInteractionBlocks()

compute interactionBlocks if necessary (this depends on the type of OSNS, on the indexSets …)