|
MoorDyn
|
A cylindrical rod. More...
#include <Rod.hpp>


Public Types | |
| enum | types { COUPLED = -2 , CPLDPIN = -1 , FREE = 0 , PINNED = 1 , FIXED = 2 , VESSEL = COUPLED , VESPIN = CPLDPIN , POINT = FREE , ANCHOR = FIXED } |
| Types of rods. More... | |
Public Member Functions | |
| Rod (moordyn::Log *log, size_t rodId) | |
| Costructor. More... | |
| ~Rod () | |
| Destructor. | |
| void | setup (int number, types type, RodProps *props, vec6 endCoords, unsigned int n, EnvCondRef env_in, shared_ptr< ofstream > outfile, string channels) |
| Setup a rod. More... | |
| void | addLine (Line *line, EndPoints line_end_point, EndPoints rod_end_point) |
| Attach a line endpoint to the rod end point A. More... | |
| EndPoints | removeLine (EndPoints end_point, Line *line) |
| Dettach a line. More... | |
| void | setWaves (moordyn::WavesRef waves_in, moordyn::SeafloorRef seafloor_in) |
| Set the environmental data. More... | |
| void | openoutput () |
| Opens rod output file. | |
| std::pair< XYZQuat, vec6 > | initialize () |
| Initialize the rod state. More... | |
| void | initialize (InstanceStateVarView r) |
| Initialize a free instance. More... | |
| unsigned int | getN () const |
| Number of segments. More... | |
| vec | getNodePos (unsigned int i) const |
| Get the position of a node. More... | |
| vec | getNodeVel (unsigned int i) const |
| Get the velocity of a node. More... | |
| real | GetRodOutput (OutChanProps outChan) |
| Get rod output. More... | |
| std::pair< real, real > | getDrag () const |
| Get the drag coefficients. More... | |
| void | setDrag (real cdn, real cdt) |
| Set the drag coefficients. More... | |
| void | scaleDrag (real scaler) |
| Scale the drag coefficients. More... | |
| void | setTime (real time) |
| Set the line simulation time. More... | |
| void | getState (XYZQuat &pos, vec6 &vel) const |
| Get the body kinematics. More... | |
| std::pair< XYZQuat, vec6 > | getState () const |
| Get the body kinematics. More... | |
Public Member Functions inherited from moordyn::Instance | |
| Instance (moordyn::Log *log) | |
| Costructor. More... | |
| virtual | ~Instance ()=default |
| Destructor. | |
| const size_t | id () const |
| Get the unique identifier of this instance. More... | |
Public Member Functions inherited from moordyn::io::IO | |
| IO (moordyn::Log *log) | |
| Costructor. More... | |
| virtual | ~IO ()=default |
| Destructor. | |
| void | Save (const std::string filepath) |
| Save the entity into a file. More... | |
| void | Load (const std::string filepath) |
| Loads the entity from a file. More... | |
Public Member Functions inherited from moordyn::LogUser | |
| LogUser (Log *log=NULL) | |
| Constructor. More... | |
| ~LogUser () | |
| Destructor. | |
| void | SetLogger (Log *log) |
| Set the log handler. More... | |
| Log * | GetLogger () const |
| Get the log handler. More... | |
Static Public Member Functions | |
| static string | TypeName (types t) |
| Return a string with the name of a type. More... | |
Public Attributes | |
| size_t | rodId |
| Rod ID. | |
| int | number |
| Rod number. | |
| types | type |
| Rod type. | |
| real | roll |
| The roll angle (useful for output) | |
| real | pitch |
| The pitch angle (useful for output) | |
| void | setState (const InstanceStateVarView r) |
| Set the rod state. More... | |
| void | initiateStep (vec6 r, vec6 rd, vec6 rdd) |
| Called at the beginning of each coupling step to update the boundary conditions (rod kinematics) for the proceeding time steps. More... | |
| vec6 | getUnfreeVel () const |
| Get the last setted velocity for an unfree rod. More... | |
| void | updateFairlead (real time) |
| Sets the kinematics. More... | |
| void | setKinematics (vec6 r, vec6 rd) |
| Take the kinematics from the fairlead information. More... | |
| void | setDependentStates () |
| Set the end kinematics then set the states (positions and velocities) of any line ends attached to this rod. More... | |
| void | getStateDeriv (InstanceStateVarView drdt) |
| calculate the forces and state derivatives of the rod More... | |
| const vec6 | getFnet () const |
| Get the net force on rod (and possibly moment at end A if it's not pinned) More... | |
| const mat6 | getM () const |
| Get the rod mass matrix. More... | |
| void | getNetForceAndMass (vec6 &Fnet_out, mat6 &M_out, vec rBody, vec6 vBody) |
| Calculate the force and mass contributions of the point on the parent body. More... | |
| void | getNetForceAndMass (vec6 &Fnet_out, mat6 &M_out) |
| Calculate the force and mass contributions of the point on the parent body. More... | |
| void | doRHS () |
| This is the big function that calculates the forces on the rod, including from attached lines. More... | |
| void | Output (real) |
| const size_t | stateN () const |
| Get the number of state variables required by this instance. More... | |
| const size_t | stateDims () const |
| Get the dimension of the state variable. More... | |
| std::vector< uint64_t > | Serialize (void) |
| Produce the packed data to be saved. More... | |
| uint64_t * | Deserialize (const uint64_t *data) |
| Unpack the data to restore the Serialized information. More... | |
| void | saveVTK (const char *filename) |
| Save the rod on a VTK (.vtp) file. More... | |
| const leanvtk::VTPWriter * | getVTK () const |
| Get the VTK writer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from moordyn::io::IO | |
| ofstream | MakeFile (const std::string filepath) const |
| Create an output file and write the MoorDyn magic header. More... | |
| std::tuple< uint64_t, uint64_t * > | LoadFile (const std::string filepath) const |
| Open an input file and load the data. More... | |
| uint64_t | Serialize (const uint64_t &i) |
| Pack an unsigned integer to make it writable. More... | |
| uint64_t | Serialize (const int64_t &i) |
| Pack an integer to make it writable. More... | |
| uint64_t | Serialize (const real &f) |
| Pack a float to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const vec &m) |
| Pack a 3D vector to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const vec6 &m) |
| Pack a 6D vector to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const mat &m) |
| Pack a 3x3 matrix to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const mat6 &m) |
| Pack a 6x6 matrix to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const quaternion &m) |
| Pack a quaternion to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const XYZQuat &m) |
| Pack an XYZQuat to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const std::vector< real > &l) |
| Pack a list of floating point numbers to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const std::vector< vec > &l) |
| Pack a list of 3D vectors to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const std::vector< vec6 > &l) |
| Pack a list of 6D vectors to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const std::vector< mat > &l) |
| Pack a list of 3x3 matrices to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const std::vector< mat6 > &l) |
| Pack a list of 6x6 matrices to make it writable. More... | |
| std::vector< uint64_t > | Serialize (const Eigen::Matrix< real, Eigen::Dynamic, Eigen::Dynamic > &l) |
| Pack an arbitrarily large matrix. More... | |
| template<typename T > | |
| std::vector< uint64_t > | Serialize (const std::vector< std::vector< T >> &l) |
| Pack a list of lists to make it writable This function might act recursively. More... | |
| uint64_t * | Deserialize (const uint64_t *in, uint64_t &out) |
| Unpack a loaded unsigned integer. More... | |
| uint64_t * | Deserialize (const uint64_t *in, int64_t &out) |
| Unpack a loaded integer. More... | |
| uint64_t * | Deserialize (const uint64_t *in, real &out) |
| Unpack a loaded floating point number. More... | |
| uint64_t * | Deserialize (const uint64_t *in, vec &out) |
| Unpack a loaded 3D vector. More... | |
| uint64_t * | Deserialize (const uint64_t *in, vec6 &out) |
| Unpack a loaded 6D vector. More... | |
| uint64_t * | Deserialize (const uint64_t *in, mat &out) |
| Unpack a loaded 3x3 matrix. More... | |
| uint64_t * | Deserialize (const uint64_t *in, mat6 &out) |
| Unpack a loaded 6x6 matrix. More... | |
| uint64_t * | Deserialize (const uint64_t *in, quaternion &out) |
| Unpack a loaded quaternion. More... | |
| uint64_t * | Deserialize (const uint64_t *in, XYZQuat &out) |
| Unpack a loaded XYZQuat. More... | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< real > &out) |
| Unpack a loaded list of floating point numbers. More... | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< vec > &out) |
| Unpack a loaded list of 3D vectors. More... | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< vec6 > &out) |
| Unpack a loaded list of 6D vectors. More... | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< mat > &out) |
| Unpack a loaded list of 3x3 matrices. More... | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< mat6 > &out) |
| Unpack a loaded list of 6x6 matrices. More... | |
| uint64_t * | Deserialize (const uint64_t *in, Eigen::Matrix< real, Eigen::Dynamic, Eigen::Dynamic > &out) |
| Unpack an arbitrarily large matrix. More... | |
| template<typename T > | |
| uint64_t * | Deserialize (const uint64_t *in, std::vector< std::vector< T >> &out) |
| Unpack a loaded list of lists. More... | |
Protected Attributes inherited from moordyn::LogUser | |
| Log * | _log |
| The log handler. | |
A cylindrical rod.
Rod are cylindrical structures with much more complete dynamics than moordyn::Body.
Each end point of the rod can be fixed or pinned to another object, let free or control it externally
| enum moordyn::Rod::types |
Types of rods.
| Enumerator | |
|---|---|
| COUPLED | Is attached rigidly to a coupling point (6dof) |
| CPLDPIN | Is pinned to a coupling point (3dof) |
| FREE | Is free to move, controlled by MoorDyn. |
| PINNED | Is pinned to a fixed point (or a body/ptfm, in which case added to list?) |
| FIXED | Is attached rigidly to a fixed point (or a body/ptfm, in which case added to list?) |
| moordyn::Rod::Rod | ( | moordyn::Log * | log, |
| size_t | rodId | ||
| ) |
Costructor.
| log | Logging handler |
| rodId | Unique identifier of this rod |
Attach a line endpoint to the rod end point A.
| line | The line to be attached |
| line_end_point | The line endpoint |
| rod_end_point | The rod endpoint |
| moordyn::invalid_value_error | If the end points are not valid |

|
virtual |
Unpack the data to restore the Serialized information.
This is the inverse of Serialize(void)
| data | The packed data |
Implements moordyn::io::IO.

| void moordyn::Rod::doRHS | ( | ) |
This is the big function that calculates the forces on the rod, including from attached lines.
(-z1lo+Rodzeta(I))/abs(sinPhi) ! distance from node to waterline cross at same axial location [m]


Get the drag coefficients.
| const vec6 moordyn::Rod::getFnet | ( | ) | const |
Get the net force on rod (and possibly moment at end A if it's not pinned)
| moordyn::invalid_value_error | If the rod is not of type moordyn::Rod::COUPLED or moordyn::Rod::CPLDPIN |

|
inline |
Get the rod mass matrix.
| moordyn::invalid_value_error | If the rod is not of type moordyn::Rod::COUPLED or moordyn::Rod::CPLDPIN |
|
inline |
Number of segments.
The number of nodes can be computed as moordyn::Rod::getN() + 1

Calculate the force and mass contributions of the point on the parent body.
| Fnet_out | Output Force about body ref point |
| M_out | Output Mass matrix about body ref point |
Calculate the force and mass contributions of the point on the parent body.
| Fnet_out | Output Force about body ref point |
| M_out | Output Mass matrix about body ref point |
| rBody | The body position |
| vBody | The body velocity |


|
inline |
Get the position of a node.
| i | The line node index |
| invalid_value_error | If the node index i is bigger than the number of nodes, moordyn::Line::N + 1 |
|
inline |
Get the velocity of a node.
| i | The line node index |
| invalid_value_error | If the node index i is bigger than the number of nodes, moordyn::Line::N + 1 |
| real moordyn::Rod::GetRodOutput | ( | OutChanProps | outChan | ) |
Get rod output.
This funtion is useful when outputs are set in the rod properties
| outChan | The output channel/field |

Get the body kinematics.
Get the body kinematics.
| pos | The output position |
| vel | The output velocity |
|
virtual |
calculate the forces and state derivatives of the rod
| drdt | The velocity quaternion and the linear and angular accelerations |
| nan_error | If nan values are detected in any node position |
Implements moordyn::Instance.

|
inline |
Get the last setted velocity for an unfree rod.
For free rods the behaviour is undetermined
|
inline |
Get the VTK writer.
This function is useful for writing multiblock .vtm files
Initialize the rod state.
| r | The output state variable |

|
inlinevirtual |
Initialize a free instance.
| r | The output state variable |
| moordyn::invalid_value_error | If the instance does not have free states. e.g. a coupled body controlled from outside |
Implements moordyn::Instance.
Called at the beginning of each coupling step to update the boundary conditions (rod kinematics) for the proceeding time steps.
| r | The input position |
| rd | The input velocity |
| rdd | The input acceleration |
| moordyn::invalid_value_error | If the rod is not of type moordyn::Rod::COUPLED or moordyn::Rod::CPLDPIN |
r and rd are considered 
Dettach a line.
| end_point | The rod end point where the line is attached |
| line | The line |
| moordyn::invalid_value_error | If there is no an attached line with the provided lineID |

| void moordyn::Rod::saveVTK | ( | const char * | filename | ) |
Save the rod on a VTK (.vtp) file.
| filename | The output file name |
| output_file_error | If the file cannot be saved |

|
inline |
Scale the drag coefficients.
| scaler | The drag coefficients scale factor |
|
virtual |
Produce the packed data to be saved.
The produced data can be used afterwards to restore the saved information afterwards calling Deserialize(void).
Thus, this function is not processing the information that is extracted from the definition file
Implements moordyn::io::IO.

| void moordyn::Rod::setDependentStates | ( | ) |
Set the end kinematics then set the states (positions and velocities) of any line ends attached to this rod.
This also determines the orientation of zero-length rods.

Set the drag coefficients.
| cdn | Normal (transversal) coefficient |
| cdt | tangential (axial) coefficient |
Take the kinematics from the fairlead information.
set kinematics for Rods ONLY if they are attached to a body (including a coupled body) (otherwise shouldn't be called)
| r | Position |
| rd | Velocity |
| moordyn::invalid_value_error | If the rod is not of type moordyn::Rod::FIXED or moordyn::Rod::PINNED |
r and rd are considered 
|
virtual |
Set the rod state.
for a free Rod, there are 12 states: [x, y, z velocity of end A, then rate of change of u/v/w coordinates of unit vector pointing toward end B, then x, y, z coordinate of end A, u/v/w coordinates of unit vector pointing toward end B]
for a pinned Rod, there are 6 states (rotational only): [rate of change of u/v/w coordinates of unit vector pointing toward end B, then u/v/w coordinates of unit vector pointing toward end B]
| r | The rod states |
| invalid_value_error | If the rod is not of type FREE, CPLDPIN or PINNED |
Implements moordyn::Instance.

|
inline |
Set the line simulation time.
| time | Simulation time |
| void moordyn::Rod::setup | ( | int | number, |
| types | type, | ||
| RodProps * | props, | ||
| vec6 | endCoords, | ||
| unsigned int | n, | ||
| EnvCondRef | env_in, | ||
| shared_ptr< ofstream > | outfile, | ||
| string | channels | ||
| ) |
Setup a rod.
| number | Rod ID |
| type | Rod type |
| props | Rod properties |
| endCoords | The coordinates of both end points |
| n | Number of segments |
| env_in | Global struct that holds environmental settings |
| outfile | The outfile where information shall be witten |
| channels | The channels/fields that shall be printed in the file |


|
inline |
|
inlinevirtual |
Get the dimension of the state variable.
Reimplemented from moordyn::Instance.
|
inlinevirtual |
Get the number of state variables required by this instance.
Reimplemented from moordyn::Instance.
|
inlinestatic |
Return a string with the name of a type.
This tool is useful mainly for debugging

| void moordyn::Rod::updateFairlead | ( | real | time | ) |
Sets the kinematics.
This function is meant only for coupled or fixed bodies
| time | Local time within the time step (from 0 to dt) |
| moordyn::invalid_value_error | If the rod is not of type moordyn::Rod::COUPLED or moordyn::Rod::CPLDPIN |
