proteus.mprans.BodyDynamics module

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

Bases: proteus.AuxiliaryVariables.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(). :param shape: Class instance of the shape associated to the rigid body calculations. :type shape: proteus.mprans.SpatialTools.Shape_RANS :param cfl_target: UNUSED (to implement), sets the maximum displacement of the body

allowed per time step.
Parameters: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) :param spring: If True, spring module is switched on. :type spring: string :param Kx: horizontal stiffness :type Kx: float :param Ky: vertical stiffness :type Ky: float :param Krot: rotational stiffness :type Krot: float :param Cx: horizontal damping parameter :type Cx: float :param Cy: vertical damping parameter :type Cy: float :param Crot: rotational damping parameter :type Crot: float

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 :param dt: time step :type dt: float

setConstraints(free_x, free_r)[source]

Sets constraints on the Shape (for moving bodies) :param free_x: Translational constraints. :type free_x: array_like :param free_r: Rotational constraints. :type free_r: array_like

setMass(mass)[source]

Set mass of the shape. :param mass: mass of the body :type mass: float

setInertiaTensor(It)[source]

Set the inertia tensor of the shape :param It: Inertia tensor of the body (3x3 array in 3D, float in 2D) :type It: array_like, float

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 :param vec: Vector around which the body rotates. :type vec: array_like :param pivot: 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. :param filename: Name of file, if not set, the file will be named as follows:

‘record_[shape.name].csv’
Parameters:
  • 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: proteus.mprans.BodyDynamics.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 :param dt: time step :type dt: float

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

Gives the inertia of the shape from an axis and a pivot :param vec: Vector around which the body rotates. :type vec: array_like :param pivot: 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 :param friction: If True, friction module is switched on. :type friction: string :param m_static: Static friction parameter (see Coulomb equation). :type m_static: float :param m_dynamic: Dynamic friction parameter. :type m_dynamic: float :param tolerance: 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.
Parameters: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 :param overturning: If True, overturning module is switched on. :type overturning: string

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) :param spring: If True, spring module is switched on. :type spring: string :param Kx: horizontal stiffness :type Kx: float :param Ky: vertical stiffness :type Ky: float :param Krot: rotational stiffness :type Krot: float :param Cx: horizontal damping parameter :type Cx: float :param Cy: vertical damping parameter :type Cy: float :param Crot: rotational damping parameter :type Crot: float

setNumericalScheme(scheme)[source]

Sets the numerical scheme used to solve motion. :param scheme: 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. :param dt: :type dt: Time step.

overturning_module(dt)[source]

Calculate overturning motion modelling soil foundation reactions. :param dt: :type 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. :param filename: Name of file, if not set, the file will be named as follows:

‘record_[shape.name].csv’
Parameters:
  • 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: proteus.mprans.BodyDynamics.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 :param dt: time step :type dt: float

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.

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. :param u0: :type u0: translational or rotational displacement. :param v0: :type v0: translational or rotational velocity. :param a0: :type a0: translational or rotational acceleration. :param dt: :type dt: Time step. :param substeps: :type substeps: integer number of substeps. :param F: :type F: translational or rotational loading. :param K: :type K: translational or rotational stiffness. :param C: :type C: translational or rotational damping factor. :param m: :type m: mass (translational calculation) or inertia (rotational calculation). :param velCheck: :type velCheck: check on translational velocity sign (friction module only!).