Skip to content

Small standalone tool for interprocess communication in CoSimulation contexts for coupling and exchanging data between different solvers or other software-tools.

License

Notifications You must be signed in to change notification settings

KratosMultiphysics/CoSimIO

Repository files navigation

   ______     _____ _           ________
  / ____/___ / ___/(_)___ ___  /  _/ __ |
 / /   / __ \\__ \/ / __ `__ \ / // / / /
/ /___/ /_/ /__/ / / / / / / // // /_/ /
\____/\____/____/_/_/ /_/ /_/___/\____/
Kratos CoSimulationApplication

CoSimIO

The CoSimIO is a small library for interprocess communication in CoSimulation contexts. It is designed for exchanging data between different solvers or other software-tools. For performing coupled simulations it is used in combination with the CoSimulationApplication.
It is implemented as a detached interface. This means that it follows the interface of Kratos but is independent of Kratos, which allows for an easy integration into other codes / solvers

The implementation is defined in co_sim_io

Documentation and tutorials can be found here

Different methods for interprocess communication are available, their documentation can be found here

The tests are contained in tests

The changelog contains information about relevant changes in the different versions.

Dependencies

  • The CoSimIO is implemented as a standalone tool in C++. The only dependency is C++11. This includes most of the major C++ compilers in Windows, Linux, and Mac. A detailed list of C++11 compatible compilers here.
  • Dependency on Kratos: There is NO dependency on Kratos. The CoSimIO can be used completely without including or linking against Kratos.

Available languages

Besides the native C++ interface, the CoSimIO also provides interfaces to other languages. Currently the following languages are supported:

  • C
  • Python

These interfaces are implemented as consistent as possible with the C++ interface.

Usage

This section provides a brief overview on how to use the CoSimIO. For more detailed explanations please check the documentation in the corresponding language.

C++

The C++ interface is defined in co_sim_io.hpp. In addition to including this header it is required to compile CoSimIO into a shared library and link against it.

C

The C interface is defined in co_sim_io_c.h. In addition to including this header it is required to compile CoSimIO into a shared library and link against it.

Python

The Python interface is defined in CoSimIO python module. The pybind library is used for the Python exposure of the C++ interface.

Parallelism

The CoSimIO supports pure sequential and mpi-parallel executions. Shared memory parallelism is currently not planned but might be added at a later stage.

Memory Management

Coupling requires frequent exchange of data. Therefore the CoSimIO uses the memory provided by the including solvers/software-tools directly, without copying it to an auxiliar data structure.

Special Thanks To

  • Boost for the intrusive_ptr
  • pybind11 for exposing C++ to python
  • filesystem Header-only single-file std::filesystem compatible helper library, based on the C++17 specs
  • asio for socket based interprocess communication
  • doctest C++ testing framework for the unit tests