1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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 Pressure-density-based compressible flow solver.
31 \*---------------------------------------------------------------------------*/
35 #include "gaussConvectionScheme.H"
36 #include "multivariateGaussConvectionScheme.H"
38 #include "LimitedScheme.H"
39 #include "boundaryTypes.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 int main(int argc, char *argv[])
45 #include "setRootCase.H"
46 #include "createTime.H"
47 #include "createMesh.H"
48 #include "readThermodynamicProperties.H"
49 #include "createFields.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 Info<< "\nStarting time loop\n" << endl;
55 while (runTime.loop())
57 Info<< "Time = " << runTime.value() << nl << endl;
59 #include "readPISOControls.H"
60 scalar HbyAblend = readScalar(piso.lookup("HbyAblend"));
62 #include "readTimeControls.H"
66 mesh.surfaceInterpolation::deltaCoeffs()
67 *mag(phiv)/mesh.magSf()
68 ).value()*runTime.deltaT().value();
70 Info<< "Max Courant Number = " << CoNum << endl;
72 #include "setDeltaT.H"
74 for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
79 fv::multivariateGaussConvectionScheme<scalar> mvConvection
84 mesh.divScheme("div(phiv,rhoUH)")
90 + mvConvection.fvmDiv(phiv, rho)
93 surfaceScalarField rhoUWeights =
94 mvConvection.interpolationScheme()()(magRhoU)()
97 weighted<vector> rhoUScheme(rhoUWeights);
99 fvVectorMatrix rhoUEqn
102 + fv::gaussConvectionScheme<vector>(mesh, phiv, rhoUScheme)
106 solve(rhoUEqn == -fvc::grad(p));
111 + mvConvection.fvmDiv(phiv, rhoE)
113 - mvConvection.fvcDiv(phiv, p)
116 T = (rhoE - 0.5*rho*magSqr(rhoU/rho))/Cv/rho;
120 for (int corr=0; corr<nCorr; corr++)
122 volScalarField rrhoUA = 1.0/rhoUEqn.A();
123 surfaceScalarField rrhoUAf("rrhoUAf", fvc::interpolate(rrhoUA));
124 volVectorField HbyA = rrhoUA*rhoUEqn.H();
126 surfaceScalarField HbyAWeights =
127 HbyAblend*mesh.weights()
130 <vector, MUSCLLimiter<NVDTVD>, limitFuncs::magSqr>
131 (mesh, phi, IStringStream("HbyA")()).weights(HbyA);
135 surfaceInterpolationScheme<vector>::interpolate
136 (HbyA, HbyAWeights) & mesh.Sf()
138 + HbyAblend*fvc::ddtPhiCorr(rrhoUA, rho, rhoU, phi);
140 p.boundaryField().updateCoeffs();
142 surfaceScalarField phiGradp =
143 rrhoUAf*mesh.magSf()*fvc::snGrad(p);
147 #include "resetPhiPatches.H"
149 surfaceScalarField rhof =
150 mvConvection.interpolationScheme()()(rho)()
158 + mvConvection.fvcDiv(phiv, rho)
160 - fvm::laplacian(rrhoUAf, p)
165 phi += phiGradp + pEqn.flux();
168 mvConvection.interpolationScheme()()(rho)()
172 rhoU = HbyA - rrhoUA*fvc::grad(p);
173 rhoU.correctBoundaryConditions();
181 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
182 << " ClockTime = " << runTime.elapsedClockTime() << " s"
186 Info<< "End\n" << endl;
192 // ************************************************************************* //