Removed unneeded lib dependency from mdInitialise
[foam-extend-3.2.git] / applications / solvers / incompressible / porousSimpleFoam / UEqn.H
blob688120809a1dfb9821d74ff7d7274e4fb50183d0
1     // Construct the Momentum equation
3     tmp<fvVectorMatrix> UEqn
4     (
5         fvm::div(phi, U)
6       + turbulence->divDevReff(U)
7     );
9     UEqn().relax();
11     // Include the porous media resistance and solve the momentum equation
12     // either implicit in the tensorial resistance or transport using by
13     // including the spherical part of the resistance in the momentum diagonal
15     tmp<volScalarField> trAU;
16     tmp<volTensorField> trTU;
18     if (pressureImplicitPorosity)
19     {
20         tmp<volTensorField> tTU = tensor(I)*UEqn().A();
21         pZones.addResistance(UEqn(), tTU());
22         trTU = inv(tTU());
23         trTU().rename("rAU");
25         volVectorField gradp = fvc::grad(p);
27         for (int UCorr=0; UCorr<nUCorr; UCorr++)
28         {
29             U = trTU() & (UEqn().H() - gradp);
30         }
31         U.correctBoundaryConditions();
32     }
33     else
34     {
35         pZones.addResistance(UEqn());
37         eqnResidual = solve
38         (
39             UEqn() == -fvc::grad(p)
40         ). initialResidual();
42         maxResidual = max(eqnResidual, maxResidual);
44         trAU = 1.0/UEqn().A();
45         trAU().rename("rAU");
46     }