mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
multiphase: Changed phiU to phiHbyA and cache HbyA rather than store the velocity predictor in U
This commit is contained in:
@ -41,6 +41,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_("phiHbyA"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
DpName_("Dp"),
|
||||
adjoint_(false)
|
||||
{}
|
||||
|
||||
@ -57,6 +58,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_(ptf.phiHbyAName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
DpName_(ptf.rhoName_),
|
||||
adjoint_(ptf.adjoint_)
|
||||
{}
|
||||
|
||||
@ -72,6 +74,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
DpName_(dict.lookupOrDefault<word>("Dp", "Dp")),
|
||||
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
@ -97,6 +100,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
DpName_(wbppsf.DpName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
{}
|
||||
|
||||
@ -111,6 +115,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
DpName_(wbppsf.DpName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
{}
|
||||
|
||||
@ -136,6 +141,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
fvsPatchField<scalar> phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
/*
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
@ -144,16 +150,38 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
phip /= rhop;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& Dpp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("Dp");
|
||||
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phiHbyAp /= rhop;
|
||||
}
|
||||
*/
|
||||
|
||||
const scalarField *DppPtr = NULL;
|
||||
|
||||
if (db().foundObject<volScalarField>(DpName_))
|
||||
{
|
||||
DppPtr =
|
||||
&patch().lookupPatchField<volScalarField, scalar>(DpName_);
|
||||
}
|
||||
else if (db().foundObject<surfaceScalarField>(DpName_))
|
||||
{
|
||||
const surfaceScalarField& Dp =
|
||||
db().lookupObject<surfaceScalarField>(DpName_);
|
||||
|
||||
DppPtr =
|
||||
&patch().patchField<surfaceScalarField, scalar>(Dp);
|
||||
}
|
||||
|
||||
if (adjoint_)
|
||||
{
|
||||
gradient() = (phip - phiHbyAp)/patch().magSf()/Dpp;
|
||||
gradient() = (phip - phiHbyAp)/patch().magSf()/(*DppPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
gradient() = (phiHbyAp - phip)/patch().magSf()/Dpp;
|
||||
gradient() = (phiHbyAp - phip)/patch().magSf()/(*DppPtr);
|
||||
}
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
@ -166,6 +194,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "Dp", "Dp", rhoName_);
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
gradient().writeEntry("gradient", os);
|
||||
}
|
||||
|
||||
@ -71,6 +71,9 @@ class fixedFluxPressureFvPatchScalarField
|
||||
// if neccessary
|
||||
word rhoName_;
|
||||
|
||||
//- Name of the pressure diffusivity field
|
||||
word DpName_;
|
||||
|
||||
//- Is the pressure adjoint, i.e. has the opposite sign
|
||||
Switch adjoint_;
|
||||
|
||||
|
||||
@ -136,6 +136,7 @@ void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
fvsPatchField<scalar> phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
/*
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
@ -144,6 +145,15 @@ void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
phip /= rhop;
|
||||
}
|
||||
|
||||
if (phiHbyA.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
phiHbyAp /= rhop;
|
||||
}
|
||||
*/
|
||||
|
||||
const fvsPatchField<scalar>& Dpp =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user