preCICE for coupling sloshing in OpenFOAM with control software

Hello,
we are currently looking into developing a closed-loop system for coupling OpenFOAM sloshing simulations with an external control software (Matlab). The idea would be to perform sloshing simulations based on the output of the control software and then have the forces and torques generated by the sloshing be an input to the controller.
I have some ideas how to achieve this, but am not sure were to start.

  1. Extend the OpenFOAM adapter to write directly into the acceleration environment, similar to what is done in the tabulatedAccelerationSource functionObject.
  2. Influence the sloshing motion using the rigidBody motion.

My question mainly is, if there are others who have worked on such a system, and if there is guidance on how to approach this problem.

Thanks!

Quick correction, I meant the tabulatedAccelerationSource fvOption, of course.

I will pursue this path first, since it seems the most straight forward. I will add a new field to the FSI module in the OpenFOAM adapter, which reads acceleration and writes it to the simulation like the aforementioned fvOption. One thing I am unsure about, is how to handle the other participant, since it will be Matlab/Simulink control software and won’t have a mesh. Can preCICE communicate values which are not linked to a mesh? I attended the preCICE Workshow in 2023 and remember a presentation on coupling a neural-network to OpenFOAM for training the network to act as a controller. I can’t seem to find the presentation anymore.

Hi @openFoe :wave:

We recently added a controller tutorial that seems similar to what you need. It uses an FMI-based controller, however.

Currently not. But you can always define a helper mesh with an arbitrary vertex and then write data to this vertex.

The talk you were referring to:

Unfortunately, I cannot help with your OpenFOAM adapter question.

Benjamin

1 Like

Thank you @uekerman! This was already very helpful. Maybe @Makis could help me with my openFoam questions :grin:
Specifically how I would define such a helper mesh in openFoam?