31 #include "addToRunTimeSelectionTable.H"
32 #include "fvcSmooth.H"
34 #include "fvcSnGrad.H"
35 #include "primitiveMeshTools.H"
38 #include "emptyFvPatch.H"
39 #include "wedgeFvPatch.H"
60 const dictionary& dict
63 QGDCoeffs(io, mesh, dict),
69 qgdAspectRatioThreshold_(1.5),
71 cqSc_(mesh.V().size(), 0.0),
72 constScCellSetPtr_(nullptr)
74 scalar ScQGD = 0.0, PrQGD = 1.0;
76 dict.lookup(
"ScQGD") >> ScQGD;
77 dict.lookup(
"PrQGD") >> PrQGD;
79 ScQGD_.primitiveFieldRef() = ScQGD;
80 PrQGD_.primitiveFieldRef() = PrQGD;
82 ScQGD_.boundaryFieldRef() = ScQGD;
83 PrQGD_.boundaryFieldRef() = PrQGD;
85 if (dict.found(
"smoothCoeff"))
92 dict.lookup(
"rC") >>
rC_;
95 if (dict.found(
"minSc"))
97 dict.lookup(
"minSc") >>
minSc_;
100 if (dict.found(
"maxSc"))
102 dict.lookup(
"maxSc") >>
maxSc_;
105 if (dict.found(
"badQualitySc"))
110 if (dict.found(
"maxAspectRatio"))
115 scalarField openness(mesh.V().size(), 0);
116 scalarField aspectRatio(mesh.V().size(), 1);
118 primitiveMeshTools::cellClosedness
128 forAll(aspectRatio, iCell)
137 if (dict.found(
"constScCellSet"))
139 word constScCellSet (dict.lookup(
"constScCellSet"));
203 const volScalarField& cSound = qgdThermo.
c();
204 const volScalarField&
p = qgdThermo.
p();
205 const volScalarField
rho(qgdThermo.
rho()*1.0);
207 this->tauQGDf_= linearInterpolate(this->aQGD_ / cSound) * hQGDf_;
208 this->tauQGD_ = this->aQGD_ * this->hQGD_ / cSound;
210 const surfaceScalarField
pf =
211 linearInterpolate(p);
212 const surfaceScalarField dpf =
213 fvc::snGrad(p)/mesh_.deltaCoeffs();
217 const cell& facesOfCell = mesh_.cells()[icell];
225 forAll(facesOfCell, iface)
227 faceid = facesOfCell[iface];
228 if (mesh_.isInternalFace(faceid))
230 sumpf += pf.primitiveField()[faceid];
231 if (mesh_.owner()[faceid] == icell)
233 sumDpF += dpf.primitiveField()[faceid];
237 sumDpF -= dpf.primitiveField()[faceid];
243 patchid = mesh_.boundaryMesh().whichPatch(faceid);
244 if (isA<emptyFvPatch>(mesh_.boundary()[patchid]))
248 if (isA<wedgeFvPatch>(mesh_.boundary()[patchid]))
252 faceid -= mesh_.boundaryMesh()[patchid].start();
254 if (p.boundaryField()[patchid].coupled())
257 (p.boundaryField()[patchid].patchNeighbourField()()[faceid] - p[icell]);
261 sumDpF += dpf.boundaryField()[patchid][faceid];
263 sumpf += pf.boundaryField()[patchid][faceid];
268 ScQGD_[icell] = mag(sumDpF) / sumpf;
303 Info<<
"max/min ScQGD: "
304 << max(this->ScQGD_).value() <<
"/"
305 << min(this->ScQGD_).value() << endl;
307 if (runTime_.outputTime())
309 this->ScQGD_.write();
313 forAll(p.primitiveField(), celli)
315 muQGD_.primitiveFieldRef()[celli] =
316 p.primitiveField()[celli] *
317 ScQGD_.primitiveField()[celli] *
318 tauQGD_.primitiveField()[celli];
320 alphauQGD_.primitiveFieldRef()[celli] = muQGD_.primitiveField()[celli] /
321 PrQGD_.primitiveField()[celli];
324 forAll(p.boundaryField(), patchi)
326 forAll(p.boundaryField()[patchi], facei)
328 muQGD_.boundaryFieldRef()[patchi][facei] =
329 p.boundaryField()[patchi][facei] *
330 ScQGD_.boundaryField()[patchi][facei] *
331 tauQGD_.boundaryField()[patchi][facei];
333 alphauQGD_.boundaryFieldRef()[patchi][facei] =
334 muQGD_.boundaryFieldRef()[patchi][facei] /
335 PrQGD_.boundaryField()[patchi][facei];
void correct(const QGDThermo &)
autoPtr< cellSet > constScCellSetPtr_
varScModel6(const IOobject &io, const fvMesh &mesh, const dictionary &dict)
virtual const volScalarField & c() const =0
virtual tmp< volScalarField > rho() const =0
Abstract base class for classes implementing thermophysical properties of gases and fluids governed b...
volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho())
virtual const volScalarField & p() const =0
addToRunTimeSelectionTable(QGDCoeffs, constScPrModel1, dictionary)
scalar qgdAspectRatioThreshold_
defineTypeNameAndDebug(constScPrModel1, 0)