# OpenFOAM mesh motion problem: Compression of single cells

**URL:** <https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222>\
**Category:** Using preCICE\
**Tags:** openfoam\
**Created:** [November 16, 2022, 3:18pm UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222 "2022-11-16T15:18:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrich](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@Ulrich](https://precice.discourse.group/u/Ulrich)\
**Post date:** [November 16, 2022, 3:18pm UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/1 "2022-11-16T15:18:05Z")

</div>

Dear friends,

we have a problem with mesh motion in OpenFOAM (for FSI applications with CalculiX), especially when the fluid mesh is to be compressed into a gap by displacing the solid domain.

Here, the displacementLaplacian displacement approach in OpenFOAM shows a strong compression of individual cells in the domain in a wave-like structure up to the crash. I use hex grids and planar simulations. I have encountered this problem frequently and I wonder if anyone has already found a solution for a better mesh motion in OpenFOAM for cases like this.

Many greetings

Ulrich

![b1](https://global.discourse-cdn.com/free1/uploads/precice/original/2X/f/f2cdcb920c2d254a8a9bf2a0d4c753b59b0368d5.gif)

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [November 19, 2022, 8:27am UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/2 "2022-11-19T08:27:14Z")

</div>

Dear Ulrich,

try using the `RBFMeshMotionSolver` from the `nextRelease` branch of solids4Foam, which should work with the latest OpenFOAM adapter (v1.2.0, currently in master, to be tagged very soon):

> <https://github.com/precice/openfoam-adapter/pull/241>
>
> Old title: \_FSI/Displacement: allow the adapter to work with the RBF mesh motion… solver in solids4foam\_
> 
> TODO list:
> 
> \- \[x\] I updated the documentation in \`docs/\`
> \- \[x\] I added a changelog entry in \`changelog-entries/\` (create directory if missing)
> 
> Details:
> 
> \- Should resolve https://github.com/precice/openfoam-adapter/issues/227
> \- This change allows the RBF mesh motion solver in solids4foam to work with the preCICE OpenFOAM adapter
> \- The nextRelease branch of solids4foam is required, where the RBF mesh motion solver has been modified to allow use with the preCICE OpenFOAM adapter
> \- I have checked it with OpenFOAM-v2012, but it should work with other supported versions.
> \- The RBF mesh motion solver has now been extracted into its own dynamic library so that it can be used with any suitable OpenFOAM solver (not just solids4foam).
> 
> \[Just for reference\] For the perpendicular-flap tutorial, the following changes to the \`fluid-openfoam\` case would be required if one wants to use the RBF mesh motion solver:
> \- \`constant/dynamicMeshDict\`
> \`\`\`
> FoamFile
> {
> version 2.0;
> format ascii;
> class dictionary;
> object dynamicMeshDict;
> }
> 
> dynamicFvMesh dynamicMotionSolverFvMesh;
> 
> motionSolverLibs ("libfvMotionSolvers.so" "libRBFMeshMotionSolver.so");
> 
> // Radial basis function solver
> solver RBFMeshMotionSolver;
> 
> RBFMeshMotionSolverCoeffs
> {
> // Settings for the RBF solver
> staticPatches (upperWall lowerWall);
> movingPatches (flap);
> fixedPatches (inlet outlet);
> interpolation
> {
> function TPS;
> }
> coarsening
> {
> enabled no;
> }
> }
> \`\`\`
> \- \`system/preciceDict\`
> \`\`\`
> FoamFile
> {
> version 2.0;
> format ascii;
> class dictionary;
> object preciceDict;
> }
> 
> preciceConfig "../precice-config.xml";
> 
> participant Fluid;
> 
> modules (FSI);
> 
> interfaces
> {
> Interface1
> {
> mesh Fluid-Mesh;
> patches (flap);
> locations faceCenters;
>     
> readData
> (
> Displacement
> );
>     
> writeData
> (
> Force
> );
> };
> };
> 
> FSI
> {
> rho rho \[1 -3 0 0 0 0 0\] 1;
> 
> // The point displacement field is unused for the RBF mesh motion solver
> namePointDisplacement unused;
> 
> // Specify the RBF cell motion field
> nameCellDisplacement rbfMotionCentersField;
> }
> \`\`\`
> 
> Here is the case:
> \[fluid-openfoam-rbf.zip\](https://github.com/precice/openfoam-adapter/files/9290145/fluid-openfoam-rbf.zip)

---

<div class="post-metadata">

**Author:** ![Ulrich](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@Ulrich](https://precice.discourse.group/u/Ulrich)\
**Post date:** [November 20, 2022, 2:24pm UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/3 "2022-11-20T14:24:22Z")

</div>

Dear Makis, thanks a lot. I will try this. I tried meanwhile SBRStress solver which is directly available in OpenFOAM.The SBRStress solver gives also a pretty nice mesh with good orthogonality. But I’m not yet at the end of my mesh desired compression. I will check out which solver then allows the highest grid compression.  
Best regards  
Ulrich

---

<div class="post-metadata">

**Author:** ![Ulrich](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@Ulrich](https://precice.discourse.group/u/Ulrich)\
**Post date:** [December 12, 2022, 5:00pm UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/4 "2022-12-12T17:00:23Z")

</div>

Dear Makis,

after we continued to have problems with the displacement of the grid (with displacementSBRStress-Solver), we followed your recommendation and used the RBFMeshMotion with the new preCICE version. We were able to successfully reproduce your flap case ([Displacement reading: Allow mesh motion solvers without a pointDisplacement field by solids4foam · Pull Request #241 · precice/openfoam-adapter · GitHub](https://github.com/precice/openfoam-adapter/pull/241)). Thank you very much for providing it. However, we have encountered a new problem:

The RBF-MotionSolver seems to always set the grid points at the boundaries to fixedValue, so that no sliding of the grid on the boundaries is possible. However, a working “slip” condition on some walls would be mandatory for us. We have tried it with different settings in dynamicMeshDict (static/moving/fixed patches) as well as with different entries in the pointDisplacement file, but it seems that it is not used at all.

Do you know if and how a slip boundary condition for the grid displacement on some boundaries can be realised in the RBFMotion solver?  
Thanks a lot  
Ulrich

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [December 14, 2022, 5:15pm UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/5 "2022-12-14T17:15:16Z")

</div>

> [@Ulrich](#):
>
> The RBF-MotionSolver seems to always set the grid points at the boundaries to fixedValue, so that no sliding of the grid on the boundaries is possible. However, a working “slip” condition on some walls would be mandatory for us.

> [@Ulrich](#):
>
> Do you know if and how a slip boundary condition for the grid displacement on some boundaries can be realised in the RBFMotion solver?

What exactly do you mean by “sliding of the grid”? Having a moving part? If that is not on the coupling interface, then maybe @philip could help (or maybe ask [solids4foam](https://github.com/solids4foam/solids4foam)).

If the moving part is on the coupling interface, then this is not currently easy to do with preCICE (work in progress).

---

<div class="post-metadata">

**Author:** ![Ulrich](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@Ulrich](https://precice.discourse.group/u/Ulrich)\
**Post date:** [December 18, 2022, 9:55am UTC](https://precice.discourse.group/t/openfoam-mesh-motion-problem-compression-of-single-cells/1222/6 "2022-12-18T09:55:24Z")

</div>

Dear Makis, thanks for your reply.  
With sliding I mean a “\*slip”-conditions in the pointDisplacement. For the Laplacian and SBRStress solver we can use e.g. “slip” or “fixedNormalSlip” to allow a sliding of the mesh nodes along wall patches. This is quite important, if a deformed structure comes close to a wall. Please see attached figure with an initial solid in blue and a deformed solid in brown: If the nodes stick at the wall, the mesh gets highly deformed (see red line). In a closing gap situation (deformed solid reaches the wall boundary) it is very important that the nodes on the wall-patch can slide along the wall (see green line): The mesh is compressed but it remains more or less orthogonal. For this we don’t see an option in the RBF-motion solver. But we contacted Philip as you suggested.

 ![mesh_deformation](https://global.discourse-cdn.com/free1/uploads/precice/original/2X/4/46fa2a5f0cab7f78c633c3876a931e2a0aff21ff.png)
