Skip to content

Commit 0adde0d

Browse files
committed
Finished test case, added reference data for a few typical schemes and plotting thereof
1 parent 86da0f0 commit 0adde0d

File tree

10 files changed

+4133
-1792
lines changed

10 files changed

+4133
-1792
lines changed

OFtutorial15_discretisation/OFtutorial15.C

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,35 @@ License
2626

2727
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2828

29+
30+
/*
31+
scalarTransportFoam solver solves this:
32+
33+
while (simple.loop(runTime))
34+
{
35+
Info<< "Time = " << runTime.timeName() << nl << endl;
36+
37+
while (simple.correctNonOrthogonal())
38+
{
39+
fvScalarMatrix TEqn
40+
(
41+
fvm::ddt(T)
42+
+ fvm::div(phi, T)
43+
- fvm::laplacian(DT, T)
44+
==
45+
fvOptions(T)
46+
);
47+
48+
TEqn.relax();
49+
fvOptions.constrain(TEqn);
50+
TEqn.solve();
51+
fvOptions.correct(T);
52+
}
53+
54+
runTime.write();
55+
}
56+
*/
57+
2958
int main(int argc, char *argv[])
3059
{
3160
// Set up the case, parse command line options and create the grid
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
rm -rf constant/polyMesh/* log.* 0.* 1* 2*
2+
rm -rf constant/polyMesh/* log.* 0.* 1* 2* postProcessing
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Sun Jun 6 11:04:35 2021
5+
6+
@author: artur
7+
"""
8+
9+
import pandas
10+
import numpy as np
11+
import matplotlib
12+
import matplotlib.pyplot as plt
13+
import os
14+
15+
font = {'family' : 'serif',
16+
'weight' : 'normal',
17+
'size' : 16}
18+
19+
matplotlib.rc('font', **font)
20+
21+
# %% Read the data.
22+
refData = {f.split("_")[1].replace(".csv", ""): pandas.read_csv(os.path.join("refData", f))
23+
for f in os.listdir("./refData")}
24+
25+
# %% Plot solutions obtained using each scheme.
26+
fig, ax = plt.subplots(1)
27+
ax.set_xlabel("x [m]")
28+
ax.set_ylabel(r"$\phi$ [-]")
29+
for s in refData:
30+
ax.plot(refData[s]["x"], refData[s]["T"], "o--", lw=1, ms=4, mew=2, label=s)
31+
xlim = ax.get_xlim()
32+
ax.hlines([0, 1], xlim[0], xlim[1], color="k", ls="--", alpha=0.5, zorder=-10)
33+
ax.set_xlim(xlim)
34+
ax.legend(loc="lower left", framealpha=1)
35+
plt.tight_layout()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
x,y,z,T
2+
0.025,0.05,0.05,1.00021
3+
0.075,0.05,0.05,0.999031
4+
0.125,0.05,0.05,0.99892
5+
0.175,0.05,0.05,1.00479
6+
0.225,0.05,0.05,1.01202
7+
0.275,0.05,0.05,1.00212
8+
0.325,0.05,0.05,0.953314
9+
0.375,0.05,0.05,0.855654
10+
0.425,0.05,0.05,0.717507
11+
0.475,0.05,0.05,0.560317
12+
0.525,0.05,0.05,0.407872
13+
0.575,0.05,0.05,0.277604
14+
0.625,0.05,0.05,0.177362
15+
0.675,0.05,0.05,0.106822
16+
0.725,0.05,0.05,0.060899
17+
0.775,0.05,0.05,0.0329906
18+
0.825,0.05,0.05,0.0170445
19+
0.875,0.05,0.05,0.00841831
20+
0.925,0.05,0.05,0.00402652
21+
0.975,0.05,0.05,0.00165676
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
x,y,z,T
2+
0.025,0.05,0.05,0.999996
3+
0.075,0.05,0.05,1.00001
4+
0.125,0.05,0.05,1.00022
5+
0.175,0.05,0.05,1.0004
6+
0.225,0.05,0.05,0.997676
7+
0.275,0.05,0.05,0.983597
8+
0.325,0.05,0.05,0.94426
9+
0.375,0.05,0.05,0.866203
10+
0.425,0.05,0.05,0.745505
11+
0.475,0.05,0.05,0.593092
12+
0.525,0.05,0.05,0.43145
13+
0.575,0.05,0.05,0.284822
14+
0.625,0.05,0.05,0.169655
15+
0.675,0.05,0.05,0.0907059
16+
0.725,0.05,0.05,0.0432548
17+
0.775,0.05,0.05,0.0182241
18+
0.825,0.05,0.05,0.00667237
19+
0.875,0.05,0.05,0.00205313
20+
0.925,0.05,0.05,0.000487457
21+
0.975,0.05,0.05,4.4752e-05
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
x,y,z,T
2+
0.025,0.05,0.05,0.999308
3+
0.075,0.05,0.05,0.996427
4+
0.125,0.05,0.05,0.989001
5+
0.175,0.05,0.05,0.973398
6+
0.225,0.05,0.05,0.945365
7+
0.275,0.05,0.05,0.901116
8+
0.325,0.05,0.05,0.838635
9+
0.375,0.05,0.05,0.758637
10+
0.425,0.05,0.05,0.664766
11+
0.475,0.05,0.05,0.562933
12+
0.525,0.05,0.05,0.460049
13+
0.575,0.05,0.05,0.362635
14+
0.625,0.05,0.05,0.275731
15+
0.675,0.05,0.05,0.202337
16+
0.725,0.05,0.05,0.143416
17+
0.775,0.05,0.05,0.0982881
18+
0.825,0.05,0.05,0.0652061
19+
0.875,0.05,0.05,0.041932
20+
0.925,0.05,0.05,0.0262306
21+
0.975,0.05,0.05,0.0165926

OFtutorial15_discretisation/testCase/system/controlDict

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ startTime 0;
2323

2424
stopAt endTime;
2525

26-
endTime 1.5;
26+
endTime 0.99;
2727

2828
deltaT 0.01;
2929

3030
writeControl timeStep;
3131

32-
writeInterval 10;
32+
writeInterval 50;
3333

3434
purgeWrite 0;
3535

@@ -45,6 +45,31 @@ timePrecision 6;
4545

4646
runTimeModifiable true;
4747

48+
functions
49+
{
50+
samplingLine
51+
{
52+
type sets;
53+
libs ("libsampling.so");
54+
writeControl writeTime;
55+
56+
fields (T);
57+
interpolationScheme cellPoint;
58+
setFormat csv;
59+
60+
sets
61+
(
62+
centrelineData
63+
{
64+
type lineCell;
65+
axis xyz;
66+
nPoints 100;
67+
start (0 0.05 0.05);
68+
end (1 0.05 0.05);
69+
}
70+
);
71+
}
72+
}
4873

4974
// ************************************************************************* //
5075

OFtutorial15_discretisation/testCase/system/fvSchemes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ gradSchemes
2828
divSchemes
2929
{
3030
default none;
31-
div(phi,T) Gauss linearUpwind grad(T);
31+
// div(phi,T) Gauss linearUpwind grad(T);
32+
// div(phi,T) Gauss upwind;
33+
div(phi,T) Gauss linear;
3234
}
3335

3436
laplacianSchemes
25.4 KB
Loading

0 commit comments

Comments
 (0)