Skip to content

Commit 83fab0c

Browse files
committed
Create the case waterChannel
1 parent ff2dbe2 commit 83fab0c

File tree

16 files changed

+682
-1
lines changed

16 files changed

+682
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
# OpenFOAM
1+
# OpenFOAM Tutorials Plus
2+
This repository contains several OpenFOAM cases and notes related to my blog [OpenFOAM Studio [in Chinese]](https://zhuanlan.zhihu.com/openfoam).
3+
4+
Here's a brief description:
5+
* **linuxCheatSheet**
6+
7+
OpenFOAM Linux Cheat Sheet.
8+
9+
* **flatPlate**
10+
11+
A simple 2D geometry is used to show the development of a turbulent boundary layer. It's an exercise of [Flow over a flat plate - YouTube](https://youtu.be/69Nna1UjICI).
12+
13+
* **abruptContraction**
14+
15+
Abrupt contraction of a rectangular channel where cavitation occures. The *blockMeshDict* is written with variables. *interPhaseChangeFoam*, *pisoFoam* and *pimpleFoam* are used.
16+
17+
* **abruptContractionPar**
18+
19+
Parallel edition of abruptContraction.
20+
21+
* **waterChannel**
22+
23+
Two-phase open channel flow. It's a fork of the original interFoam tutorial *waterChannel*. The *surfaces* function is configured to generate water surfaces (namely, the isosurfaces where *alpha.water* is equal to 0.5).
24+
25+
Pull requests are welcome! Happy foaming!

waterChannel/Allclean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # Run from this directory
3+
4+
# Source tutorial clean functions
5+
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
6+
7+
rm 0/alpha.water.gz 0/alpha.water 2>/dev/null
8+
rm -rf *Flux
9+
10+
cleanCase

waterChannel/Allmesh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # run from this directory
3+
4+
# Source tutorial run functions
5+
. $WM_PROJECT_DIR/bin/tools/RunFunctions
6+
7+
application=`getApplication`
8+
9+
runApplication blockMesh
10+
11+
echo "Creating channel"
12+
i=1
13+
while [ "$i" -lt 3 ] ; do
14+
cp system/extrudeMeshDict.${i} system/extrudeMeshDict
15+
echo "Running extrudeMesh, instance" ${i}
16+
extrudeMesh > log.extrudeMesh.${i}
17+
i=`expr $i + 1`
18+
done
19+
20+
#------------------------------------------------------------------------------

waterChannel/Allrun

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # Run from this directory
3+
4+
# Source tutorial run functions
5+
. $WM_PROJECT_DIR/bin/tools/RunFunctions
6+
7+
application=`getApplication`
8+
9+
./Allmesh
10+
11+
cp 0/alpha.water.orig 0/alpha.water
12+
runApplication setFields
13+
14+
runApplication $application
15+
16+
#------------------------------------------------------------------------------

waterChannel/constant/g

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class uniformDimensionedVectorField;
13+
location "constant";
14+
object g;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
dimensions [0 1 -2 0 0 0 0];
19+
value (0 0 -9.81);
20+
21+
// ************************************************************************* //
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
location "constant";
14+
object transportProperties;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
phases (water air);
19+
20+
water
21+
{
22+
transportModel Newtonian;
23+
nu [0 2 -1 0 0 0 0] 1e-06;
24+
rho [1 -3 0 0 0 0 0] 1000;
25+
}
26+
27+
air
28+
{
29+
transportModel Newtonian;
30+
nu [0 2 -1 0 0 0 0] 1.48e-05;
31+
rho [1 -3 0 0 0 0 0] 1;
32+
}
33+
34+
sigma [1 0 -2 0 0 0 0] 0.07;
35+
36+
37+
// ************************************************************************* //
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
location "constant";
14+
object turbulenceProperties;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
simulationType RAS;
19+
20+
RAS
21+
{
22+
RASModel kOmegaSST;
23+
24+
turbulence on;
25+
26+
printCoeffs on;
27+
}
28+
29+
30+
// ************************************************************************* //

waterChannel/system/blockMeshDict

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
object blockMeshDict;
14+
}
15+
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
convertToMeters 1;
19+
20+
vertices
21+
(
22+
( 0 -10 2) // 0
23+
(20 -10 2) // 1
24+
( 0 -3 2) // 2
25+
(20 -3 2) // 3
26+
( 0 3 2) // 4
27+
(20 3 2) // 5
28+
( 0 10 2) // 6
29+
(20 10 2) // 7
30+
31+
( 0 -10 8) // 8
32+
(20 -10 8) // 9
33+
( 0 -4 8) // 10
34+
(20 -4 8) // 11
35+
( 0 4 8) // 12
36+
(20 4 8) // 13
37+
( 0 10 8) // 14
38+
(20 10 8) // 15
39+
);
40+
41+
blocks
42+
(
43+
hex (0 1 3 2 8 9 11 10) (20 5 20) simpleGrading (1 1 1)
44+
hex (2 3 5 4 10 11 13 12) (20 10 20) simpleGrading (1 1 1)
45+
hex (4 5 7 6 12 13 15 14) (20 5 20) simpleGrading (1 1 1)
46+
);
47+
48+
edges
49+
(
50+
);
51+
52+
boundary
53+
(
54+
inlet
55+
{
56+
type patch;
57+
faces
58+
(
59+
(0 1 3 2)
60+
(4 5 7 6)
61+
);
62+
}
63+
64+
walls
65+
{
66+
type wall;
67+
faces
68+
(
69+
(2 3 5 4)
70+
(0 1 9 8)
71+
(0 2 10 8)
72+
(1 3 11 9)
73+
(2 4 12 10)
74+
(5 7 15 13)
75+
(6 7 15 14)
76+
(4 6 14 12)
77+
);
78+
}
79+
80+
outlet
81+
{
82+
type patch;
83+
faces
84+
(
85+
(3 5 13 11)
86+
);
87+
}
88+
89+
atmosphere
90+
{
91+
type patch;
92+
faces
93+
(
94+
(8 9 11 10)
95+
(10 11 13 12)
96+
(12 13 15 14)
97+
);
98+
}
99+
);
100+
101+
// ************************************************************************* //

waterChannel/system/controlDict

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
location "system";
14+
object controlDict;
15+
}
16+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17+
18+
application interFoam;
19+
20+
startFrom startTime;
21+
22+
startTime 0;
23+
24+
stopAt endTime;
25+
26+
endTime 200;
27+
28+
deltaT 0.1;
29+
30+
writeControl adjustableRunTime;
31+
32+
writeInterval 5;
33+
34+
purgeWrite 0;
35+
36+
writeFormat ascii;
37+
38+
writePrecision 6;
39+
40+
writeCompression compressed;
41+
42+
timeFormat general;
43+
44+
timePrecision 6;
45+
46+
runTimeModifiable yes;
47+
48+
adjustTimeStep yes;
49+
50+
maxCo 6;
51+
maxAlphaCo 6;
52+
maxDeltaT 1;
53+
54+
functions
55+
{
56+
#includeFunc surfaces
57+
58+
inletFlux
59+
{
60+
type surfaceRegion;
61+
libs ("libfieldFunctionObjects.so");
62+
writeControl timeStep;
63+
log true;
64+
// Output field values as well
65+
writeFields false;
66+
regionType patch;
67+
name inlet;
68+
operation sum;
69+
70+
fields
71+
(
72+
rhoPhi
73+
);
74+
}
75+
76+
outletFlux
77+
{
78+
$inletFlux;
79+
name outlet;
80+
}
81+
82+
atmosphereFlux
83+
{
84+
$inletFlux;
85+
name atmosphere;
86+
}
87+
88+
}
89+
90+
// ************************************************************************* //
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
| ========= | |
3+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4+
| \\ / O peration | Version: 4.1 |
5+
| \\ / A nd | Web: www.OpenFOAM.org |
6+
| \\/ M anipulation | |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
version 2.0;
11+
format ascii;
12+
class dictionary;
13+
object extrudeProperties;
14+
}
15+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16+
17+
constructFrom mesh;
18+
sourceCase "$FOAM_CASE";
19+
sourcePatches (outlet);
20+
21+
flipNormals false;
22+
23+
extrudeModel linearDirection;
24+
25+
nLayers 40;
26+
expansionRatio 1.0;
27+
28+
linearDirectionCoeffs
29+
{
30+
axisPt (0 0 0);
31+
direction (1 -0.2 -0.03);
32+
thickness 40;
33+
}
34+
35+
mergeFaces false;
36+
37+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

0 commit comments

Comments
 (0)