Skip to content

Commit e5b72c1

Browse files
davidscnMakisH
andauthored
Add the flow-over-heated-plate for nearest-projection (#159)
* Add the flow-over-heated-plate for nearest-projection * Remove OpenFOAM merch header * Remove OpenFOAM merch header pt 2 * Update run.sh script documentation * Move parts from this tutorial to the adapter docs * Update flow-over-heated-plate-nearest-projection/README.md Co-authored-by: Gerasimos Chourdakis <[email protected]> Co-authored-by: Gerasimos Chourdakis <[email protected]>
1 parent 3ddf707 commit e5b72c1

35 files changed

+1494
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Flow over heated plate nearest projection
3+
permalink: tutorials-flow-over-heated-plate-nearest-projection.html
4+
keywords: OpenFOAM, nearest-projection, CHT
5+
summary: This tutorial introduces an example simulation setup for a nearest-projection mapping. At the moment, it only contains an example with the OpenFOAM adapter. The demonstrated "flow over a heated plate" scenario is exactly the same as in the `buoyantPimpleFoam-laplacianFoam` tutorial.
6+
---
7+
8+
## Setup
9+
10+
The setup is exactly the same as described in our [flow-over-heated-plate tutorial](tutorials-flow-over-heated-plate.html).
11+
12+
## Available solvers
13+
14+
Fluid participant:
15+
16+
* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html).
17+
18+
Solid participant:
19+
20+
* OpenFOAM (laplacianFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html).
21+
22+
The solvers are currently only OpenFOAM related. For information regarding the nearest-projection mapping, have a look in the [OpenFOAM configuration section](adapter-openfoam-config.html).
23+
24+
25+
## Running the Simulation
26+
27+
Open two separate terminals and start each participant by calling the respective run script.
28+
29+
```
30+
cd fluid-openfoam
31+
./run.sh
32+
```
33+
and
34+
```
35+
cd solid-openfoam
36+
./run.sh
37+
```
38+
39+
You can also run OpenFOAM in parallel by `./run.sh -parallel`. If you are using OpenFOAM v1712 / 5.x or older have a look in the `fluid-openfoam/system/controlDict` file and set the appropriate solver name.
40+
41+
## Changes in the Simulation Setup
42+
43+
As we are defining two meshes for each participant, we need to define them in the `precice-config.xml` and `preciceDict` configuration files. Additionally, we need to enable the `connectivity` switch for the adapter.
44+
45+
### Changes in `precice-config.xml`
46+
In order to map from face nodes to face centers, both meshes need to be specified. The nodes-based mesh uses the write data and the centers-based mesh uses the read data. Have a look in the given `precice-config.xml` in this tutorial. Example: `Temperature` is calculated by the `Fluid` participant and passed to the `Solid` participant. Therefore, it is the write data of the participant `Fluid` and the read data of the participant `Solid`. This results in the following two meshes for this data:
47+
```
48+
<mesh name="Fluid-Mesh-Nodes">
49+
<use-data name="Temperature"/>
50+
</mesh>
51+
<mesh name="Solid-Mesh-Centers">
52+
<use-data name="Temperature"/>
53+
</mesh>
54+
```
55+
All further changes follow from this interface splitting. Have a look in the given config files for all details.
56+
57+
### Notes on 2D Cases
58+
59+
From the preCICE point of view, the simulation here is in 3D, as opposed to the original 2D case, as is often the case with 3D solvers (such as OpenFOAM). In such cases, we recommend keeping the out-of-plane thickness of the domain small and comparable to the in-plane cell size. Otherwise, the face centers will have a large distance to the face nodes, which might trigger a preCICE warning and preCICE may even filter out one of the meshes, especially in parallel simulations.
60+
61+
62+
## Post-processing
63+
64+
Have a look at the [flow-over heated-plate](tutorials-flow-over-heated-plate.html) tutorial for the general aspects of post-processing.
65+
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`.
66+
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:
67+
68+
![triangulated](https://user-images.githubusercontent.com/33414590/55974257-96b07d80-5c87-11e9-9965-972b922c483d.png)
69+
70+
Note: Connectivity is defined on meshes associated with mesh nodes, which are named respectively e.g. `Fluid-Mesh-Nodes`. In this case, you could directly see the interface without applying filters by loading the `.vtk` files. In order to visualize additionally center based meshes, where no connectivity is provided, select a Glyph filter in ParaView. Furthermore, it makes a difference, on which participant the `<export...` tag is defined in your `precice-config.xml` file. Each participant exports interface meshes, which he provides or receives. The receiving participant filters out mesh parts that it does not need (for the mapping). Hence, a received mesh might look incomplete.
71+
72+
{% include disclaimer.html content="This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks." %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # Run from this directory
3+
4+
echo "Cleaning..."
5+
6+
clean_case(){
7+
cd ${1}
8+
# Clean the result and auxiliary files
9+
rm -fv *.vtk
10+
rm -fv ${1}.log
11+
rm -fv precice-*.log \
12+
rm -fv precice-postProcessingInfo.log \
13+
rm -fv precice-*-events.json
14+
}
15+
16+
finished_clean(){
17+
cd ..
18+
}
19+
20+
# Openfoam
21+
Name="fluid-openfoam"
22+
clean_case ${Name}
23+
# Clean specialized files
24+
if [ -n "${WM_PROJECT}" ];
25+
then
26+
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
27+
cleanCase
28+
rm -rfv ./0
29+
touch ${Name}.foam
30+
fi
31+
finished_clean
32+
33+
Name="solid-openfoam"
34+
clean_case ${Name}
35+
# Clean specialized files
36+
if [ -n "${WM_PROJECT}" ];
37+
then
38+
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
39+
cleanCase
40+
rm -rfv ./0
41+
touch ${Name}.foam
42+
fi
43+
finished_clean
44+
45+
# Remove the preCICE address files
46+
rm -rfv precice-run
47+
48+
echo "Cleaning complete!"
49+
#------------------------------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volScalarField;
6+
object T;
7+
}
8+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9+
10+
dimensions [ 0 0 0 1 0 0 0 ];
11+
12+
internalField uniform 300;
13+
14+
boundaryField
15+
{
16+
interface
17+
{
18+
type fixedGradient;
19+
gradient uniform 0;
20+
}
21+
inlet
22+
{
23+
type fixedValue;
24+
value $internalField;
25+
}
26+
outlet
27+
{
28+
type zeroGradient;
29+
}
30+
top
31+
{
32+
type zeroGradient;
33+
}
34+
bottom
35+
{
36+
type zeroGradient;
37+
}
38+
slip-bottom
39+
{
40+
type zeroGradient;
41+
}
42+
outerWall
43+
{
44+
type zeroGradient;
45+
}
46+
defaultFaces
47+
{
48+
type empty;
49+
}
50+
}
51+
52+
53+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volVectorField;
6+
object U;
7+
}
8+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9+
10+
dimensions [ 0 1 -1 0 0 0 0 ];
11+
12+
internalField uniform ( 0.1 0 0 );
13+
14+
boundaryField
15+
{
16+
interface
17+
{
18+
type noSlip;
19+
}
20+
inlet
21+
{
22+
type fixedValue;
23+
value $internalField;
24+
}
25+
outlet
26+
{
27+
type zeroGradient;
28+
}
29+
top
30+
{
31+
type slip;
32+
}
33+
bottom
34+
{
35+
type noSlip;
36+
}
37+
slip-bottom
38+
{
39+
type slip;
40+
}
41+
defaultFaces
42+
{
43+
type empty;
44+
}
45+
}
46+
47+
48+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volScalarField;
6+
location "0";
7+
object alphat;
8+
}
9+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10+
11+
dimensions [ 1 -1 -1 0 0 0 0 ];
12+
13+
internalField uniform 0;
14+
15+
boundaryField
16+
{
17+
interface
18+
{
19+
type compressible::alphatWallFunction;
20+
value uniform 0;
21+
}
22+
inlet
23+
{
24+
type compressible::alphatWallFunction;
25+
value uniform 0;
26+
}
27+
outlet
28+
{
29+
type compressible::alphatWallFunction;
30+
value uniform 0;
31+
}
32+
top
33+
{
34+
type compressible::alphatWallFunction;
35+
value uniform 0;
36+
}
37+
bottom
38+
{
39+
type compressible::alphatWallFunction;
40+
value uniform 0;
41+
}
42+
slip-bottom
43+
{
44+
type compressible::alphatWallFunction;
45+
value uniform 0;
46+
}
47+
defaultFaces
48+
{
49+
type empty;
50+
}
51+
}
52+
53+
54+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volScalarField;
6+
location "0";
7+
object epsilon;
8+
}
9+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10+
11+
dimensions [ 0 2 -3 0 0 0 0 ];
12+
13+
internalField uniform 0.01;
14+
15+
boundaryField
16+
{
17+
interface
18+
{
19+
type epsilonWallFunction;
20+
value uniform 0.01;
21+
}
22+
inlet
23+
{
24+
type epsilonWallFunction;
25+
value uniform 0.01;
26+
}
27+
outlet
28+
{
29+
type epsilonWallFunction;
30+
value uniform 0.01;
31+
}
32+
top
33+
{
34+
type epsilonWallFunction;
35+
value uniform 0.01;
36+
}
37+
bottom
38+
{
39+
type epsilonWallFunction;
40+
value uniform 0.01;
41+
}
42+
slip-bottom
43+
{
44+
type epsilonWallFunction;
45+
value uniform 0.01;
46+
}
47+
defaultFaces
48+
{
49+
type empty;
50+
}
51+
}
52+
53+
54+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volScalarField;
6+
location "0";
7+
object k;
8+
}
9+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10+
11+
dimensions [ 0 2 -2 0 0 0 0 ];
12+
13+
internalField uniform 0.1;
14+
15+
boundaryField
16+
{
17+
interface
18+
{
19+
type kqRWallFunction;
20+
value uniform 0.1;
21+
}
22+
inlet
23+
{
24+
type kqRWallFunction;
25+
value uniform 0.1;
26+
}
27+
outlet
28+
{
29+
type kqRWallFunction;
30+
value uniform 0.1;
31+
}
32+
top
33+
{
34+
type kqRWallFunction;
35+
value uniform 0.1;
36+
}
37+
slip-bottom
38+
{
39+
type kqRWallFunction;
40+
value uniform 0.1;
41+
}
42+
bottom
43+
{
44+
type kqRWallFunction;
45+
value uniform 0.1;
46+
}
47+
defaultFaces
48+
{
49+
type empty;
50+
}
51+
}
52+
53+
54+
// ************************************************************************* //

0 commit comments

Comments
 (0)