ENH: Adding optional uniform jump switch to fan BC

This commit is contained in:
sergio
2016-07-27 08:55:52 -07:00
parent 2d695acf49
commit 14f5239e5b
3 changed files with 25 additions and 6 deletions

View File

@ -48,7 +48,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
:
uniformJumpFvPatchField<Type>(p, iF),
phiName_("phi"),
rhoName_("rho")
rhoName_("rho"),
uniformJump_(false)
{}
@ -62,7 +63,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
:
uniformJumpFvPatchField<Type>(p, iF, dict),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", "false"))
{}
@ -77,7 +79,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
:
uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
uniformJump_(ptf.uniformJump_)
{}
@ -89,7 +92,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
:
uniformJumpFvPatchField<Type>(ptf),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
uniformJump_(ptf.uniformJump_)
{}
@ -102,7 +106,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
:
uniformJumpFvPatchField<Type>(ptf, iF),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
rhoName_(ptf.rhoName_),
uniformJump_(ptf.uniformJump_)
{}
@ -129,6 +134,10 @@ void Foam::fanFvPatchField<Type>::write(Ostream& os) const
uniformJumpFvPatchField<Type>::write(os);
this->template writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
this->template writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
this->template writeEntryIfDifferent<bool>
(
os, "uniformJump", false, uniformJump_
);
}

View File

@ -42,6 +42,8 @@ Description
jumpTable | jump data, e.g. \c csvFile | yes |
phi | flux field name | no | phi
rho | density field name | no | none
uniformJump | applies a uniform pressure based on the averaged
velocity | no | false
\endtable
Example of the boundary condition specification:
@ -109,6 +111,9 @@ class fanFvPatchField
// if neccessary
word rhoName_;
//- Uniform pressure drop
bool uniformJump_;
// Private Member Functions

View File

@ -44,6 +44,10 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un(max(phip/patch().magSf(), scalar(0)));
if (uniformJump_)
{
Un = gAverage(Un);
}
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
@ -67,7 +71,8 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
:
uniformJumpFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false))
{
if (this->cyclicPatch().owner())
{