proteus.mprans.BodyDynamics module

class proteus.mprans.BodyDynamics.RigidBody(shape, cfl_target=0.9, dt_init=0.001, substeps=20)[source]

Bases: AV_base, object

Auxiliary variable used to calculate attributes of an associated shape class instance acting as a rigid body. To set a shape as a rigid body, use shape.setRigidBody(). The class instance is created automatically when shape.setRigidBody() has been called and after calling assembleDomain().

Parameters:
  • shape (proteus.mprans.SpatialTools.Shape_RANS) – Class instance of the shape associated to the rigid body calculations.

  • cfl_target (Optional[float]) – UNUSED (to implement), sets the maximum displacement of the body allowed per time step.

  • dt_init (float) – first time step of the simulation.

attachModel(model, ar)[source]

Attaches model to auxiliary variable

calculate_init()[source]

Function called automatically at the very beginning of the simulation by proteus.

calculate()[source]

Function called automatically at each time step by proteus.

getPressureForces()[source]

Gives the pressure forces applied on each segments/facets of the rigid body :returns: F_p – pressure forces (x, y, z) as provided by Proteus :rtype: array_like

getShearForces()[source]

Gives the shear forces applied on each segments/facets of the rigid body :returns: F_v – shear forces (x, y, z) as provided by Proteus :rtype: array_like

getGravityForce()[source]
Returns:

Fg – gravity force

Return type:

array_like

getMoments()[source]

Gives the moments applied on each segments/facets of the rigid body :returns: M – moments (x, y, z) as provided by Proteus :rtype: array_like

getTotalMoments()[source]

Gives the total moments applied the rigid body :returns: M_t – total moments (x, y, z) as provided by Proteus :rtype: array_like

getTotalForces()[source]

Gives the total forces applied the rigid body: shear, pressure and gravity forces :returns: F_t – total forces (x, y, z) as provided by Proteus :rtype: array_like

getAcceleration()[source]
Returns:

a – acceleration of current time step

Return type:

array_like

getAngularAcceleration()[source]
getDisplacement(dt)[source]
getAngularDisplacement(dt)[source]
setSprings(springs, Kx, Ky, Krot, Cx, Cy, Crot, Kz=0.0, Cz=0.0)[source]

Sets a system of uniform springs to model soil’s reactions (for moving bodies)

Parameters:
  • spring (string) – If True, spring module is switched on.

  • Kx (float) – horizontal stiffness

  • Ky (float) – vertical stiffness

  • Krot (float) – rotational stiffness

  • Cx (float) – horizontal damping parameter

  • Cy (float) – vertical damping parameter

  • Crot (float) – rotational damping parameter

setPivot(pivot=None)[source]

Sets pivot centre of rotation for the angular calculation

Parameters:

pivot (array)

setNumericalScheme(scheme)[source]

Sets the numerical scheme used to solve motion.

Parameters:

scheme (string) – If Runge_Kutta, runge kutta scheme is applied. If Forward_Euler, forward euler scheme is applied.

inputMotion(InputMotion=False, pivot=None, At=[0.0, 0.0, 0], Tt=[0.0, 0.0, 0], Ar=[0.0, 0.0, 0], Tr=[0.0, 0.0, 0])[source]

Sets motion as an input. It’s imposed rather than calculated.

Parameters:
  • InputMotion (bool) – If True, motion as input is applied.

  • pivot (list) – Centre of rotation. If only translation, write barycenter’s coordinates

  • At (list) – Amplitude of translational motion

  • Tt (list) – Period of translational motion

  • Ar (list) – Amplitude of rotational motion

  • Tr (list) – Period of rotational motion

imposeSinusoidalMotion()[source]

Motion is imposed rather than calculated.

step(dt)[source]

Step for rigid body calculations in Python

Parameters:

dt (float) – time step

setConstraints(free_x, free_r)[source]

Sets constraints on the Shape (for moving bodies)

Parameters:
  • free_x (array_like) – Translational constraints.

  • free_r (array_like) – Rotational constraints.

setMass(mass)[source]

Set mass of the shape.

Parameters:

mass (float) – mass of the body

setInertiaTensor(It)[source]

Set the inertia tensor of the shape

Parameters:

It (array_like, float) – Inertia tensor of the body (3x3 array in 3D, float in 2D)

Notes

The inertia tensor should not be already scaled with the mass of the shape.

getInertia(vec=(0.0, 0.0, 1.0), pivot=None)[source]

Gives the inertia of the shape from an axis and a pivot

Parameters:
  • vec (array_like) – Vector around which the body rotates.

  • pivot (Optional[array_like]) – Pivotal point around which the body rotates. If not set, it will be the barycenter coordinates

Returns:

I – inertia of the mass

Return type:

float

Notes

The inertia is calculated relative to the coordinate system of the shape (self.coords_system). If the shape was not initialised with a position corresponding to its inertia tensor (e.g. shape was already rotated when initialised), set the coordinate system accordingly before calling this function

setRecordValues(filename=None, all_values=False, pos=False, rot=False, ang_disp=False, F=False, M=False, inertia=False, vel=False, acc=False, ang_vel=False, ang_acc=False)[source]

Sets the rigid body attributes that are to be recorded in a csv file during the simulation.

Parameters:
  • filename (Optional[string]) – Name of file, if not set, the file will be named as follows: ‘record_[shape.name].csv’

  • all_values (bool) – Set to True to record all values listed below.

  • time (bool) – Time of recorded row (default: True).

  • pos (bool) – Position of body (default: False. Set to True to record).

  • rot (bool) – Rotation of body (default: False. Set to True to record).

  • ang_disp (array) – Angular displecement calculated during rigid body calculation step. Applied on the body in order to make it rotating.

  • F (bool) – Forces applied on body (default: False. Set to True to record).

  • M (bool) – Moments applied on body (default: False. Set to True to record).

  • inertia (bool) – Inertia of body (default: False. Set to True to record).

  • vel (bool) – Velocity of body (default: False. Set to True to record).

  • acc (bool) – Acceleration of body (default: False. Set to True to record).

  • ang_vel (array) – Angular velocity of body (default: False. Set to True to record).

  • ang_acc (bool) – Angular acceleration of body (default: False. Set to True to record).

Notes

To add another value manually, add to dictionary self.record_dict:

key: header of the column in .csv
value: list of length 2: [variable name, index within variable]
       (if no index, use None)
e.g. self.record_dict['m']['mass', None]
class proteus.mprans.BodyDynamics.CaissonBody(shape, substeps)[source]

Bases: RigidBody

Sub-class to create a caisson rigid body.

calculate_init()[source]

Function called at the very beginning of the simulation by proteus.

step(dt, substeps=20)[source]

Step for rigid body calculations in Python

Parameters:

dt (float) – time step

getInertia(vec=(0.0, 0.0, 1.0), pivot=None)[source]

Gives the inertia of the shape from an axis and a pivot

Parameters:
  • vec (array_like) – Vector around which the body rotates.

  • pivot (Optional[array_like]) – Pivotal point around which the body rotates. If not set, it will be the barycenter coordinates

Returns:

I – inertia of the mass

Return type:

float

Notes

The inertia is calculated relative to the coordinate system of the shape (self.coords_system). If the shape was not initialised with a position corresponding to its inertia tensor (e.g. shape was already rotated when initialised), set the coordinate system accordingly before calling this function

setFriction(friction, m_static, m_dynamic, tolerance, grainSize)[source]

Sets material properties for sliding and overturning modules

Parameters:
  • friction (string) – If True, friction module is switched on.

  • m_static (float) – Static friction parameter (see Coulomb equation).

  • m_dynamic (float) – Dynamic friction parameter.

  • tolerance (float) – It’s used to check if the body is in rotated state or not. It imposes a tolerance limit for the difference between the vertical coordinates of the 2 bottom vertices of the rigid body.

  • grainSize (float) – Typical grain size of the rubble mound (if exists!) under the caisson. It offers an extra check of the body position. If the rigid body lower point position is higher than this value, it is a floating body.

setOverturning(overturning)[source]

Sets material properties for sliding and overturning modules

Parameters:

overturning (string) – If True, overturning module is switched on.

setSprings(springs, Kx, Ky, Krot, Cx, Cy, Crot, Kz=0.0, Cz=0.0)[source]

Sets a system of uniform springs to model soil’s reactions (for moving bodies)

Parameters:
  • spring (string) – If True, spring module is switched on.

  • Kx (float) – horizontal stiffness

  • Ky (float) – vertical stiffness

  • Krot (float) – rotational stiffness

  • Cx (float) – horizontal damping parameter

  • Cy (float) – vertical damping parameter

  • Crot (float) – rotational damping parameter

setNumericalScheme(scheme)[source]

Sets the numerical scheme used to solve motion.

Parameters:

scheme (string) – If Runge_Kutta, runge kutta scheme is applied. If Central_Difference, central difference scheme is applied.

friction_module(dt)[source]

Calculate sliding motion modelling frictional force.

Parameters:

dt (Time step.)

overturning_module(dt)[source]

Calculate overturning motion modelling soil foundation reactions.

Parameters:

dt (Time step.)

setRecordValues(filename=None, all_values=False, pos=False, rot=False, ang_disp=False, F=False, M=False, inertia=False, vel=False, acc=False, ang_vel=False, ang_acc=False, elasticPlastic=False)[source]

Sets the rigid body attributes that are to be recorded in a csv file during the simulation.

Parameters:
  • filename (Optional[string]) – Name of file, if not set, the file will be named as follows: ‘record_[shape.name].csv’

  • all_values (bool) – Set to True to record all values listed below.

  • time (bool) – Time of recorded row (default: True).

  • pos (bool) – Position of body (default: False. Set to True to record).

  • rot (bool) – Rotation of body (default: False. Set to True to record).

  • ang_disp (array) – Angular displecement calculated during rigid body calculation step. Applied on the body in order to make it rotating.

  • F (bool) – Forces applied on body (default: False. Set to True to record).

  • M (bool) – Moments applied on body (default: False. Set to True to record).

  • inertia (bool) – Inertia of body (default: False. Set to True to record).

  • vel (bool) – Velocity of body (default: False. Set to True to record).

  • acc (bool) – Acceleration of body (default: False. Set to True to record).

  • ang_vel (array) – Angular velocity of body (default: False. Set to True to record).

  • ang_acc (bool) – Angular acceleration of body (default: False. Set to True to record).

Notes

To add another value manually, add to dictionary self.record_dict:

key: header of the column in .csv
value: list of length 2: [variable name, index within variable]
       (if no index, use None)
e.g. self.record_dict['m']['mass', None]
class proteus.mprans.BodyDynamics.PaddleBody(shape, substeps)[source]

Bases: RigidBody

Sub-class to create a PADDLE rigid body.

calculate_init()[source]

Function called at the very beginning of the simulation by proteus.

step(dt, substeps=20)[source]

Step for rigid body calculations in Python

Parameters:

dt (float) – time step

inputMotion(InputMotion=False, pivot=None, At=[0.0, 0.0, 0], Tt=[0.0, 0.0, 0], Ar=[0.0, 0.0, 0], Tr=[0.0, 0.0, 0], rampStart=0, rampEnd=0, Tend=1000000.0)[source]

Sets motion as an input. It’s imposed rather than calculated.

Parameters:
  • InputMotion (bool) – If True, motion as input is applied.

  • pivot (list) – Centre of rotation. If only translation, write barycenter’s coordinates

  • At (list) – Amplitude of translational motion

  • Tt (list) – Period of translational motion

  • Ar (list) – Amplitude of rotational motion

  • Tr (list) – Period of rotational motion

  • rampStart (float) – Time for ramping waves at the beginning

  • rampStart – Time for ramping waves at end

  • Tend (float) – End time of paddle operation (needed for rampEnd)

imposeSinusoidalMotion(tt=None)[source]

Motion is imposed rather than calculated.

Parameters:

tt (None or float) – tt should be None for other than testing purposes. If not None, time is externally set.

proteus.mprans.BodyDynamics.forward_euler(p0, v0, a, dt)[source]
proteus.mprans.BodyDynamics.getEulerAngles(coord_system)[source]
proteus.mprans.BodyDynamics.runge_kutta(u0, v0, a0, dt, substeps, F, K, C, m, velCheck)[source]

Function that applies Runge Kutta’s scheme for motion calculation.

Parameters:
  • u0 (translational or rotational displacement.)

  • v0 (translational or rotational velocity.)

  • a0 (translational or rotational acceleration.)

  • dt (Time step.)

  • substeps (integer number of substeps.)

  • F (translational or rotational loading.)

  • K (translational or rotational stiffness.)

  • C (translational or rotational damping factor.)

  • m (mass (translational calculation) or inertia (rotational calculation).)

  • velCheck (check on translational velocity sign (friction module only!).)