mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
chtMultiRegionFoam: updated thermodynamics
This commit is contained in:
@ -31,7 +31,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicRhoThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "regionProperties.H"
|
||||
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info << "End\n" << endl;
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "basicRhoThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "regionProperties.H"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Initialise fluid field pointer lists
|
||||
PtrList<basicPsiThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> rhoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> KFluid(fluidRegions.size());
|
||||
PtrList<volVectorField> UFluid(fluidRegions.size());
|
||||
@ -28,7 +28,7 @@
|
||||
thermoFluid.set
|
||||
(
|
||||
i,
|
||||
basicPsiThermo::New(fluidRegions[i]).ptr()
|
||||
basicRhoThermo::New(fluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoFluid\n" << endl;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
// From buoyantSimpleFoam
|
||||
rho = thermo.rho();
|
||||
rho = max(rho, rhoMin[i]);
|
||||
rho = min(rho, rhoMax[i]);
|
||||
@ -13,6 +12,8 @@
|
||||
|
||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||
bool closedVolume = adjustPhi(phi, U, p_rgh);
|
||||
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
||||
bool compressible = (compressibility.value() > SMALL);
|
||||
|
||||
surfaceScalarField buoyancyPhi = rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||
phi -= buoyancyPhi;
|
||||
@ -25,7 +26,11 @@
|
||||
fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phi)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||
p_rghEqn.setReference
|
||||
(
|
||||
pRefCell,
|
||||
compressible ? getRefCellValue(p_rgh, pRefCell) : pRefValue
|
||||
);
|
||||
|
||||
p_rghEqn.solve();
|
||||
|
||||
@ -50,10 +55,10 @@
|
||||
|
||||
// For closed-volume cases adjust the pressure level
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
if (closedVolume && compressible)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
p += (initialMass - fvc::domainIntegrate(thermo.rho()))
|
||||
/compressibility;
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const fvMesh& mesh = fluidRegions[i];
|
||||
|
||||
basicPsiThermo& thermo = thermoFluid[i];
|
||||
basicRhoThermo& thermo = thermoFluid[i];
|
||||
volScalarField& rho = rhoFluid[i];
|
||||
volScalarField& K = KFluid[i];
|
||||
volVectorField& U = UFluid[i];
|
||||
|
||||
@ -34,16 +34,13 @@ Foam::scalar Foam::compressibleCourantNo
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
{
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
|
||||
scalarField sumPhi =
|
||||
fvc::surfaceSum(mag(phi))().internalField()
|
||||
/rho.internalField();
|
||||
|
||||
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
scalar CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
|
||||
meanCoNum =
|
||||
scalar meanCoNum =
|
||||
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
|
||||
|
||||
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// Initialise fluid field pointer lists
|
||||
PtrList<basicPsiThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> rhoFluid(fluidRegions.size());
|
||||
PtrList<volScalarField> KFluid(fluidRegions.size());
|
||||
PtrList<volVectorField> UFluid(fluidRegions.size());
|
||||
@ -23,7 +23,7 @@
|
||||
thermoFluid.set
|
||||
(
|
||||
i,
|
||||
basicPsiThermo::New(fluidRegions[i]).ptr()
|
||||
basicRhoThermo::New(fluidRegions[i]).ptr()
|
||||
);
|
||||
|
||||
Info<< " Adding to rhoFluid\n" << endl;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
{
|
||||
bool closedVolume = p_rgh.needReference();
|
||||
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
||||
bool compressible = (compressibility.value() > SMALL);
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
@ -19,34 +21,48 @@
|
||||
|
||||
phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
fvScalarMatrix p_rghDDtEqn
|
||||
(
|
||||
fvm::ddt(psi, p_rgh) + fvc::ddt(psi, rho)*gh
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rhorAUf, p_rgh)
|
||||
);
|
||||
|
||||
p_rghEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||
// pressure solution - done in 2 parts. Part 1:
|
||||
thermo.rho() -= psi*p_rgh;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
p_rgh.select
|
||||
p_rghDDtEqn
|
||||
- fvm::laplacian(rhorAUf, p_rgh)
|
||||
);
|
||||
|
||||
p_rghEqn.solve
|
||||
(
|
||||
mesh.solver
|
||||
(
|
||||
p_rgh.select
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += p_rghEqn.flux();
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += p_rghEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
// Second part of thermodynamic density update
|
||||
thermo.rho() += psi*p_rgh;
|
||||
}
|
||||
|
||||
// Correct velocity field
|
||||
@ -66,10 +82,10 @@
|
||||
|
||||
// For closed-volume cases adjust the pressure and density levels
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
if (closedVolume && compressible)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
p += (initialMass - fvc::domainIntegrate(thermo.rho()))
|
||||
/compressibility;
|
||||
rho = thermo.rho();
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
fvMesh& mesh = fluidRegions[i];
|
||||
|
||||
basicPsiThermo& thermo = thermoFluid[i];
|
||||
basicRhoThermo& thermo = thermoFluid[i];
|
||||
volScalarField& rho = rhoFluid[i];
|
||||
volScalarField& K = KFluid[i];
|
||||
volVectorField& U = UFluid[i];
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
const dictionary& piso = solidRegions[i].solutionDict().subDict("PISO");
|
||||
|
||||
const int nNonOrthCorr =
|
||||
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
||||
}
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.internalField())
|
||||
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||
|
||||
@ -116,13 +116,12 @@
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
Info<< "Damping rDeltaT" << endl;
|
||||
rDeltaT = rDeltaT0*max(rDeltaT/rDeltaT0, 1.0 - rDeltaTDampingCoeff);
|
||||
}
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.internalField())
|
||||
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||
Info<< "Damped flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.internalField())
|
||||
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||
}
|
||||
|
||||
label nAlphaSubCycles
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user