Force mapping with OpenFOAM adapter

I have a problem regarding the mapping of forces when coupling with OpenFOAM. I don’t get how it works. I was thinking that on the structure side I should receive nodal forces. I am not a CalculiX expert and I am not able to read what it uses as loads. I Built a different adapter and used it with the vertical flap tutorial. My adapter uses nodal forces. Displacements are consistent within the solid and the fluid mesh, while with my configurations the forces are not. I made an experiment writing a dummy solid adapter which imposes the movement of the mesh and reads the nodal forces. The case is like this:

If I keep the structure still, OpenFOAM shows these nodal forces:

While this is what I read on the structure side:

which are of course wrong. Nevertheless the mapping is right on the displacement side: if I impose a mesh movement the displacement of the two meshes are coherent. Is that I read cell forces? Or is it that the config file is wrong?
precice-config.xml (3.6 KB)
Any help is much appreciated

Hi Caudio,

some aspects on forces calculation in OpenFOAM, which might help:

  • forces are calculated for each cell face, since OF uses finite volume methods, so you get one value, which corresponds to one face
  • this leads to the fact, that in case of 2d the out-of-plain direction i.e. the mesh ‘thickness’ matters. If your mesh is e.g. 0.1 thick, your forces are scaled by 0.1 as well
  • forces should be mapped conservative and therefore make sure you treat them in a conservative way in your structure solver

I am not sure what you mean by ‘nodal forces’. Forces are calculated from e.g. pressure, which always refers to some reference area, but this should not bother you on the structural solver side.

Hi David,
thank you for your answer. By ‘nodal forces’ I mean forces applied to the nodes of the structure. I understand that forces derive from pressure in the fluid and are calculated at the cell center. The OF side of the coupling defines 2 meshes, one considering cell centers and one considering nodes. If you see the images concerning the patch in the fluid domain regarding the interface I am plotting “node data” in paraFoam and they are pretty reasonable (also consistent with the corresponding “cell data”). The data seem to be calculated exactly at cells and nodes in the OF side of the coupling. The structure side of the coupling uses only node data but they differ from the OF data. I was suspecting that the coupling is between cell-faces and structure nodes:
direction="write" from="Fluid-Mesh-Faces" to="Solid-Mesh" constraint="conservative"
but I can’t do
direction="write" from="**Fluid-Mesh-Nodes**" to="Solid-Mesh" constraint="conservative"

No, you can’t do that, because the node mesh is just used for the deformation and not for anything else in OpenFoam.

Do these data correspond now to different interface meshes exported using preCICE or do you just select different representations in paraView? What paraView shows you, when you select ‘node data’ for a ‘cell related’ data set is an interpolation done by paraView itself.

Yes, that is right, we map cell-face forces on the nodes and they might differ depending on different mesh resolutions and your selected mapping scheme, but your results look rather wrong.
How do you visualize your preCICE exported meshes? Could you apply a glyph filter on the node data? In this case, you can exactly see, where data is available and figure out, what might be wrong.

The data I plotted derive directly from paraview. I am not computing anything, they are just in the paraview output for the different patches, I agree that they should be paraview interpolations. They look pretty reasonable. I can extract the data on the Precice meshes (force on cell centers on the fluid side and forces on the nodes at the solid side) and the error in the mapping is clear:

See the images above. They are the Delauney surfaces of the structural mesh and the fluid cell centers. The mesh nodes of the structural mesh and the mesh of the fluid nodes are the same. The elements of the mesh with the fluid cells are the centers of each rectangle and the delaunay 2D surface results in a flat surface. The fact that the full-scale value is the same makes me think that data aren’t mapped from cells to nodes. I thought that Precice would take care of the mapping considering cells-to-nodes conversion. Should I do it myself? When coupling with SU2 directly receive node data, that is why I considered node data. Besides, If I receive cell data, the number of elements would differ.

I agree there is some inconsistency.
Could you do the following, to see better, what is going on here:

  1. add the <export-vtk…> tag in your precice-config
  2. load the .vtk files into e.g. paraview and apply a glyph filter.

As a result, you can see the data precice gets form each participant and which data points are used during simulation.

precice doesn’t care, where your data locations are derived from i.e. faces or nodes. Values are just mapped conservative or consistent depending on your config.

Hi David,
Thank you for your suggestions. The images I was plotting were exactly the vtk files exported by PreCICE and loaded in paraview with Delaunay 3D filter.
I think I have found my mistake. The problem was due to a wrong setting in the convergence parameters for the forces. This is the reason why the solution converged too early to a wrong solution.
After that I computed the resultant forces and moments in OpenFOAM and on the structural side and they coincide.