How is the force calculated in the OpenFOAM Adapter?


I’m running the preCICE OpenFOAM Adapter in the FSI configuration.
When coupling a FSI case, I receive different aerodynamic forces from OpenFOAM (when coupling through preCICE) than they are evaluated/logged from OpenFOAM.

what I’ve done so far:

  • Export the forces of OpenFOAM in the post processing → one resulting force on the body
  • adding the forces received through preCICE together to receive a resulting force → they differ in factor 10 …

I’m assuming that I can just add all forces in one plane together (or do I need to transform them?)


on which side do you actually perform the summation? Do you use acceleration methods?

I’m receiving the forces from OpenFOAM (fluid solver) via preCICE in my python script (solid solver).
No I’m using parallel explicit coupling without acceleration.

Ok. In general, the result should be the same. Some things to consider: the density is specified in different places (controlDict vs preciceDict). Is it the same? Do you have the same patches defined in order to evaluate the forces (should be only the coupling interface)? Which value do you expect? In order to exclude errors from the geometry, maybe use a unit length in z direction (assuming a 2D simulation).

I have to change the density in the preciceDict, thank you for pointing that out. Additionally I will compare the force exchange in a 2D case

Is there some documentation how the OpenFOAM Adapter calculates the force or do I have to read the code?
To exclude the possibility, that I have a mapping issue: Is it possible to log the coupling data from the OpenFOAM Adapter before sending it to preCICE?

Not really. I think the source code is rather intuitive in this regard and I think we already answered a similar question here in the forum. In general, the force computation is really similar to the force computation in OpenFOAM itself. Maybe you can find something about it and post a link below.

I’ve tested a similar case in 2D and the force mapping was good.
So I might check the force mapping in my 3D case again.

If you compile preCICE with python bindings can you not access the data using a python action? Your python action wouldn’t actually have to modify the data that is being read from the OpenFOAM adapter. You could simply use print commands to have values appear in the log.fluid or log.solid file.


Quick remark for future readers: The Python action callback interface of preCICE is something different than the Python bindings of preCICE.
Python bindings: The API of preCICE in Python: Python bindings | preCICE - The Coupling Library
Python actions: A callback interface to modify data in preCICE via Python scripts: Action configurations | preCICE - The Coupling Library

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.