# Nearest-neighbor mapping | 3 mesh

**URL:** <https://precice.discourse.group/t/nearest-neighbor-mapping-3-mesh/618>\
**Category:** Is preCICE for me?\
**Tags:** openfoam, adapters, data-mapping, python, fsi\
**Created:** [May 28, 2021, 2:30pm UTC](https://precice.discourse.group/t/nearest-neighbor-mapping-3-mesh/618 "2021-05-28T14:30:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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 28, 2021, 3:10pm UTC](https://precice.discourse.group/t/nearest-neighbor-mapping-3-mesh/618/3 "2021-05-28T15:10:22Z")

</div>

> [@ajaust](#):
>
> Do you want the displacements/forces to be added, subtracted…?

I assume, that if I divide a airfoil (2D) in two parts, I have to add the displacements forces, to consider them as one airfoil together, am I right?.

> [@ajaust](#):
>
> What data is mapped from where to where?

The aim is to map forces from the fluid simulation to the FSI simulation and recieve displacement back.

> [@ajaust](#):
>
> What happens with the forces/displacements when they are communicated in the opposite direction?

This will not work, since my FSI simulation requires force input.

> [@ajaust](#):
>
> What data is mapped from which interface to which other interface?

Originally, my body in the fluid simulation (2D airfoil) consisted of one interface and the solid simulation also had one interface. Because the model in the fluid simulation is divided into two patches, the simulation crashes. I want to solve this issue by creating two meshes (seperate one for every patch in the fluid simulation). The aim is to map the same data (force from fluid to solid an displacement back), but from two meshes to one mesh.

> [@ajaust](#):
>
> I worked on an application with similar setup that was discussed [here](https://precice.discourse.group/t/two-couplings-to-one-interface-mixed-dimensional-coupling/68) and [here](https://precice.discourse.group/t/two-couplings-to-one-interface-reloaded/260).

The link you provided sounds promising 👍

> [@ajaust](#):
>
> **Edit** Just as an addition. You could also merge your fluid meshes into one `Fluid-Mesh` instead of have a `Fluid-Mesh-Up` and `Fluid-Mesh-Down` . I assume that is not possible for your application/setup, but it is hard to tell what you want to achieve.

I have tried using just one fluid-mesh for the two fluid patches. Using OpenFOAM, it resulted in this weird behaviour during a externally imposed rotation (counter-clockwise):  
 ![3](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/70f37467bca0b593d875e60774c1e52d07f2ff8a.gif)  
You can see the left and the right boundary of the arifoil, which are both seperate patches. They are both linked to the same mesh. Unfortunately, the left patch gets overlapped by the right patch, which shouldn’t happen. The expected behaviour would be a consistent rotation of the body without deformation of the patches.

**Edit:** When trying @ajaust’s proposed solution of [“Multiple mappings to and from a mesh” feature by the preCICE team](https://precice.discourse.group/t/highlights-of-the-new-precice-release-v2-2/429), I’m getting the following message:

```
---[precice] ERROR: There cannot be two mappings to mesh "Solid-Mesh" if the meshes from which is mapped contain duplicated data fields that are also actually mapped on this participant. Here, both from meshes contain data "Force". The mapping is not well defined. Which data "Force" should be mapped to mesh "Solid-Mesh"?

```

---

_[View the full topic](https://precice.discourse.group/t/nearest-neighbor-mapping-3-mesh/618)._
