-
Notifications
You must be signed in to change notification settings - Fork 4
/
getFields.H
156 lines (139 loc) · 3.2 KB
/
getFields.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
IOobject Uheader
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
IOobject UMeanheader
(
"UMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
if (Uheader.headerOk())
{
Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh);
Info<< " Reading UMean" << endl;
volVectorField UMean(UMeanheader, mesh);
volVectorField UPrime(U-UMean);
volVectorField vorticityPrime(fvc::curl(UPrime));
volVectorField vorticityMean(fvc::curl(UMean));
volTensorField UMeanGrad(fvc::grad(UMean));
volTensorField UPrimeGrad(fvc::grad(UPrime));
volTensorField vorticityMeanGrad(fvc::grad(vorticityMean));
volTensorField vorticityPrimeGrad(fvc::grad(vorticityPrime));
Info<< " Calculating P1 term" << endl;
volScalarField enstrophyProd1
(
IOobject
(
"enstrophyProd1",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
(vorticityPrime * vorticityPrime) && UMeanGrad
);
Info<< " Calculating P2 term" << endl;
volScalarField enstrophyProd2
(
IOobject
(
"enstrophyProd2",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
(vorticityPrime & UPrimeGrad) & vorticityMean
);
Info<< " Calculating P3 term" << endl;
volScalarField enstrophyProd3
(
IOobject
(
"enstrophyProd3",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
(UPrime * vorticityPrime) && vorticityMeanGrad
);
Info<< " Calculating P4 term" << endl;
volScalarField enstrophyProd4
(
IOobject
(
"enstrophyProd4",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
(vorticityPrime * vorticityPrime) && UPrimeGrad
);
Info<< " Calculating transport term" << endl;
volScalarField enstrophyTransport
(
IOobject
(
"enstrophyTransort",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
-0.5 * fvc::div( UPrime & (vorticityPrime * vorticityPrime))
);
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar nu(transportProperties.lookup("nu"));
Info<< " Calculating viscous diffusion term" << endl;
volScalarField enstrophyDiffusion
(
IOobject
(
"enstrophyDiffusion",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
nu * fvc::laplacian( 0.5*magSqr(vorticityPrime) )
);
Info<< " Calculating viscous dissipation term" << endl;
volScalarField enstrophyDissipation
(
IOobject
(
"enstrophyDissipation",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
-1.0 * nu * (vorticityPrimeGrad && vorticityPrimeGrad)
);
if (writeResults)
{
Info<< " Writing terms to files" << endl;
enstrophyProd1.write();
enstrophyProd2.write();
enstrophyProd3.write();
enstrophyProd4.write();
enstrophyTransport.write();
enstrophyDiffusion.write();
enstrophyDissipation.write();
}
}
else
{
Info<< " No UMean" << endl;
}