Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make preCICE export paths consistent #510

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flow-over-heated-plate-nearest-projection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ From the preCICE point of view, the simulation here is in 3D, as opposed to the
## Post-processing

Have a look at the [flow-over heated-plate](https://www.precice.org/tutorials-flow-over-heated-plate.html) tutorial for the general aspects of post-processing.
Since we now defined mesh connectivity on our interface, we can export the coupling interface with the tag `<export:vtk directory="preCICE-output" />` in our `precice-config.xml`.
Since we now defined mesh connectivity on our interface, we can export the coupling interface with the tag `<export:vtk directory="precice-exports" />` in our `precice-config.xml`.
Visualizing these files (e.g. using ParaView) will show a triangular mesh, even though you use hexahedral meshes. This has nothing to do with your mesh and is just caused by the way the connectivity is defined in preCICE. As described above, the function `setMeshTriangles` is used to define the connectivity. Hence, every interface cell/face is represented by two triangles. The following image should give you an impression of a possible triangulated coupling mesh, which consists purely of hexahedral cells:

![triangulated](https://user-images.githubusercontent.com/33414590/55974257-96b07d80-5c87-11e9-9965-972b922c483d.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<provide-mesh name="Solid-Mesh-Centers" />
<read-data name="Temperature" mesh="Solid-Mesh-Centers" />
<write-data name="Heat-Flux" mesh="Solid-Mesh-Nodes" />
<!-- <export:vtk directory="preCICE-output" /> -->
<!-- <export:vtk directory="precice-exports" /> -->
<mapping:nearest-projection
direction="read"
from="Fluid-Mesh-Nodes"
Expand Down
4 changes: 2 additions & 2 deletions flow-over-heated-plate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ First generate the output for each run by adding export to the participant `Soli

```xml
<participant name="Solid">
<export:vtk directory="preCICE-output" />
<export:vtk directory="precice-exports" />
<receive-mesh name="Fluid-Mesh" from="Fluid" />
<provide-mesh name="Solid-Mesh" />
...
</participant>
```

After that running a case from this tutorial will export data into `solid-*/preCICE-output`. To visualize and compare these results run `python3 plot-final-interface-temperature.py` (You can install the required python packages by running `pip3 install -r plot-final-interface-temperature-requirements.txt`). This will plot the dimensionless temperature `theta = (T-300)/(310-300)` (with `T` being the temperature) across the coupling interface, i.e. where the solid and the fluid meet and exchange heat. The x-axis shows the x coordinate and the y-axis the dimensionless temperature `theta` at the interface. If you want to exclude certain cases, simply comment out the corresponding lines in the script. For reference see below:
After that running a case from this tutorial will export data into `solid-*/precice-exports`. To visualize and compare these results run `python3 plot-final-interface-temperature.py` (You can install the required python packages by running `pip3 install -r plot-final-interface-temperature-requirements.txt`). This will plot the dimensionless temperature `theta = (T-300)/(310-300)` (with `T` being the temperature) across the coupling interface, i.e. where the solid and the fluid meet and exchange heat. The x-axis shows the x coordinate and the y-axis the dimensionless temperature `theta` at the interface. If you want to exclude certain cases, simply comment out the corresponding lines in the script. For reference see below:

![Comparison of the results with different solvers](images/tutorials-flow-over-heated-plate-results-comparison.png)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions flow-over-heated-plate/plot-final-interface-temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def vtk_to_dict(case):
vtkFileName = "solid-{}/preCICE-output/Fluid-Mesh-Solid.dt100.vtk".format(case)
vtkFileName = "solid-{}/precice-exports/Fluid-Mesh-Solid.dt100.vtk".format(case)
# read the vtk file as an unstructured grid
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(vtkFileName)
Expand Down Expand Up @@ -44,8 +44,9 @@ def vtk_to_dict(case):
cases.append('fenics')
cases.append('openfoam')
cases.append('nutils')
cases.append('dunefem')

case_labels = {'fenics': 'OpenFOAM-FEniCS', 'openfoam': 'OpenFOAM-OpenFOAM', 'nutils': 'OpenFOAM-Nutils', }
case_labels = {'fenics': 'OpenFOAM-FEniCS', 'openfoam': 'OpenFOAM-OpenFOAM', 'nutils': 'OpenFOAM-Nutils', 'dunefem': 'OpenFOAM-DuneFem'}
styles = [':', '-', '--']
colors = ['r', 'b', 'g', 'k']
i = 0
Expand Down
1 change: 1 addition & 0 deletions flow-over-heated-plate/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</participant>

<participant name="Solid">
<export:vtk directory="precice-exports" />
<receive-mesh name="Fluid-Mesh" from="Fluid" />
<provide-mesh name="Solid-Mesh" />
<mapping:nearest-neighbor
Expand Down
2 changes: 1 addition & 1 deletion quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ In serial, the simulation should take less than a minute to compute (simulated t

You can visualize the simulation results of the `Fluid` participant using ParaView and loading the (empty) file `fluid-openfoam/fluid-openfoam.foam`. The rigid body does not generate any readable output files, but the OpenFOAM data should be enough for now: click "play" in ParaView, the flap should already be moving! 🎉

You may be curious what displacements OpenFOAM received from the rigid body solver. We can actually easily visualize the coupling meshes, including the exchanged coupling data: preCICE generates the relevant files during the simulation and stores them in the directory `solid-cpp/coupling-meshes`. Load these VTK files in ParaView and apply a `Glyph` filter with `Glyph Type: Arrow`,`Orientation Array: Displacement`, and `Scale Array: No scale array`. You can further add a `Warp By Vector` filter with `Displacement` to deform the coupling data. The result should look as follows:
You may be curious what displacements OpenFOAM received from the rigid body solver. We can actually easily visualize the coupling meshes, including the exchanged coupling data: preCICE generates the relevant files during the simulation and stores them in the directory `solid-cpp/precice-exports`. Load these VTK files in ParaView and apply a `Glyph` filter with `Glyph Type: Arrow`,`Orientation Array: Displacement`, and `Scale Array: No scale array`. You can further add a `Warp By Vector` filter with `Displacement` to deform the coupling data. The result should look as follows:

![result](images/quickstart-result.png)

Expand Down
2 changes: 1 addition & 1 deletion quickstart/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<read-data name="Force" mesh="Solid-Mesh" />
<write-data name="Displacement" mesh="Solid-Mesh" />
<watch-point mesh="Solid-Mesh" name="Flap-Tip" coordinate="0.25;0.0" />
<export:vtk directory="coupling-meshes" />
<export:vtk directory="precice-exports" />
</participant>

<m2n:sockets acceptor="Fluid" connector="Solid" exchange-directory=".." />
Expand Down
1 change: 0 additions & 1 deletion quickstart/solid-cpp/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ set -e -u

. ../../tools/cleaning-tools.sh

rm -rfv coupling-meshes
clean_precice_logs .
clean_case_logs .
2 changes: 1 addition & 1 deletion tools/cleaning-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ clean_precice_logs() {
./precice-*-watchintegral-*.log \
./core
rm -rfv ./precice-profiling/ profiling.json trace.json
rm -rfv ./preCICE-output/
rm -rfv ./precice-exports/
)
}

Expand Down
Loading