mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
settlingFoam: Changed to solving for pmh (static pressure minus hydrostatic pressure).
While p and pmh (pd in OpenFOAM-1.5.?) are equivalent on orthogonal meshes they are not on non-orthogonal meshes and the difference is very important for buoyancy-dominated flows such as settling. settlingFoam is now written in terms of pmh (static pressure minus hydrostatic pressure) which used to be called pd but that confused too may people.
This commit is contained in:
@ -22,8 +22,7 @@
|
|||||||
==
|
==
|
||||||
fvc::reconstruct
|
fvc::reconstruct
|
||||||
(
|
(
|
||||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
(- ghf*fvc::snGrad(rho) - fvc::snGrad(pmh))*mesh.magSf()
|
||||||
- fvc::snGrad(p)*mesh.magSf()
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
Info<< "Reading field p\n" << endl;
|
Info<< "Reading field pmh\n" << endl;
|
||||||
volScalarField p
|
volScalarField pmh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"p",
|
"pmh",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
@ -119,11 +119,6 @@
|
|||||||
#include "compressibleCreatePhi.H"
|
#include "compressibleCreatePhi.H"
|
||||||
|
|
||||||
|
|
||||||
label pRefCell = 0;
|
|
||||||
scalar pRefValue = 0.0;
|
|
||||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "Calculating field mul\n" << endl;
|
Info<< "Calculating field mul\n" << endl;
|
||||||
volScalarField mul
|
volScalarField mul
|
||||||
(
|
(
|
||||||
@ -346,3 +341,48 @@
|
|||||||
),
|
),
|
||||||
mut + mul
|
mut + mul
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Calculating field (g.h)f\n" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf = surfaceScalarField("gh", g & mesh.Cf());
|
||||||
|
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pmh + rho*gh
|
||||||
|
);
|
||||||
|
|
||||||
|
label pmhRefCell = 0;
|
||||||
|
scalar pmhRefValue = 0.0;
|
||||||
|
setRefCell
|
||||||
|
(
|
||||||
|
pmh,
|
||||||
|
mesh.solutionDict().subDict("PISO"),
|
||||||
|
pmhRefCell,
|
||||||
|
pmhRefValue
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
|
|
||||||
|
if (pmh.needReference())
|
||||||
|
{
|
||||||
|
pRefValue = readScalar
|
||||||
|
(
|
||||||
|
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
|
||||||
|
);
|
||||||
|
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pmhRefCell)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
52
applications/solvers/multiphase/settlingFoam/pmhEqn.H
Normal file
52
applications/solvers/multiphase/settlingFoam/pmhEqn.H
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
|
||||||
|
surfaceScalarField rUAf
|
||||||
|
(
|
||||||
|
"(rho*(1|A(U)))",
|
||||||
|
fvc::interpolate(rho)*fvc::interpolate(rUA)
|
||||||
|
);
|
||||||
|
|
||||||
|
U = rUA*UEqn.H();
|
||||||
|
phi =
|
||||||
|
fvc::interpolate(rho)
|
||||||
|
*(
|
||||||
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
surfaceScalarField phiU("phiU", phi);
|
||||||
|
phi -= ghf*fvc::snGrad(rho)*rUAf*mesh.magSf();
|
||||||
|
|
||||||
|
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pmhEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rUAf, pmh) == fvc::ddt(rho) + fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
pmhEqn.setReference(pmhRefCell, pmhRefValue);
|
||||||
|
pmhEqn.solve();
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi -= pmhEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p == pmh + rho*gh;
|
||||||
|
|
||||||
|
if (pmh.needReference())
|
||||||
|
{
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pmhRefCell)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "rhoEqn.H"
|
||||||
|
#include "compressibleContinuityErrs.H"
|
||||||
|
|
||||||
|
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
@ -64,22 +64,24 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "rhoEqn.H"
|
#include "rhoEqn.H"
|
||||||
|
|
||||||
#include "calcVdj.H"
|
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||||
|
|
||||||
#include "UEqn.H"
|
|
||||||
|
|
||||||
#include "alphaEqn.H"
|
|
||||||
|
|
||||||
#include "correctViscosity.H"
|
|
||||||
|
|
||||||
|
|
||||||
// --- PISO loop
|
|
||||||
for (int corr=0; corr<nCorr; corr++)
|
|
||||||
{
|
{
|
||||||
#include "pEqn.H"
|
#include "calcVdj.H"
|
||||||
}
|
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "UEqn.H"
|
||||||
|
|
||||||
|
#include "alphaEqn.H"
|
||||||
|
|
||||||
|
#include "correctViscosity.H"
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
#include "pmhEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "kEpsilon.H"
|
||||||
|
}
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class volScalarField;
|
class volScalarField;
|
||||||
object p;
|
object pmh;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: 1.6.x |
|
| \\ / O peration | Version: dev |
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -39,7 +39,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
laplacian((rho*(1|A(U))),pmh) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
laplacian(mut,Alpha) Gauss linear corrected;
|
laplacian(mut,Alpha) Gauss linear corrected;
|
||||||
@ -58,7 +58,7 @@ snGradSchemes
|
|||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p ;
|
pmh ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
p
|
pmh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
|
|||||||
@ -57,7 +57,8 @@ boundaryField
|
|||||||
|
|
||||||
WALL6
|
WALL6
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type translatingWallVelocity;
|
||||||
|
U (-0.003 0 0);
|
||||||
value uniform (-0.003 0 0);
|
value uniform (-0.003 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class volScalarField;
|
class volScalarField;
|
||||||
object p;
|
object pmh;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -28,27 +28,32 @@ boundaryField
|
|||||||
|
|
||||||
INLE1
|
INLE1
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type buoyantPressure;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUTL9
|
OUTL9
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type buoyantPressure;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUTL10
|
OUTL10
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type buoyantPressure;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUTL11
|
OUTL11
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type buoyantPressure;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUTL12
|
OUTL12
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type buoyantPressure;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WALL6
|
WALL6
|
||||||
@ -3,4 +3,4 @@
|
|||||||
# Clean time folders only
|
# Clean time folders only
|
||||||
|
|
||||||
rm -rf *[1-9]*
|
rm -rf *[1-9]*
|
||||||
rm -f log.* 2>/dev/null
|
rm log.*
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application settlingFoam;
|
application settlingFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ laplacianSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
laplacian(muEff,U) Gauss linear corrected;
|
laplacian(muEff,U) Gauss linear corrected;
|
||||||
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
|
laplacian((rho*(1|A(U))),pmh) Gauss linear corrected;
|
||||||
laplacian(DkEff,k) Gauss linear corrected;
|
laplacian(DkEff,k) Gauss linear corrected;
|
||||||
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
|
||||||
laplacian(mut,Alpha) Gauss linear corrected;
|
laplacian(mut,Alpha) Gauss linear corrected;
|
||||||
@ -58,7 +58,7 @@ snGradSchemes
|
|||||||
fluxRequired
|
fluxRequired
|
||||||
{
|
{
|
||||||
default no;
|
default no;
|
||||||
p ;
|
pmh ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
solvers
|
solvers
|
||||||
{
|
{
|
||||||
p
|
pmh
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver PCG;
|
||||||
preconditioner DIC;
|
preconditioner DIC;
|
||||||
@ -68,9 +68,17 @@ solvers
|
|||||||
|
|
||||||
PISO
|
PISO
|
||||||
{
|
{
|
||||||
nCorrectors 2;
|
momentumPredictor yes;
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
nCorrectors 2;
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relaxationFactors
|
||||||
|
{
|
||||||
|
U 1;
|
||||||
|
k 1;
|
||||||
|
epsilon 1;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user