mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
rhoPorousMRFSimpleFoam: Added MRF support to rhoPorousSimpleFoam
This commit is contained in:
@ -19,7 +19,7 @@ if (transonic)
|
|||||||
fvc::interpolate(psi)
|
fvc::interpolate(psi)
|
||||||
*(
|
*(
|
||||||
(fvc::interpolate(U) & mesh.Sf())
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
//+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
|
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
|
||||||
|
|||||||
@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
wmake
|
wmake
|
||||||
wmake rhoPorousSimpleFoam
|
wmake rhoPorousMRFSimpleFoam
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
rhoPorousMRFSimpleFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/rhoPorousMRFSimpleFoam
|
||||||
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
UEqn().relax();
|
UEqn().relax();
|
||||||
|
|
||||||
|
mrfZones.addCoriolis(rho, UEqn());
|
||||||
|
|
||||||
// Include the porous media resistance and solve the momentum equation
|
// Include the porous media resistance and solve the momentum equation
|
||||||
// either implicit in the tensorial resistance or transport using by
|
// either implicit in the tensorial resistance or transport using by
|
||||||
// including the spherical part of the resistance in the momentum diagonal
|
// including the spherical part of the resistance in the momentum diagonal
|
||||||
@ -1,3 +1,6 @@
|
|||||||
|
MRFZones mrfZones(mesh);
|
||||||
|
mrfZones.correctBoundaryVelocity(U);
|
||||||
|
|
||||||
thermalPorousZones pZones(mesh);
|
thermalPorousZones pZones(mesh);
|
||||||
Switch pressureImplicitPorosity(false);
|
Switch pressureImplicitPorosity(false);
|
||||||
|
|
||||||
@ -24,4 +27,3 @@
|
|||||||
Info<< "Using pressure explicit porosity" << endl;
|
Info<< "Using pressure explicit porosity" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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;
|
||||||
@ -26,13 +26,15 @@ Application
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Steady-state solver for turbulent flow of compressible fluids with
|
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 "fvCFD.H"
|
||||||
#include "basicPsiThermo.H"
|
#include "basicPsiThermo.H"
|
||||||
#include "RASModel.H"
|
#include "RASModel.H"
|
||||||
|
#include "MRFZones.H"
|
||||||
#include "thermalPorousZones.H"
|
#include "thermalPorousZones.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -43,7 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "createPorousZones.H"
|
#include "createZones.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -1,3 +0,0 @@
|
|||||||
rhoPorousSimpleFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam
|
|
||||||
@ -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;
|
|
||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
application rhoPorousSimpleFoam;
|
application rhoPorousMRFSimpleFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom startTime;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
application rhoPorousSimpleFoam;
|
application rhoPorousMRFSimpleFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom startTime;
|
||||||
|
|
||||||
Reference in New Issue
Block a user