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

Remove redundant buoyantPressure BC

parent 0e10f002
No related branches found
No related tags found
No related merge requests found
......@@ -127,7 +127,6 @@ derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "buoyantPressureFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::buoyantPressureFvPatchScalarField::
buoyantPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
rhoName_("rho")
{}
Foam::buoyantPressureFvPatchScalarField::
buoyantPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("value") && dict.found("gradient"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
gradient() = scalarField("gradient", dict, p.size());
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
}
Foam::buoyantPressureFvPatchScalarField::
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
rhoName_(ptf.rhoName_)
{}
Foam::buoyantPressureFvPatchScalarField::
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField& ptf
)
:
fixedGradientFvPatchScalarField(ptf),
rhoName_(ptf.rhoName_)
{}
Foam::buoyantPressureFvPatchScalarField::
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(ptf, iF),
rhoName_(ptf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::buoyantPressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g");
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// If the variable name is "p_rgh", "ph_rgh" or "pd"
// assume it is p? - rho*g.h and set the gradient appropriately.
// Otherwise assume the variable is the static pressure.
if
(
dimensionedInternalField().name() == "p_rgh"
|| dimensionedInternalField().name() == "ph_rgh"
|| dimensionedInternalField().name() == "pd"
)
{
gradient() = -rho.snGrad()*(g.value() & patch().Cf());
}
else
{
gradient() = rho*(g.value() & patch().nf());
}
fixedGradientFvPatchScalarField::updateCoeffs();
}
void Foam::buoyantPressureFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
buoyantPressureFvPatchScalarField
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::buoyantPressureFvPatchScalarField
Group
grpGenericBoundaryConditions grpWallBoundaryConditions
Description
This boundary condition sets the pressure gradient appropriately for
buoyant flow.
If the variable name is one of:
- \c pd
- \c p_rgh
- \c ph_rgh
we assume that the pressure variable is \f$p - \rho(g \cdot h)\f$ and the
gradient set using:
\f[
\nabla(p) = -\nabla_\perp(\rho)(g \cdot h)
\f]
where
\vartable
\rho | density [kg/m3]
g | acceleration due to gravity [m/s2]
h | patch face centres [m]
\endvartable
Otherwise we assume that it is the static pressure, and the gradient
calculated using:
\f[
\nabla(p) = \rho(g \cdot n)
\f]
where
\vartable
n | patch face normal vectors
\endvartable
\heading Patch usage
\table
Property | Description | Required | Default value
rho | density field name | no | rho
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type buoyantPressure;
rho rho;
value uniform 0;
}
\endverbatim
SourceFiles
buoyantPressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef buoyantPressureFvPatchScalarFields_H
#define buoyantPressureFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class buoyantPressureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class buoyantPressureFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
// Private data
//- Name of the density field used to calculate the buoyancy force
word rhoName_;
public:
//- Runtime type information
TypeName("buoyantPressure");
// Constructors
//- Construct from patch and internal field
buoyantPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
buoyantPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// buoyantPressureFvPatchScalarField onto a new patch
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new buoyantPressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
buoyantPressureFvPatchScalarField
(
const buoyantPressureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new buoyantPressureFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment