Removed unnecessary return statement
[foam-extend-3.2.git] / applications / solvers / heatTransfer / buoyantSimpleFoam / pEqn.H
blob11768ea2f69f574fe194297a71fc3b8872ccf441
2     rho = thermo.rho();
4     volScalarField rUA = 1.0/UEqn().A();
5     surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
7     U = rUA*UEqn().H();
8     UEqn.clear();
10     phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
11     bool closedVolume = adjustPhi(phi, U, p);
13     surfaceScalarField buoyancyPhi =
14         rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
15     phi += buoyancyPhi;
17     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
18     {
19         fvScalarMatrix pEqn
20         (
21             fvm::laplacian(rhorUAf, p) == fvc::div(phi)
22         );
24         pEqn.setReference(pRefCell, pRefValue);
26         // retain the residual from the first iteration
27         if (nonOrth == 0)
28         {
29             eqnResidual = pEqn.solve().initialResidual();
30             maxResidual = max(eqnResidual, maxResidual);
31         }
32         else
33         {
34             pEqn.solve();
35         }
37         if (nonOrth == nNonOrthCorr)
38         {
39             // For closed-volume cases adjust the pressure and density levels
40             // to obey overall mass continuity
41             if (closedVolume)
42             {
43                 p += (initialMass - fvc::domainIntegrate(psi*p))
44                     /fvc::domainIntegrate(psi);
45             }
47             // Calculate the conservative fluxes
48             phi -= pEqn.flux();
50             // Explicitly relax pressure for momentum corrector
51             p.relax();
53             // Correct the momentum source with the pressure gradient flux
54             // calculated from the relaxed pressure
55             U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
56             U.correctBoundaryConditions();
57         }
58     }
60     #include "continuityErrs.H"
62     rho = thermo.rho();
63     rho.relax();
64     Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
65         << endl;