mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
PrghPressureFvPatchScalarField: New base class used to create p_rgh variants of pressure BCs
The prghPressureFvPatchScalarField, prghTotalPressureFvPatchScalarField and prghUniformDensityHydrostaticPressure p_rgh boundary conditions are now derived from the corresponding pressure boundary conditions using the PrghPressureFvPatchScalarField template.
This commit is contained in:
@ -192,7 +192,6 @@ $(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVe
|
||||
$(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C
|
||||
$(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/uniformFixedGradient/uniformFixedGradientFvPatchFields.C
|
||||
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/uniformInletOutlet/uniformInletOutletFvPatchFields.C
|
||||
@ -205,12 +204,12 @@ $(derivedFvPatchFields)/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVe
|
||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||
$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/prghPressure/prghPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/prghTotalPressure/prghTotalPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/prghTotalHydrostaticPressure/prghTotalHydrostaticPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/fixedProfile/fixedProfileFvPatchFields.C
|
||||
$(derivedFvPatchFields)/plenumPressure/plenumPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/interfaceCompression/interfaceCompressionFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/pressure/pressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/PrghPressure/prghPressureFvPatchScalarFields.C
|
||||
$(derivedFvPatchFields)/prghTotalHydrostaticPressure/prghTotalHydrostaticPressureFvPatchScalarField.C
|
||||
|
||||
fvsPatchFields = fields/fvsPatchFields
|
||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 "PrghPressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
PressureFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
PressureFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const PrghPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
PressureFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const PrghPressureFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
PressureFvPatchScalarField(ptf)
|
||||
{}
|
||||
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const PrghPressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
PressureFvPatchScalarField(ptf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class PressureFvPatchScalarField>
|
||||
void Foam::PrghPressureFvPatchScalarField<PressureFvPatchScalarField>::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (PressureFvPatchScalarField::updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PressureFvPatchScalarField::updateCoeffs();
|
||||
|
||||
const scalarField& rhop = this->patch().template
|
||||
lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
"rho"
|
||||
);
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
this->db().template lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
const uniformDimensionedScalarField& hRef =
|
||||
this->db().template lookupObject<uniformDimensionedScalarField>("hRef");
|
||||
|
||||
dimensionedScalar ghRef
|
||||
(
|
||||
mag(g.value()) > small
|
||||
? g & (cmptMag(g.value())/mag(g.value()))*hRef
|
||||
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
|
||||
);
|
||||
|
||||
this->operator==
|
||||
(
|
||||
*this - rhop*((g.value() & this->patch().Cf()) - ghRef.value())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,64 +22,38 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::prghTotalPressureFvPatchScalarField
|
||||
Foam::PrghPressureFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides static pressure condition for p_rgh,
|
||||
calculated as:
|
||||
This boundary condition provides the p_rgh equivalent of a pressure
|
||||
boundary condition calculated as:
|
||||
|
||||
\f[
|
||||
p_rgh = p - \rho g.(h - hRef)
|
||||
\f]
|
||||
|
||||
\f[
|
||||
p = p0 - 0.5 \rho |U|^2
|
||||
p_rgh = p - \rho g (h - hRef)
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
p_rgh | Pseudo hydrostatic pressure [Pa]
|
||||
p | Static pressure [Pa]
|
||||
p0 | Total pressure [Pa]
|
||||
h | Height in the opposite direction to gravity
|
||||
hRef | Reference height in the opposite direction to gravity
|
||||
\rho | Density
|
||||
g | Acceleration due to gravity [m/s^2]
|
||||
\rho | density
|
||||
g | acceleration due to gravity [m/s^2]
|
||||
\endtable
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
U | Velocity field name | no | U
|
||||
phi | Flux field name | no | phi
|
||||
rho | Density field name | no | rho
|
||||
p0 | Total pressure | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
type prghTotalPressure;
|
||||
p0 uniform 0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
See also
|
||||
Foam::fixedValueFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
prghTotalPressureFvPatchScalarField.C
|
||||
PrghPressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef prghTotalPressureFvPatchScalarField_H
|
||||
#define prghTotalPressureFvPatchScalarField_H
|
||||
#ifndef PrghPressureFvPatchScalarField_H
|
||||
#define PrghPressureFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "fvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -87,48 +61,32 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class prghTotalPressureFvPatchScalarField Declaration
|
||||
Class PrghPressureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class prghTotalPressureFvPatchScalarField
|
||||
template<class PressureFvPatchScalarField>
|
||||
class PrghPressureFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public PressureFvPatchScalarField
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Name of phase-fraction field
|
||||
word rhoName_;
|
||||
|
||||
//- Total pressure
|
||||
scalarField p0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("prghTotalPressure");
|
||||
TypeName("PrghPressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
prghTotalPressureFvPatchScalarField
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
prghTotalPressureFvPatchScalarField
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
@ -136,19 +94,19 @@ public:
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// prghTotalPressureFvPatchScalarField onto a new patch
|
||||
prghTotalPressureFvPatchScalarField
|
||||
// PrghPressureFvPatchScalarField onto a new patch
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField&,
|
||||
const PrghPressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
prghTotalPressureFvPatchScalarField
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField&
|
||||
const PrghPressureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
@ -156,14 +114,14 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField >
|
||||
(
|
||||
new prghTotalPressureFvPatchScalarField(*this)
|
||||
new PrghPressureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
prghTotalPressureFvPatchScalarField
|
||||
PrghPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField&,
|
||||
const PrghPressureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
@ -175,52 +133,17 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new prghTotalPressureFvPatchScalarField(*this, iF)
|
||||
new PrghPressureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the total pressure
|
||||
const scalarField& p0() const
|
||||
{
|
||||
return p0_;
|
||||
}
|
||||
|
||||
//- Return reference to the total pressure to allow adjustment
|
||||
scalarField& p0()
|
||||
{
|
||||
return p0_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
@ -230,6 +153,24 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "PrghPressureFvPatchScalarField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makePrghPatchScalarField(Pressure, PrghPressure) \
|
||||
typedef PrghPressureFvPatchScalarField<Pressure##FvPatchScalarField> \
|
||||
PrghPressure; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebug(PrghPressure, 0); \
|
||||
\
|
||||
addToPatchFieldRunTimeSelection \
|
||||
( \
|
||||
fvPatchScalarField, \
|
||||
PrghPressure \
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 "PrghPressureFvPatchScalarField.H"
|
||||
#include "pressureFvPatchScalarField.H"
|
||||
#include "totalPressureFvPatchScalarField.H"
|
||||
#include "uniformDensityHydrostaticPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePrghPatchScalarField(pressure, prghPressure)
|
||||
|
||||
makePrghPatchScalarField(totalPressure, prghTotalPressure)
|
||||
|
||||
makePrghPatchScalarField
|
||||
(
|
||||
uniformDensityHydrostaticPressure,
|
||||
prghUniformDensityHydrostaticPressure
|
||||
)
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "prghPressureFvPatchScalarField.H"
|
||||
#include "pressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
@ -31,21 +31,18 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::prghPressureFvPatchScalarField::
|
||||
prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField::pressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
rhoName_("rho"),
|
||||
p_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghPressureFvPatchScalarField::
|
||||
prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField::pressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
@ -53,7 +50,6 @@ prghPressureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict, false),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
p_("p", dict, p.size())
|
||||
{
|
||||
if (dict.found("value"))
|
||||
@ -70,49 +66,43 @@ prghPressureFvPatchScalarField
|
||||
}
|
||||
|
||||
|
||||
Foam::prghPressureFvPatchScalarField::
|
||||
prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField::pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField& ptf,
|
||||
const pressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p_(ptf.p_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghPressureFvPatchScalarField::
|
||||
prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField::pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField& ptf
|
||||
const pressureFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p_(ptf.p_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghPressureFvPatchScalarField::
|
||||
prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField::pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField& ptf,
|
||||
const pressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, iF),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p_(ptf.p_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::prghPressureFvPatchScalarField::autoMap
|
||||
void Foam::pressureFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
@ -122,7 +112,7 @@ void Foam::prghPressureFvPatchScalarField::autoMap
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghPressureFvPatchScalarField::rmap
|
||||
void Foam::pressureFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
@ -130,48 +120,29 @@ void Foam::prghPressureFvPatchScalarField::rmap
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const prghPressureFvPatchScalarField& tiptf =
|
||||
refCast<const prghPressureFvPatchScalarField>(ptf);
|
||||
const pressureFvPatchScalarField& tiptf =
|
||||
refCast<const pressureFvPatchScalarField>(ptf);
|
||||
|
||||
p_.rmap(tiptf.p_, addr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghPressureFvPatchScalarField::updateCoeffs()
|
||||
void Foam::pressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
rhoName_
|
||||
);
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
const uniformDimensionedScalarField& hRef =
|
||||
db().lookupObject<uniformDimensionedScalarField>("hRef");
|
||||
|
||||
dimensionedScalar ghRef
|
||||
(
|
||||
mag(g.value()) > small
|
||||
? g & (cmptMag(g.value())/mag(g.value()))*hRef
|
||||
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
|
||||
);
|
||||
|
||||
operator==(p_ - rhop*((g.value() & patch().Cf()) - ghRef.value()));
|
||||
operator==(p_);
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghPressureFvPatchScalarField::write(Ostream& os) const
|
||||
void Foam::pressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
p_.writeEntry("p", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
@ -184,7 +155,7 @@ namespace Foam
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
prghPressureFvPatchScalarField
|
||||
pressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,33 +22,20 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::prghPressureFvPatchScalarField
|
||||
Foam::pressureFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides static pressure condition for p_rgh,
|
||||
calculated as:
|
||||
Static pressure boundary condition
|
||||
|
||||
\f[
|
||||
p_rgh = p - \rho g (h - hRef)
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
p_rgh | Pseudo hydrostatic pressure [Pa]
|
||||
p | Static pressure [Pa]
|
||||
h | Height in the opposite direction to gravity
|
||||
hRef | Reference height in the opposite direction to gravity
|
||||
\rho | density
|
||||
g | acceleration due to gravity [m/s^2]
|
||||
\endtable
|
||||
Used as the base-class for static pressure boundary conditions force
|
||||
alternative pressure variables, e.g. p_rgh.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
rho | rho field name | no | rho
|
||||
p | static pressure | yes |
|
||||
\endtable
|
||||
|
||||
@ -56,8 +43,7 @@ Usage
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
type prghPressure;
|
||||
rho rho;
|
||||
type pressure;
|
||||
p uniform 0;
|
||||
value uniform 0; // optional initial value
|
||||
}
|
||||
@ -65,14 +51,15 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::fixedValueFvPatchScalarField
|
||||
Foam::PrghPressureFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
prghPressureFvPatchScalarField.C
|
||||
pressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef prghPressureFvPatchScalarField_H
|
||||
#define prghPressureFvPatchScalarField_H
|
||||
#ifndef pressureFvPatchScalarField_H
|
||||
#define pressureFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
@ -82,10 +69,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class prghPressureFvPatchScalarField Declaration
|
||||
Class pressureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class prghPressureFvPatchScalarField
|
||||
class pressureFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
@ -94,9 +81,6 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of phase-fraction field
|
||||
word rhoName_;
|
||||
|
||||
//- Static pressure
|
||||
scalarField p_;
|
||||
|
||||
@ -104,20 +88,20 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("prghPressure");
|
||||
TypeName("pressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
prghPressureFvPatchScalarField
|
||||
pressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
prghPressureFvPatchScalarField
|
||||
pressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
@ -125,19 +109,19 @@ public:
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// prghPressureFvPatchScalarField onto a new patch
|
||||
prghPressureFvPatchScalarField
|
||||
// pressureFvPatchScalarField onto a new patch
|
||||
pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField&,
|
||||
const pressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
prghPressureFvPatchScalarField
|
||||
pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField&
|
||||
const pressureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
@ -145,14 +129,14 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField >
|
||||
(
|
||||
new prghPressureFvPatchScalarField(*this)
|
||||
new pressureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
prghPressureFvPatchScalarField
|
||||
pressureFvPatchScalarField
|
||||
(
|
||||
const prghPressureFvPatchScalarField&,
|
||||
const pressureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
@ -164,7 +148,7 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new prghPressureFvPatchScalarField(*this, iF)
|
||||
new pressureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,213 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2018 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 "prghTotalPressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::prghTotalPressureFvPatchScalarField::
|
||||
prghTotalPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
p0_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghTotalPressureFvPatchScalarField::
|
||||
prghTotalPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict, false),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
p0_("p0", dict, p.size())
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(p0_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::prghTotalPressureFvPatchScalarField::
|
||||
prghTotalPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p0_(ptf.p0_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghTotalPressureFvPatchScalarField::
|
||||
prghTotalPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf),
|
||||
UName_(ptf.UName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghTotalPressureFvPatchScalarField::
|
||||
prghTotalPressureFvPatchScalarField
|
||||
(
|
||||
const prghTotalPressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, iF),
|
||||
UName_(ptf.UName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
p0_(ptf.p0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::prghTotalPressureFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
p0_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghTotalPressureFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const prghTotalPressureFvPatchScalarField& tiptf =
|
||||
refCast<const prghTotalPressureFvPatchScalarField>(ptf);
|
||||
|
||||
p0_.rmap(tiptf.p0_, addr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghTotalPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
const scalarField& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
|
||||
const vectorField& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
const uniformDimensionedScalarField& hRef =
|
||||
db().lookupObject<uniformDimensionedScalarField>("hRef");
|
||||
|
||||
dimensionedScalar ghRef
|
||||
(
|
||||
mag(g.value()) > small
|
||||
? g & (cmptMag(g.value())/mag(g.value()))*hRef
|
||||
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
|
||||
);
|
||||
|
||||
operator==
|
||||
(
|
||||
p0_
|
||||
- 0.5*rhop*(1.0 - pos0(phip))*magSqr(Up)
|
||||
- rhop*((g.value() & patch().Cf()) - ghRef.value())
|
||||
);
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghTotalPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
p0_.writeEntry("p0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
prghTotalPressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,179 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 "prghUniformDensityHydrostaticPressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
pRef_(0),
|
||||
rhoRef_(0),
|
||||
rhoName_("rho")
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict, false),
|
||||
pRef_(readScalar(dict.lookup("pRef"))),
|
||||
rhoRef_(readScalar(dict.lookup("rhoRef"))),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(pRef_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
pRef_(ptf.pRef_),
|
||||
rhoRef_(ptf.rhoRef_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf),
|
||||
pRef_(ptf.pRef_),
|
||||
rhoRef_(ptf.rhoRef_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, iF),
|
||||
pRef_(ptf.pRef_),
|
||||
rhoRef_(ptf.rhoRef_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
rhoName_
|
||||
);
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
const uniformDimensionedScalarField& hRef =
|
||||
db().lookupObject<uniformDimensionedScalarField>("hRef");
|
||||
|
||||
dimensionedScalar ghRef
|
||||
(
|
||||
mag(g.value()) > small
|
||||
? g & (cmptMag(g.value())/mag(g.value()))*hRef
|
||||
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
|
||||
);
|
||||
|
||||
operator==
|
||||
(
|
||||
pRef_ - (rhop - rhoRef_)*((g.value() & patch().Cf()) - ghRef.value())
|
||||
);
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("pRef") << pRef_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rhoRef") << rhoRef_ << token::END_STATEMENT << nl;
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,206 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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::prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpGenericBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides a hydrostatic pressure condition for p_rgh,
|
||||
calculated as:
|
||||
|
||||
\f[
|
||||
p_{rgh} = p_{ref} - (\rho - \rho_{ref}) g (h - h_{ref})
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
p_{rgh} | Pseudo hydrostatic pressure [Pa]
|
||||
p_{ref} | Static pressure at hRef [Pa]
|
||||
h | Height in the opposite direction to gravity
|
||||
h_{ref} | Reference height in the opposite direction to gravity
|
||||
\rho | Density field
|
||||
\rho_{ref} | Uniform reference density at boundary
|
||||
g | Acceleration due to gravity [m/s^2]
|
||||
\endtable
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
pRef | Reference static pressure | yes |
|
||||
rhoRef | Reference density | yes |
|
||||
rho | Density field name | no | rho
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
type prghUniformDensityHydrostaticPressure;
|
||||
rhoRef 1000;
|
||||
p 0;
|
||||
value uniform 0; // optional initial value
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
See also
|
||||
Foam::fixedValueFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef prghUniformDensityHydrostaticPressureFvPatchScalarField_H
|
||||
#define prghUniformDensityHydrostaticPressureFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class prghUniformDensityHydrostaticPressureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference Static pressure
|
||||
scalar pRef_;
|
||||
|
||||
//- Reference density
|
||||
scalar rhoRef_;
|
||||
|
||||
//- Name of phase-fraction field
|
||||
word rhoName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("prghUniformDensityHydrostaticPressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
// onto a new patch
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField >
|
||||
(
|
||||
new prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
const prghUniformDensityHydrostaticPressureFvPatchScalarField&,
|
||||
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 prghUniformDensityHydrostaticPressureFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user