prghCyclicPressureFvPatchScalarField.H
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) 2024-2026 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 Class
25  Foam::prghCyclicPressureFvPatchScalarField
26 
27 Description
28  This boundary condition provides a cyclic condition for p_rgh. It applies
29  corrections to the value and gradient on both sides of the cyclic to
30  account for the non-cylicity of the gravitational force.
31 
32  This condition is only needed when the cyclic patches have a transformation
33  and a normal component in the direction of gravity. If the cyclic patches
34  are orthogonal to the direction gravity, then a normal cyclic boundary
35  condition can be used instead.
36 
37  Care must be taken when using this boundary condition that the simulation
38  is actually cyclic. The following constraints apply:
39 
40  - Both cyclic patches must be oriented in the same way with respect to
41  gravity. In practice this means that applicability is limited to cyclics
42  with translational transformations.
43 
44  - The model cannot have any dependence on the absolute value of the
45  pressure field. The absolute value of the pressure, in reality, varies
46  between each repetition of the geometry; it is not actually formally
47  cyclic. Only the gradient of the pressure field can be truly cyclic. This
48  model is therefore only valid if the absolute value of the pressure is
49  arbitrary, and only the gradient has an effect on the solution. This is
50  the case for incompressible multiphase solutions or incompressible
51  Boussinesq-like models of density variation. It is not true if (for
52  example) a compressible thermodynamic model is being used.
53 
54 Usage
55  \table
56  Property | Description | Required | Default value
57  patchType | underlying patch type (should be \c cyclic) | yes |
58  rhoInf | far-field density | yes |
59  \endtable
60 
61  Example of the boundary condition specification:
62  \verbatim
63  <patchName>
64  {
65  type prghCyclicPressure;
66  patchType cyclic;
67  rhoInf 1;
68  }
69  \endverbatim
70 
71 SourceFiles
72  prghCyclicPressureFvPatchScalarField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef prghCyclicPressureFvPatchScalarField_H
77 #define prghCyclicPressureFvPatchScalarField_H
78 
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class prghCyclicPressureFvPatchScalarField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class prghCyclicPressureFvPatchScalarField
91 :
92  public jumpCyclicFvPatchScalarField
93 {
94  // Private Data
95 
96  //- Name of the density field
97  const word rhoName_;
98 
99  //- Far-field density
100  const scalar rhoInf_;
101 
102  //- Jump in value from the other patch to this one
103  scalarField jump_;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("prghCyclicPressure");
110 
111 
112  // Constructors
113 
114  //- Construct from patch, internal field and dictionary
116  (
117  const fvPatch&,
119  const dictionary&
120  );
121 
122  //- Construct by mapping given fixedValueTypeFvPatchField
123  // onto a new patch
125  (
127  const fvPatch&,
129  const fieldMapper&
130  );
131 
132  //- Disallow copy without setting internal field reference
134  (
136  ) = delete;
137 
138  //- Copy constructor setting internal field reference
140  (
143  );
144 
145  //- Construct and return a clone setting internal field reference
147  (
149  ) const
150  {
152  (
154  (
155  *this,
156  iF
157  )
158  );
159  }
160 
161 
162  // Member Functions
163 
164  // Access
165 
166  //- Return the "jump"
167  virtual tmp<scalarField> jump() const;
168 
169 
170  // Mapping functions
171 
172  //- Map the given fvPatchField onto this fvPatchField
173  virtual void map(const fvPatchScalarField&, const fieldMapper&);
174 
175  //- Reset the fvPatchField to the given fvPatchField
176  // Used for mesh to mesh mapping
177  virtual void reset(const fvPatchScalarField&);
178 
179 
180  // Evaluation functions
181 
182  //- Update the patch pressure gradient field
183  virtual void updateCoeffs();
184 
185 
186  //- Write
187  virtual void write(Ostream&) const;
188 
189 
190  // Member Operators
191 
192  //- Inherit assignment
193  using jumpCyclicFvPatchScalarField::operator=;
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
This boundary condition provides a cyclic condition for p_rgh. It applies corrections to the value an...
virtual tmp< scalarField > jump() const
Return the "jump".
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual void updateCoeffs()
Update the patch pressure gradient field.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, fvMesh > &iF) const
Construct and return a clone setting internal field reference.
prghCyclicPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
TypeName("prghCyclicPressure")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.