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/>.
25 COnvert volumetric to mass flux
27 \*---------------------------------------------------------------------------*/
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 int main(int argc, char *argv[])
36 argList::validOptions.insert("rhoRef", "scalar");
38 # include "setRootCase.H"
40 if (!args.options().found("rhoRef"))
42 FatalErrorIn(args.executable())
43 << "Missing reference density"
50 dimensionedScalar rhoRef
54 readScalar(IStringStream(args.options()["rhoRef"])())
57 Info<< "Reference density = " << rhoRef.value() << endl;
60 # include "createTime.H"
61 # include "createMesh.H"
63 Info<< "Time = " << runTime.value() << endl;
65 Info<< " Reading p" << endl;
79 if (p.dimensions() == dimPressure)
81 Info<< "Pressure " << p.name() << " is a dynamic pressure. "
85 else if (p.dimensions() == dimPressure/dimDensity)
100 Info<< "Correcting kinematic pressure " << p.name()
101 << " into dynamic pressure " << rhoP.name()
108 Info<< "Cannot recognise dimensions of pressure field " << p.name()
109 << ": " << p.dimensions() << ". Ignoring" << endl;
113 Info<< " Reading phi" << endl;
114 surfaceScalarField phi
127 if (phi.dimensions() == dimMass/dimTime)
129 Info<< "Flux " << phi.name() << " is a mass flux. Nothing to do"
132 else if (phi.dimensions() == dimVolume/dimTime)
134 surfaceScalarField rhoPhi
147 Info<< "Correcting volume flux " << phi.name()
148 << " into mass flux " << rhoPhi.name()
155 Info<< "Cannot recognise dimensions of flux field " << phi.name()
156 << ": " << phi.dimensions() << ". Ignoring" << endl;
159 Info<< "End\n" << endl;
165 // ************************************************************************* //