1 /*---------------------------------------------------------------------------* \
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, 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
84 IOobject::MUST_READ_IF_MODIFIED,
88 IOobject LESPropertiesHeader
93 IOobject::MUST_READ_IF_MODIFIED,
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",
177 IOobject::MUST_READ_IF_MODIFIED,
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",
302 IOobject::MUST_READ_IF_MODIFIED,
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 // ************************************************************************* //