This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/incompressible/porousSimpleFoam/UEqn.H

47 lines
1.1 KiB
C
Raw Normal View History

2010-08-26 14:22:03 +00:00
// Construct the Momentum equation
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
);
UEqn().relax();
// Include the porous media resistance and solve the momentum equation
// either implicit in the tensorial resistance or transport using by
// including the spherical part of the resistance in the momentum diagonal
tmp<volScalarField> trAU;
tmp<volTensorField> trTU;
if (pressureImplicitPorosity)
{
tmp<volTensorField> tTU = tensor(I)*UEqn().A();
pZones.addResistance(UEqn(), tTU());
trTU = inv(tTU());
trTU().rename("rAU");
volVectorField gradp = fvc::grad(p);
for (int UCorr=0; UCorr<nUCorr; UCorr++)
{
U = trTU() & (UEqn().H() - gradp);
}
U.correctBoundaryConditions();
}
else
{
pZones.addResistance(UEqn());
eqnResidual = solve
(
UEqn() == -fvc::grad(p)
). initialResidual();
maxResidual = max(eqnResidual, maxResidual);
trAU = 1.0/UEqn().A();
trAU().rename("rAU");
}