Improved steadyCompressibleMRFFoam

This commit is contained in:
Henrik Rusche 2015-11-11 14:17:46 +01:00 committed by Hrvoje Jasak
parent 89607b8cc7
commit fc2316f71b
8 changed files with 173 additions and 20 deletions

View file

@ -9,7 +9,8 @@
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& h = thermo.h(); volScalarField& h = thermo.h();
const volScalarField& T = thermo.T(); const volScalarField& T = thermo.T();
const volScalarField& psi = thermo.psi(); volScalarField psis("psi", thermo.psi()/thermo.Cp()*thermo.Cv());
psis.oldTime();
volScalarField rho volScalarField rho
( (

View file

@ -25,4 +25,5 @@
// Bounding of enthalpy taken out // Bounding of enthalpy taken out
thermo.correct(); thermo.correct();
psis = thermo.psi()/thermo.Cp()*thermo.Cv();
} }

View file

@ -53,4 +53,5 @@
i = h - 0.5*magSqr(Urot); i = h - 0.5*magSqr(Urot);
thermo.correct(); thermo.correct();
psis = thermo.psi()/thermo.Cp()*thermo.Cv();
} }

View file

@ -1,29 +1,23 @@
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField psisf = fvc::interpolate(psis);
surfaceScalarField rhof = fvc::interpolate(rho);
// Needs to be outside of loop since p is changing, but psi and rho are not.
surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p);
for (int corr = 0; corr < nCorr; corr++) for (int corr = 0; corr < nCorr; corr++)
{ {
U = rUA*UEqn.H(); U = rUA*UEqn.H();
surfaceScalarField psif = fvc::interpolate(psi); phi = rhoReff*(fvc::interpolate(U) & mesh.Sf());
surfaceScalarField rhof = fvc::interpolate(rho);
// Execute ddtPhiCorr before recalculating flux surfaceScalarField phid("phid", psisf/rhoReff*phi);
// HJ, 27/Apr/2010
surfaceScalarField phid
(
"phid",
psif*(fvc::interpolate(U) & mesh.Sf())
);
// Make flux relative within the MRF zone // Make fluxes relative within the MRF zone
mrfZones.relativeFlux(psif, phid); mrfZones.relativeFlux(psisf, phid);
mrfZones.relativeFlux(rhoReff, phi);
// Calculate phi for boundary conditions
phi = fvc::interpolate(rho*U) & mesh.Sf();
// Make flux relative within the MRF zone
mrfZones.relativeFlux(rhof, phi);
p.storePrevIter(); p.storePrevIter();
@ -31,8 +25,9 @@
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, p) fvm::ddt(psis, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rho*rUA, p)
); );
@ -47,7 +42,7 @@
// Calculate the flux // Calculate the flux
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi = pEqn.flux(); phi += pEqn.flux();
} }
} }

View file

@ -254,6 +254,59 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs()
} }
Foam::tmp<Foam::scalarField>
Foam::totalPressureFvPatchScalarField::snGrad() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::totalPressureFvPatchScalarField::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::totalPressureFvPatchScalarField::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
return *this;
}
Foam::tmp<Foam::scalarField>
Foam::totalPressureFvPatchScalarField::gradientInternalCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::totalPressureFvPatchScalarField::gradientBoundaryCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);

View file

@ -207,6 +207,30 @@ public:
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Return patch-normal gradient
virtual tmp<scalarField> snGrad() const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<scalarField> valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientBoundaryCoeffs() const;
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;

View file

@ -184,6 +184,59 @@ void Foam::isentropicTotalPressureFvPatchScalarField::updateCoeffs
} }
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::snGrad() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
return *this;
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::gradientInternalCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::gradientBoundaryCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
void Foam::isentropicTotalPressureFvPatchScalarField::write void Foam::isentropicTotalPressureFvPatchScalarField::write
( (
Ostream& os Ostream& os

View file

@ -134,6 +134,31 @@ public:
// Access // Access
//- Return the name of the velocity field
const word& UName() const
{
return UName_;
}
//- Return reference to the name of the velocity field
// to allow adjustment
word& UName()
{
return UName_;
}
//- Return the heat capacity ratio
scalar gamma() const
{
return gamma_;
}
//- Return reference to the heat capacity ratio to allow adjustment
scalar& gamma()
{
return gamma_;
}
//- Return the total pressure //- Return the total pressure
const scalarField& p0() const const scalarField& p0() const
{ {