mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
interFoam et. al.: Changed phiU to phiHbyA and cache HbyA rather than changing U
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
phiHbyAName_("phiHbyA"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
adjoint_(false)
|
||||
@ -54,7 +54,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
phiHbyAName_(ptf.phiHbyAName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
adjoint_(ptf.adjoint_)
|
||||
@ -69,10 +69,10 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
phiHbyAName_(dict.lookupOrDefault<word>("phiHbyA", "phiHbyA")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
adjoint_(dict.lookup("adjoint"))
|
||||
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
{
|
||||
@ -94,7 +94,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf),
|
||||
UName_(wbppsf.UName_),
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
@ -108,7 +108,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(wbppsf, iF),
|
||||
UName_(wbppsf.UName_),
|
||||
phiHbyAName_(wbppsf.phiHbyAName_),
|
||||
phiName_(wbppsf.phiName_),
|
||||
rhoName_(wbppsf.rhoName_),
|
||||
adjoint_(wbppsf.adjoint_)
|
||||
@ -124,12 +124,15 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<vector>& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const surfaceScalarField& phiHbyA =
|
||||
db().lookupObject<surfaceScalarField>(phiHbyAName_);
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
fvsPatchField<scalar> phiHbyAp =
|
||||
patch().patchField<surfaceScalarField, scalar>(phiHbyA);
|
||||
|
||||
fvsPatchField<scalar> phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
@ -141,16 +144,16 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
phip /= rhop;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& rAp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("(1|A("+UName_+"))");
|
||||
const fvPatchField<scalar>& Dpp =
|
||||
patch().lookupPatchField<volScalarField, scalar>("Dp");
|
||||
|
||||
if (adjoint_)
|
||||
{
|
||||
gradient() = ((patch().Sf() & Up) - phip)/patch().magSf()/rAp;
|
||||
gradient() = (phip - phiHbyAp)/patch().magSf()/Dpp;
|
||||
}
|
||||
else
|
||||
{
|
||||
gradient() = (phip - (patch().Sf() & Up))/patch().magSf()/rAp;
|
||||
gradient() = (phiHbyAp - phip)/patch().magSf()/Dpp;
|
||||
}
|
||||
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
@ -160,7 +163,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,14 @@ Class
|
||||
Foam::fixedFluxPressureFvPatchScalarField
|
||||
|
||||
Description
|
||||
Foam::fixedFluxPressureFvPatchScalarField
|
||||
Adjusts the pressure gradient such that the flux on the boundary is that
|
||||
specified by the velocity boundary condition.
|
||||
|
||||
The predicted flux to be compensated by the pressure gradient is evaluated
|
||||
as (phi - phiHbyA), both of which are looked-up from the database as is
|
||||
the pressure diffusivity Dp used to calculate the gradient.
|
||||
|
||||
The names of the phi, phiHbyA and Dp fields may be optionally specified.
|
||||
|
||||
SourceFiles
|
||||
fixedFluxPressureFvPatchScalarField.C
|
||||
@ -54,8 +61,8 @@ class fixedFluxPressureFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
//- Name of the predicted flux transporting the field
|
||||
word phiHbyAName_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
@ -25,7 +25,14 @@ Class
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField
|
||||
|
||||
Description
|
||||
Foam::multiphaseFixedFluxPressureFvPatchScalarField
|
||||
Adjusts the pressure gradient such that the flux on the boundary is that
|
||||
specified by the velocity boundary condition.
|
||||
|
||||
The predicted flux to be compensated by the pressure gradient is evaluated
|
||||
as (phi - phiHbyA), both of which are looked-up from the database as is
|
||||
the pressure diffusivity Dp used to calculate the gradient.
|
||||
|
||||
The names of the phi, phiHbyA and Dp fields may be optionally specified.
|
||||
|
||||
SourceFiles
|
||||
multiphaseFixedFluxPressureFvPatchScalarField.C
|
||||
|
||||
Reference in New Issue
Block a user