ENH: Added run-time selectable sources to compressible solvers

This commit is contained in:
andy
2012-10-19 13:52:41 +01:00
parent 2166a03245
commit 8d85caee1d
30 changed files with 159 additions and 36 deletions

View File

@ -16,9 +16,12 @@
: -dpdt
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
sources(rho, he)
);
EEqn.relax();
sources.constrain(EEqn);
EEqn.solve();
thermo.correct();

View File

@ -2,7 +2,10 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -11,4 +14,6 @@ EXE_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lsampling \
-lfieldSources

View File

@ -9,8 +9,10 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax();
sources.constrain(UEqn());
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
solve(UEqn() == -fvc::grad(p) + sources(rho, U));
K = 0.5*magSqr(U);
}

View File

@ -69,3 +69,6 @@
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
Info<< "Creating sources\n" << endl;
IObasicSourceList sources(mesh);

View File

@ -5,7 +5,7 @@ rho.relax();
volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
HbyA = rAU*(UEqn() == sources(rho, U))().H();
if (pimple.nCorrPISO() <= 1)
{
@ -33,8 +33,12 @@ if (pimple.transonic())
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
@ -65,8 +69,12 @@ else
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
@ -92,6 +100,7 @@ Info<< "rho max/min : " << max(rho).value()
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U);
if (thermo.dpdt())

View File

@ -38,6 +38,7 @@ Description
#include "turbulenceModel.H"
#include "bound.H"
#include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,10 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -12,4 +15,6 @@ EXE_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lsampling \
-lfieldSources

View File

@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn().A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1()));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
HbyA = rAU*(UEqn() == sources(rho, U))().H();
if (pimple.nCorrPIMPLE() <= 1)
{
@ -44,11 +44,15 @@ if (pimple.transonic())
+ fvm::div(phid, p)
+ fvc::div(phic)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
// Relax the pressure equation to maintain diagonal dominance
pEqn.relax();
sources.constrain(pEqn, rho.name());
pEqn.solve();
if (pimple.finalNonOrthogonalIter())
@ -81,8 +85,12 @@ else
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.solve();
if (pimple.finalNonOrthogonalIter())
@ -100,6 +108,7 @@ p.relax();
U = HbyA - rAtU*fvc::grad(p);
U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U);
if (thermo.dpdt())

View File

@ -38,6 +38,7 @@ Description
#include "turbulenceModel.H"
#include "bound.H"
#include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,9 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -14,4 +16,6 @@ EXE_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lsampling \
-lfieldSources

View File

@ -39,6 +39,7 @@ Description
#include "turbulenceModel.H"
#include "MRFZones.H"
#include "IOporosityModelList.H"
#include "IObasicSourceList.H"
#include "fvcSmooth.H"
#include "pimpleControl.H"
#include "bound.H"

View File

@ -4,7 +4,9 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -13,4 +15,6 @@ EXE_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lsampling \
-lfieldSources

View File

@ -11,9 +11,12 @@ tmp<fvVectorMatrix> UEqn
UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
pZones.addResistance(UEqn());
sources.constrain(UEqn());
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
solve(UEqn() == -fvc::grad(p) + sources(rho, U));
}

View File

@ -5,7 +5,7 @@ rho.relax();
volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
HbyA = rAU*(UEqn() == sources(rho, U))().H();
if (pimple.nCorrPISO() <= 1)
{
@ -34,8 +34,12 @@ if (pimple.transonic())
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
@ -68,8 +72,12 @@ else
fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
@ -94,6 +102,7 @@ Info<< "rho max/min : " << max(rho).value()
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U);
if (thermo.dpdt())

View File

@ -39,6 +39,7 @@ Description
#include "bound.H"
#include "MRFZones.H"
#include "IOporosityModelList.H"
#include "IObasicSourceList.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,9 +10,12 @@
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
sources(rho, he)
);
EEqn.relax();
sources.constrain(EEqn);
EEqn.solve();
thermo.correct();

View File

@ -3,7 +3,10 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -11,4 +14,6 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools
-lsampling \
-lmeshTools \
-lfieldSources

View File

@ -60,3 +60,6 @@
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
Info<< "Creating sources\n" << endl;
IObasicSourceList sources(mesh);

View File

@ -6,7 +6,7 @@
volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
HbyA = rAU*(UEqn() == sources(rho, U))().H();
UEqn.clear();
@ -25,12 +25,16 @@
fvScalarMatrix pEqn
(
fvm::div(phid, p)
- fvm::laplacian(rho*rAU, p)
- fvm::laplacian(rho*rAU, p)
==
sources(psi, p, rho.name())
);
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
sources.constrain(pEqn, rho.name());
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
@ -56,11 +60,15 @@
fvScalarMatrix pEqn
(
fvc::div(phiHbyA)
- fvm::laplacian(rho*rAU, p)
- fvm::laplacian(rho*rAU, p)
==
sources(psi, p, rho.name())
);
pEqn.setReference(pRefCell, pRefValue);
sources.constrain(pEqn, rho.name());
pEqn.solve();
if (simple.finalNonOrthogonalIter())
@ -78,6 +86,7 @@
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
sources.correct(U);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity

View File

@ -10,11 +10,12 @@
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
sources(rho, he)
);
pZones.addEnergySource(thermo, rho, EEqn);
EEqn.relax();
sources.constrain(EEqn);
EEqn.solve();
thermo.correct();

View File

@ -1,18 +1,20 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
-lthermalPorousZone \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools
-lsampling \
-lmeshTools \
-lfieldSources

View File

@ -24,11 +24,13 @@
trTU = inv(tTU());
trTU().rename("rAU");
sources.constrain(UEqn());
volVectorField gradp(fvc::grad(p));
for (int UCorr=0; UCorr<nUCorr; UCorr++)
{
U = trTU() & (UEqn().H() - gradp);
U = trTU() & ((UEqn() == sources(rho, U))().H() - gradp);
}
U.correctBoundaryConditions();
}
@ -36,7 +38,9 @@
{
pZones.addResistance(UEqn());
solve(UEqn() == -fvc::grad(p));
sources.constrain(UEqn());
solve(UEqn() == -fvc::grad(p) + sources(rho, U));
trAU = 1.0/UEqn().A();
trAU().rename("rAU");

View File

@ -59,3 +59,6 @@
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
Info<< "Creating sources\n" << endl;
IObasicSourceList sources(mesh);

View File

@ -1,7 +1,7 @@
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
thermalPorousZones pZones(mesh);
IOporosityModelList pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity

View File

@ -4,15 +4,17 @@
rho = min(rho, rhoMax);
rho.relax();
const volScalarField& psi = thermo.psi();
volVectorField HbyA("HbyA", U);
if (pressureImplicitPorosity)
{
HbyA = trTU() & UEqn().H();
HbyA = trTU() & (UEqn() == sources(rho, U))().H();
}
else
{
HbyA = trAU()*UEqn().H();
HbyA = trAU()*(UEqn() == sources(rho, U))().H();
}
UEqn.clear();
@ -35,15 +37,29 @@
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phiHbyA));
tpEqn =
(
fvm::laplacian(rho*trTU(), p)
+ sources(psi, p, rho.name())
==
fvc::div(phiHbyA)
);
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phiHbyA));
tpEqn =
(
fvm::laplacian(rho*trAU(), p)
+ sources(psi, p, rho.name())
==
fvc::div(phiHbyA)
);
}
tpEqn().setReference(pRefCell, pRefValue);
sources.constrain(tpEqn(), rho.name());
tpEqn().solve();
if (simple.finalNonOrthogonalIter())
@ -67,12 +83,12 @@
}
U.correctBoundaryConditions();
sources.correct(U);
// 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);
}

View File

@ -35,7 +35,8 @@ Description
#include "rhoThermo.H"
#include "RASModel.H"
#include "MRFZones.H"
#include "thermalPorousZones.H"
#include "IObasicSourceList.H"
#include "IOporosityModelList.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -34,6 +34,7 @@ Description
#include "psiThermo.H"
#include "RASModel.H"
#include "simpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -4,11 +4,16 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools
-lsampling \
-lmeshTools \
-lfieldSources

View File

@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn().A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1()));
volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H();
HbyA = rAU*(UEqn() == sources(rho, U))().H();
UEqn.clear();
@ -38,11 +38,15 @@ if (simple.transonic())
fvm::div(phid, p)
+ fvc::div(phic)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
// Relax the pressure equation to maintain diagonal dominance
pEqn.relax();
sources.constrain(pEqn, rho.name());
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
@ -74,8 +78,12 @@ else
(
fvc::div(phiHbyA)
- fvm::laplacian(Dp, p)
==
sources(psi, p, rho.name())
);
sources.constrain(pEqn, rho.name());
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
@ -96,6 +104,7 @@ p.relax();
U = HbyA - rAtU*fvc::grad(p);
U.correctBoundaryConditions();
sources.correct(U);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity

View File

@ -36,6 +36,7 @@ Description
#include "mixedFvPatchFields.H"
#include "bound.H"
#include "simpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //