Skip to content
Snippets Groups Projects
Commit f2f4c00e authored by Henry's avatar Henry
Browse files

porousBafflePressure: Corrected and added support for compressible flow

parent b382579c
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -37,27 +37,14 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
)
:
fixedJumpFvPatchField<scalar>(p, iF),
phiName_("phi"),
rhoName_("rho"),
D_(0),
I_(0),
length_(0)
{}
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
{}
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
(
const fvPatch& p,
......@@ -66,6 +53,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
)
:
fixedJumpFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
D_(readScalar(dict.lookup("D"))),
I_(readScalar(dict.lookup("I"))),
length_(readScalar(dict.lookup("length")))
......@@ -77,6 +66,23 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
}
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
{}
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
(
const porousBafflePressureFvPatchField& ptf
......@@ -84,6 +90,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
:
cyclicLduInterfaceField(),
fixedJumpFvPatchField<scalar>(ptf),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
......@@ -97,6 +105,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
)
:
fixedJumpFvPatchField<scalar>(ptf, iF),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
D_(ptf.D_),
I_(ptf.I_),
length_(ptf.length_)
......@@ -113,13 +123,18 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un(phip/patch().magSf());
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
{
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
}
scalarField magUn(mag(Un));
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
......@@ -134,10 +149,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
jump_ =
-sign(Un)
*(
I_*turbModel.nuEff(patch().index())
+ D_*0.5*magUn
D_*turbModel.nu(patch().index())
+ I_*0.5*magUn
)*magUn*length_;
if (dimensionedInternalField().dimensions() == dimPressure)
{
jump_ *= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
}
if (debug)
{
scalar avePressureJump = gAverage(jump_);
......@@ -157,6 +177,8 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const
{
fixedJumpFvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl;
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
......
......@@ -25,7 +25,7 @@ Class
Foam::porousBafflePressureFvPatchField
Group
grpCoupledBoundaryConditions grpTurbulenceBoundaryConditions
grpCoupledBoundaryConditions
Description
This boundary condition provides a jump condition, using the \c cyclic
......@@ -34,7 +34,7 @@ Description
The porous baffle introduces a pressure jump defined by:
\f[
\Delta p = -(I \mu U + 0.5 D \rho |U|^2 )L
\Delta p = -(D \mu U + 0.5 I \rho |U|^2 )L
\f]
where
......@@ -42,7 +42,7 @@ Description
\vartable
p | pressure [Pa]
\rho | density [kg/m3]
\mu | viscosity [Pa s]
\mu | laminar viscosity [Pa s]
I | inertial coefficient
D | Darcy coefficient
L | porous media length in the flow direction
......@@ -54,6 +54,8 @@ Description
\table
Property | Description | Required | Default value
patchType | underlying patch type should be \c cyclic| yes |
phi | flux field name | no | phi
rho | density field name | no | rho
D | Darcy coefficient | yes |
I | inertial coefficient | yes |
L | porous media length in the flow direction | yes |
......@@ -66,8 +68,8 @@ Description
type porousBafflePressure;
patchType cyclic;
jump uniform 0;
D 1000000;
I 0.001;
D 0.001;
I 1000000;
L 0.1;
value uniform 0;
}
......@@ -101,6 +103,12 @@ class porousBafflePressureFvPatchField
{
// Private data
//- Name of flux field (default = phi)
const word phiName_;
//- Name of density field (default = rho)
const word rhoName_;
//- Darcy pressure loss coefficient
scalar D_;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment