fixedFluxPressureFvPatchScalarField.H
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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fixedFluxPressureFvPatchScalarField
29
30Group
31 grpInletBoundaryConditions grpWallBoundaryConditions
32
33Description
34 This boundary condition sets the pressure gradient to the provided value
35 such that the flux on the boundary is that specified by the velocity
36 boundary condition.
37
38 Example of the boundary condition specification:
39 \verbatim
40 <patchName>
41 {
42 type fixedFluxPressure;
43 }
44 \endverbatim
45
46See also
47 Foam::fixedGradientFvPatchField
48
49SourceFiles
50 fixedFluxPressureFvPatchScalarField.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef fixedFluxPressureFvPatchScalarField_H
55#define fixedFluxPressureFvPatchScalarField_H
56
57#include "fvPatchFields.H"
59#include "updateableSnGrad.H"
60
61// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62
63namespace Foam
64{
65
66/*---------------------------------------------------------------------------*\
67 Class fixedFluxPressureFvPatchScalarField Declaration
68\*---------------------------------------------------------------------------*/
71:
72 public fixedGradientFvPatchScalarField,
74{
75 // Private data
76
77 //- Current time index (used for updating)
78 label curTimeIndex_;
79
80
81public:
82
83 //- Runtime type information
84 TypeName("fixedFluxPressure");
85
86
87 // Constructors
88
89 //- Construct from patch and internal field
91 (
92 const fvPatch&,
94 );
95
96 //- Construct from patch, internal field and dictionary
98 (
99 const fvPatch&,
101 const dictionary&
102 );
103
104 //- Construct by mapping given fixedFluxPressureFvPatchScalarField onto
105 // a new patch
107 (
109 const fvPatch&,
111 const fvPatchFieldMapper&
112 );
113
114 //- Construct as copy
116 (
118 );
119
120 //- Construct and return a clone
121 virtual tmp<fvPatchScalarField> clone() const
122 {
124 (
126 );
127 }
128
129 //- Construct as copy setting internal field reference
131 (
134 );
135
136 //- Construct and return a clone setting internal field reference
138 (
140 ) const
141 {
143 (
145 );
146 }
147
148
149 // Member functions
150
151 //- Update the patch pressure gradient field from the given snGradp
152 virtual void updateSnGrad(const scalarField& snGradp);
153
154 //- Update the patch pressure gradient field
155 virtual void updateCoeffs();
156
157 //- Write
158 virtual void write(Ostream&) const;
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#include "volFields.H"
169
170namespace Foam
171{
172 template<class GradBC>
173 inline void setSnGrad
174 (
177 )
178 {
179 forAll(bf, patchi)
180 {
181 if (isA<GradBC>(bf[patchi]))
182 {
183 refCast<GradBC>(bf[patchi]).updateSnGrad(snGrad[patchi]);
184 }
185 }
186 }
187
188 template<class GradBC>
189 inline void setSnGrad
190 (
193 )
194 {
195 setSnGrad<GradBC>(bf, tsnGrad());
196 }
197}
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201#endif
202
203// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
This boundary condition sets the pressure gradient to the provided value such that the flux on the bo...
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
virtual void updateCoeffs()
Update the patch pressure gradient field.
virtual void updateSnGrad(const scalarField &snGradp)
Update the patch pressure gradient field from the given snGradp.
TypeName("fixedFluxPressure")
Runtime type information.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
void setSnGrad(volScalarField::Boundary &bf, const FieldField< fvsPatchField, scalar > &snGrad)
runTime write()
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73