prghTotalHydrostaticPressureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "fvPatchFieldMapper.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
39 (
40  const fvPatch& p,
42 )
43 :
44  fixedValueFvPatchScalarField(p, iF),
45  UName_("U"),
46  phiName_("phi"),
47  rhoName_("rho"),
48  ph_rghName_("ph_rgh")
49 {}
50 
51 
54 (
55  const fvPatch& p,
57  const dictionary& dict
58 )
59 :
60  fixedValueFvPatchScalarField(p, iF, dict),
61  UName_(dict.lookupOrDefault<word>("U", "U")),
62  phiName_(dict.lookupOrDefault<word>("phi", "phi")),
63  rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
64  ph_rghName_(dict.lookupOrDefault<word>("ph_rgh", "ph_rgh"))
65 {}
66 
67 
70 (
72  const fvPatch& p,
74  const fvPatchFieldMapper& mapper
75 )
76 :
77  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
78  UName_(ptf.UName_),
79  phiName_(ptf.phiName_),
80  rhoName_(ptf.rhoName_),
81  ph_rghName_(ptf.ph_rghName_)
82 {}
83 
84 
87 (
89 )
90 :
91  fixedValueFvPatchScalarField(ptf),
92  UName_(ptf.UName_),
93  phiName_(ptf.phiName_),
94  rhoName_(ptf.rhoName_),
95  ph_rghName_(ptf.ph_rghName_)
96 {}
97 
98 
101 (
104 )
105 :
106  fixedValueFvPatchScalarField(ptf, iF),
107  UName_(ptf.UName_),
108  phiName_(ptf.phiName_),
109  rhoName_(ptf.rhoName_),
110  ph_rghName_(ptf.ph_rghName_)
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
117 {
118  if (updated())
119  {
120  return;
121  }
122 
123  const scalarField& rhop =
124  patch().lookupPatchField<volScalarField, scalar>(rhoName_);
125 
126  const scalarField& ph_rghp =
127  patch().lookupPatchField<volScalarField, scalar>(ph_rghName_);
128 
129  const scalarField& phip =
130  patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
131 
132  const vectorField& Up =
133  patch().lookupPatchField<volVectorField, vector>(UName_);
134 
135  operator==
136  (
137  ph_rghp
138  - 0.5*rhop*(1.0 - pos0(phip))*magSqr(Up)
139  );
140 
141  fixedValueFvPatchScalarField::updateCoeffs();
142 }
143 
144 
146 (
147  Ostream& os
148 ) const
149 {
151  os.writeEntryIfDifferent<word>("U", "U", UName_);
152  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
153  os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
154  os.writeEntryIfDifferent<word>("ph_rgh", "ph_rgh", ph_rghName_);
155  writeEntry("value", os);
156 }
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 namespace Foam
162 {
164  (
167  );
168 }
169 
170 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
volFields.H
Foam::fvPatchField< scalar >::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:364
Foam::prghTotalHydrostaticPressureFvPatchScalarField::ph_rghName_
word ph_rghName_
Name of hydrostatic pressure field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.H:164
Foam::Ostream::writeEntryIfDifferent
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:231
Foam::prghTotalHydrostaticPressureFvPatchScalarField::rhoName_
word rhoName_
Name of density field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.H:161
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::prghTotalHydrostaticPressureFvPatchScalarField::prghTotalHydrostaticPressureFvPatchScalarField
prghTotalHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.C:39
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
Foam::pos0
dimensionedScalar pos0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:188
Foam::prghTotalHydrostaticPressureFvPatchScalarField
This boundary condition provides static pressure condition for p_rgh, calculated as:
Definition: prghTotalHydrostaticPressureFvPatchScalarField.H:145
Foam::prghTotalHydrostaticPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.C:146
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::Field< scalar >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
prghTotalHydrostaticPressureFvPatchScalarField.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::prghTotalHydrostaticPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.C:116
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
uniformDimensionedFields.H
Foam::prghTotalHydrostaticPressureFvPatchScalarField::UName_
word UName_
Name of the velocity field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.H:155
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::prghTotalHydrostaticPressureFvPatchScalarField::phiName_
word phiName_
Name of the flux transporting the field.
Definition: prghTotalHydrostaticPressureFvPatchScalarField.H:158
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54