diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 5f56d4e7f..0baa5fa4a 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -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 diff --git a/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.C new file mode 100644 index 000000000..b17a8f973 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.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 . + +\*---------------------------------------------------------------------------*/ + +#include "PrghPressureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PrghPressureFvPatchScalarField:: +PrghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + PressureFvPatchScalarField(p, iF) +{} + + +template +Foam::PrghPressureFvPatchScalarField:: +PrghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + PressureFvPatchScalarField(p, iF, dict) +{} + + +template +Foam::PrghPressureFvPatchScalarField:: +PrghPressureFvPatchScalarField +( + const PrghPressureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + PressureFvPatchScalarField(ptf, p, iF, mapper) +{} + + +template +Foam::PrghPressureFvPatchScalarField:: +PrghPressureFvPatchScalarField +( + const PrghPressureFvPatchScalarField& ptf +) +: + PressureFvPatchScalarField(ptf) +{} + + +template +Foam::PrghPressureFvPatchScalarField:: +PrghPressureFvPatchScalarField +( + const PrghPressureFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + PressureFvPatchScalarField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::PrghPressureFvPatchScalarField:: +updateCoeffs() +{ + if (PressureFvPatchScalarField::updated()) + { + return; + } + + PressureFvPatchScalarField::updateCoeffs(); + + const scalarField& rhop = this->patch().template + lookupPatchField + ( + "rho" + ); + + const uniformDimensionedVectorField& g = + this->db().template lookupObject("g"); + + const uniformDimensionedScalarField& hRef = + this->db().template lookupObject("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()) + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.H similarity index 52% rename from src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.H rename to src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.H index a7c1516eb..2ab6eb3fb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/PrghPressureFvPatchScalarField.H @@ -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 . 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 - - { - 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 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& ); //- Construct from patch, internal field and dictionary - prghTotalPressureFvPatchScalarField + PrghPressureFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -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&, const fvPatchFieldMapper& ); //- Construct as copy - prghTotalPressureFvPatchScalarField + PrghPressureFvPatchScalarField ( - const prghTotalPressureFvPatchScalarField& + const PrghPressureFvPatchScalarField& ); //- Construct and return a clone @@ -156,14 +114,14 @@ public: { return tmp ( - new prghTotalPressureFvPatchScalarField(*this) + new PrghPressureFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - prghTotalPressureFvPatchScalarField + PrghPressureFvPatchScalarField ( - const prghTotalPressureFvPatchScalarField&, + const PrghPressureFvPatchScalarField&, const DimensionedField& ); @@ -175,52 +133,17 @@ public: { return tmp ( - 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 \ + PrghPressure; \ + \ + defineTemplateTypeNameAndDebug(PrghPressure, 0); \ + \ + addToPatchFieldRunTimeSelection \ + ( \ + fvPatchScalarField, \ + PrghPressure \ + ) + #endif // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/prghPressureFvPatchScalarFields.C b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/prghPressureFvPatchScalarFields.C new file mode 100644 index 000000000..fe40cfbea --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/PrghPressure/prghPressureFvPatchScalarFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "PrghPressureFvPatchScalarField.H" +#include "pressureFvPatchScalarField.H" +#include "totalPressureFvPatchScalarField.H" +#include "uniformDensityHydrostaticPressureFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePrghPatchScalarField(pressure, prghPressure) + + makePrghPatchScalarField(totalPressure, prghTotalPressure) + + makePrghPatchScalarField + ( + uniformDensityHydrostaticPressure, + prghUniformDensityHydrostaticPressure + ) +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C similarity index 62% rename from src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C rename to src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C index 5236d2c42..2de47f17c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C @@ -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& iF ) : fixedValueFvPatchScalarField(p, iF), - rhoName_("rho"), p_(p.size(), 0.0) {} -Foam::prghPressureFvPatchScalarField:: -prghPressureFvPatchScalarField +Foam::pressureFvPatchScalarField::pressureFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -53,7 +50,6 @@ prghPressureFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF, dict, false), - rhoName_(dict.lookupOrDefault("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& 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& 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(ptf); + const pressureFvPatchScalarField& tiptf = + refCast(ptf); p_.rmap(tiptf.p_, addr); } -void Foam::prghPressureFvPatchScalarField::updateCoeffs() +void Foam::pressureFvPatchScalarField::updateCoeffs() { if (updated()) { return; } - const scalarField& rhop = patch().lookupPatchField - ( - rhoName_ - ); - - const uniformDimensionedVectorField& g = - db().lookupObject("g"); - - const uniformDimensionedScalarField& hRef = - db().lookupObject("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(os, "rho", "rho", rhoName_); p_.writeEntry("p", os); writeEntry("value", os); } @@ -184,7 +155,7 @@ namespace Foam makePatchTypeField ( fvPatchScalarField, - prghPressureFvPatchScalarField + pressureFvPatchScalarField ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H similarity index 74% rename from src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H rename to src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H index 69d45ffc2..c00878ab9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.H @@ -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 . 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 { - 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& ); //- Construct from patch, internal field and dictionary - prghPressureFvPatchScalarField + pressureFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -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&, const fvPatchFieldMapper& ); //- Construct as copy - prghPressureFvPatchScalarField + pressureFvPatchScalarField ( - const prghPressureFvPatchScalarField& + const pressureFvPatchScalarField& ); //- Construct and return a clone @@ -145,14 +129,14 @@ public: { return tmp ( - new prghPressureFvPatchScalarField(*this) + new pressureFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - prghPressureFvPatchScalarField + pressureFvPatchScalarField ( - const prghPressureFvPatchScalarField&, + const pressureFvPatchScalarField&, const DimensionedField& ); @@ -164,7 +148,7 @@ public: { return tmp ( - new prghPressureFvPatchScalarField(*this, iF) + new pressureFvPatchScalarField(*this, iF) ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C deleted file mode 100644 index f099b3d61..000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghTotalPressure/prghTotalPressureFvPatchScalarField.C +++ /dev/null @@ -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 . - -\*---------------------------------------------------------------------------*/ - -#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& iF -) -: - fixedValueFvPatchScalarField(p, iF), - UName_("U"), - phiName_("phi"), - rhoName_("rho"), - p0_(p.size(), 0.0) -{} - - -Foam::prghTotalPressureFvPatchScalarField:: -prghTotalPressureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict, false), - UName_(dict.lookupOrDefault("U", "U")), - phiName_(dict.lookupOrDefault("phi", "phi")), - rhoName_(dict.lookupOrDefault("rho", "rho")), - p0_("p0", dict, p.size()) -{ - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else - { - fvPatchField::operator=(p0_); - } -} - - -Foam::prghTotalPressureFvPatchScalarField:: -prghTotalPressureFvPatchScalarField -( - const prghTotalPressureFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& 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& 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(ptf); - - p0_.rmap(tiptf.p0_, addr); -} - - -void Foam::prghTotalPressureFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - const scalarField& rhop = - patch().lookupPatchField(rhoName_); - - const scalarField& phip = - patch().lookupPatchField(phiName_); - - const vectorField& Up = - patch().lookupPatchField(UName_); - - const uniformDimensionedVectorField& g = - db().lookupObject("g"); - - const uniformDimensionedScalarField& hRef = - db().lookupObject("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(os, "U", "U", UName_); - writeEntryIfDifferent(os, "phi", "phi", phiName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); - p0_.writeEntry("p0", os); - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - prghTotalPressureFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.C deleted file mode 100644 index 16a8c115c..000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.C +++ /dev/null @@ -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 . - -\*---------------------------------------------------------------------------*/ - -#include "prghUniformDensityHydrostaticPressureFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "uniformDimensionedFields.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField:: -prghUniformDensityHydrostaticPressureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedValueFvPatchScalarField(p, iF), - pRef_(0), - rhoRef_(0), - rhoName_("rho") -{} - - -Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField:: -prghUniformDensityHydrostaticPressureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict, false), - pRef_(readScalar(dict.lookup("pRef"))), - rhoRef_(readScalar(dict.lookup("rhoRef"))), - rhoName_(dict.lookupOrDefault("rho", "rho")) -{ - if (dict.found("value")) - { - fvPatchScalarField::operator= - ( - scalarField("value", dict, p.size()) - ); - } - else - { - fvPatchField::operator=(pRef_); - } -} - - -Foam::prghUniformDensityHydrostaticPressureFvPatchScalarField:: -prghUniformDensityHydrostaticPressureFvPatchScalarField -( - const prghUniformDensityHydrostaticPressureFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& 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& 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 - ( - rhoName_ - ); - - const uniformDimensionedVectorField& g = - db().lookupObject("g"); - - const uniformDimensionedScalarField& hRef = - db().lookupObject("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(os, "rho", "rho", rhoName_); - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - prghUniformDensityHydrostaticPressureFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.H deleted file mode 100644 index 6db5e912b..000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghUniformDensityHydrostaticPressure/prghUniformDensityHydrostaticPressureFvPatchScalarField.H +++ /dev/null @@ -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 . - -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 - - { - 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& - ); - - //- Construct from patch, internal field and dictionary - prghUniformDensityHydrostaticPressureFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // prghUniformDensityHydrostaticPressureFvPatchScalarField - // onto a new patch - prghUniformDensityHydrostaticPressureFvPatchScalarField - ( - const prghUniformDensityHydrostaticPressureFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - prghUniformDensityHydrostaticPressureFvPatchScalarField - ( - const prghUniformDensityHydrostaticPressureFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new prghUniformDensityHydrostaticPressureFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - prghUniformDensityHydrostaticPressureFvPatchScalarField - ( - const prghUniformDensityHydrostaticPressureFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - 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 - -// ************************************************************************* //