mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
add in UEqn.H, pEqn.H for simpleFoam as well
This commit is contained in:
11
applications/solvers/incompressible/simpleFoam/UEqn.H
Normal file
11
applications/solvers/incompressible/simpleFoam/UEqn.H
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Solve the Momentum equation
|
||||||
|
|
||||||
|
tmp<fvVectorMatrix> UEqn
|
||||||
|
(
|
||||||
|
fvm::div(phi, U)
|
||||||
|
+ turbulence->divDevReff(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn().relax();
|
||||||
|
|
||||||
|
solve(UEqn() == -fvc::grad(p));
|
||||||
34
applications/solvers/incompressible/simpleFoam/pEqn.H
Normal file
34
applications/solvers/incompressible/simpleFoam/pEqn.H
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
p.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
|
volScalarField AU = UEqn().A();
|
||||||
|
U = UEqn().H()/AU;
|
||||||
|
UEqn.clear();
|
||||||
|
phi = fvc::interpolate(U) & mesh.Sf();
|
||||||
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
|
// Non-orthogonal pressure corrector loop
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
pEqn.solve();
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi -= pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# include "continuityErrs.H"
|
||||||
|
|
||||||
|
// Explicitly relax pressure for momentum corrector
|
||||||
|
p.relax();
|
||||||
|
|
||||||
|
// Momentum corrector
|
||||||
|
U -= fvc::grad(p)/AU;
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
|
||||||
@ -26,8 +26,7 @@ Application
|
|||||||
simpleFoam
|
simpleFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Steady-state solver for incompressible, turbulent flow of non-Newtonian
|
Steady-state solver for incompressible, turbulent flow
|
||||||
fluids.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -41,14 +40,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createMesh.H"
|
# include "createMesh.H"
|
||||||
# include "createFields.H"
|
# include "createFields.H"
|
||||||
# include "initContinuityErrs.H"
|
# include "initContinuityErrs.H"
|
||||||
|
|
||||||
//mesh.clearPrimitives();
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
@ -63,50 +59,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Pressure-velocity SIMPLE corrector
|
// Pressure-velocity SIMPLE corrector
|
||||||
{
|
{
|
||||||
// Momentum predictor
|
# include "UEqn.H"
|
||||||
|
# include "pEqn.H"
|
||||||
tmp<fvVectorMatrix> UEqn
|
|
||||||
(
|
|
||||||
fvm::div(phi, U)
|
|
||||||
+ turbulence->divDevReff(U)
|
|
||||||
);
|
|
||||||
|
|
||||||
UEqn().relax();
|
|
||||||
|
|
||||||
solve(UEqn() == -fvc::grad(p));
|
|
||||||
|
|
||||||
p.boundaryField().updateCoeffs();
|
|
||||||
volScalarField AU = UEqn().A();
|
|
||||||
U = UEqn().H()/AU;
|
|
||||||
UEqn.clear();
|
|
||||||
phi = fvc::interpolate(U) & mesh.Sf();
|
|
||||||
adjustPhi(phi, U, p);
|
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
|
||||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
|
||||||
{
|
|
||||||
fvScalarMatrix pEqn
|
|
||||||
(
|
|
||||||
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
|
||||||
pEqn.solve();
|
|
||||||
|
|
||||||
if (nonOrth == nNonOrthCorr)
|
|
||||||
{
|
|
||||||
phi -= pEqn.flux();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# include "continuityErrs.H"
|
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector
|
|
||||||
p.relax();
|
|
||||||
|
|
||||||
// Momentum corrector
|
|
||||||
U -= fvc::grad(p)/AU;
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
turbulence->correct();
|
turbulence->correct();
|
||||||
|
|||||||
Reference in New Issue
Block a user