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 Hrvoje Jasak, Wikki Ltd. All rights reserved.
31 Calculate and write residual for a simpleFoam momentum equation
33 \*---------------------------------------------------------------------------*/
36 #include "singlePhaseTransportModel.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
44 timeSelector::addOptions();
46 # include "setRootCase.H"
47 # include "createTime.H"
49 instantList timeDirs = timeSelector::select0(runTime, args);
51 # include "createMesh.H"
53 forAll(timeDirs, timeI)
55 runTime.setTime(timeDirs[timeI], timeI);
57 Info<< "Time = " << runTime.timeName() << endl;
76 if (Uheader.headerOk() && pHeader.headerOk())
80 Info<< " Reading U" << endl;
81 volVectorField U(Uheader, mesh);
83 Info<< " Reading p" << endl;
84 volScalarField p(pHeader, mesh);
86 # include "createPhi.H"
88 singlePhaseTransportModel laminarTransport(U, phi);
90 autoPtr<incompressible::RASModel> turbulence
92 incompressible::RASModel::New(U, phi, laminarTransport)
95 Info<< " Calculating uResidual" << endl;
96 volScalarField uResidual
108 + fvc::div(turbulence->R())
113 Info<< "uResidual max: " << max(uResidual.internalField())
115 << sum(uResidual.internalField()*mesh.V())/
116 sum(mesh.V()).value()
123 Info<< " No U or p" << endl;
129 Info<< "End\n" << endl;
135 // ************************************************************************* //