1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Calculates and writes the Pe number as a surfaceScalarField obtained from
31 The -noWrite option just outputs the max/min values without writing
34 \*---------------------------------------------------------------------------*/
39 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
40 #include "incompressible/RAS/RASModel/RASModel.H"
41 #include "incompressible/LES/LESModel/LESModel.H"
42 #include "basicPsiThermo.H"
43 #include "compressible/RAS/RASModel/RASModel.H"
44 #include "compressible/LES/LESModel/LESModel.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
50 bool writeResults = !args.optionFound("noWrite");
60 if (phiHeader.headerOk())
62 autoPtr<surfaceScalarField> PePtr;
64 Info<< " Reading phi" << endl;
65 surfaceScalarField phi(phiHeader, mesh);
79 IOobject RASPropertiesHeader
88 IOobject LESPropertiesHeader
97 Info<< " Calculating Pe" << endl;
99 if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
101 if (RASPropertiesHeader.headerOk())
103 IOdictionary RASProperties(RASPropertiesHeader);
105 singlePhaseTransportModel laminarTransport(U, phi);
107 autoPtr<incompressible::RASModel> RASModel
109 incompressible::RASModel::New
119 new surfaceScalarField
131 * mesh.surfaceInterpolation::deltaCoeffs()
132 * fvc::interpolate(RASModel->nuEff())
137 else if (LESPropertiesHeader.headerOk())
139 IOdictionary LESProperties(LESPropertiesHeader);
141 singlePhaseTransportModel laminarTransport(U, phi);
143 autoPtr<incompressible::LESModel> sgsModel
145 incompressible::LESModel::New(U, phi, laminarTransport)
150 new surfaceScalarField
162 * mesh.surfaceInterpolation::deltaCoeffs()
163 * fvc::interpolate(sgsModel->nuEff())
170 IOdictionary transportProperties
174 "transportProperties",
182 dimensionedScalar nu(transportProperties.lookup("nu"));
186 new surfaceScalarField
195 mesh.surfaceInterpolation::deltaCoeffs()
196 * (mag(phi)/mesh.magSf())*(runTime.deltaT()/nu)
201 else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
203 if (RASPropertiesHeader.headerOk())
205 IOdictionary RASProperties(RASPropertiesHeader);
207 autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
220 autoPtr<compressible::RASModel> RASModel
222 compressible::RASModel::New
233 new surfaceScalarField
245 * mesh.surfaceInterpolation::deltaCoeffs()
246 * fvc::interpolate(RASModel->muEff())
251 else if (LESPropertiesHeader.headerOk())
253 IOdictionary LESProperties(LESPropertiesHeader);
255 autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
268 autoPtr<compressible::LESModel> sgsModel
270 compressible::LESModel::New(rho, U, phi, thermo())
275 new surfaceScalarField
287 * mesh.surfaceInterpolation::deltaCoeffs()
288 * fvc::interpolate(sgsModel->muEff())
295 IOdictionary transportProperties
299 "transportProperties",
307 dimensionedScalar mu(transportProperties.lookup("mu"));
311 new surfaceScalarField
320 mesh.surfaceInterpolation::deltaCoeffs()
321 * (mag(phi)/(mesh.magSf()))*(runTime.deltaT()/mu)
328 FatalErrorIn(args.executable())
329 << "Incorrect dimensions of phi: " << phi.dimensions()
330 << abort(FatalError);
334 // can also check how many cells exceed a particular Pe limit
341 if (PePtr()[i] > PeLimit)
348 Info<< "Fraction > " << PeLimit << " = "
349 << scalar(count)/Pe.size() << endl;
353 Info << "Pe max : " << max(PePtr()).value() << endl;
362 Info<< " No phi" << endl;
365 Info<< "\nEnd\n" << endl;
369 // ************************************************************************* //