Skip to content

Commit 7dc998d

Browse files
authored
Merge pull request #6 from unicfdlab/sdev-4.1
Sdev 4.1
2 parents f53fdea + e572760 commit 7dc998d

File tree

154 files changed

+6732
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+6732
-681
lines changed

Allwclean

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ cd QGD; wclean; wcleanLnIncludeAll; cd ../
44

55
cd QGDFoam; ./Allwclean; cd ../
66

7-
cd mQGDFoam; ./Allwclean; cd ../
7+
cd QHDFoam; ./Allwclean; cd ../
8+
9+
cd TQGDFoam; ./Allwclean; cd ../
10+
11+
cd cQGDFoam; ./Allwclean; cd ../
12+
13+
cd vQGDFoam; ./Allwclean; cd ../
14+
15+
cd utils/selectBadCells; wclean; cd ../../
816

917
#
1018
#END-OF-FILE

Allwmake

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ cd QGD; wmake libso; cd ../
44

55
cd QGDFoam; ./Allwmake; cd ../
66

7+
cd QHDFoam; ./Allwmake; cd ../
8+
9+
cd TQGDFoam; ./Allwmake; cd ../
10+
11+
cd cQGDFoam; ./Allwmake; cd ../
12+
13+
cd vQGDFoam; ./Allwmake; cd ../
14+
15+
cd utils/selectBadCells; wmake; cd ../../
16+
717
#
818
#END-OF-FILE
919
#

QGD/Make/files

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ fvsc/leastSquaresOpt/extendedFaceStencilScalarGradOpt.C
1616
/* QGD Coeffs */
1717
QGDCoeffs/QGDCoeffs/QGDCoeffs.C
1818
QGDCoeffs/constScPrModel1QGDCoeffs/constScPrModel1QGDCoeffs.C
19+
QGDCoeffs/constScPrModel2QGDCoeffs/constScPrModel2QGDCoeffs.C
20+
QGDCoeffs/varScModel5QGDCoeffs/varScModel5QGDCoeffs.C
21+
QGDCoeffs/alphaH2bynuQHD/alphaH2bynuQHD.C
22+
QGDCoeffs/alphaHbyUQHD/alphaHbyUQHD.C
23+
/*QGDCoeffs/varScModel6QGDCoeffs/varScModel6QGDCoeffs.C*/
1924

25+
thermoModels/QGDThermo/QGDThermo.C
2026
thermoModels/psiQGDThermo/psiQGDThermo.C
2127
thermoModels/psiQGDThermo/psiQGDThermos.C
28+
thermoModels/rhoQGDThermo/rhoQGDThermo.C
29+
thermoModels/rhoQGDThermo/rhoQGDThermos.C
2230

2331
LIB = $(FOAM_USER_LIBBIN)/libQGD
24-

QGD/QGDCoeffs/QGDCoeffs/QGDCoeffs.C

+98-63
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / 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.
77
-------------------------------------------------------------------------------
8+
QGDsolver | Copyright (C) 2016-2018 ISP RAS (www.unicfd.ru)
9+
-------------------------------------------------------------------------------
10+
811
License
9-
This file is part of OpenFOAM.
10-
12+
This file is part of QGDsolver, based on OpenFOAM library.
13+
1114
OpenFOAM is free software: you can redistribute it and/or modify it
1215
under the terms of the GNU General Public License as published by
1316
the Free Software Foundation, either version 3 of the License, or
1417
(at your option) any later version.
15-
18+
1619
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
1720
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1821
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1922
for more details.
20-
23+
2124
You should have received a copy of the GNU General Public License
2225
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23-
26+
2427
\*---------------------------------------------------------------------------*/
2528

2629
#include "QGDCoeffs.H"
@@ -30,7 +33,9 @@ License
3033
#include "Time.H"
3134
#include "addToRunTimeSelectionTable.H"
3235
#include "coupledFvsPatchFields.H"
33-
#include "psiQGDThermo.H"
36+
#include "QGDThermo.H"
37+
#include "linear.H"
38+
#include "emptyFvPatch.H"
3439

3540
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
3641

@@ -56,10 +61,10 @@ autoPtr<QGDCoeffs> QGDCoeffs::New
5661
)
5762
{
5863
Info<< "Selecting QGD coeffs evaluation approach type " << qgdCoeffsType << endl;
59-
64+
6065
dictionaryConstructorTable::iterator cstrIter =
6166
dictionaryConstructorTablePtr_->find(qgdCoeffsType);
62-
67+
6368
if (cstrIter == dictionaryConstructorTablePtr_->end())
6469
{
6570
FatalErrorIn
@@ -70,7 +75,7 @@ autoPtr<QGDCoeffs> QGDCoeffs::New
7075
<< dictionaryConstructorTablePtr_->sortedToc()
7176
<< exit(FatalError);
7277
}
73-
78+
7479
return autoPtr<QGDCoeffs>
7580
(
7681
cstrIter()
@@ -122,6 +127,11 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
122127
mesh,
123128
dimensionSet(1, -1, -1, 0, 0)
124129
),
130+
hQGDf_
131+
(
132+
"hQGDf",
133+
1.0 / mag(mesh.surfaceInterpolation::deltaCoeffs())
134+
),
125135
hQGD_
126136
(
127137
IOobject
@@ -132,7 +142,8 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
132142
IOobject::NO_READ,
133143
IOobject::NO_WRITE
134144
),
135-
qgdLength(mesh)()
145+
mesh,
146+
hQGDf_.dimensions()
136147
),
137148
aQGD_
138149
(
@@ -159,6 +170,11 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
159170
mesh,
160171
dimensionSet(0, 0, 1, 0, 0)
161172
),
173+
tauQGDf_
174+
(
175+
"tauQGDf",
176+
linearInterpolate(tauQGD_)
177+
),
162178
PrQGD_
163179
(
164180
IOobject
@@ -179,20 +195,21 @@ QGDCoeffs::QGDCoeffs(const IOobject& io, const fvMesh& mesh, const dictionary& d
179195
"ScQGD",
180196
mesh.time().timeName(),
181197
mesh,
182-
IOobject::NO_READ,
198+
IOobject::READ_IF_PRESENT,
183199
IOobject::NO_WRITE
184200
),
185201
mesh,
186202
dimensionSet(0, 0, 0, 0, 0)
187203
)
188204
{
205+
this->updateQGDLength(mesh);
189206
}
190207

191208
QGDCoeffs::~QGDCoeffs()
192209
{
193210
}
194211

195-
void Foam::qgd::QGDCoeffs::correct(const psiQGDThermo& qgdThermo)
212+
void Foam::qgd::QGDCoeffs::correct(const QGDThermo& qgdThermo)
196213
{
197214
forAll(tauQGD_, celli)
198215
{
@@ -206,79 +223,93 @@ void Foam::qgd::QGDCoeffs::correct(const psiQGDThermo& qgdThermo)
206223
{
207224
forAll(tauQGD_.boundaryField()[patchi], facei)
208225
{
209-
tauQGD_.boundaryFieldRef()[patchi][facei] =
226+
tauQGD_.boundaryFieldRef()[patchi][facei] =
210227
0.0;
211-
muQGD_.boundaryFieldRef()[patchi][facei] =
228+
muQGD_.boundaryFieldRef()[patchi][facei] =
212229
0.0;
213-
alphauQGD_.boundaryFieldRef()[patchi][facei] =
230+
alphauQGD_.boundaryFieldRef()[patchi][facei] =
214231
0.0;
215-
PrQGD_.boundaryFieldRef()[patchi][facei] =
232+
PrQGD_.boundaryFieldRef()[patchi][facei] =
216233
1.0;
217-
ScQGD_.boundaryFieldRef()[patchi][facei] =
234+
ScQGD_.boundaryFieldRef()[patchi][facei] =
218235
1.0;
219236
}
220237
}
221238
}
222239

223-
Foam::tmp<Foam::volScalarField> Foam::qgd::QGDCoeffs::qgdLength(const fvMesh& mesh)
240+
void Foam::qgd::QGDCoeffs::updateQGDLength(const fvMesh& mesh)
224241
{
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)
251266
{
252267
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;
254272
forAll(c, facei)
255273
{
256-
if (mesh.isInternalFace(c[facei]))
274+
fid = c[facei];
275+
276+
if (mesh.isInternalFace(fid))
257277
{
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)
260285
{
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+
}
262294
}
263295
}
264296
}
265-
qgdLen.primitiveFieldRef()[celli] = maxlen;
297+
298+
hQGD_.primitiveFieldRef()[celli] = hint / surf;
266299
}
267-
300+
268301
forAll(mesh.boundary(), patchi)
269302
{
270-
const fvPatch& fvp = mesh.boundary()[patchi];
271-
if (fvp.coupled())
303+
if (!isA<emptyFvPatch>(mesh.boundary()[patchi]))
272304
{
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;
278306
}
279307
}
280-
281-
return tqgdLen;
308+
}
309+
310+
const Foam::surfaceScalarField& Foam::qgd::QGDCoeffs::hQGDf() const
311+
{
312+
return hQGDf_;
282313
}
283314

284315
const Foam::volScalarField& Foam::qgd::QGDCoeffs::hQGD() const
@@ -301,10 +332,14 @@ const Foam::volScalarField& Foam::qgd::QGDCoeffs::tauQGD() const
301332
return tauQGD_;
302333
}
303334

335+
const Foam::surfaceScalarField& Foam::qgd::QGDCoeffs::tauQGDf() const
336+
{
337+
return tauQGDf_;
338+
}
339+
304340
}; //namespace qgd
305341

306342
}; //namespace Foam
307343

308344

309345
//END-OF-FILE
310-

0 commit comments

Comments
 (0)