rhoPorousMRFSimpleFoam: Changed to rhoThermo

Also renamed addEnthalpySource -> addEnergySource
This commit is contained in:
Henry
2012-07-16 09:49:04 +01:00
parent 734f853ca9
commit 09aa9fbeb2
18 changed files with 430 additions and 259 deletions

View File

@ -1,98 +1,102 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
UEqn.clear();
bool closedVolume = false;
if (simple.transonic())
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(HbyA) & mesh.Sf())
);
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::div(phid, p)
- fvm::laplacian(rho*rAU, p)
);
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
}
}
else
{
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf())
);
closedVolume = adjustPhi(phiHbyA, U, p);
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvc::div(phiHbyA)
- fvm::laplacian(rho*rAU, p)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi = phiHbyA + pEqn.flux();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
U = HbyA - rAU*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);
if (!simple.transonic())
{ {
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; volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
UEqn.clear();
bool closedVolume = false;
if (simple.transonic())
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(HbyA) & mesh.Sf())
);
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::div(phid, p)
- fvm::laplacian(rho*rAU, p)
);
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi == pEqn.flux();
}
}
}
else
{
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf())
);
closedVolume = adjustPhi(phiHbyA, U, p);
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvc::div(phiHbyA)
- fvm::laplacian(rho*rAU, p)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (simple.finalNonOrthogonalIter())
{
phi = phiHbyA + pEqn.flux();
}
}
}
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
U = HbyA - rAU*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);
if (!simple.transonic())
{
rho.relax();
}
Info<< "rho max/min : "
<< max(rho).value() << " "
<< min(rho).value() << endl;
}

View File

@ -0,0 +1,61 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoThermo> pThermo
(
rhoThermo::New(mesh)
);
rhoThermo& thermo = pThermo();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
thermo.rho()
);
volScalarField& p = thermo.p();
volScalarField& e = thermo.he();
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
(
rho,
U,
phi,
thermo
)
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);

View File

@ -1,4 +1,5 @@
{ {
// Kinetic + pressure energy
volScalarField Ekp("Ekp", 0.5*magSqr(U) + p/rho); volScalarField Ekp("Ekp", 0.5*magSqr(U) + p/rho);
fvScalarMatrix eEqn fvScalarMatrix eEqn
@ -10,7 +11,7 @@
fvc::div(phi)*Ekp - fvc::div(phi, Ekp) fvc::div(phi)*Ekp - fvc::div(phi, Ekp)
); );
//pZones.addEnergySource(thermo, rho, eEqn); pZones.addEnergySource(thermo, rho, eEqn);
eEqn.relax(); eEqn.relax();
eEqn.solve(); eEqn.solve();

View File

@ -1,52 +1,24 @@
volVectorField HbyA("HbyA", U);
if (pressureImplicitPorosity)
{ {
HbyA = trTU() & UEqn().H(); rho = thermo.rho();
} rho = max(rho, rhoMin);
else rho = min(rho, rhoMax);
{ rho.relax();
HbyA = trAU()*UEqn().H();
}
UEqn.clear(); volVectorField HbyA("HbyA", U);
bool closedVolume = false; if (pressureImplicitPorosity)
if (simple.transonic())
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(HbyA) & mesh.Sf())
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
while (simple.correctNonOrthogonal())
{ {
tmp<fvScalarMatrix> tpEqn; HbyA = trTU() & UEqn().H();
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 (simple.finalNonOrthogonalIter())
{
phi == tpEqn().flux();
}
} }
} else
else {
{ HbyA = trAU()*UEqn().H();
}
UEqn.clear();
bool closedVolume = false;
surfaceScalarField phiHbyA surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
@ -79,34 +51,37 @@ else
phi = phiHbyA - tpEqn().flux(); phi = phiHbyA - tpEqn().flux();
} }
} }
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U = HbyA - (trTU() & fvc::grad(p));
}
else
{
U = HbyA - trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
const volScalarField& psi = thermo.psi();
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;
} }
#include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
if (pressureImplicitPorosity)
{
U = HbyA - (trTU() & fvc::grad(p));
}
else
{
U = HbyA - 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

@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "psiThermo.H" #include "rhoThermo.H"
#include "RASModel.H" #include "RASModel.H"
#include "MRFZones.H" #include "MRFZones.H"
#include "thermalPorousZones.H" #include "thermalPorousZones.H"

View File

@ -16,7 +16,6 @@ porousPhi =
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(porousRho*rAUPorous, porousP) == fvc::div(porousPhi) fvm::laplacian(porousRho*rAUPorous, porousP) == fvc::div(porousPhi)

View File

@ -61,51 +61,6 @@ namespace Foam
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
perfectGas
);
makeBasicMixture makeBasicMixture
( (
pureMixture, pureMixture,
@ -185,6 +140,87 @@ makeBasicMixture
); );
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
incompressible
);
makeBasicPolyMixture
(
pureMixture,
3,
sensibleInternalEnergy
);
makeBasicPolyMixture
(
pureMixture,
8,
sensibleInternalEnergy
);
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
isobaricPerfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
isobaricPerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -84,27 +84,27 @@ makeThermo
/* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */
makeThermo // makeThermo
( // (
psiThermo, // psiThermo,
hePsiThermo, // hePsiThermo,
pureMixture, // pureMixture,
constTransport, // constTransport,
sensibleInternalEnergy, // sensibleInternalEnergy,
eConstThermo, // eConstThermo,
perfectGas // perfectGas
); // );
makeThermo // makeThermo
( // (
psiThermo, // psiThermo,
hePsiThermo, // hePsiThermo,
pureMixture, // pureMixture,
sutherlandTransport, // sutherlandTransport,
sensibleInternalEnergy, // sensibleInternalEnergy,
eConstThermo, // eConstThermo,
perfectGas // perfectGas
); // );
makeThermo makeThermo
( (

View File

@ -149,6 +149,104 @@ makeThermo
); );
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
perfectGas
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
perfectGas
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
incompressible
);
makePolyThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
3,
sensibleInternalEnergy
);
makePolyThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
8,
sensibleInternalEnergy
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
constTransport,
sensibleInternalEnergy,
hConstThermo,
isobaricPerfectGas
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
hConstThermo,
isobaricPerfectGas
);
makeThermo
(
rhoThermo,
heRhoThermo,
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
janafThermo,
isobaricPerfectGas
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -64,7 +64,7 @@ Foam::porousMedia::fixedTemperature::~fixedTemperature()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousMedia::fixedTemperature::addEnthalpySource void Foam::porousMedia::fixedTemperature::addEnergySource
( (
const basicThermo& thermo, const basicThermo& thermo,
const volScalarField& rho, const volScalarField& rho,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,7 +78,7 @@ public:
// Member Functions // Member Functions
//- Add the thermal source to the enthalpy equation //- Add the thermal source to the enthalpy equation
virtual void addEnthalpySource virtual void addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField& rho, const volScalarField& rho,
@ -100,4 +100,3 @@ public:
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,7 +63,7 @@ Foam::porousMedia::noThermalModel::~noThermalModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousMedia::noThermalModel::addEnthalpySource void Foam::porousMedia::noThermalModel::addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField&, const volScalarField&,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -70,7 +70,7 @@ public:
// Member Functions // Member Functions
//- Add the thermal source to the enthalpy equation //- Add the thermal source to the enthalpy equation
virtual void addEnthalpySource virtual void addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField& rho, const volScalarField& rho,
@ -92,4 +92,3 @@ public:
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,7 +105,7 @@ public:
// Member Functions // Member Functions
//- Add the thermal source to the enthalpy equation //- Add the thermal source to the enthalpy equation
virtual void addEnthalpySource virtual void addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField& rho, const volScalarField& rho,
@ -127,4 +127,3 @@ public:
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,7 +44,7 @@ Foam::thermalPorousZone::thermalPorousZone
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::thermalPorousZone::addEnthalpySource void Foam::thermalPorousZone::addEnergySource
( (
const basicThermo& thermo, const basicThermo& thermo,
const volScalarField& rho, const volScalarField& rho,
@ -53,7 +53,7 @@ void Foam::thermalPorousZone::addEnthalpySource
{ {
if (model_.valid()) if (model_.valid())
{ {
model_->addEnthalpySource(thermo, rho, hEqn); model_->addEnergySource(thermo, rho, hEqn);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -125,7 +125,7 @@ public:
// Member Functions // Member Functions
//- Add the thermal source to the enthalpy equation //- Add the thermal source to the enthalpy equation
void addEnthalpySource void addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField& rho, const volScalarField& rho,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,7 @@ Foam::thermalPorousZones::thermalPorousZones
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::thermalPorousZones::addEnthalpySource void Foam::thermalPorousZones::addEnergySource
( (
const basicThermo& thermo, const basicThermo& thermo,
const volScalarField& rho, const volScalarField& rho,
@ -55,7 +55,7 @@ void Foam::thermalPorousZones::addEnthalpySource
{ {
forAll(*this, i) forAll(*this, i)
{ {
operator[](i).addEnthalpySource(thermo, rho, hEqn); operator[](i).addEnergySource(thermo, rho, hEqn);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,7 +93,7 @@ public:
// Member Functions // Member Functions
//- Add the thermal source to the enthalpy equation //- Add the thermal source to the enthalpy equation
void addEnthalpySource void addEnergySource
( (
const basicThermo&, const basicThermo&,
const volScalarField& rho, const volScalarField& rho,