Specific Adapters for OpenFOAM Solvers

We wish to couple our custom IB code that is written in OpenFOAM with CalculiX. The problem is that it is difficult to pass data from IB to the general adapter since the number of vertices are constantly changing and the IB moves from one processor to another. Therefore, we would like to assemble the data buffer in our custom pimpleFoam and pass it directly to preCICE, such that preCICE does not need to read the same from a patch.

Would appreciate any help.

Hi @mishal49,

if your interface (immersed boundary) is constantly changing (and if brute-force restarting every few time steps is not an option), then I am afraid it will be a bit complicated with preCICE at the moment, even if you directly call preCICE directly in your solver. @fsimonis and @DavidSCN are working on making this easier, but features in this direction will take a while till they are available.

I am not sure what you mean here. Using additional context from our previous communication, I assume that you want to use some of the features of the adapter (which?), without actually associating a specific OpenFOAM patch to the interface. This sounds very complicated, and I think it would be easier for you to just hard-code the preCICE calls into your solver. The source of the OpenFOAM adapter may look too long, but most of it is handling special cases and covers features which you may not need. For one specific case, it may be best to just hard-code.

By the way, I think that @KyleDavisSA tried to directly couple an immersed boundary solver in foam-extend a long time ago, without much success (if I remember correctly).

Other threads that may help:

@Makis Thanks for your timely reply, Actually what we want to do is rather simple, The number of vertices in the mesh is not changing, and neither is the number of faces. If I understand correctly, preCICE will read data from a coupled patch e.g. forces, and store it in a buffer before sending it to the solid solver. We want to avoid this step and assemble the buffer ourselves (in the fluid solver) but we don’t know how to send this data to the solid solver. The buffer is equivalent to what preCICE reads from a patch even the order and the size.

How do we go about this in OpenFOAM directly instead of using the general adapter provided, which uses function objects?

Ah, I see. Then maybe you could add your own reader/writer: Extend the OpenFOAM adapter | preCICE - The Coupling Library

I guess we could also add a generic reader/writer for such purposes.

@mishal49: this is what I meant in my first post.

Thanks @Makis. Is it possible to make a reader/writer that reads/writes an array of data in Openfoam without having to read/write from a patch. Lets say for instance I have a solid mesh with 10 faces, therefore I have array of size 10 in openfoam which I can populate or read in openfoam, can we make a reader/writer in preCICE that can read from that array.

you could modify the adapter to do that, I guess. But it cannot do it as-is right now. You could probably even create a “fake” patch for your array, fill it with your data, and ask the adapter to read/write on that.