ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


This is an old revision of the document!

Evolution function

Functions are quite useful to describe how some parameters evolve, over time for example. They can be used to set displacements or to define hardening laws.


A piecewise linear function is defined one point at a time:

  fct = PieceWiseLinearFunction()
  fct.setData(abs1, ord1)
  fct.setData(abs2, ord2)


abs1, abs2, … list of abscissae
ord1, ord2, … list of ordinates

Remark #1: Evolution functions are objects derived from refCounted. Once associated to a loading, their reference is incremented and memory management is associated to the object which uses them. Therefore, it is no longer required to define them as global.

Fonction linéaire par morceaux

Remark #2: As can be seen above, the first and last segments are extrapolated if a value of the function is required outside its domain.


If function is too complex to be defined with a PieceWiseLinearFunction, it must be defined analytically, with the function PythonOneParameterFunction.

The goal is to give as argument a Python function as OneParameterFunction.

For example, this is used to:

Example: the ramp function:

  fct1 = PieceWiseLinearFunction()

becomes with interpreted Python:

  def f(a):
      return a
  fct1 = PythonOneParameterFunction(f)

or, using python lambda function:

  f = lambda x: x
  fct1 = PythonOneParameterFunction(f)

The value can also be displayed for each estimation, and a more complex function can also be defined using all Python tools. For example, a load function can be first defined with a parabola, then with a straight line, the change between these two being controlled by an conditional structure.

  def f(a):
      print 'value=', val
      return val	
  fct1 = PythonOneParameterFunction(f)
doc/user/general/fonctions.1407340728.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki