mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: cleaning chtMultiRegionFoam and chtMultiRegionSimpleFoam from
porous fluid and solid now incorporated into fluid and solid regions
This commit is contained in:
@ -60,14 +60,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createFluidMeshes.H"
|
||||
#include "createSolidMeshes.H"
|
||||
#include "createPorousFluidRegions.H"
|
||||
#include "createPorousSolidMeshes.H"
|
||||
|
||||
#include "createFluidFields.H"
|
||||
#include "createSolidFields.H"
|
||||
#include "createPorousFluidFields.H"
|
||||
#include "createPorousSolidFields.H"
|
||||
|
||||
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
@ -116,24 +111,6 @@ int main(int argc, char *argv[])
|
||||
#include "solveFluid.H"
|
||||
}
|
||||
|
||||
forAll(porousFluidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for fluid porous region "
|
||||
<< porousFluidRegions[i].name() << endl;
|
||||
#include "setPorousFluidFields.H"
|
||||
#include "readPorousFluidRegionPIMPLEControls.H"
|
||||
#include "solvePorousFluid.H"
|
||||
}
|
||||
|
||||
forAll(porousSolidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for porous solid region "
|
||||
<< porousSolidRegions[i].name() << endl;
|
||||
#include "setPorousRegionSolidFields.H"
|
||||
#include "readPorousSolidMultiRegionPIMPLEControls.H"
|
||||
#include "solvePorousSolid.H"
|
||||
}
|
||||
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for solid region "
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
EXE_INC = \
|
||||
-Ifluid \
|
||||
-Isolid \
|
||||
-I./porousFluid \
|
||||
-I./porousSolid \
|
||||
-I../solid \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
|
||||
@ -50,13 +50,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createFluidMeshes.H"
|
||||
#include "createSolidMeshes.H"
|
||||
#include "createPorousFluidRegions.H"
|
||||
#include "createPorousSolidMeshes.H"
|
||||
|
||||
#include "createFluidFields.H"
|
||||
#include "createSolidFields.H"
|
||||
#include "createPorousFluidFields.H"
|
||||
#include "createPorousSolidFields.H"
|
||||
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
@ -74,24 +70,6 @@ int main(int argc, char *argv[])
|
||||
#include "solveFluid.H"
|
||||
}
|
||||
|
||||
forAll(porousFluidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for fluid porous region "
|
||||
<< porousFluidRegions[i].name() << endl;
|
||||
#include "setPorousFluidFields.H"
|
||||
#include "readPorousFluidRegionSIMPLEControls.H"
|
||||
#include "solvePorousFluid.H"
|
||||
}
|
||||
|
||||
forAll(porousSolidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for porous solid region "
|
||||
<< porousSolidRegions[i].name() << endl;
|
||||
#include "setPorousRegionSolidFields.H"
|
||||
#include "readPorousSolidMultiRegionSIMPLEControls.H"
|
||||
#include "solvePorousSolid.H"
|
||||
}
|
||||
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "\nSolving for solid region "
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
// Solve the Momentum equation
|
||||
tmp<fvVectorMatrix> porousUEqn
|
||||
(
|
||||
fvm::div(porousPhi, porousU)
|
||||
+ turbPorous.divDevRhoReff(porousU)
|
||||
+ porousSources(porousRho, porousU)
|
||||
);
|
||||
|
||||
porousUEqn().relax();
|
||||
|
||||
solve(porousUEqn() == -fvc::grad(porousP));
|
||||
@ -1,181 +0,0 @@
|
||||
// Initialise porous field pointer lists
|
||||
PtrList<rhoThermo> thermoPorous(porousFluidRegions.size());
|
||||
PtrList<volScalarField> rhoPorous(porousFluidRegions.size());
|
||||
PtrList<volScalarField> kappaPorous(porousFluidRegions.size());
|
||||
PtrList<volVectorField> UPorous(porousFluidRegions.size());
|
||||
PtrList<surfaceScalarField> phiPorous(porousFluidRegions.size());
|
||||
PtrList<compressible::turbulenceModel> turbulencePorous
|
||||
(
|
||||
porousFluidRegions.size()
|
||||
);
|
||||
PtrList<volScalarField> pPorous(porousFluidRegions.size());
|
||||
|
||||
List<scalar> initialMassFluidPorous(porousFluidRegions.size());
|
||||
List<label> pRefCellFluidPorous(porousFluidRegions.size(),0);
|
||||
List<scalar> pRefValueFluidPorous(porousFluidRegions.size(),0.0);
|
||||
|
||||
PtrList<dimensionedScalar> rhoMaxPorous(fluidRegions.size());
|
||||
PtrList<dimensionedScalar> rhoMinPorous(fluidRegions.size());
|
||||
|
||||
PtrList<IObasicSourceList> heatPorousSources
|
||||
(
|
||||
porousFluidRegions.size()
|
||||
);
|
||||
|
||||
forAll(porousFluidRegions, i)
|
||||
{
|
||||
Info<< "Reading fluid mesh thermophysical properties for porous "
|
||||
<< porousFluidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermoFluid porous\n" << endl;
|
||||
|
||||
thermoPorous.set
|
||||
(
|
||||
i,
|
||||
rhoThermo::New(porousFluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoPorous\n" << endl;
|
||||
rhoPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermoPorous[i].rho()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to UPorous\n" << endl;
|
||||
UPorous.set
|
||||
(
|
||||
i,
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousFluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to phiPorous\n" << endl;
|
||||
phiPorous.set
|
||||
(
|
||||
i,
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rhoPorous[i]*UPorous[i])
|
||||
& porousFluidRegions[i].Sf()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding turbulence to porous\n" << endl;
|
||||
turbulencePorous.set
|
||||
(
|
||||
i,
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rhoPorous[i],
|
||||
UPorous[i],
|
||||
phiPorous[i],
|
||||
thermoPorous[i]
|
||||
).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to kappaFluid\n" << endl;
|
||||
kappaPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"kappaPorous",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
thermoPorous[i].Cp()*thermoPorous[i].alpha()
|
||||
)
|
||||
);
|
||||
|
||||
pPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousFluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
setRefCell
|
||||
(
|
||||
thermoPorous[i].p(),
|
||||
pPorous[i],
|
||||
porousFluidRegions[i].solutionDict().subDict("SIMPLE"),
|
||||
pRefCellFluidPorous[i],
|
||||
pRefValueFluidPorous[i]
|
||||
);
|
||||
|
||||
rhoMaxPorous.set
|
||||
(
|
||||
i,
|
||||
new dimensionedScalar
|
||||
(
|
||||
porousFluidRegions[i].solutionDict().subDict("SIMPLE").lookup
|
||||
(
|
||||
"rhoMax"
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
rhoMinPorous.set
|
||||
(
|
||||
i,
|
||||
new dimensionedScalar
|
||||
(
|
||||
porousFluidRegions[i].solutionDict().subDict("SIMPLE").lookup
|
||||
(
|
||||
"rhoMin"
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
heatPorousSources.set
|
||||
(
|
||||
i,
|
||||
new IObasicSourceList(porousFluidRegions[i])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
const wordList porousFluidNames(rp["porousFluid"]);
|
||||
|
||||
PtrList<fvMesh> porousFluidRegions(porousFluidNames.size());
|
||||
|
||||
forAll (porousFluidNames, iPorous)
|
||||
{
|
||||
const word porousFluidName = porousFluidNames[iPorous];
|
||||
Info<< "Create porous fluid region " << porousFluidName
|
||||
<< nl << endl;
|
||||
|
||||
porousFluidRegions.set
|
||||
(
|
||||
iPorous,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
porousFluidName,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
{
|
||||
fvScalarMatrix hPorousEqn
|
||||
(
|
||||
fvm::div(porousPhi, porousH)
|
||||
- fvm::laplacian(turbPorous.alphaEff(), porousH)
|
||||
==
|
||||
- fvc::div(porousPhi, 0.5*magSqr(porousU), "div(phi,K)")
|
||||
+ porousSources(porousRho, porousH)
|
||||
);
|
||||
|
||||
hPorousEqn.relax();
|
||||
hPorousEqn.solve();
|
||||
|
||||
porousThermo.correct();
|
||||
|
||||
Info<< "Min/max in the porous T:"
|
||||
<< min(porousThermo.T()).value() << ' '
|
||||
<< max(porousThermo.T()).value() << endl;
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
porousRho = porousThermo.rho();
|
||||
porousRho = max(porousRho, rhoMin);
|
||||
porousRho = min(porousRho, rhoMax);
|
||||
porousRho.relax();
|
||||
|
||||
volScalarField rAUPorous(1.0/porousUEqn().A());
|
||||
|
||||
porousU = rAUPorous*porousUEqn().H();
|
||||
porousUEqn.clear();
|
||||
|
||||
bool closedVolume = false;
|
||||
|
||||
porousPhi =
|
||||
fvc::interpolate(porousRho)
|
||||
*(fvc::interpolate(porousU) & porousMesh.Sf());
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(porousRho*rAUPorous, porousP) == fvc::div(porousPhi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
porousPhi -= pEqn.flux();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
porousP.relax();
|
||||
|
||||
porousU -= rAUPorous*fvc::grad(porousP);
|
||||
porousU.correctBoundaryConditions();
|
||||
|
||||
if (closedVolume)
|
||||
{
|
||||
porousP += (initialMass - fvc::domainIntegrate(porousPsi*porousP))
|
||||
/fvc::domainIntegrate(porousPsi);
|
||||
}
|
||||
|
||||
porousRho = porousThermo.rho();
|
||||
porousRho = max(porousRho, rhoMin);
|
||||
porousRho = min(porousRho, rhoMax);
|
||||
porousRho.relax();
|
||||
|
||||
Info<< "rho max/min : "
|
||||
<< max(porousRho).value() << " "
|
||||
<< min(porousRho).value() << endl;
|
||||
@ -1,4 +0,0 @@
|
||||
const dictionary& simple = porousMesh.solutionDict().subDict("SIMPLE");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
@ -1,28 +0,0 @@
|
||||
const fvMesh& porousMesh = porousFluidRegions[i];
|
||||
|
||||
rhoThermo& porousThermo = thermoPorous[i];
|
||||
volScalarField& porousRho = rhoPorous[i];
|
||||
|
||||
volVectorField& porousU = UPorous[i];
|
||||
surfaceScalarField& porousPhi = phiPorous[i];
|
||||
|
||||
compressible::turbulenceModel& turbPorous = turbulencePorous[i];
|
||||
|
||||
volScalarField& porousP = porousThermo.p();
|
||||
const volScalarField& porousPsi = porousThermo.psi();
|
||||
volScalarField& porousH = porousThermo.he();
|
||||
|
||||
const dimensionedScalar initialMass
|
||||
(
|
||||
"initialMass",
|
||||
dimMass,
|
||||
initialMassFluidPorous[i]
|
||||
);
|
||||
|
||||
IObasicSourceList& porousSources = heatPorousSources[i];
|
||||
|
||||
const label pRefCell = pRefCellFluidPorous[i];
|
||||
const scalar pRefValue = pRefValueFluidPorous[i];
|
||||
|
||||
const scalar rhoMax = rhoMaxPorous[i].value();
|
||||
const scalar rhoMin = rhoMinPorous[i].value();
|
||||
@ -1,11 +0,0 @@
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
|
||||
porousP.storePrevIter();
|
||||
porousRho.storePrevIter();
|
||||
{
|
||||
#include "UPorousFluidEqn.H"
|
||||
#include "hPorousFluidEqn.H"
|
||||
#include "pPorousFluidEqn.H"
|
||||
}
|
||||
|
||||
turbPorous.correct();
|
||||
@ -1,43 +0,0 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size());
|
||||
PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size());
|
||||
PtrList<volScalarField> betavSolid(porousSolidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(porousSolidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading porous solid mesh thermophysical "
|
||||
<< "properties for region "
|
||||
<< porousSolidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
porousSolidThermos.set
|
||||
(
|
||||
i,
|
||||
solidThermo::New(porousSolidRegions[i])
|
||||
);
|
||||
Info<< " Adding sources\n" << endl;
|
||||
solidHeatSources.set
|
||||
(
|
||||
i,
|
||||
new IObasicSourceList(porousSolidRegions[i])
|
||||
);
|
||||
|
||||
Info<< " Adding to betavSolid\n" << endl;
|
||||
betavSolid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"betavSolid",
|
||||
runTime.timeName(),
|
||||
porousSolidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousSolidRegions[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
const wordList porousSolidNames(rp["porousSolid"]);
|
||||
|
||||
PtrList<fvMesh> porousSolidRegions(porousSolidNames.size());
|
||||
|
||||
forAll(porousSolidNames, i)
|
||||
{
|
||||
Info<< "Create solid mesh for region " << porousSolidNames[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
porousSolidRegions.set
|
||||
(
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
porousSolidNames[i],
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
const dictionary& simple = mesh.solutionDict().subDict("SIMPLE");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
@ -1,23 +0,0 @@
|
||||
const fvMesh& mesh = porousSolidRegions[i];
|
||||
|
||||
solidThermo& thermo = porousSolidThermos[i];
|
||||
const volScalarField& betav = betavSolid[i];
|
||||
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
tmp<volScalarField> tcp = thermo.Cp();
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
tmp<volScalarField> tkappa = thermo.kappa();
|
||||
//tmp<volSymmTensorField> tkappa = thermo.directionalKappa()*betav;
|
||||
|
||||
const volScalarField& kappa = tkappa();
|
||||
//const volSymmTensorField& K = tK();
|
||||
|
||||
tmp<volScalarField> talpha = thermo.alpha();
|
||||
const volScalarField& alpha = talpha();
|
||||
|
||||
volScalarField& h = thermo.he();
|
||||
|
||||
IObasicSourceList& sources = solidHeatSources[i];
|
||||
@ -1,18 +0,0 @@
|
||||
scalar DiNum = -GREAT;
|
||||
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
# include "setRegionSolidFields.H"
|
||||
|
||||
DiNum = max
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
solidRegions[i],
|
||||
runTime,
|
||||
rho*cp,
|
||||
K
|
||||
),
|
||||
DiNum
|
||||
);
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
tmp<fvScalarMatrix> hEqn
|
||||
(
|
||||
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
|
||||
+ sources(rho, h)
|
||||
);
|
||||
|
||||
hEqn().relax();
|
||||
hEqn().solve();
|
||||
}
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
|
||||
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;
|
||||
@ -1,20 +0,0 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<solidThermo> thermos(solidRegions.size());
|
||||
PtrList<radiation::radiationModel> radiations(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading solid mesh thermophysical properties for region "
|
||||
<< solidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
thermos.set
|
||||
(
|
||||
i,
|
||||
solidThermo::New(solidRegions[i])
|
||||
);
|
||||
|
||||
Info<< " Adding to radiations\n" << endl;
|
||||
radiations.set(i, radiation::radiationModel::New(thermos[i].T()));
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
const wordList solidsNames(rp["solid"]);
|
||||
|
||||
PtrList<fvMesh> solidRegions(solidsNames.size());
|
||||
|
||||
forAll(solidsNames, i)
|
||||
{
|
||||
Info<< "Create solid mesh for region " << solidsNames[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
solidRegions.set
|
||||
(
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
solidsNames[i],
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
fvMesh& mesh = solidRegions[i];
|
||||
solidThermo& thermo = thermos[i];
|
||||
const radiation::radiationModel& radiation = radiations[i];
|
||||
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
tmp<volScalarField> tcp = thermo.Cp();
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
tmp<volScalarField> tkappa = thermo.kappa();
|
||||
//tmp<volSymmTensorField> tkappa = thermo.directionalkappa();
|
||||
const volScalarField& kappa = tkappa();
|
||||
|
||||
tmp<volScalarField> talpha = thermo.alpha();
|
||||
const volScalarField& alpha = talpha();
|
||||
|
||||
volScalarField& h = thermo.he();
|
||||
@ -3,7 +3,8 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
-fvm::laplacian(alpha, h)
|
||||
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
|
||||
+ sources(rho, h)
|
||||
);
|
||||
hEqn.relax();
|
||||
hEqn.solve();
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
CoNum
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
forAll (porousFluidRegions, porousI)
|
||||
{
|
||||
CoNum = max
|
||||
@ -29,3 +29,4 @@
|
||||
CoNum
|
||||
);
|
||||
}
|
||||
*/
|
||||
@ -1,24 +0,0 @@
|
||||
|
||||
// Solve the Momentum equation
|
||||
tmp<fvVectorMatrix> porousUEqn
|
||||
(
|
||||
fvm::ddt(porousRho, porousU)
|
||||
+ fvm::div(porousPhi, porousU)
|
||||
+ turbPorous.divDevRhoReff(porousU)
|
||||
+ porousSources(porousRho, porousU)
|
||||
);
|
||||
|
||||
porousUEqn().relax();
|
||||
|
||||
volScalarField rAUPorous(1.0/porousUEqn().A());
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(porousUEqn() == -fvc::grad(porousP));
|
||||
}
|
||||
else
|
||||
{
|
||||
porousU = rAUPorous*(porousUEqn().H() - fvc::grad(porousP));
|
||||
porousU.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
@ -1,147 +0,0 @@
|
||||
// Initialise porous field pointer lists
|
||||
PtrList<rhoThermo> thermoPorous(porousFluidRegions.size());
|
||||
PtrList<volScalarField> rhoPorous(porousFluidRegions.size());
|
||||
PtrList<volVectorField> UPorous(porousFluidRegions.size());
|
||||
PtrList<surfaceScalarField> phiPorous(porousFluidRegions.size());
|
||||
PtrList<volScalarField> KPorous(porousFluidRegions.size());
|
||||
PtrList<volScalarField> dpdtPorous(fluidRegions.size());
|
||||
|
||||
PtrList<compressible::turbulenceModel> turbulencePorous
|
||||
(
|
||||
porousFluidRegions.size()
|
||||
);
|
||||
PtrList<volScalarField> pPorous(porousFluidRegions.size());
|
||||
|
||||
PtrList<IObasicSourceList> heatPorousSources
|
||||
(
|
||||
porousFluidRegions.size()
|
||||
);
|
||||
|
||||
forAll(porousFluidRegions, i)
|
||||
{
|
||||
Info<< "Reading fluid mesh thermophysical properties for porous "
|
||||
<< porousFluidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermoFluid porous\n" << endl;
|
||||
|
||||
thermoPorous.set
|
||||
(
|
||||
i,
|
||||
rhoThermo::New(porousFluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoPorous\n" << endl;
|
||||
rhoPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermoPorous[i].rho()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to UPorous\n" << endl;
|
||||
UPorous.set
|
||||
(
|
||||
i,
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousFluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to phiPorous\n" << endl;
|
||||
phiPorous.set
|
||||
(
|
||||
i,
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rhoPorous[i]*UPorous[i])
|
||||
& porousFluidRegions[i].Sf()
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding turbulence to porous\n" << endl;
|
||||
turbulencePorous.set
|
||||
(
|
||||
i,
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rhoPorous[i],
|
||||
UPorous[i],
|
||||
phiPorous[i],
|
||||
thermoPorous[i]
|
||||
).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to KPorous\n" << endl;
|
||||
KPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
"KPorous",
|
||||
0.5*magSqr(UPorous[i])
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Adding to dpdtPorous\n" << endl;
|
||||
dpdtPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
"dpdtPorous",
|
||||
fvc::ddt(thermoPorous[i].p())
|
||||
)
|
||||
);
|
||||
|
||||
pPorous.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
porousFluidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousFluidRegions[i]
|
||||
)
|
||||
);
|
||||
|
||||
heatPorousSources.set
|
||||
(
|
||||
i,
|
||||
new IObasicSourceList(porousFluidRegions[i])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
const wordList porousFluidNames(rp["porousFluid"]);
|
||||
|
||||
PtrList<fvMesh> porousFluidRegions(porousFluidNames.size());
|
||||
|
||||
forAll (porousFluidNames, iPorous)
|
||||
{
|
||||
const word porousFluidName = porousFluidNames[iPorous];
|
||||
Info<< "Create porous fluid region " << porousFluidName
|
||||
<< nl << endl;
|
||||
|
||||
porousFluidRegions.set
|
||||
(
|
||||
iPorous,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
porousFluidName,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
{
|
||||
fvScalarMatrix hPorousEqn
|
||||
(
|
||||
fvm::ddt(porousRho, porousH)
|
||||
+ fvm::div(porousPhi, porousH)
|
||||
- fvm::laplacian(turbPorous.alphaEff(), porousH)
|
||||
==
|
||||
porousdpdt
|
||||
- (fvc::ddt(porousRho, porousK) + fvc::div(porousPhi, porousK))
|
||||
+ porousSources(porousRho, porousH)
|
||||
);
|
||||
|
||||
hPorousEqn.relax();
|
||||
hPorousEqn.solve();
|
||||
|
||||
porousThermo.correct();
|
||||
|
||||
Info<< "Min/max in the porous T:"
|
||||
<< min(porousThermo.T()).value() << ' '
|
||||
<< max(porousThermo.T()).value() << endl;
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
porousRho = porousThermo.rho();
|
||||
|
||||
porousU = rAUPorous*porousUEqn().H();
|
||||
|
||||
if (nCorr <= 1)
|
||||
{
|
||||
porousUEqn.clear();
|
||||
}
|
||||
|
||||
porousPhi =
|
||||
fvc::interpolate(porousRho)*
|
||||
(
|
||||
(fvc::interpolate(porousU) & porousMesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rAUPorous, porousRho, porousU, porousPhi)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
// Pressure corrector
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(porousPsi, porousP)
|
||||
+ fvc::div(porousPhi)
|
||||
- fvm::laplacian(porousRho*rAUPorous, porousP)
|
||||
);
|
||||
|
||||
pEqn.solve
|
||||
(
|
||||
porousMesh.solver
|
||||
(
|
||||
porousP.select
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
porousPhi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
solve(fvm::ddt(porousRho) + fvc::div(porousPhi));
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
porousP.relax();
|
||||
|
||||
// Recalculate density from the relaxed pressure
|
||||
porousRho = porousThermo.rho();
|
||||
|
||||
|
||||
porousU -= rAUPorous*fvc::grad(porousP);
|
||||
porousU.correctBoundaryConditions();
|
||||
porousK = 0.5*magSqr(porousU);
|
||||
|
||||
// Update pressure time derivative if needed
|
||||
if (porousThermo.dpdt())
|
||||
{
|
||||
porousdpdt = fvc::ddt(porousP);
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
const dictionary& pimple = porousMesh.solutionDict().subDict("PIMPLE");
|
||||
|
||||
const int nCorr =
|
||||
pimple.lookupOrDefault<int>("nCorrectors", 1);
|
||||
|
||||
const int nNonOrthCorr =
|
||||
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
const bool momentumPredictor =
|
||||
pimple.lookupOrDefault("momentumPredictor", true);
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
fvMesh& porousMesh = porousFluidRegions[i];
|
||||
|
||||
rhoThermo& porousThermo = thermoPorous[i];
|
||||
volScalarField& porousRho = rhoPorous[i];
|
||||
|
||||
volVectorField& porousU = UPorous[i];
|
||||
surfaceScalarField& porousPhi = phiPorous[i];
|
||||
|
||||
compressible::turbulenceModel& turbPorous = turbulencePorous[i];
|
||||
volScalarField& porousK = KPorous[i];
|
||||
volScalarField& porousdpdt = dpdtPorous[i];
|
||||
|
||||
volScalarField& porousP = porousThermo.p();
|
||||
const volScalarField& porousPsi = porousThermo.psi();
|
||||
volScalarField& porousH = porousThermo.he();
|
||||
|
||||
IObasicSourceList& porousSources = heatPorousSources[i];
|
||||
@ -1,28 +0,0 @@
|
||||
if (finalIter)
|
||||
{
|
||||
porousMesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
if (oCorr == 0)
|
||||
{
|
||||
solve(fvm::ddt(porousRho) + fvc::div(porousPhi));
|
||||
}
|
||||
|
||||
#include "UPorousFluidEqn.H"
|
||||
|
||||
#include "hPorousFluidEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
#include "pPorousFluidEqn.H"
|
||||
}
|
||||
|
||||
turbPorous.correct();
|
||||
|
||||
porousRho = porousThermo.rho();
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
porousMesh.data::remove("finalIteration");
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size());
|
||||
PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size());
|
||||
PtrList<volScalarField> betavSolid(porousSolidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(porousSolidRegions, i)
|
||||
{
|
||||
Info<< "*** Reading porous solid mesh thermophysical "
|
||||
<< "properties for region "
|
||||
<< porousSolidRegions[i].name() << nl << endl;
|
||||
|
||||
Info<< " Adding to thermos\n" << endl;
|
||||
porousSolidThermos.set
|
||||
(
|
||||
i,
|
||||
solidThermo::New(porousSolidRegions[i])
|
||||
);
|
||||
Info<< " Adding sources\n" << endl;
|
||||
solidHeatSources.set
|
||||
(
|
||||
i,
|
||||
new IObasicSourceList(porousSolidRegions[i])
|
||||
);
|
||||
|
||||
Info<< " Adding to betavSolid\n" << endl;
|
||||
betavSolid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"betavSolid",
|
||||
runTime.timeName(),
|
||||
porousSolidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
porousSolidRegions[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
const wordList porousSolidNames(rp["porousSolid"]);
|
||||
|
||||
PtrList<fvMesh> porousSolidRegions(porousSolidNames.size());
|
||||
|
||||
forAll(porousSolidNames, i)
|
||||
{
|
||||
Info<< "Create solid mesh for region " << porousSolidNames[i]
|
||||
<< " for time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
porousSolidRegions.set
|
||||
(
|
||||
i,
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
porousSolidNames[i],
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE");
|
||||
|
||||
int nNonOrthCorr =
|
||||
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
@ -1,26 +0,0 @@
|
||||
fvMesh& mesh = porousSolidRegions[i];
|
||||
|
||||
solidThermo& thermo = porousSolidThermos[i];
|
||||
const volScalarField& betav = betavSolid[i];
|
||||
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
tmp<volScalarField> tcp = thermo.Cp();
|
||||
const volScalarField& cp = tcp();
|
||||
|
||||
tmp<volScalarField> tkappa = thermo.kappa();
|
||||
//tmp<volSymmTensorField> tkappa = thermo.directionalKappa()*betav;
|
||||
|
||||
const volScalarField& kappa = tkappa();
|
||||
//const volSymmTensorField& K = tK();
|
||||
|
||||
//tmp<volScalarField> trhoCp = cp*rho;
|
||||
//const volScalarField& rhoCp = trhoCp();
|
||||
|
||||
tmp<volScalarField> talpha = thermo.alpha();
|
||||
const volScalarField& alpha = talpha();
|
||||
|
||||
volScalarField& h = thermo.he();
|
||||
|
||||
IObasicSourceList& sources = solidHeatSources[i];
|
||||
@ -1,18 +0,0 @@
|
||||
scalar DiNum = -GREAT;
|
||||
|
||||
forAll(solidRegions, i)
|
||||
{
|
||||
# include "setRegionSolidFields.H"
|
||||
|
||||
DiNum = max
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
solidRegions[i],
|
||||
runTime,
|
||||
rho*cp,
|
||||
K
|
||||
),
|
||||
DiNum
|
||||
);
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::add("finalIteration", true);
|
||||
}
|
||||
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
tmp<fvScalarMatrix> hEqn
|
||||
(
|
||||
fvm::ddt(betav*rho, h)
|
||||
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
|
||||
+ sources(rho, h)
|
||||
);
|
||||
|
||||
hEqn().relax();
|
||||
hEqn().solve(mesh.solver(h.select(finalIter)));
|
||||
}
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
|
||||
Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl;
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data::remove("finalIteration");
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
// Initialise solid field pointer lists
|
||||
PtrList<solidThermo> thermos(solidRegions.size());
|
||||
PtrList<radiation::radiationModel> radiations(solidRegions.size());
|
||||
PtrList<IObasicSourceList> solidHeatSources(solidRegions.size());
|
||||
PtrList<volScalarField> betavSolid(solidRegions.size());
|
||||
|
||||
// Populate solid field pointer lists
|
||||
forAll(solidRegions, i)
|
||||
@ -13,4 +15,49 @@
|
||||
|
||||
Info<< " Adding to radiations\n" << endl;
|
||||
radiations.set(i, radiation::radiationModel::New(thermos[i].T()));
|
||||
|
||||
Info<< " Adding sources\n" << endl;
|
||||
solidHeatSources.set
|
||||
(
|
||||
i,
|
||||
new IObasicSourceList(solidRegions[i])
|
||||
);
|
||||
|
||||
IOobject betavSolidIO
|
||||
(
|
||||
"betavSolid",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (betavSolidIO.headerOk())
|
||||
{
|
||||
betavSolid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField(betavSolidIO, solidRegions[i])
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
betavSolid.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"betavSolid",
|
||||
runTime.timeName(),
|
||||
solidRegions[i],
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
solidRegions[i],
|
||||
dimensionedScalar("1", dimless, scalar(1.0))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,3 +14,7 @@
|
||||
const volScalarField& kappa = tkappa();
|
||||
|
||||
volScalarField& h = thermo.he();
|
||||
|
||||
const volScalarField& betav = betavSolid[i];
|
||||
|
||||
IObasicSourceList& sources = solidHeatSources[i];
|
||||
|
||||
@ -8,8 +8,9 @@ if (finalIter)
|
||||
{
|
||||
tmp<fvScalarMatrix> hEqn
|
||||
(
|
||||
fvm::ddt(rho, h)
|
||||
- fvm::laplacian(alpha, h)
|
||||
fvm::ddt(betav*rho, h)
|
||||
- fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)")
|
||||
+ sources(rho, h)
|
||||
);
|
||||
hEqn().relax();
|
||||
hEqn().solve(mesh.solver(h.select(finalIter)));
|
||||
|
||||
@ -19,8 +19,6 @@ regions
|
||||
(
|
||||
fluid (bottomAir topAir)
|
||||
solid (heater leftSolid rightSolid)
|
||||
porousFluid ()
|
||||
porousSolid ()
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -19,8 +19,7 @@ regions
|
||||
(
|
||||
fluid (bottomWater topAir)
|
||||
solid (heater leftSolid rightSolid)
|
||||
porousFluid ()
|
||||
porousSolid ()
|
||||
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -19,8 +19,6 @@ regions
|
||||
(
|
||||
fluid (bottomAir topAir)
|
||||
solid (heater leftSolid rightSolid)
|
||||
porousFluid ()
|
||||
porousSolid ()
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@ regions
|
||||
(
|
||||
fluid (bottomAir topAir)
|
||||
solid (heater leftSolid rightSolid)
|
||||
porousFluid ()
|
||||
porousSolid ()
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -19,8 +19,6 @@ regions
|
||||
(
|
||||
fluid (bottomAir topAir)
|
||||
solid (heater leftSolid rightSolid)
|
||||
porousFluid ()
|
||||
porousSolid ()
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user