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?

Hi Claudio,

I have seen your post about RBFMeshMotionSolver. I also want to use this mesh motion solver to deal with the large mesh deformation. I can use RBF in pimple solver, but it can’t be used in interfoam through my test. I’d like to know whether interfoam doesn’t support RBFMeshMotionSolver. And how can I do to make interfaom support RBF?

Hi @Sun ,
I have never tried to use RBFMeshMotion solver with interFoam. It would be interesting to learn more about this. On one side it looks strange that it doesn’t work, I don’t see a dependency between the mesh motion solver and the solver itself, but I might be wrong. Which kind of error do you see?
Another slightly related question is: what is the size of your mesh? In general VOF meshes are quite big, because of the resolution at the interface and at the wet surface. Can you set up RBFMeshMotionSolver with a such a mesh? I paused using RBF because at the moment I am not able to tune the parameters for coarsening (plus other ones) in order to avoid either eating up the whole memory or waiting forever for the RBF to compute. What is your experience here?

Hi Claudio,
I checked the RBFMeshMotionSolver and didn’t find the dependency between it and solver. So I am not sure whether interFoam supports it. Error information is “Mapping distance not available due to empty partition”. You can check my log files.
debug_OpenFOAM_Inner.log (3.3 KB)
debug_OpenFOAM_Outer.log (3.2 KB)
debug_Solid.log (4.3 KB)
About my mesh size, it is 0.01m for one cell and 160000 totally for the whole domain. I don’t understand what you mean about “Can you set up RBFMeshMotionSolver with a such a mesh?”. Is there any special setup for the mesh? I modify my previous case by adding these setups in the dynamicMeshDict and preciceDict. You can check these files.
dynamicMeshDict_inner.txt (652 Bytes)
dynamicMeshDict.txt (677 Bytes)
preciceDict_inner.txt (929 Bytes)
preciceDict_outer.txt (926 Bytes)
Finally, I just run the perpendicular-flap tutorial successfully. So I haven’t met the problem about eating up the whole memory or waiting forever for the RBF to compute.

Do you use RBFMeshMotionSolver? I get the same problem with you. I think it is due to the RBFMeshMotionSolver. If you changed this mesh motion solver into others, you can run successfully.

Hi @Sun
I tried to look at your logs, but I’m not sure if I can understand your case, as you have multiple interfaces and fluid domains. First, as to the mesh size, afaik 160k cells is manageable, I was thinking about 1M plus cells. Right now I cannot check but, if I remember correctly, when you use displacementLaplacian you have to map Fluid-Mesh-Nodes and Fluid-Mesh-Faces, when you use RBF you only need Fluid-Mesh-Nodes and that is the reason why you might have an inconsistent mapping. would suggest to look for a running case with RBF and check the mapping.

Hi Claudio,

I have tested it according to your suggestions, but it doesn’t work. This is not the reason. I think interFoam doesn’t support RBFMeshMotionSolver.


just a couple of possible tests: in this post on RBF I tried to axplain some troubles when using RBFMeshMotionSolver with preCICE. Another thing that you could try is to convert the flexible DAM Break case in the solids4foam repository to make it work with RBFMeshMotions solver. Everything you should need is inside s4f (no preCICE, no other software…), if you manage to make it work there, maybe you can extend it to your case. I will be able to make some test on my side next week…

According to your advice, I have tried to modify the solids4foam/tutorial/flexibleDamBreak. After changing the mesh motion solver into RBFMeshMotionSolver, the case didn’t work and got an error “Problem with fluid mesh motion solver selection”. So it is most likely due to the compatibility.
log.solids4Foam.txt (7.5 KB)