Coupling between Chrono and Proteus is done in this file.
Objects (classes) starting with ‘ProtCh’ (e.g. ProtChBody) are objects that have logic specifically developed for communication between Proteus and Chrono.
Objects starting with ‘Ch’ (e.g. ChBody) are objects that only have Chrono logic associated to them.
Some ProtCh objects give access to the Chrono object: my_protchsystem = ProtChSystem() my_protchbody = ProtChBody(system=my_protchsystem) my_chbody = my_protchbody.ChBody my_chbody.SetPos(…) my_chbody.SetRot(…)
# pass the index of the boundaries (or particle index) where forces must be integrated my_protchbody.setIndexBoundary([0, 1, 2, 3]) # alternatively, if you use a Shape instance from proteus.SpatialTools # the boundaries indice will be set automatically after calling SpatialTools.assembleDomain() my_protchbody.setShape(my_shape)
proteus.mbd.CouplingFSI.
ProtChSystem
[source]¶Bases: object
addSubcomponent
[source]¶Adds subcomponent to system calculate_init() of subcomponent called before initial timestep prestep() and poststep of subcomponent() called at all timestep
subcomponent (class instance) – class instance of subcomponent
calculate
[source]¶Does chrono system calculation for a Proteus time step Calls prestep and poststep on all subcomponents (bodies, moorings, etc) attached to the system.
proteus_dt (Optional[proteus_dt]) – Manually sets a time step. The time step is set automatically when coupled with a Proteus simulation
calculate_init
[source]¶Does chrono system initialisation (!) Must be called before the first calculate() call. Calls calculate_init and poststep on all subcomponents (bodies, moorings, etc) attached to the system.
findElementContainingCoordsDist
[source]¶Distance search of nearest node, element containing coords, and owning rank.
xi – local coordinates
node (int) – nearest node
eN (int) – (local) element number
rank (int) – processor rank containing element
findElementContainingCoordsKD
[source]¶k-d tree search of nearest node, element containing coords, and owning rank.
coords (array_like) – global coordinates to look for
xi – local coordinates
node (int) – nearest node
eN (int) – (local) element number
rank (int) – processor rank containing element
getFluidVelocityLocalCoords
[source]¶param xi: local coords in element :param element: element number (local to processor ‘rank’) :type element: int :param rank: rank of processor owning the element :type rank: int
setMinimumSubsteps
[source]¶Sets the minimum nb of chrono substeps per proteus step if prot_dt=0.001 and ch_dt=0.002, there will be <nb> substeps of chrono instead of just 1.
nb (int) – Minimum number of chrono substeps.
setTimeStep
[source]¶Sets time step for Chrono solver. Calculations in Chrono will use this time step within the Proteus time step (if bigger) :param dt: Chrono time step size :type dt: float
proteus.mbd.CouplingFSI.
ProtChBody
[source]¶Bases: object
addPrismaticLinksWithSpring
[source]¶barycenter coords pris: absolute coords pris1——-fairlead(barycenter) | | | | pris2
fairlead
addTriangleMeshFromVerticesFaces
[source]¶Adds triangle mesh to collision model and for IBM calculations
attachShape
[source]¶Attach proteus.SpatialTools shape to body. Used for automatic calculation of external forces from Proteus. Called automatically when creating a body and passing a shape instance.
shape (SpatialTools.Shape) – instance of shape from proteus.SpatialTools or proteus.mprans.SpatialTools
getMoments
[source]¶Gives moments from fluid (Proteus) acting on body (!) Only works during proteus simulation
M – moments (x, y, z) as provided by Proteus
array_like
getPressureForces
[source]¶Gives pressure forces from fluid (Proteus) acting on body. (!) Only works during proteus simulation
F_p – pressure forces (x, y, z) as provided by Proteus
array_like
getRotationMatrix
[source]¶Gives current rotation (matrix) of body
rot – current rotation (matrix) of body
array_like
getShearForces
[source]¶Gives shear forces from fluid (Proteus) acting on body (!) Only works during proteus simulation
F_v – shear forces (x, y, z) as provided by Proteus
array_like
hx
[source]¶BC function for mesh nodes displacement (x component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hx_rotation
[source]¶BC function for mesh nodes displacement (x component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hx_translation
[source]¶BC function for mesh nodes displacement (x component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hy
[source]¶BC function for mesh nodes displacement (y component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hy_rotation
[source]¶BC function for mesh nodes displacement (y component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hy_translation
[source]¶BC function for mesh nodes displacement (y component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hz
[source]¶BC function for mesh nodes displacement (z component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hz_rotation
[source]¶BC function for mesh nodes displacement (z component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
hz_translation
[source]¶BC function for mesh nodes displacement (z component)
x (array_like) – coordinates of the node before displacement
t (double) – simulation time
poststep
[source]¶Called after Chrono system step. Records values to csv, broadcast new position and rotation from calculating processor to all processors for moving mesh BC.
prestep
[source]¶Called before Chrono system step. Sets external forces automatically from Proteus solution.
setAddedMass
[source]¶Sets the added mass matrix of the body
added_mass (array_like) – Added mass matrix (must be 6x6 array!)
setBoundaryFlags
[source]¶Sets the flags of the boundaries of the body numbers must be gloabal (from domain.segmentFlags or domain.facetFlags).
flags (array_like) – list of flags that belong to this body
setConstraints
[source]¶Sets constraints on the body (!) Only acts on Proteus and gravity forces
free_x (array_like) – Translational constraints.
free_r (array_like) – Rotational constraints.
setExternalForces
[source]¶Sets external forces to body. Called during prestep or can be called manually. If called manually, must be a Chrono only simulation.
forces (array_like) – forces array (length 3)
moments (array_like) – moments array (length 3)
setIBM
[source]¶Sets IBM mode for retrieving fluid forces
useIBM (bool) – set if IBM should be used
radiusIBM (double) – radius of the particle for IBM
setPrescribedMotion
[source]¶Sets custom prescribed motion function (!) should be preferably set only if body is free and not linked to other bodies or other elements (such as moorings) as this is used only for setting moving mesh BC by enforcing position of the body at each time step. Use setPrescribedMotionPoly or setPrescribedMotionSine for functions that are safe to use with a body linked with other elements.
function – must be a function of time returning an array of the absolute position of the body (numpy array of length 3: x, y, z)
setPrescribedMotionCustom
[source]¶Sets custom prescribed motion for body. Parameters must have the same length as the time array t
t (array_like) – time array
x (array_like) – x coordinates of body
y (array_like) – y coordinates of body
z (array_like) – z coordinates of body
ang (array_like) – rotation of body
ang2 (array_like) – rotation of body
ang3 (array_like) – rotation coordinates of body
t_max (double) – prescribed motion is released when t > t_max. if t_max=0, the prescribed motion is never released.
setPrescribedMotionPoly
[source]¶Sets polynomial prescribed motion for body
coeff1 (double) – coeff1 of polynomial
setPrescribedMotionSine
[source]¶Sets sinusoidal prescribed motion for body
a (double) – amplitude of sinusoid
f (double) – frequency of sinusoid
setRecordValues
[source]¶Sets the body attributes that are to be recorded in a csv file during the simulation.
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]
proteus.mbd.CouplingFSI.
ProtChMesh
[source]¶Bases: object
proteus.mbd.CouplingFSI.
ProtChMoorings
[source]¶Bases: object
Class for building mooring cables
system (System) – Class instance of the system.
mesh (Mesh) – Class instance of the mesh.
length (np.ndarray) – Length of cable segments. Must be an array, if the cable only has one type of segment (e.g. only one type of chain), an array of length 1 can be passed.
nb_elems (np.ndarray) – Number of elements per segments.
d (np.ndarray) – Diameter of segments.
rho (np.ndarray) – Density of segments.
E (np.ndarray) – Young’s modulus of segments.
beam_type (str) – Type of elements (default: “CableANCF”).
attachBackNodeToBody
[source]¶Attaches back node to a body with ChLinkLockLock
body (ProtChBody) – body to which the node will be attached
attachFrontNodeToBody
[source]¶Attaches front node to a body with ChLinkLockLock
body (ProtChBody) – body to which the node will be attached
getNodesAcceleration
[source]¶Gives array of nodes acceleration
pos – Array of nodes acceleration.
np.ndarray
getNodesD
[source]¶Gives direction of nodes
dire – Array of nodes direction.
np.ndarray
getNodesPosition
[source]¶Gives array of nodes position
pos – Array of nodes position.
np.ndarray
getNodesVelocity
[source]¶Gives array of nodes velocity
pos – Array of nodes velocity.
np.ndarray
setAddedMassCoefficients
[source]¶Sets added mass coefficients of cable
tangential (double) – Tangential added mass coefficient.
normal (double) – Normal added mass coefficient.
segment_nb (int) – Segment number to which these coefficients apply.
setContactMaterial
[source]¶Sets contact material of the cable
mat (ChMaterialSurfaceSMC) – Material of cable.
setDragCoefficients
[source]¶Sets drag coefficients of cable
tangential (double) – Tangential drag coefficient.
normal (double) – Normal drag coefficient.
segment_nb (int) – Segment number to which these coefficients apply.
setExternalForces
[source]¶Sets external forces acting on cables Pass fluid velocity_array as argument only for debugging (must be an array as long as the number of nodes)
setFluidVelocityFunction
[source]¶Function to build nodes
function – Must be a function taking two arguments (3D coordinates and time), and returning velocity (x, y, z).
setNodesPosition
[source]¶Builds the nodes of the cable.
(!) Must be called after setNodesPositionFunction()
setNodesPositionFunction
[source]¶Function to build nodes
function_position (Optional) – Must be a function taking one argument (e.g. distance along cable) and returning 3 arguments (x, y, z) coords.
function_position – Must be a function taking one argument (e.g. distance along cable) and returning 3 arguments (x, y, z) tangents at coords.