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

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

virtual ~OneStepNSProblem()

destructor

virtual int compute(double time) = 0

To run the solver for ns problem.

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

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

compute diagonal Interaction block

Parameters
  • vd: a vertex descriptor

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

compute extra-diagonal interactionBlock-matrix

Parameters
  • ed: an edge descriptor

virtual void displayBlocks(SP::InteractionsGraph indexSet)

Display the set of blocks for a given indexSet.

Parameters
  • 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)

Return
the required matrix.
Parameters
  • 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()

Return
bool _hasBeenUpdated

bool hasInteractions() const

Check if the OSNSPb has interactions.

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

unsigned int indexSetLevel() const

get indexSetLevel

Return
an unsigned int

virtual void initialize(SP::Simulation sim)

initialize the problem(compute topology …)

Parameters
  • sim: the simulation, owner of this OSNSPB

unsigned int inputOutputLevel() const

get the Input/Output level

Return
an unsigned int

unsigned int maxSize() const

get maximum value allowed for the dimension of the problem

Return
an unsigned int

SP::SolverOptions numericsSolverOptions() const

To get the SolverOptions structure.

Return
, 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

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

void setHasBeenUpdated(bool v)

Parameters
  • v: to set _hasBeenUpdated.

void setIndexSetLevel(unsigned int newVal)

set the value of level min

Parameters
  • newVal: an unsigned int

void setInputOutputLevel(unsigned int newVal)

set the value of Input/Output level

Parameters
  • newVal: an unsigned int

void setMaxSize(const unsigned int newVal)

set the value of maxSize

Parameters
  • 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

Parameters

virtual void setSolverId(int solverId)

change the solver type.

This requires a reset of the Solveroption struct

Parameters
  • solverId: the new solver

SP::Simulation simulation() const

get the simulation which owns this nonsmooth problem

Return
a pointer on Simulation

virtual void updateInteractionBlocks()

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