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),
72 cqSc_(mesh.V().size(), 0.0),
73 constScCellSetPtr_(nullptr)
75 scalar ScQGD = 0.0, PrQGD = 1.0;
77 dict.lookup(
"ScQGD") >> ScQGD;
78 dict.lookup(
"PrQGD") >> PrQGD;
80 ScQGD_.primitiveFieldRef() = ScQGD;
81 PrQGD_.primitiveFieldRef() = PrQGD;
83 ScQGD_.boundaryFieldRef() = ScQGD;
84 PrQGD_.boundaryFieldRef() = PrQGD;
86 if (dict.found(
"smoothCoeff"))
93 dict.lookup(
"rC") >>
rC_;
96 if (dict.found(
"minSc"))
98 dict.lookup(
"minSc") >>
minSc_;
101 if (dict.found(
"maxSc"))
103 dict.lookup(
"maxSc") >>
maxSc_;
106 if (dict.found(
"badQualitySc"))
111 if (dict.found(
"maxAspectRatio"))
116 if (dict.found(
"cSc1"))
118 dict.lookup(
"cSc1") >>
cSc1_;
121 scalarField openness(mesh.V().size(), 0);
122 scalarField aspectRatio(mesh.V().size(), 1);
124 primitiveMeshTools::cellClosedness
134 forAll(aspectRatio, iCell)
143 if (dict.found(
"constScCellSet"))
145 word constScCellSet (dict.lookup(
"constScCellSet"));
169 const volScalarField& cSound = qgdThermo.
c();
170 const volScalarField&
p = qgdThermo.
p();
171 const volScalarField
rho(qgdThermo.
rho()*1.0);
173 this->tauQGDf_= linearInterpolate(this->aQGD_ / cSound) * hQGDf_;
174 this->tauQGD_ = this->aQGD_ * this->hQGD_ / cSound;
176 const surfaceScalarField
pf =
177 linearInterpolate(p);
178 const surfaceScalarField dpf =
179 fvc::snGrad(p)/mesh_.deltaCoeffs();
183 const cell& facesOfCell = mesh_.cells()[icell];
191 forAll(facesOfCell, iface)
193 faceid = facesOfCell[iface];
194 if (mesh_.isInternalFace(faceid))
196 sumpf += pf.primitiveField()[faceid];
197 if (mesh_.owner()[faceid] == icell)
199 sumDpF += dpf.primitiveField()[faceid];
203 sumDpF -= dpf.primitiveField()[faceid];
209 patchid = mesh_.boundaryMesh().whichPatch(faceid);
210 if (isA<emptyFvPatch>(mesh_.boundary()[patchid]))
214 if (isA<wedgeFvPatch>(mesh_.boundary()[patchid]))
218 faceid -= mesh_.boundaryMesh()[patchid].start();
220 if (p.boundaryField()[patchid].coupled())
223 (p.boundaryField()[patchid].patchNeighbourField()()[faceid] - p[icell]);
227 sumDpF += dpf.boundaryField()[patchid][faceid];
229 sumpf += pf.boundaryField()[patchid][faceid];
234 ScQGD_[icell] = cSc1_*(mag(sumDpF) / sumpf);
239 this->ScQGD_ = max(this->ScQGD_, minSc_);
243 this->ScQGD_ = min(this->ScQGD_, maxSc_);
246 if (constScCellSetPtr_.valid())
248 const cellSet& constScCells = constScCellSetPtr_();
250 forAllConstIter(cellSet, constScCells, iter)
252 ScQGD_[iter.key()] = constSc_;
267 Info<<
"max/min ScQGD: "
268 << max(this->ScQGD_).value() <<
"/"
269 << min(this->ScQGD_).value() << endl;
271 if (runTime_.outputTime())
273 this->ScQGD_.write();
277 forAll(p.primitiveField(), celli)
279 muQGD_.primitiveFieldRef()[celli] =
280 p.primitiveField()[celli] *
281 ScQGD_.primitiveField()[celli] *
282 tauQGD_.primitiveField()[celli];
284 alphauQGD_.primitiveFieldRef()[celli] = muQGD_.primitiveField()[celli] /
285 PrQGD_.primitiveField()[celli];
288 forAll(p.boundaryField(), patchi)
290 forAll(p.boundaryField()[patchi], facei)
292 muQGD_.boundaryFieldRef()[patchi][facei] =
293 p.boundaryField()[patchi][facei] *
294 ScQGD_.boundaryField()[patchi][facei] *
295 tauQGD_.boundaryField()[patchi][facei];
297 alphauQGD_.boundaryFieldRef()[patchi][facei] =
298 muQGD_.boundaryFieldRef()[patchi][facei] /
299 PrQGD_.boundaryField()[patchi][facei];
varScModel7(const IOobject &io, const fvMesh &mesh, const dictionary &dict)
virtual const volScalarField & c() const =0
virtual tmp< volScalarField > rho() const =0
scalar qgdAspectRatioThreshold_
autoPtr< cellSet > constScCellSetPtr_
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())
void correct(const QGDThermo &)
virtual const volScalarField & p() const =0
addToRunTimeSelectionTable(QGDCoeffs, constScPrModel1, dictionary)
defineTypeNameAndDebug(constScPrModel1, 0)