OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

UEqn.H

Go to the documentation of this file.
00001     // Construct the Momentum equation
00002 
00003     tmp<fvVectorMatrix> UEqn
00004     (
00005         fvm::div(phi, U)
00006       - fvm::Sp(fvc::div(phi), U)
00007       + turbulence->divDevRhoReff(U)
00008     );
00009 
00010     UEqn().relax();
00011 
00012     // Include the porous media resistance and solve the momentum equation
00013     // either implicit in the tensorial resistance or transport using by
00014     // including the spherical part of the resistance in the momentum diagonal
00015 
00016     tmp<volScalarField> trAU;
00017     tmp<volTensorField> trTU;
00018 
00019     if (pressureImplicitPorosity)
00020     {
00021         tmp<volTensorField> tTU = tensor(I)*UEqn().A();
00022         pZones.addResistance(UEqn(), tTU());
00023         trTU = inv(tTU());
00024         trTU().rename("rAU");
00025 
00026         volVectorField gradp = fvc::grad(p);
00027 
00028         for (int UCorr=0; UCorr<nUCorr; UCorr++)
00029         {
00030             U = trTU() & (UEqn().H() - gradp);
00031         }
00032         U.correctBoundaryConditions();
00033     }
00034     else
00035     {
00036         pZones.addResistance(UEqn());
00037 
00038         eqnResidual = solve
00039         (
00040             UEqn() == -fvc::grad(p)
00041         ). initialResidual();
00042 
00043         maxResidual = max(eqnResidual, maxResidual);
00044 
00045         trAU = 1.0/UEqn().A();
00046         trAU().rename("rAU");
00047     }
Copyright © 2000-2009 OpenCFD Ltd