Description
preCICE adapter for Chrono MBS simulation.
#include <ChPreciceAdapterMbs.h>


Classes | |
| class | AfterStepDynamicsCallback |
| Class to be used as a callback interface for user-defined actions to be performed after advancing MBS dynamics. More... | |
| class | BeforeStepDynamicsCallback |
| Class to be used as a callback interface for user-defined actions to be performed before advancing MBS dynamics. More... | |
Public Member Functions | |
| ChPreciceAdapterMbs (const std::string &precice_config_filename, std::shared_ptr< ChSystem > sys, double time_step, bool verbose=false) | |
| Construct a Chrono MBS preCICE participant for the specified Chrono system. More... | |
| void | EnforceRealtime (bool realtime) |
| Enable/disable soft real-time for MBS simulation (default: false). | |
| void | AddCouplingBody (std::shared_ptr< ChBodyAuxRef > body, const std::vector< ChVector3d > &points) |
| Add the specified body as a preCICE interface object. More... | |
| void | SetAddedMassBlocks (const std::string &h5_filename) |
| Set baseline added mass blocks from specified HDF5 hydrodynamics file (infinite-frequency added mass). More... | |
| void | SetAddedMassBlocks (const std::vector< ChMatrixDynamic<>> blocks) |
| Set baseline added mass blocks (simultaneously for all interface objects). More... | |
| ChSystem & | GetSystem () |
| Get underlying Chrono multibody system. | |
| void | RegisterBeforeStepDynamicsCallback (std::shared_ptr< BeforeStepDynamicsCallback > callback) |
| Register a callback for operations to be performed before advancing dynamics at each step. | |
| void | RegisterAfterStepDynamicsCallback (std::shared_ptr< AfterStepDynamicsCallback > callback) |
| Register a callback for operations to be performed after advancing dynamics at each step. | |
Public Member Functions inherited from chrono::ch_precice::ChPreciceAdapter | |
| void | SetVerbose (bool verbose) |
| Enable/disable verbose terminal output (default: false). | |
| void | EnableVisualization (bool vis) |
| Enable/disable run-time visualization (default: false). More... | |
| void | EnableOutput (bool out) |
| Enable/disable simulation output (default: false). More... | |
| void | SetOutputDir (const std::string &out_dir) |
| Set root output directory (default: "."). More... | |
| void | SetOutputSettings (const ChOutput::Settings &settings) |
| Set Chrono simulation output settings. More... | |
| void | SetOutputSettings (ChOutput::Format format, ChOutput::Mode mode, double output_fps) |
| Set Chrono simulation output settings. More... | |
| void | SetModelName (const std::string &name) |
| Set the Chrono model name. | |
| const std::string & | GetModelName () const |
| Get the name of the Chrono model. | |
| int | GetCouplingMeshDimensions (const std::string &mesh_name) const |
| Get the number of spatial dimensions for the mesh with specified name. More... | |
| size_t | GetNumVertices (const std::string &mesh_name) |
| Get the number of vertices for the mesh with specified name. | |
| CouplingMeshType | GetCouplingMeshType (const std::string &mesh_name) const |
| Get the type (vertex semantics) for the mesh with specified name. | |
| std::string | GetCouplingMeshTypeAsString (const std::string &mesh_name) const |
| Get the type (vertex semantics) for the mesh with specified name. | |
| int | GetCouplingDataDimensions (const std::string &mesh_name, const std::string &data_name) const |
| Get the data dimensions for the data with specified name on the mesh with specified name. More... | |
| CouplingDataType | GetCouplingDataType (const std::string &mesh_name, const std::string &data_name) const |
| Get the type for the coupling data with specified name on the mesh with specified name. | |
| bool | GetCouplingDataUsed (const std::string &mesh_name, const std::string &data_name) const |
Get the used flag for the coupling data with specified name on the mesh with specified name. More... | |
| std::string | GetCouplingDataTypeAsString (const std::string &mesh_name, const std::string &data_name) const |
| Get the type for the coupling data with specified name on the mesh with specified name. | |
| double | GetMaxTimeStepSize () const |
| Get the maximum time step size from preCICE. | |
| void | SetCouplingReadTime (CouplingReadTime read_time) |
| Set the point within the coupling time window at which data from other participants is read (default: CouplingReadTime::WINDOW_START). More... | |
| CouplingReadTime | GetCouplingReadTime () const |
| Get the point within the coupling time window at which data from other participants is read. | |
| const std::string & | GetParticipantName () const |
| Get the preCICE participant name. | |
| std::vector< std::string > | GetCouplingMeshNames () const |
| Get the coupled mesh names on this participant. | |
| std::vector< std::string > | GetReadDataNamesOnMesh (const std::string &mesh_name) const |
| Get the data names for reading on the mesh with specified name. | |
| std::vector< std::string > | GetWriteDataNamesOnMesh (const std::string &mesh_name) const |
| Get the data names for writing on the mesh with specified name. | |
| bool | MustWriteInitialData () |
| Check if the participant is required to provide initial data. More... | |
| bool | IsCouplingOngoing () |
| Check if coupling is ongoing. | |
| bool | IsTimeWindowComplete () |
| Check if the time window has completed. | |
| void | InitializeSimulation (int process_index=0, int process_size=1) |
| Create the participant (using the specified solver process size and index) and initialize the coupled simulation for this participant. More... | |
| void | RunSimulation () |
| Wrapper function for performing the simulation loop. More... | |
| void | FinalizeSimulation () |
| Wrapper function for finalizing the coupled simulation for this participant. More... | |
Additional Inherited Members | |
Public Types inherited from chrono::ch_precice::ChPreciceAdapter | |
| enum | CouplingMeshType { CouplingMeshType::GENERIC, CouplingMeshType::RIGID_BODY_REFS, CouplingMeshType::RIGID_BODY_POINTS, CouplingMeshType::FEA_MESH_NODES, CouplingMeshType::FEA_MESH_POINTS } |
| Chrono coupling mesh types (mesh vertex semantics). More... | |
| enum | CouplingDataType { CouplingDataType::GENERIC, CouplingDataType::POSITIONS, CouplingDataType::ROTATIONS, CouplingDataType::DISPLACEMENTS, CouplingDataType::LINEAR_VELOCITIES, CouplingDataType::ANGULAR_VELOCITIES, CouplingDataType::FORCES, CouplingDataType::TORQUES } |
| Chrono coupling data type. More... | |
| enum | CouplingReadTime { CouplingReadTime::WINDOW_START, CouplingReadTime::WINDOW_END } |
| Point within the coupling time window at which data from other participants is sampled. More... | |
Static Public Member Functions inherited from chrono::ch_precice::ChPreciceAdapter | |
| static std::string | GetCouplingDataTypeAsString (CouplingDataType type) |
| Return the data type as a string. | |
Protected Types inherited from chrono::ch_precice::ChPreciceAdapter | |
| using | CouplingData = std::map< std::string, CouplingDataInfo > |
| Data type to hold information for all data blocks in a coupling mesh, indexed by the data name. | |
| using | CouplingMeshes = std::map< std::string, CouplingMeshInfo > |
| Data type to hold data for all coupling meshes, indexed by the mesh name. | |
| using | MeshDataNames = std::map< std::string, std::vector< std::string > > |
| Data type to hold data names associated with a given mesh name. | |
Protected Member Functions inherited from chrono::ch_precice::ChPreciceAdapter | |
| ChPreciceAdapter (const std::string &precice_config_filename, const std::string &model_name="", bool verbose=false) | |
| ChPreciceAdapter (const ChPreciceAdapter &)=delete | |
| void | operator= (const ChPreciceAdapter &)=delete |
| void | SetParticipantName (const std::string &participant_name) |
| Set the participant name. More... | |
| void | AddCouplingMeshInterface (const std::string &mesh_name, CouplingMeshType data_type, const std::vector< std::string > &data_write_names, const std::vector< std::string > &data_read_names) |
| Add a coupling mesh with specified data type, using the given lists of data names for writing and reading. More... | |
| void | RegisterMesh (const std::string &mesh_name, const std::vector< ChVector3d > &positions) |
| Register a coupling mesh with preCICE, using the specified mesh name and its vertex positions (of ChVector3d type). More... | |
| void | RegisterMesh (const std::string &mesh_name, const std::vector< double > &positions) |
| Register a coupling mesh with preCICE, using the specified mesh name and its vertex positions (as a flattened vector of doubles). More... | |
| void | ReadData () |
| Receive data from other participant(s) via preCICE. More... | |
| void | WriteData () |
| Send data to other participant(s) via preCICE. More... | |
| void | SetDataBlock (const std::string &mesh_name, const std::string &data_name, const std::vector< double > &data) |
| Set the (write) data vector for the specified mesh and data names. | |
| void | WriteDataBlock (const std::string &mesh_name, const std::string &data_name) |
| Write (send) a block of data to preCICE. | |
| void | WriteDataBlock (const std::string &mesh_name, const std::string &data_name, const std::vector< double > &data) |
| Set and write (send) a block of data to preCICE. More... | |
| void | ReadDataBlock (const std::string &mesh_name, const std::string &data_name, double relative_read_time) |
| Read (receive) a block of data from preCICE. | |
| const std::vector< double > & | GetDataBlock (const std::string &mesh_name, const std::string &data_name) const |
| Get the (read) data vector for the specified mesh and data names. | |
| const std::vector< double > & | ReadDataBlock (const std::string &mesh_name, const std::string &data_name) |
| Read (receive) a block of data from preCICE and return the data vector. More... | |
| bool | WriteCheckpoint (double time) |
| Write the solver state to a checkpoint if required by preCICE. More... | |
| bool | ReadCheckpoint (double time) |
| Read the solver state from a checkpoint if required by preCICE. More... | |
| void | WriteOutput (int frame, double time) |
| Prepare output database (if needed) and let the concrete participant write output. | |
| virtual void | FinalizeParticipant () |
| Let the derived class perform any necessary operations during simulation shutdown. More... | |
| void | Output (double time) |
| Save output at the current frame is output is enabled. More... | |
| void | Render (double time) |
| Render the current frame if run-time visualization is available and enabled. More... | |
| virtual void | OnWriteDataAM (std::vector< ChMatrix66d > &blocks) |
| Prepare added mass data to be sent via preCICE. More... | |
Static Protected Member Functions inherited from chrono::ch_precice::ChPreciceAdapter | |
| static std::vector< double > | SetVerticesToData (const std::vector< ChVector2d > &vertices) |
| Convert a vector of ChVector2d to a vector of doubles in the format (x0, y0, x1, y1, ...). | |
| static std::vector< double > | SetVerticesToData (const std::vector< ChVector3d > &vertices) |
| Convert a vector of ChVector3d to a vector of doubles in the format (x0, y0, z0, x1, y1, z1, ...). | |
| static std::vector< ChVector3d > | ReadPoints (const std::string &filename) |
| Read a set of 3D points from an ASCII file (one point per line, space-delimited). | |
Protected Attributes inherited from chrono::ch_precice::ChPreciceAdapter | |
| std::string | m_model_name |
| Chrono model name. | |
| std::string | m_precice_config_filename |
| name of the preCICE configuration file | |
| bool | m_use_added_mass |
| bool | m_use_dynamic_added_mass |
| CouplingReadTime | m_coupling_read_time |
| where in the time window read data is sampled | |
| std::unique_ptr< precice::Participant > | m_participant |
| preCICE instance | |
| std::string | m_participant_name |
| name of the Chrono preCICE participant/solver | |
| CouplingMeshes | m_coupling_meshes |
| data for all coupling meshes | |
| MeshDataNames | m_data_read |
| input data names for all coupling meshes | |
| MeshDataNames | m_data_write |
| output data names for all coupling meshes | |
| bool | m_interfaces_created |
| true if the data interfaces were created | |
| bool | m_participant_created |
| true if the preCICE participant was created | |
| bool | m_initialized |
| true if preCICE participant was initialized | |
| bool | m_verbose |
| verbose terminal output | |
| std::string | m_prefix1 |
| prefix for terminal messages (first line) | |
| std::string | m_prefix2 |
| prefix for terminal messages (subsequent lines) | |
| bool | m_visualize |
| enable/disable run-time visualization | |
| bool | m_output |
| enable/disable run-time output | |
| std::string | m_output_dir |
| output directory name | |
| ChOutput::Settings | m_output_settings |
| output settings | |
| std::unique_ptr< ChOutput > | m_output_db |
| output database | |
Constructor & Destructor Documentation
◆ ChPreciceAdapterMbs()
| chrono::ch_precice::ChPreciceAdapterMbs::ChPreciceAdapterMbs | ( | const std::string & | precice_config_filename, |
| std::shared_ptr< ChSystem > | sys, | ||
| double | time_step, | ||
| bool | verbose = false |
||
| ) |
Construct a Chrono MBS preCICE participant for the specified Chrono system.
No preCICE interfaces (coupling bodies and FEA meshes) are defined. If enabled and if added mass blocks are defined, a hydrodynamics load object will be created during initialization.
Member Function Documentation
◆ AddCouplingBody()
| void chrono::ch_precice::ChPreciceAdapterMbs::AddCouplingBody | ( | std::shared_ptr< ChBodyAuxRef > | body, |
| const std::vector< ChVector3d > & | points | ||
| ) |
Add the specified body as a preCICE interface object.
Notes:
- if the MBS preCICE participant is created from a YAML specification file, calls to this function are made automatically.
◆ SetAddedMassBlocks() [1/2]
| void chrono::ch_precice::ChPreciceAdapterMbs::SetAddedMassBlocks | ( | const std::string & | h5_filename | ) |
Set baseline added mass blocks from specified HDF5 hydrodynamics file (infinite-frequency added mass).
Notes:
- if the MBS preCICE participant is created from a YAML specification file, this information is read from that file if present.
- with dynamic added mass, the self (diagonal) blocks applied at each time window are the sum of these baseline blocks and the increments received from all participants that send added mass; the body-to-body coupling blocks keep their baseline values. If no baseline is provided, a zero baseline is used.
◆ SetAddedMassBlocks() [2/2]
| void chrono::ch_precice::ChPreciceAdapterMbs::SetAddedMassBlocks | ( | const std::vector< ChMatrixDynamic<>> | blocks | ) |
Set baseline added mass blocks (simultaneously for all interface objects).
Each block must have size 6 x 6n, where n is the number of coupling bodies. Notes:
- if the MBS preCICE participant is created from a YAML specification file, this information is read from that file if present.
- with dynamic added mass, the self (diagonal) blocks applied at each time window are the sum of these baseline blocks and the increments received from all participants that send added mass; the body-to-body coupling blocks keep their baseline values. If no baseline is provided, a zero baseline is used.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_precice/ChPreciceAdapterMbs.h
- /builds/uwsbel/chrono/src/chrono_precice/ChPreciceAdapterMbs.cpp
Public Member Functions inherited from