1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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 Incompressible LES solver for flow in a channel.
31 - channelFoam [OPTION]
33 @param -case \<dir\> \n
34 Specify the case directory
37 Run the case in parallel
40 Display short usage message
43 Display Doxygen documentation page
48 \*---------------------------------------------------------------------------*/
50 #include <finiteVolume/fvCFD.H>
51 #include <incompressibleTransportModels/singlePhaseTransportModel.H>
52 #include <incompressibleLESModels/LESModel.H>
53 #include <OpenFOAM/IFstream.H>
54 #include <OpenFOAM/OFstream.H>
55 #include <OpenFOAM/Random.H>
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 int main(int argc, char *argv[])
61 #include <OpenFOAM/setRootCase.H>
62 #include <OpenFOAM/createTime.H>
63 #include <OpenFOAM/createMesh.H>
64 #include "readTransportProperties.H"
65 #include "createFields.H"
66 #include <finiteVolume/initContinuityErrs.H>
67 #include "createGradP.H"
69 Info<< "\nStarting time loop\n" << endl;
71 while (runTime.loop())
73 Info<< "Time = " << runTime.timeName() << nl << endl;
75 #include <finiteVolume/readPISOControls.H>
77 #include <finiteVolume/CourantNo.H>
85 + sgsModel->divDevBeff(U)
90 if (momentumPredictor)
92 solve(UEqn == -fvc::grad(p));
98 volScalarField rUA = 1.0/UEqn.A();
100 for (int corr=0; corr<nCorr; corr++)
103 phi = (fvc::interpolate(U) & mesh.Sf())
104 + fvc::ddtPhiCorr(rUA, U, phi);
106 adjustPhi(phi, U, p);
108 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
112 fvm::laplacian(rUA, p) == fvc::div(phi)
115 pEqn.setReference(pRefCell, pRefValue);
117 if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
119 pEqn.solve(mesh.solver(p.name() + "Final"));
123 pEqn.solve(mesh.solver(p.name()));
126 if (nonOrth == nNonOrthCorr)
132 #include <finiteVolume/continuityErrs.H>
134 U -= rUA*fvc::grad(p);
135 U.correctBoundaryConditions();
139 // Correct driving force for a constant mass flow rate
141 // Extract the velocity in the flow direction
142 dimensionedScalar magUbarStar =
143 (flowDirection & U)().weightedAverage(mesh.V());
145 // Calculate the pressure gradient increment needed to
146 // adjust the average flow-rate to the correct value
147 dimensionedScalar gragPplus =
148 (magUbar - magUbarStar)/rUA.weightedAverage(mesh.V());
150 U += flowDirection*rUA*gragPplus;
154 Info<< "Uncorrected Ubar = " << magUbarStar.value() << tab
155 << "pressure gradient = " << gradP.value() << endl;
159 #include "writeGradP.H"
161 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
162 << " ClockTime = " << runTime.elapsedClockTime() << " s"
166 Info<< "End\n" << endl;
172 // ************************ vim: set sw=4 sts=4 et: ************************ //