2
2
========= |
3
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
4
\\ / O peration |
5
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6
- \\/ M anipulation |
5
+ \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6
+ \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
7
7
-------------------------------------------------------------------------------
8
+ QGDsolver | Copyright (C) 2016-2018 ISP RAS (www.unicfd.ru)
9
+ -------------------------------------------------------------------------------
10
+
8
11
License
9
- This file is part of OpenFOAM.
10
-
12
+ This file is part of QGDsolver, based on OpenFOAM library .
13
+
11
14
OpenFOAM is free software: you can redistribute it and/or modify it
12
15
under the terms of the GNU General Public License as published by
13
16
the Free Software Foundation, either version 3 of the License, or
14
17
(at your option) any later version.
15
-
18
+
16
19
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
20
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
21
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
22
for more details.
20
-
23
+
21
24
You should have received a copy of the GNU General Public License
22
25
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
-
26
+
24
27
\*---------------------------------------------------------------------------*/
25
28
26
29
#include "QGDCoeffs.H"
@@ -30,7 +33,9 @@ License
30
33
#include "Time.H"
31
34
#include "addToRunTimeSelectionTable.H"
32
35
#include "coupledFvsPatchFields.H"
33
- #include "psiQGDThermo.H"
36
+ #include "QGDThermo.H"
37
+ #include "linear.H"
38
+ #include "emptyFvPatch.H"
34
39
35
40
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36
41
@@ -56,10 +61,10 @@ autoPtr<QGDCoeffs> QGDCoeffs::New
56
61
)
57
62
{
58
63
Info << "Selecting QGD coeffs evaluation approach type " << qgdCoeffsType << endl ;
59
-
64
+
60
65
dictionaryConstructorTable ::iterator cstrIter =
61
66
dictionaryConstructorTablePtr_ -> find (qgdCoeffsType );
62
-
67
+
63
68
if (cstrIter == dictionaryConstructorTablePtr_ -> end ())
64
69
{
65
70
FatalErrorIn
@@ -70,7 +75,7 @@ autoPtr<QGDCoeffs> QGDCoeffs::New
70
75
<< dictionaryConstructorTablePtr_ -> sortedToc ()
71
76
<< exit (FatalError );
72
77
}
73
-
78
+
74
79
return autoPtr < QGDCoeffs >
75
80
(
76
81
cstrIter ()
@@ -122,6 +127,11 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
122
127
mesh ,
123
128
dimensionSet (1 , -1 , -1 , 0 , 0 )
124
129
),
130
+ hQGDf_
131
+ (
132
+ "hQGDf" ,
133
+ 1.0 / mag (mesh .surfaceInterpolation ::deltaCoeffs ())
134
+ ),
125
135
hQGD_
126
136
(
127
137
IOobject
@@ -132,7 +142,8 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
132
142
IOobject ::NO_READ ,
133
143
IOobject ::NO_WRITE
134
144
),
135
- qgdLength (mesh )()
145
+ mesh ,
146
+ hQGDf_ .dimensions ()
136
147
),
137
148
aQGD_
138
149
(
@@ -159,6 +170,11 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
159
170
mesh ,
160
171
dimensionSet (0 , 0 , 1 , 0 , 0 )
161
172
),
173
+ tauQGDf_
174
+ (
175
+ "tauQGDf" ,
176
+ linearInterpolate (tauQGD_ )
177
+ ),
162
178
PrQGD_
163
179
(
164
180
IOobject
@@ -179,20 +195,21 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
179
195
"ScQGD" ,
180
196
mesh .time ().timeName (),
181
197
mesh ,
182
- IOobject ::NO_READ ,
198
+ IOobject ::READ_IF_PRESENT ,
183
199
IOobject ::NO_WRITE
184
200
),
185
201
mesh ,
186
202
dimensionSet (0 , 0 , 0 , 0 , 0 )
187
203
)
188
204
{
205
+ this -> updateQGDLength (mesh );
189
206
}
190
207
191
208
QGDCoeffs ::~QGDCoeffs ()
192
209
{
193
210
}
194
211
195
- void Foam ::qgd ::QGDCoeffs ::correct (const psiQGDThermo & qgdThermo )
212
+ void Foam ::qgd ::QGDCoeffs ::correct (const QGDThermo & qgdThermo )
196
213
{
197
214
forAll (tauQGD_ , celli )
198
215
{
@@ -206,79 +223,93 @@ void Foam::qgd::QGDCoeffs::correct(const psiQGDThermo& qgdThermo)
206
223
{
207
224
forAll (tauQGD_ .boundaryField ()[patchi ], facei )
208
225
{
209
- tauQGD_ .boundaryFieldRef ()[patchi ][facei ] =
226
+ tauQGD_ .boundaryFieldRef ()[patchi ][facei ] =
210
227
0.0 ;
211
- muQGD_ .boundaryFieldRef ()[patchi ][facei ] =
228
+ muQGD_ .boundaryFieldRef ()[patchi ][facei ] =
212
229
0.0 ;
213
- alphauQGD_ .boundaryFieldRef ()[patchi ][facei ] =
230
+ alphauQGD_ .boundaryFieldRef ()[patchi ][facei ] =
214
231
0.0 ;
215
- PrQGD_ .boundaryFieldRef ()[patchi ][facei ] =
232
+ PrQGD_ .boundaryFieldRef ()[patchi ][facei ] =
216
233
1.0 ;
217
- ScQGD_ .boundaryFieldRef ()[patchi ][facei ] =
234
+ ScQGD_ .boundaryFieldRef ()[patchi ][facei ] =
218
235
1.0 ;
219
236
}
220
237
}
221
238
}
222
239
223
- Foam :: tmp < Foam :: volScalarField > Foam ::qgd ::QGDCoeffs ::qgdLength (const fvMesh & mesh )
240
+ void Foam ::qgd ::QGDCoeffs ::updateQGDLength (const fvMesh & mesh )
224
241
{
225
- tmp < volScalarField > tqgdLen
226
- (
227
- new volScalarField
228
- (
229
- IOobject
230
- (
231
- "hQGD" ,
232
- mesh .time ().timeName (),
233
- mesh ,
234
- IOobject ::NO_READ ,
235
- IOobject ::NO_WRITE
236
- ),
237
- mesh ,
238
- dimensionSet (0 , 1 , 0 , 0 , 0 )
239
- )
240
- );
241
-
242
- volScalarField & qgdLen = tqgdLen .ref ();
243
-
244
- surfaceScalarField hf
245
- (
246
- 1.0 / mag (mesh .surfaceInterpolation ::deltaCoeffs ())
247
- );
248
-
249
- scalar cdist = 0.0 ;
250
- forAll (qgdLen , celli )
242
+ {
243
+ scalar hown = 0.0 ;
244
+ scalar hnei = 0.0 ;
245
+ forAll (hQGDf_ .primitiveField (), iFace )
246
+ {
247
+ hown = mag (mesh .C ()[mesh .owner ()[iFace ]] - mesh .Cf ()[iFace ]);
248
+ hnei = mag (mesh .C ()[mesh .neighbour ()[iFace ]] - mesh .Cf ()[iFace ]);
249
+ hQGDf_ .primitiveFieldRef ()[iFace ] = 2.0 * min (hown , hnei );
250
+ }
251
+
252
+ forAll (mesh .boundary (), patchi )
253
+ {
254
+ const fvPatch & fvp = mesh .boundary ()[patchi ];
255
+ if (!fvp .coupled ())
256
+ {
257
+ hQGDf_ .boundaryFieldRef ()[patchi ] *= 2.0 ;
258
+ }
259
+ }
260
+ }
261
+
262
+ scalar hint = 0.0 ;
263
+ scalar surf = 0.0 ;
264
+ label fid = 0 ;
265
+ forAll (hQGD_ , celli )
251
266
{
252
267
const cell & c = mesh .cells ()[celli ];
253
- scalar maxlen = 0.0 ;
268
+ hint = 0.0 ;
269
+ surf = 0.0 ;
270
+ label pid = -1 ;
271
+ label pfid = -1 ;
254
272
forAll (c , facei )
255
273
{
256
- if (mesh .isInternalFace (c [facei ]))
274
+ fid = c [facei ];
275
+
276
+ if (mesh .isInternalFace (fid ))
257
277
{
258
- cdist = hf [c [facei ]];
259
- if (cdist > maxlen )
278
+ hint += hQGDf_ [fid ] * mesh .magSf ()[fid ];
279
+ surf += mesh .magSf ()[fid ];
280
+ }
281
+ else
282
+ {
283
+ pid = mesh .boundaryMesh ().whichPatch (fid );
284
+ if (pid >= 0 )
260
285
{
261
- maxlen = hf [c [facei ]];
286
+ if (!isA < emptyFvPatch > (mesh .boundary ()[pid ]))
287
+ {
288
+ pfid = mesh .boundaryMesh ()[pid ].whichFace (fid );
289
+
290
+ hint += hQGDf_ .boundaryField ()[pid ][pfid ] *
291
+ mesh .magSf ().boundaryField ()[pid ][pfid ];
292
+ surf += mesh .magSf ().boundaryField ()[pid ][pfid ];
293
+ }
262
294
}
263
295
}
264
296
}
265
- qgdLen .primitiveFieldRef ()[celli ] = maxlen ;
297
+
298
+ hQGD_ .primitiveFieldRef ()[celli ] = hint / surf ;
266
299
}
267
-
300
+
268
301
forAll (mesh .boundary (), patchi )
269
302
{
270
- const fvPatch & fvp = mesh .boundary ()[patchi ];
271
- if (fvp .coupled ())
303
+ if (!isA < emptyFvPatch > (mesh .boundary ()[patchi ]))
272
304
{
273
- qgdLen .boundaryFieldRef ()[patchi ] = hf .boundaryField ()[patchi ];
274
- }
275
- else
276
- {
277
- qgdLen .boundaryFieldRef ()[patchi ] = 2.0 * hf .boundaryField ()[patchi ];
305
+ hQGD_ .boundaryFieldRef ()[patchi ] = hQGDf_ .boundaryField ()[patchi ] * 1.0 ;
278
306
}
279
307
}
280
-
281
- return tqgdLen ;
308
+ }
309
+
310
+ const Foam ::surfaceScalarField & Foam ::qgd ::QGDCoeffs ::hQGDf () const
311
+ {
312
+ return hQGDf_ ;
282
313
}
283
314
284
315
const Foam ::volScalarField & Foam ::qgd ::QGDCoeffs ::hQGD () const
@@ -301,10 +332,14 @@ const Foam::volScalarField& Foam::qgd::QGDCoeffs::tauQGD() const
301
332
return tauQGD_ ;
302
333
}
303
334
335
+ const Foam ::surfaceScalarField & Foam ::qgd ::QGDCoeffs ::tauQGDf () const
336
+ {
337
+ return tauQGDf_ ;
338
+ }
339
+
304
340
}; //namespace qgd
305
341
306
342
}; //namespace Foam
307
343
308
344
309
345
//END-OF-FILE
310
-
0 commit comments