1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Calculates and writes the Pe number as a surfaceScalarField obtained from
32 The -noWrite option just outputs the max/min values without writing
35 \*---------------------------------------------------------------------------*/
40 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
41 #include "incompressible/RAS/RASModel/RASModel.H"
42 #include "incompressible/LES/LESModel/LESModel.H"
43 #include "basicPsiThermo.H"
44 #include "compressible/RAS/RASModel/RASModel.H"
45 #include "compressible/LES/LESModel/LESModel.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
51 bool writeResults = !args.optionFound("noWrite");
61 if (phiHeader.headerOk())
63 autoPtr<surfaceScalarField> PePtr;
65 Info<< " Reading phi" << endl;
66 surfaceScalarField phi(phiHeader, mesh);
80 IOobject RASPropertiesHeader
89 IOobject LESPropertiesHeader
98 Info<< " Calculating Pe" << endl;
100 if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
102 if (RASPropertiesHeader.headerOk())
104 IOdictionary RASProperties(RASPropertiesHeader);
106 singlePhaseTransportModel laminarTransport(U, phi);
108 autoPtr<incompressible::RASModel> RASModel
110 incompressible::RASModel::New
120 new surfaceScalarField
132 * mesh.surfaceInterpolation::deltaCoeffs()
133 * fvc::interpolate(RASModel->nuEff())
138 else if (LESPropertiesHeader.headerOk())
140 IOdictionary LESProperties(LESPropertiesHeader);
142 singlePhaseTransportModel laminarTransport(U, phi);
144 autoPtr<incompressible::LESModel> sgsModel
146 incompressible::LESModel::New(U, phi, laminarTransport)
151 new surfaceScalarField
163 * mesh.surfaceInterpolation::deltaCoeffs()
164 * fvc::interpolate(sgsModel->nuEff())
171 IOdictionary transportProperties
175 "transportProperties",
183 dimensionedScalar nu(transportProperties.lookup("nu"));
187 new surfaceScalarField
196 mesh.surfaceInterpolation::deltaCoeffs()
197 * (mag(phi)/mesh.magSf())*(runTime.deltaT()/nu)
202 else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
204 if (RASPropertiesHeader.headerOk())
206 IOdictionary RASProperties(RASPropertiesHeader);
208 autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
221 autoPtr<compressible::RASModel> RASModel
223 compressible::RASModel::New
234 new surfaceScalarField
246 * mesh.surfaceInterpolation::deltaCoeffs()
247 * fvc::interpolate(RASModel->muEff())
252 else if (LESPropertiesHeader.headerOk())
254 IOdictionary LESProperties(LESPropertiesHeader);
256 autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
269 autoPtr<compressible::LESModel> sgsModel
271 compressible::LESModel::New(rho, U, phi, thermo())
276 new surfaceScalarField
288 * mesh.surfaceInterpolation::deltaCoeffs()
289 * fvc::interpolate(sgsModel->muEff())
296 IOdictionary transportProperties
300 "transportProperties",
308 dimensionedScalar mu(transportProperties.lookup("mu"));
312 new surfaceScalarField
321 mesh.surfaceInterpolation::deltaCoeffs()
322 * (mag(phi)/(mesh.magSf()))*(runTime.deltaT()/mu)
329 FatalErrorIn(args.executable())
330 << "Incorrect dimensions of phi: " << phi.dimensions()
331 << abort(FatalError);
335 // can also check how many cells exceed a particular Pe limit
342 if (PePtr()[i] > PeLimit)
349 Info<< "Fraction > " << PeLimit << " = "
350 << scalar(count)/Pe.size() << endl;
354 Info << "Pe max : " << max(PePtr()).value() << endl;
363 Info<< " No phi" << endl;
366 Info<< "\nEnd\n" << endl;
370 // ************************************************************************* //