Rods

Base class for rods

class elastica.rod.rod_base.RodBase[source]

Base class for all rods.

Notes

All new rod classes must be derived from this RodBase class.

Cosserat Rod

On Nodes (+1)

On Elements (n_elements)

On Voronoi (-1)

Geometry

position

director, tangents
length, rest_length
radius
volume
dilatation
rest voronoi length
voronoi dilatation

Kinematics

velocity
acceleration
external forces
damping forces
angular velocity (omega)
angular acceleration (alpha)
mass second moment of inertia
+inverse
dilatation rates
external torques
damping torques

Elasticity

internal forces

shear matrix (modulus)
shear/stretch strain (sigma)
rest shear/stretch strain
internal torques
internal stress
bend matrix (modulus)
bend/twist strain (kappa)
rest bend/twist strain
internal couple

Material

mass

density
dissipation constant (force, torque)

Rod classes and implementation details

class elastica.rod.cosserat_rod.CosseratRod(n_elements, position, velocity, omega, acceleration, angular_acceleration, directors, radius, mass_second_moment_of_inertia, inv_mass_second_moment_of_inertia, shear_matrix, bend_matrix, density, volume, mass, dissipation_constant_for_forces, dissipation_constant_for_torques, internal_forces, internal_torques, external_forces, external_torques, lengths, rest_lengths, tangents, dilatation, dilatation_rate, voronoi_dilatation, rest_voronoi_lengths, sigma, kappa, rest_sigma, rest_kappa, internal_stress, internal_couple, damping_forces, damping_torques)[source]

Cosserat Rod class. This is the preferred class for rods because it is derived from some of the essential base classes.

Attributes
n_elems: int

The number of elements of the rod.

position_collection: numpy.ndarray

2D (dim, n_nodes) array containing data with ‘float’ type. Array containing node position vectors.

velocity_collection: numpy.ndarray

2D (dim, n_nodes) array containing data with ‘float’ type. Array containing node velocity vectors.

acceleration_collection: numpy.ndarray

2D (dim, n_nodes) array containing data with ‘float’ type. Array containing node acceleration vectors.

omega_collection: numpy.ndarray

2D (dim, n_elems) array containing data with ‘float’ type. Array containing element angular velocity vectors.

alpha_collection: numpy.ndarray

2D (dim, n_elems) array containing data with ‘float’ type. Array contining element angular acceleration vectors.

director_collection: numpy.ndarray

3D (dim, dim, n_elems) array containing data with ‘float’ type. Array containing element director matrices.

rest_lengths: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element lengths at rest configuration.

density: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod elements densities.

volume: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element volumes.

mass: numpy.ndarray

1D (n_nodes) array containing data with ‘float’ type. Rod node masses. Note that masses are stored on the nodes, not on elements.

mass_second_moment_of_inertia: numpy.ndarray

3D (dim, dim, n_elems) array containing data with ‘float’ type. Rod element mass second moment of interia.

inv_mass_second_moment_of_inertia: numpy.ndarray

3D (dim, dim, n_elems) array containing data with ‘float’ type. Rod element inverse mass moment of inertia.

dissipation_constant_for_forces: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element dissipation coefficient (nu).

dissipation_constant_for_torques: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element dissipation (nu). Can be customized by passing ‘nu_for_torques’.

rest_voronoi_lengths: numpy.ndarray

1D (n_voronoi) array containing data with ‘float’ type. Rod lengths on the voronoi domain at the rest configuration.

internal_forces: numpy.ndarray

2D (dim, n_nodes) array containing data with ‘float’ type. Rod node internal forces. Note that internal forces are stored on the node, not on elements.

internal_torques: numpy.ndarray

2D (dim, n_elems) array containing data with ‘float’ type. Rod element internal torques.

external_forces: numpy.ndarray

2D (dim, n_nodes) array containing data with ‘float’ type. External forces acting on rod nodes.

external_torques: numpy.ndarray

2D (dim, n_elems) array containing data with ‘float’ type. External torques acting on rod elements.

lengths: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element lengths.

tangents: numpy.ndarray

2D (dim, n_elems) array containing data with ‘float’ type. Rod element tangent vectors.

radius: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element radius.

dilatation: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element dilatation.

voronoi_dilatation: numpy.ndarray

1D (n_voronoi) array containing data with ‘float’ type. Rod dilatation on voronoi domain.

dilatation_rate: numpy.ndarray

1D (n_elems) array containing data with ‘float’ type. Rod element dilatation rates.

compute_bending_energy()[source]

Compute total bending energy of the rod at the instance.

compute_position_center_of_mass()[source]

Compute position center of mass of the rod at the instance.

compute_rotational_energy()[source]

Compute total rotational energy of the rod at the instance.

compute_shear_energy()[source]

Compute total shear energy of the rod at the instance.

compute_translational_energy()[source]

Compute total translational energy of the rod at the instance.

compute_velocity_center_of_mass()[source]

Compute velocity center of mass of the rod at the instance.

classmethod straight_rod(n_elements, start, direction, normal, base_length, base_radius, density, nu, youngs_modulus, *args, **kwargs)[source]

Cosserat rod constructor for straight-rod geometry.

Parameters
n_elementsint

Number of element. Must be greater than 3. Generarally recommended to start with 40-50, and adjust the resolution.

startNDArray[3, float]

Starting coordinate in 3D

directionNDArray[3, float]

Direction of the rod in 3D

normalNDArray[3, float]

Normal vector of the rod in 3D

base_lengthfloat

Total length of the rod

base_radiusfloat

Uniform radius of the rod

densityfloat

Density of the rod

nufloat

Damping coefficient for Rayleigh damping

youngs_modulusfloat

Young’s modulus

*argstuple

Additional arguments should be passed as keyward arguments. (e.g. shear_modulus, poisson_ratio)

**kwargsdict, optional

The “position” and/or “directors” can be overrided by passing “position” and “directors” argument. Remember, the shape of the “position” is (3,n_elements+1) and the shape of the “directors” is (3,3,n_elements).

Returns
CosseratRod

Notes

Since we expect the Cosserat Rod to simulate soft rod, Poisson’s ratio is set to 0.5 by default. It is possible to give additional argument “shear_modulus” or “poisson_ratio” to specify extra modulus.