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 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  // Private Member Functions
107 
108  //- Get the far-field density from the owner patch
109  scalar rhoInf() const;
110 
111  //- Update result field based on interface functionality
112  template<class ... Cmpt>
113  void updateInterfaceMatrix
114  (
115  scalarField& result,
116  const scalarField& psiInternal,
117  const scalarField& coeffs,
118  const Pstream::commsTypes commsType,
119  const Cmpt ... cmpt
120  ) const;
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("prghCyclicPressure");
127 
128 
129  // Constructors
130 
131  //- Construct from patch, internal field and dictionary
133  (
134  const fvPatch&,
136  const dictionary&
137  );
138 
139  //- Construct by mapping given fixedValueTypeFvPatchField
140  // onto a new patch
142  (
144  const fvPatch&,
146  const fieldMapper&
147  );
148 
149  //- Disallow copy without setting internal field reference
151  (
153  ) = delete;
154 
155  //- Copy constructor setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
171  (
172  *this,
173  iF
174  )
175  );
176  }
177 
178 
179  // Member Functions
180 
181  // Access
182 
183  //- Return the "jump"
184  virtual tmp<scalarField> jump() const;
185 
186 
187  // Mapping functions
188 
189  //- Map the given fvPatchField onto this fvPatchField
190  virtual void map(const fvPatchScalarField&, const fieldMapper&);
191 
192  //- Reset the fvPatchField to the given fvPatchField
193  // Used for mesh to mesh mapping
194  virtual void reset(const fvPatchScalarField&);
195 
196 
197  // Evaluation functions
198 
199  //- Update the patch pressure gradient field
200  virtual void updateCoeffs();
201 
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 
215 #endif
216 
217 // ************************************************************************* //
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
commsTypes
Types of communications.
Definition: UPstream.H:65
A list of keyword definitions, which are a keyword followed by any number of values (e....
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:88
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
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.
prghCyclicPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the patch pressure gradient field.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
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.