# Question about data mapping from solid solver to fluid solver

**URL:** <https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864>\
**Category:** Using preCICE\
**Tags:** data-mapping\
**Created:** [January 9, 2022, 3:00pm UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864 "2022-01-09T15:00:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stan](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/stan/32/599_2.png) [@Stan](https://precice.discourse.group/u/Stan)\
**Post date:** [January 9, 2022, 3:00pm UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/1 "2022-01-09T15:00:57Z")

</div>

Hi all,  
I’m trying to simulate a multiphase FSI case (water seeping into soil). The soil part is removed in fluid mesh and it’s 0.1m wide and 0.2m high. For solid part, the cell size in x direction on the interface is 0.01m, which is two times of fluid cell size. The water level is 0.1m above the soil’s top surface. The pressure on the interface should be 981Pa. However, the solid solver didn’t get the right `Pressure`.

 ![2022-01-09 21-51-50 的屏幕截图](https://global.discourse-cdn.com/free1/uploads/precice/original/2X/1/1bff880a5f1237f1685ccfa065c55b3fa4e1db62.png)

The BC for fluid part and preciceDict are as follows:

> **alpha.water**
>
> /_--------------------------------_- C++ -_----------------------------------_  
> | ========= | |  
> | \ / F ield | OpenFOAM: The Open Source CFD Toolbox |  
> | \ / O peration | Version: 1.5-dev |  
> | \ / A nd | Web: [http://www.OpenFOAM.org](http://www.OpenFOAM.org) |  
> | \/ M anipulation | |  
> \*---------------------------------------------------------------------------\*/  
> FoamFile  
> {  
> version 2.0;  
> format ascii;  
> class volScalarField;  
> object alpha.water;  
> }  
> // \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* //
> 
> dimensions [0 0 0 0 0 0 0];
> 
> internalField uniform 0;
> 
> boundaryField  
> {  
> inlet  
> {  
> type zeroGradient;  
> }  
> outlet  
> {  
> type zeroGradient;  
> }  
> “wall.”  
> {  
> type zeroGradient;  
> }  
> seepageTest  
> {  
> type zeroGradient;  
> }  
> frontAndBack  
> {  
> type zeroGradient;  
> }  
> atmosphere  
> {  
> type inletOutlet;  
> inletValue uniform 0;  
> value uniform 0;  
> }  
> }
> 
> // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* //

> **pointDisplacement**
>
> FoamFile  
> {  
> version 2.0;  
> format ascii;  
> class pointVectorField;  
> object pointDisplacement;  
> }  
> // \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* //
> 
> dimensions [0 1 0 0 0 0 0];
> 
> internalField uniform (0 0 0);
> 
> boundaryField  
> {  
> inlet  
> {  
> type slip;  
> }
> 
> ```
> outlet
> {
> type slip;
> }
> 
> seepageTest
> {
> type fixedValue;
> value $internalField;
> }
> 
>    
> atmosphere
> {
> type slip;
> }
> 
> "wall."
> {
> type slip;
> }
> 
> frontAndBack
> {
> type slip;
> }
> 
> ```
> 
> }
> 
> // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* //

> **p\_rgh**
>
> /_--------------------------------_- C++ -_----------------------------------_  
> | ========= | |  
> | \ / F ield | OpenFOAM: The Open Source CFD Toolbox |  
> | \ / O peration | Version: 1.5-dev |  
> | \ / A nd | Web: [http://www.OpenFOAM.org](http://www.OpenFOAM.org) |  
> | \/ M anipulation | |  
> \*---------------------------------------------------------------------------\*/  
> FoamFile  
> {  
> version 2.0;  
> format ascii;  
> class volScalarField;  
> object p\_rgh;  
> }  
> // \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* //
> 
> dimensions [1 -1 -2 0 0 0 0];
> 
> internalField uniform 0;
> 
> boundaryField  
> {  
> “wall.”  
> {  
> type fixedFluxPressure;  
> value uniform 0;  
> }  
> seepageTest  
> {  
> type fixedFluxPressure;  
> value uniform 0;  
> }  
> frontAndBack  
> {  
> type fixedFluxPressure;  
> value uniform 0;  
> }  
> outlet  
> {  
> type fixedFluxPressure;  
> value uniform 0;  
> }  
> inlet  
> {  
> type fixedFluxPressure;  
> value uniform 0;  
> }  
> atmosphere  
> {  
> type totalPressure;  
> U U;  
> phi phi;  
> rho rho;  
> psi none;  
> gamma 1;  
> p0 uniform 0;  
> value uniform 0;  
> }  
> }
> 
> // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* //

> **U**
>
> /_--------------------------------_- C++ -_----------------------------------_  
> | ========= | |  
> | \ / F ield | OpenFOAM: The Open Source CFD Toolbox |  
> | \ / O peration | Version: 1.7.x |  
> | \ / A nd | Web: [www.OpenFOAM.com](http://www.OpenFOAM.com) |  
> | \/ M anipulation | |  
> \*---------------------------------------------------------------------------\*/  
> FoamFile  
> {  
> version 2.0;  
> format ascii;  
> class volVectorField;  
> location “0”;  
> object U;  
> }  
> // \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* \* //
> 
> dimensions [0 1 -1 0 0 0 0];
> 
> internalField uniform (0 0 0);
> 
> boundaryField  
> {  
> inlet  
> {  
> type fixedValue;  
> value uniform (0 0 0);  
> }  
> atmosphere  
> {  
> type pressureInletOutletVelocity;  
> value uniform (0 0 0);  
> }  
> “wall.”  
> {  
> type fixedValue;  
> value uniform (0 0 0);  
> }  
> seepageTest  
> {  
> type fixedValue;  
> value $internalField;  
> }  
> frontAndBack  
> {  
> type fixedValue;  
> value uniform (0 0 0);  
> }  
> outlet  
> {  
> type fixedValue;  
> value uniform (0 0 0);  
> }  
> }
> 
> // \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* //

> **preciceDict**
>
> FoamFile  
> {  
> version 2.0;  
> format ascii;  
> class dictionary;  
> location “system”;  
> object preciceDict;  
> }
> 
> preciceConfig “…/precice-config.xml”;
> 
> participant Fluid;
> 
> modules (FSI);
> 
> interfaces  
> {  
> Interface1  
> {  
> mesh Fluid-Mesh;  
> patches (seepageTest);  
> locations faceCenters;
> 
> ```
> readData
> (
> 
> );
> 
> writeData
> (
> Pressure
> );
> 
> ```
> 
> };
> 
> Interface2  
> {  
> mesh Fluid-Mesh;  
> patches (seepageTest);  
> locations faceNodes;
> 
> ```
> readData
> (
> Displacement
> Velocity
> );
> 
> writeData
> (
> 
> );
> 
> ```
> 
> };
> 
> };
> 
> FSI  
> {  
> rho rho [1 -3 0 0 0 0 0] 1;  
> }

---

<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:** [January 10, 2022, 7:51am UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/3 "2022-01-10T07:51:50Z")

</div>

Hi @Stan,

may I ask you upload your preciceDict as well? I cannot open the `vtu` files you uploaded since the file content is inlined in your post.

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/michael/32/716_2.png) [@Michael](https://precice.discourse.group/u/Michael)\
**Post date:** [January 11, 2022, 3:05pm UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/5 "2022-01-11T15:05:10Z")

</div>

> [@Stan](#):
>
> mesh Fluid-Mesh;

In your preDict, `interface1` and `interface2` use the same mesh. Should it be **FluidFaceMesh** and **FluidNodeMesh** respectively?

---

<div class="post-metadata">

**Author:** ![Stan](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/stan/32/599_2.png) [@Stan](https://precice.discourse.group/u/Stan)\
**Post date:** [January 12, 2022, 2:23am UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/6 "2022-01-12T02:23:20Z")

</div>

Hi @Michael, thanks for your hint. I set it wrong since I used to adopt only one `Fluid-Mesh` for `faceCenters` to read and write data. I’ll modify the setting and check the precice-output again.

---

<div class="post-metadata">

**Author:** ![Stan](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/stan/32/599_2.png) [@Stan](https://precice.discourse.group/u/Stan)\
**Post date:** [January 13, 2022, 12:03pm UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/7 "2022-01-13T12:03:55Z")

</div>

Sorry for deleting the previous wrong results since there are some mistakes in case setting. After modifing the case setting for our solid solver and modifying the preciceDict according to @Michael , the case works fine even though the pressures are still smaller than expected (due to mapping?). I’m refering to [Mapping Configuration](https://precice.org/configuration-mapping.html) and the topic [How does precice use meshes for mapping and communication](https://precice.discourse.group/t/how-does-precice-use-meshes-for-mapping-and-communication/823), however, I have a few more questions to ask.

1. In partitioned-pipe case, the locations where to exchange `Pressure` and ‘Velocity’ are not defined.  
[preciceDict\_partitioned-pipe.txt](https://precice.discourse.group/uploads/short-url/gtUDz8Tpr3iwCP79xOll9zQfVbu.txt) (437 Bytes)  
For `Pressure` and `Velocity`, should we exchange these kind of data on faceCenters or faceNodes?
2. At present, I exchange `Pressure` on faceCenters, `Displacement` and `Velocity` on faceNodes.  
[precice-config.xml](https://precice.discourse.group/uploads/short-url/ruaDkVi1UmRRLfcRurHXLNtsIoB.xml) (3.0 KB)  
[preciceDict.txt](https://precice.discourse.group/uploads/short-url/jyXMQzK7TysGIGsTbtiwb7a2OXr.txt) (735 Bytes)  
preCICE-output in solid part:  
[Fluid-Mesh-Centers-Solid.dt1.txt](https://precice.discourse.group/uploads/short-url/sQKrkuvSrEMrlv7ACWDFfYNVOy3.txt) (5.1 KB)  
[Fluid-Mesh-Nodes-Solid.dt1.txt](https://precice.discourse.group/uploads/short-url/aOJ5uLhOJeMtDsBjqojZUwCXfU2.txt) (10.8 KB)  
[Solid-Mesh-Solid.dt1.txt](https://precice.discourse.group/uploads/short-url/68BttCsYbJyouAw5aSoYs0iI03K.txt) (5.6 KB)  
For preCICE-output in solid part, `Fluid-Mesh-Centers-Solid.dt*.vtk` contains the coordinates of fluid cell face centers and pressures. The pressures in this file are interpolated by the pressures in `Fluid-Mesh-Centers-Fluid.dt1_r*.vtu`, right? For `Fluid-Mesh-Nodes-Solid.dt*.vtk`, it contains the coordinates of fluid cell nodes but all the variables are zero, why? Additionally, for `Solid-Mesh-Solid.dt*.vtk`, it includes the coordinates of all solid face nodes, pressures (mapped from `Fluid-Mesh-Centers-Fluid.dt1_r*` or `Fluid-Mesh-Centers-Solid.dt1`?)  
preCICE-output in fluid part:  
[Fluid-Mesh-Centers-Fluid.dt1\_r0.txt](https://precice.discourse.group/uploads/short-url/vWK4jn0lsPYAHZkSldWVGXobbGp.txt) (2.0 KB)  
[Fluid-Mesh-Centers-Fluid.dt1\_r1.txt](https://precice.discourse.group/uploads/short-url/5VLw3jL4ufzeOkfeTk1AjrmYhSk.txt) (2.0 KB)  
[Fluid-Mesh-Nodes-Fluid.dt1\_r0.txt](https://precice.discourse.group/uploads/short-url/yRNqYucMOagNJBr0Y1zdMuFrn7b.txt) (3.2 KB)  
[Fluid-Mesh-Nodes-Fluid.dt1\_r1.txt](https://precice.discourse.group/uploads/short-url/zLV3rz3qOky49aGFlqtMxaurUjG.txt) (3.2 KB)  
[Solid-Mesh-Fluid.dt1\_r0.txt](https://precice.discourse.group/uploads/short-url/mitMBV3rE9boZbH4Ezm2knKGYL2.txt) (3.1 KB)  
[Solid-Mesh-Fluid.dt1\_r1.txt](https://precice.discourse.group/uploads/short-url/oaS0ROaxby6gov29g4hnkVPtJqd.txt) (2.9 KB)  
For preCICE-output in fluid part, `Fluid-Mesh-Centers-Fluid.dt1_r*` contains all the pressures on faceCenters and `Fluid-Mesh-Nodes-Fluid.dt1_r*` contains all the displacements and velocities on fluid faceNodes. The pressures here are directly obtained from OpenFOAM by interpolation from volume center to face certer, and the displacements and velocities here are interpolated from the data in `Solid-Mesh-Fluid.dt1_r*`, right?
3. In fluid part, there are repetitive points and data in files such as `Solid-Mesh-Fluid.dt1_r0` and `Solid-Mesh-Fluid.dt1_r1`. Is it a kind of method preCICE handling data mapping or anything wrong in my case setting?
4. AFAIK, OpenFOAM stores and calculates variables at volume centers. I also wonder if it is OpenFOAM itself or preCICE that does the interpolation from face centers to volume centers (or from face nodes to volume centers) when I read variables from solid solver by faceCenters (or faceNodes). If it is preCICE, since preCICE only has the values on the interface, the data at the volume centers seems to be the extrapolation from the face centers or face nodes, which may be not so accurate. If it is OpenFOAM, since it has both the data of inner cells and the values on the interface, the value at the volume center can be interpolated well.  
If my understanding is wrong, please point it out. Any suggestions will be appreciated!

Best,  
Stan

---

<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:** [January 20, 2022, 9:31pm UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/8 "2022-01-20T21:31:01Z")

</div>

> [@Stan](#):
>
> In partitioned-pipe case, the locations where to exchange `Pressure` and ‘Velocity’ are not defined.  
> [preciceDict\_partitioned-pipe.txt](https://precice.discourse.group/uploads/short-url/gtUDz8Tpr3iwCP79xOll9zQfVbu.txt) (437 Bytes)  
> For `Pressure` and `Velocity` , should we exchange these kind of data on faceCenters or faceNodes?

IIRC the default is `faceCenters`. Anyway, this would be the right thing to specify if you want to specify the location.

> [@Stan](#):
>
> `Displacement` and `Velocity` on faceNodes.

That’s unfortunately not supposed to work.

> [@Stan](#):
>
> In fluid part, there are repetitive points and data in files such as `Solid-Mesh-Fluid.dt1_r0` and `Solid-Mesh-Fluid.dt1_r1` .

As you probably already know, the suffix `_r<N>` indicates the rank working on this portion of the mesh. There can be overlaps in this regions and is related to the way preCICE handles the partitioning.

> [@Stan](#):
>
> I also wonder if it is OpenFOAM itself or preCICE that does the interpolation from face centers to volume centers (or from face nodes to volume centers) when I read variables from solid solver by faceCenters (or faceNodes).

I guess you are referring here to the configuration you set in the `preciceDict` file. This is handled in the OpenFOAM adapter and has nothing to do with preCICE itself. preCICE doesn’t ‘know’ such things at all, as it is only a vertex cloud from the preCICE perspective.

---

<div class="post-metadata">

**Author:** ![Stan](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/stan/32/599_2.png) [@Stan](https://precice.discourse.group/u/Stan)\
**Post date:** [February 17, 2022, 3:08am UTC](https://precice.discourse.group/t/question-about-data-mapping-from-solid-solver-to-fluid-solver/864/9 "2022-02-17T03:08:44Z")

</div>

Hi @DavidSCN ,  
Sorry for the late reply.

> [@DavidSCN](#):
>
> That’s unfortunately not supposed to work.

You mean the original adapter, right? I’ve added `Pressure` and `Velocity` into FSI module to make it work with `Displacement`, `Pressure` and `Velocity`. The `Displacment` and `Velocity` calculated on the solid part seem to be succefully passed to OpenFOAM on faceNodes in my case.

> [@DavidSCN](#):
>
> As you probably already know, the suffix `_r<N>` indicates the rank working on this portion of the mesh. There can be overlaps in this regions and is related to the way preCICE handles the partitioning.
> 
> I guess you are referring here to the configuration you set in the `preciceDict` file. This is handled in the OpenFOAM adapter and has nothing to do with preCICE itself. preCICE doesn’t ‘know’ such things at all, as it is only a vertex cloud from the preCICE perspective.

It’s clear to me.

Thanks again for the detailed explaination!
