PrghPressureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class PressureFvPatchScalarField>
37 (
38  const fvPatch& p,
40 )
41 :
42  PressureFvPatchScalarField(p, iF)
43 {}
44 
45 
46 template<class PressureFvPatchScalarField>
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
55  PressureFvPatchScalarField(p, iF, dict)
56 {}
57 
58 
59 template<class PressureFvPatchScalarField>
62 (
64  const fvPatch& p,
66  const fvPatchFieldMapper& mapper
67 )
68 :
69  PressureFvPatchScalarField(ptf, p, iF, mapper)
70 {}
71 
72 
73 template<class PressureFvPatchScalarField>
76 (
78 )
79 :
80  PressureFvPatchScalarField(ptf)
81 {}
82 
83 
84 template<class PressureFvPatchScalarField>
87 (
90 )
91 :
92  PressureFvPatchScalarField(ptf, iF)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 template<class PressureFvPatchScalarField>
101 {
102  if (PressureFvPatchScalarField::updated())
103  {
104  return;
105  }
106 
107  PressureFvPatchScalarField::updateCoeffs();
108 
109  const scalarField& rhop = this->patch().template
110  lookupPatchField<volScalarField, scalar>
111  (
112  "rho"
113  );
114 
116  this->db().template lookupObject<uniformDimensionedVectorField>("g");
117 
118  const uniformDimensionedScalarField& hRef =
119  this->db().template lookupObject<uniformDimensionedScalarField>("hRef");
120 
121  const dimensionedScalar ghRef(- mag(g)*hRef);
122 
123  this->operator==
124  (
125  *this - rhop*((g.value() & this->patch().Cf()) - ghRef.value())
126  );
127 }
128 
129 
130 // ************************************************************************* //
PrghPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Macros for easy insertion into run-time selection tables.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
This boundary condition provides the p_rgh equivalent of a pressure boundary condition calculated as:...
Foam::fvPatchFieldMapper.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
const dimensionedVector & g