# Openfoam-Solids4foam FSI: how to set Stress as exchange data instead of Force

**URL:** https://precice.discourse.group/t/openfoam-solids4foam-fsi-how-to-set-stress-as-exchange-data-instead-of-force/1981
**Category:** Using preCICE
**Tags:** openfoam, fsi
**Created:** [June 25, 2024, 1:43am UTC](https://precice.discourse.group/t/openfoam-solids4foam-fsi-how-to-set-stress-as-exchange-data-instead-of-force/1981 "2024-06-25T01:43:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zyx](https://avatars.discourse-cdn.com/v4/letter/z/6a8cbe/32.png) [@zyx](https://precice.discourse.group/u/zyx)
#### Post date: [June 25, 2024, 1:43am UTC](https://precice.discourse.group/t/openfoam-solids4foam-fsi-how-to-set-stress-as-exchange-data-instead-of-force/1981/1 "2024-06-25T01:43:47Z")

</div>

Hello everyone, I’m using openfoam and solids4foam to calculate a fluid-structure coupling problem. I want to exchange stress data instead of Force data. I’ve changed “Force” to “Stress” in all the config files. But there is solidForce file in the 0 folder in solids4Foam, and I don’t know how to change it to the corresponding stress file.  
At present solids4foam reports the following error:  
“Participant “Solid” asks for data “Force” from mesh “Solid-Mesh”, but this mesh does not use such data. Please add a use-data tag with name=“Force” to this mesh."  
Here are all the configuration files:  
[precice-config.xml](https://precice.discourse.group/uploads/short-url/saymIZ6YhWAVfkDYcw595i5qGgn.xml) (2.6 KB)  
[preciceDict-fluid.txt](https://precice.discourse.group/uploads/short-url/3qxjy6rINjQXl495DRK4rzTtZin.txt) (462 Bytes)  
[preciceDict-solid.txt](https://precice.discourse.group/uploads/short-url/dXqxmwYZiKRw9hhlnRaxeOGtirF.txt) (697 Bytes)  
Thank you for any advice!

---

<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: [July 18, 2024, 2:01pm UTC](https://precice.discourse.group/t/openfoam-solids4foam-fsi-how-to-set-stress-as-exchange-data-instead-of-force/1981/2 "2024-07-18T14:01:18Z")

</div>

In the `precice-config.xml`, I still see:

```xml
<read-data name="Force" mesh="Solid-Mesh" />

```

which is not defined as data and associated to the `Solid-Mesh`. This is what the preCICE error is referring to.

You can configure the OpenFOAM adapter to read `solidForce`:

> **[Configure the OpenFOAM adapter](https://precice.org/adapter-openfoam-config.html#parameters-and-fields-with-different-names)**
>
> Write a system/preciceDict, set compatible boundary conditions, and activate the adapter in your system/controlDict.

Example from our tutorials:

> <https://github.com/precice/tutorials/blob/develop/perpendicular-flap/solid-solids4foam/system/preciceDict>

You currently specify `nameStress solidStress`, but this name is currently hard-coded in the adapter:

> <https://github.com/precice/openfoam-adapter/blob/70afffe36e039be7ad9de205ec772b4acbb782d8/FSI/Stress.C#L12>

You can try changing this and rebuilding the adapter. If there is a more general use case and you think this would be generally useful (it probably should), please open an issue in the OpenFOAM adapter.

---

<div class="post-metadata">

### Author: ![zyx](https://avatars.discourse-cdn.com/v4/letter/z/6a8cbe/32.png) [@zyx](https://precice.discourse.group/u/zyx)
#### Post date: [August 6, 2024, 12:28am UTC](https://precice.discourse.group/t/openfoam-solids4foam-fsi-how-to-set-stress-as-exchange-data-instead-of-force/1981/3 "2024-08-06T00:28:24Z")

</div>

Thank you very much for your help!  
I’m sorry for replying so late 😿
