ENH: Updated rhoPorousSimpleFoam solver

This commit is contained in:
andy
2010-10-07 17:16:54 +01:00
parent e44826f076
commit 29e4855042
3 changed files with 29 additions and 26 deletions

View File

@ -45,14 +45,9 @@
scalar pRefValue = 0.0; scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
dimensionedScalar rhoMax dimensionedScalar pMin
( (
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax") mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
); );
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
@ -70,16 +65,29 @@
dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar initialMass = fvc::domainIntegrate(rho);
thermalPorousZones pZones(mesh); thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity // nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0; int nUCorr = 0;
const bool pressureImplicitPorosity = if (pZones.size())
( {
pZones.size() // nUCorrectors for pressureImplicitPorosity
&& mesh.solutionDict().subDict("SIMPLE").readIfPresent if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
( {
"nUCorrectors", nUCorr = readInt
nUCorr (
) mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
&& (nUCorr > 0) );
); }
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}

View File

@ -5,8 +5,8 @@
- fvm::Sp(fvc::div(phi), h) - fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h) - fvm::laplacian(turbulence->alphaEff(), h)
== ==
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)") fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho)) - p*fvc::div(phi/fvc::interpolate(rho))
); );
pZones.addEnthalpySource(thermo, rho, hEqn); pZones.addEnthalpySource(thermo, rho, hEqn);

View File

@ -1,8 +1,3 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
if (pressureImplicitPorosity) if (pressureImplicitPorosity)
{ {
U = trTU()&UEqn().H(); U = trTU()&UEqn().H();
@ -63,6 +58,8 @@ else
U.correctBoundaryConditions(); U.correctBoundaryConditions();
bound(p, pMin);
// For closed-volume cases adjust the pressure and density levels // For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity // to obey overall mass continuity
if (closedVolume) if (closedVolume)
@ -72,7 +69,5 @@ if (closedVolume)
} }
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;