# Fluid solver mesh - How to link a solid mesh with a fluid mesh

**URL:** <https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604>\
**Category:** Is preCICE for me?\
**Tags:** openfoam, adapters, python\
**Created:** [May 24, 2021, 6:09pm UTC](https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604 "2021-05-24T18:09:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulianSchl](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/julianschl/32/692_2.png) [@JulianSchl](https://precice.discourse.group/u/JulianSchl)\
**Post date:** [May 24, 2021, 6:09pm UTC](https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604/1 "2021-05-24T18:09:45Z")

</div>

Hi,  
having implemented a structure solver with the python interface of preCICE,  
I am now planning to couple a OpenFOAM fluid solver with preCICE.  
In the documentation the implementation doesn’t seem to be very difficult but looking at the mesh,  
I am wondering how I set up the correct mesh for the fluid solver.

**Current status:**  
I have set up a mesh for the moving points of my rigid body in the solid solver.

**Plan:**

- Implementation of the fluid solver → First coupling to a [solverdummy](https://github.com/precice/python-bindings/tree/develop/solverdummy)

- If necessary: Creation of a new mesh for the fluid solver.

For the fluid solver I will need the points of the rigid body transfered to cells and in addition I will need the cells of the farfield around the moving body.

**Question:**  
Is there a way in preCICE to link specific cells (of the fluid mesh) to points (of the solid mesh) or do I have to add the farfield cells around my rigid body (transformed to points) to the solid mesh?  
For the solid mesh, I have simplified the case to just a few points, but looking at the fluid solver, it seems to get a huge work, or am I missing an easy way to link solid an fluid mesh?

My first step would be to couple my current fluid simulation (mesh with many cells) with a [solverdummy](https://github.com/precice/python-bindings/tree/develop/solverdummy), but I don’t know how to create the mesh there.

---

<div class="post-metadata">

**Author:** ![DavidSCN](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@DavidSCN](https://precice.discourse.group/u/DavidSCN)\
**Post date:** [May 25, 2021, 7:48am UTC](https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604/2 "2021-05-25T07:48:10Z")

</div>

Hi @JulianSchl,

I’m not sure if I unserstand your problem correct.

> [@JulianSchl](#):
>
> having implemented a structure solver with the python interface of preCICE,  
> I am now planning to couple a OpenFOAM fluid solver with preCICE.  
> In the documentation the implementation doesn’t seem to be very difficult but looking at the mesh,  
> I am wondering how I set up the correct mesh for the fluid solver.

I guess you have already seen our OpenFOAM tutorials?

> [@JulianSchl](#):
>
> Implementation of the fluid solver → First coupling to a [solverdummy](https://github.com/precice/python-bindings/tree/develop/solverdummy)

Is there any special reason to implement a fluid solver yourself? Why not using an OpenFOAM solver?

> [@JulianSchl](#):
>
> For the fluid solver I will need the points of the rigid body transfered to cells and in addition I will need the cells of the farfield around the moving body.

Why do you need the far-field cells? Do you really talk about cells or cell-faces? For me, it sound a bit like volume coupling instead of surface coupling? May I ask you to explain this a bit more in detail?

> [@JulianSchl](#):
>
> Is there a way in preCICE to link specific cells (of the fluid mesh) to points (of the solid mesh) or do I have to add the farfield cells around my rigid body (transformed to points) to the solid mesh?  
> For the solid mesh, I have simplified the case to just a few points, but looking at the fluid solver, it seems to get a huge work, or am I missing an easy way to link solid an fluid mesh?

The ‘link’ is essentially the mapping in preCICE. If you really want to connect cells and points in a user-defined arbitrary fashion- that’s currently not possible. However, if you want to link cells and points in a clear and debug-able way you could select a nearest-neighbor mapping in your preCICE configuration. As the name suggests, the nearest-neighbor mapping links the nearest neighbors on your coupling interface. Still, I’m not sure if this is really what you were asking for. Usually, you don’t need to exchange far-field cells for standard FSI applications.

---

<div class="post-metadata">

**Author:** ![JulianSchl](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/julianschl/32/692_2.png) [@JulianSchl](https://precice.discourse.group/u/JulianSchl)\
**Post date:** [June 7, 2021, 8:49pm UTC](https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604/3 "2021-06-07T20:49:32Z")

</div>

> [@DavidSCN](#):
>
> Is there any special reason to implement a fluid solver yourself? Why not using an OpenFOAM solver?

I am sorry, I expressed myself wrong, I do not want to implement a solver, but use the existing _displacementLaplacian_ solver.

> [@DavidSCN](#):
>
> Why do you need the far-field cells? Do you really talk about cells or cell-faces? For me, it sound a bit like volume coupling instead of surface coupling? May I ask you to explain this a bit more in detail?

The farfield case is already created. It seems, that I didn’t express myself properly. Working some time with the OpenFOAM-Adapter, I have achieved a successful coupling and now understand, that I don’t have to map from cell to cell, but from mesh to mesh, which gets interpolated by preCICE.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/67d2a5fa6f80e597e2267ff17fa8c1673cd11caa.svg) [@system](https://precice.discourse.group/u/system)\
**Post date:** [June 10, 2021, 8:50pm UTC](https://precice.discourse.group/t/fluid-solver-mesh-how-to-link-a-solid-mesh-with-a-fluid-mesh/604/4 "2021-06-10T20:50:06Z")

</div>

Closed on June 10, 2021, 8:50pm UTC

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