rhoPorousMRFSimpleFoam: Added MRF support to rhoPorousSimpleFoam

This commit is contained in:
Henry 2011-03-17 16:03:06 +00:00
parent a302f0637f
commit 76981e8770
33 changed files with 121 additions and 83 deletions

View File

@ -19,7 +19,7 @@ if (transonic)
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
//+ fvc::ddtPhiCorr(rAU, rho, U, phi)
)
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);

View File

@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake rhoPorousSimpleFoam
wmake rhoPorousMRFSimpleFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,3 @@
rhoPorousMRFSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousMRFSimpleFoam

View File

@ -8,6 +8,8 @@
UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
// 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

View File

@ -1,3 +1,6 @@
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
@ -24,4 +27,3 @@
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -0,0 +1,105 @@
if (pressureImplicitPorosity)
{
U = trTU()&UEqn().H();
}
else
{
U = trAU()*UEqn().H();
}
UEqn.clear();
bool closedVolume = false;
if (transonic)
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trTU(), p));
}
else
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trAU(), p));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi == tpEqn().flux();
}
}
}
else
{
phi = fvc::interpolate(rho*U) & mesh.Sf();
mrfZones.relativeFlux(fvc::interpolate(rho), phi);
closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U -= trTU()&fvc::grad(p);
}
else
{
U -= trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;

View File

@ -26,13 +26,15 @@ Application
Description
Steady-state solver for turbulent flow of compressible fluids with
RANS turbulence modelling, and implicit or explicit porosity treatment
RANS turbulence modelling, implicit or explicit porosity treatment
and MRF for HVAC and similar applications.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "RASModel.H"
#include "MRFZones.H"
#include "thermalPorousZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,7 +45,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createPorousZones.H"
#include "createZones.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,3 +0,0 @@
rhoPorousSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam

View File

@ -1,73 +0,0 @@
if (pressureImplicitPorosity)
{
U = trTU()&UEqn().H();
}
else
{
U = trAU()*UEqn().H();
}
UEqn.clear();
phi = fvc::interpolate(rho*U) & mesh.Sf();
bool closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tpEqn().setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
tpEqn().solve();
}
else
{
tpEqn().solve();
}
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U -= trTU()&fvc::grad(p);
}
else
{
U -= trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application rhoPorousSimpleFoam;
application rhoPorousMRFSimpleFoam;
startFrom startTime;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application rhoPorousSimpleFoam;
application rhoPorousMRFSimpleFoam;
startFrom startTime;