mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: porousBafflePressure boundary condition - change D and I to DataEntry types
This commit is contained in:
@ -39,9 +39,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(p, iF),
|
fixedJumpFvPatchField<scalar>(p, iF),
|
||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
D_(0),
|
D_(),
|
||||||
I_(0),
|
I_(),
|
||||||
length_(0)
|
length_(0),
|
||||||
|
uniformJump_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -55,9 +56,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(p, iF),
|
fixedJumpFvPatchField<scalar>(p, iF),
|
||||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||||
D_(readScalar(dict.lookup("D"))),
|
D_(DataEntry<scalar>::New("D", dict)),
|
||||||
I_(readScalar(dict.lookup("I"))),
|
I_(DataEntry<scalar>::New("I", dict)),
|
||||||
length_(readScalar(dict.lookup("length")))
|
length_(readScalar(dict.lookup("length"))),
|
||||||
|
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false))
|
||||||
{
|
{
|
||||||
fvPatchField<scalar>::operator=
|
fvPatchField<scalar>::operator=
|
||||||
(
|
(
|
||||||
@ -77,9 +79,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
|
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
D_(ptf.D_),
|
D_(ptf.D_, false),
|
||||||
I_(ptf.I_),
|
I_(ptf.I_, false),
|
||||||
length_(ptf.length_)
|
length_(ptf.length_),
|
||||||
|
uniformJump_(ptf.uniformJump_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -92,9 +95,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(ptf),
|
fixedJumpFvPatchField<scalar>(ptf),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
D_(ptf.D_),
|
D_(ptf.D_, false),
|
||||||
I_(ptf.I_),
|
I_(ptf.I_, false),
|
||||||
length_(ptf.length_)
|
length_(ptf.length_),
|
||||||
|
uniformJump_(ptf.uniformJump_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -107,9 +111,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(ptf, iF),
|
fixedJumpFvPatchField<scalar>(ptf, iF),
|
||||||
phiName_(ptf.phiName_),
|
phiName_(ptf.phiName_),
|
||||||
rhoName_(ptf.rhoName_),
|
rhoName_(ptf.rhoName_),
|
||||||
D_(ptf.D_),
|
D_(ptf.D_, false),
|
||||||
I_(ptf.I_),
|
I_(ptf.I_, false),
|
||||||
length_(ptf.length_)
|
length_(ptf.length_),
|
||||||
|
uniformJump_(ptf.uniformJump_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -130,11 +135,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
|
|||||||
|
|
||||||
scalarField Un(phip/patch().magSf());
|
scalarField Un(phip/patch().magSf());
|
||||||
|
|
||||||
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
|
if (phi.dimensions() == dimMass/dimTime)
|
||||||
{
|
{
|
||||||
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uniformJump_)
|
||||||
|
{
|
||||||
|
Un = gAverage(Un);
|
||||||
|
}
|
||||||
scalarField magUn(mag(Un));
|
scalarField magUn(mag(Un));
|
||||||
|
|
||||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||||
@ -146,11 +155,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const scalar t = db().time().timeOutputValue();
|
||||||
|
const scalar D = D_->value(t);
|
||||||
|
const scalar I = I_->value(t);
|
||||||
|
|
||||||
jump_ =
|
jump_ =
|
||||||
-sign(Un)
|
-sign(Un)
|
||||||
*(
|
*(
|
||||||
D_*turbModel.nu(patch().index())
|
D*turbModel.nu(patch().index())
|
||||||
+ I_*0.5*magUn
|
+ I*0.5*magUn
|
||||||
)*magUn*length_;
|
)*magUn*length_;
|
||||||
|
|
||||||
if (dimensionedInternalField().dimensions() == dimPressure)
|
if (dimensionedInternalField().dimensions() == dimPressure)
|
||||||
@ -161,7 +174,7 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
scalar avePressureJump = gAverage(jump_);
|
scalar avePressureJump = gAverage(jump_);
|
||||||
scalar aveVelocity = gAverage(mag(Un));
|
scalar aveVelocity = gAverage(Un);
|
||||||
|
|
||||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
@ -179,9 +192,11 @@ void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const
|
|||||||
fixedJumpFvPatchField<scalar>::write(os);
|
fixedJumpFvPatchField<scalar>::write(os);
|
||||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
|
D_->writeData(os);
|
||||||
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl;
|
I_->writeData(os);
|
||||||
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
|
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("uniformJump") << uniformJump_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,8 @@ Description
|
|||||||
D | Darcy coefficient | yes |
|
D | Darcy coefficient | yes |
|
||||||
I | inertial coefficient | yes |
|
I | inertial coefficient | yes |
|
||||||
L | porous media length in the flow direction | yes |
|
L | porous media length in the flow direction | yes |
|
||||||
|
uniformJump | applies a uniform pressure drop on the patch based on the
|
||||||
|
net velocity across the baffle | no | no
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example of the boundary condition specification:
|
Example of the boundary condition specification:
|
||||||
@ -71,6 +73,7 @@ Description
|
|||||||
D 0.001;
|
D 0.001;
|
||||||
I 1000000;
|
I 1000000;
|
||||||
L 0.1;
|
L 0.1;
|
||||||
|
uniformJump false;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
@ -87,6 +90,7 @@ SourceFiles
|
|||||||
#define porousBafflePressureFvPatchField_H
|
#define porousBafflePressureFvPatchField_H
|
||||||
|
|
||||||
#include "fixedJumpFvPatchField.H"
|
#include "fixedJumpFvPatchField.H"
|
||||||
|
#include "DataEntry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -110,14 +114,17 @@ class porousBafflePressureFvPatchField
|
|||||||
const word rhoName_;
|
const word rhoName_;
|
||||||
|
|
||||||
//- Darcy pressure loss coefficient
|
//- Darcy pressure loss coefficient
|
||||||
scalar D_;
|
autoPtr<DataEntry<scalar> > D_;
|
||||||
|
|
||||||
//- Inertia pressure lost coefficient
|
//- Inertia pressure lost coefficient
|
||||||
scalar I_;
|
autoPtr<DataEntry<scalar> > I_;
|
||||||
|
|
||||||
//- Porous media length
|
//- Porous media length
|
||||||
scalar length_;
|
scalar length_;
|
||||||
|
|
||||||
|
//- Aplies uniform pressure drop
|
||||||
|
bool uniformJump_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user