Using OpenFoam InterFoam with Solids4Foam and OpenFoam Adapter

Hi all, @Makis

I am currently using the OpenFOAM interFoam solver toegether with solids4Foam. I am trying to run a simulation of a flexible membrane under still water condition. The issue I am facing is that the I am trying to use the vertexCenteredLinearGeometry Solid Model inside Solids4Foam for the membrane. When I do that, I am receiving a error message as follows:

—[precice] ^[[0m relative convergence measure: relative two-norm diff of data “Displacement” = inf, limit = 5.00e-03, normalization = 0.00e+00, conv = true
—[precice] ^[[0m relative convergence measure: relative two-norm diff of data “Force” = 0.00e+00, limit = 5.00e-03, normalization = 1.17e-02, conv = true
—[precice] ^[[0m All converged
—[precice] ^[[36mWARNING: ^[[0m The coupling residual equals almost zero. There is maybe something wrong in your adapter. Maybe you always write the same data or you call advance without providing new data first or you do not use available read data. Or you just converge much further than actually necessary.
—[precice] ^[[0m Time window completed
—[precice] ^[[0m iteration: 1 of 5, time-window: 2, time: 0.03 of 10, time-window-size: 0.03, max-timestep-length: 0.03, ongoing: yes, time-window-complete: yes, write-iteration-checkpoint

The issue is with the mapping of the displacement between the solid and fluid mesh. I do not have this issue when I used cell centered linear geometry solid models in solids4Foam. I have set up the problem similar to the way the flexible dambreak tutorial problem was setup. I am not sure if one used a vertex centred solid model in solids4Foam, the setting inside the preciceDict for the location tag needs to change and if this is supported by the openFOAM adapter. Also, i noticed that for the vertex centered linear geometry setup, the pointD file has to be together with the D file inside the 0 directory.

There was no issue with the precice-config file as it was working properly when a cell centered linear geometry solid model was used in solids4Foam. Please advise.

Thank you
precice-config.xml (2.4 KB)

Hi all,

I would like to specifically point out that the issue I am facing above is related to the fact that the displacement from the structural solver is not mapping to the fluid mesh correctly? specifically, the pointD values from the solid case directory are not mapped to the pointDisplacement or cellDisplacement of the fluid mesh.

I am wondering how this can be rectified. Also, inside the 0 directory of the solid case, I was wondering if the solidForce that is specified for the D file can be done for the pointD file instead?

Hi raynold,
the fact that you have a two-norm diff =‘inf’ makes me wonder that something is going wrong at least in the coupling model. From your precice-config file only I am not able to give you other hints. Have you tried with serial coupling instead of parallel? Just to see what happens.
I am not a s4f expert, but I’m wondering how you simulate membranes there. I would be curious to know more about your model and see if we could replicate it with our membrane model.
kind regards

Hi Claudio,

Thank you for your suggestion. I have tested the serial-implicit coupling before but the same problem exists. The issue exists when i use parallel-implicit or serial-implicit coupling. I dont think it is an issue with the coupling. Because in the log file of the fluid solver, at the begining, there is a message about:

Starting time loop

—[preciceAdapter] Loaded the OpenFOAM-preCICE adapter - v1.2.2.
—[preciceAdapter] Reading preciceDict…
—[precice] ^[[0m This is preCICE version 2.4.0
—[precice] ^[[0m Revision info: no-info [Git failed/Not a repository]
—[precice] ^[[0m Build type: Release (without debug log)
—[precice] ^[[0m Configuring preCICE with configuration “…/precice-config.xml”
—[precice] ^[[0m I am participant “Fluid”
—[precice] ^[[0m Connecting Primary rank to 7 SecondaryRanks
—[precice] ^[[0m Setting up primary communication to coupling partner/s
—[precice] ^[[0m Primary ranks are connected
—[precice] ^[[0m Setting up preliminary secondary communication to coupling partner/s
—[precice] ^[[0m Prepare partition for mesh Fluid-Mesh
—[precice] ^[[0m Receive global mesh Solid-Mesh
—[precice] ^[[0m Broadcast mesh Solid-Mesh
—[precice] ^[[0m Filter mesh Solid-Mesh by bounding box on secondary ranks
—[precice] ^[[0m Mapping distance not available due to empty partition.
—[precice] ^[[0m Mapping distance not available due to empty partition.
—[precice] ^[[0m Filter mesh Solid-Mesh by mappings
—[precice] ^[[0m Feedback distribution for mesh Solid-Mesh
—[precice] ^[[0m Setting up secondary communication to coupling partner/s
—[precice] ^[[0m Secondary ranks are connected
—[precice] ^[[0m iteration: 1 of 5, time-window: 1, time: 0 of 10, time-window-size: 0.005, max-timestep-length: 0.005, ongoing: yes, time-window-complete: no, write-iteration-checkpoint
—[precice] ^[[0m Compute “write” mapping from mesh “Fluid-Mesh” to mesh “Solid-Mesh”.
—[precice] ^[[0m Mapping distance not available due to empty partition.
—[precice] ^[[0m initializeData is skipped since no data has to be initialized.
—[preciceAdapter] preCICE was configured and initialized
—[preciceAdapter] Setting the solver’s endTime to infinity to prevent early exits. Only preCICE will control the simulation’s endTime. Any functionObject’s end() method will be triggered by the adapter. You may disable this behavior in the adapter’s configuration.

For some reason, there is an issue with the mapping from the solid solver to the fluid solver when a vertex centered solid model is used. The same precice config file does not give any issue when a cell centered solid model is used.

For the solid model, I have used a 3D continuum linear Elastic Model of a flat plate geometry. However, it is possible to model the membrane based on plate and shell formulation. See attached.


Hi Raynold,
I have never seen this message: Mapping distance not available due to empty partition it looks to be a good candidate for your issue, because the forces converge while the coupling of the displacements doesn’t work. Are you able to look at the interface meshes that you pass to precice? For example by plotting them (e.g. the export:vtu or similar option) and/or, in order to look also at the connectivity (if I remember correctly precice exports only the points of the mesh) you might want to use paraFoam. Understanding the geometry of the two interfaces can be a first step.
As to membranes simulations, thank you for the link. It would be interesting to me to have a benchmark also for our solver for shells/membranes.

1 Like

I would also start by looking at the exported meshes. Maybe they have incompatible directions / axis systems.

Hi Makis,

Thank you for your suggestion. I first tried to do this:

<participant name="Fluid">
  <use-mesh name="Fluid-Mesh" provide="yes" />
  <use-mesh name="Solid-Mesh" from="Solid" />
  <write-data name="Force" mesh="Fluid-Mesh" />
  <read-data name="Displacement" mesh="Fluid-Mesh" />
    constraint="conservative" />
    constraint="consistent" />
    **<export:vtk />**

Where I added the export vtk command to the fluid participant. But I did not see anything in the vtu file.
Fluid-Mesh-Fluid.init_1.vtu. I am not sure if something is not right. I saw the field and tick it but it showed nothing.

Then I load the foam files, using the command touch fluid.foam and solid.foam inside the respective fluid and solid directory. Attached is the image of the mesh of the fluid and solid. It should be noted that I took a slice in the y direction of the fluid domain in the middle. It seems that the mesh is correct? But I am not sure if using such a thin plate for the solid will cause any mapping issues?

Hi @raynold_tan ,
what do you mean by “I don’t see anything in the vtu file”? Is it empty (no points in it) or you are not able to see it in paraview?
Second, did you create a baffle in the fluid to define the interface with the thin solid?

Hi Claudio,

I am not able to see it in paraview? Not sure if some settings are not right?

Inside the blockMeshDict file, there is a patch called plate, which is the interface between the fluid and solid. It covers the top and bottom part of the plate surface (see picture above).

However, surrounding the plate border (as you see the picture), there is a patch called plateFixed, which is considered to be clamped, although it is surrounding the fluid domain. But the plate border is not supposed to move and is not defined as part of the interface. Not sure if this is right?


Hi @raynold_tan
as far as I remember precice meshes contain only points and are difficult to visualize. There is a trick at the bottom of this page Export configuration | preCICE - The Coupling Library
As to the patch, I presume you need to define a baffle so that you have duplicated fluid points for above and below the plate and the fluid solver knows that there is something between the two faces and you can define them as walls.

Hi Claudio,

Yes, I now export them as vtp file and opened only the .pvtp files. Then I used the gaussian filter. Both the Fluid-Mesh-FLuid.init.pvtu and the Solid-Mesh-Fluid.init.pvtu is shown to be overlapping in the figure.

As for the plate, it is still defined as 3D solid with 15 cells in the thickness direction. Although it is very thin, the upper and bottom surface have fluid points on the bottom and top surface. See attached. The only thing I not sure if the border of the plate where it is clamped should be part of the interface as well.
Now the interface is defined as the top and bottom surface only.


so the solid is still a box, so to say. The fact that all the lateral faces are not in the interface might be a problem, even if I am not sure. This may also depend on how the solid domain (and so its interface) is defined. Is it a 2D planar surface or a solid?