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 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::fixedFluxPressureFvPatchScalarField
29 
30 Group
31  grpInletBoundaryConditions grpWallBoundaryConditions
32 
33 Description
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 
46 See also
47  Foam::fixedGradientFvPatchField
48 
49 SourceFiles
50  fixedFluxPressureFvPatchScalarField.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef fixedFluxPressureFvPatchScalarField_H
55 #define fixedFluxPressureFvPatchScalarField_H
56 
57 #include "fvPatchFields.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class fixedFluxPressureFvPatchScalarField Declaration
67 \*---------------------------------------------------------------------------*/
68 
70 :
71  public fixedGradientFvPatchScalarField
72 {
73  // Private data
74 
75  //- Current time index (used for updating)
76  label curTimeIndex_;
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("fixedFluxPressure");
83 
84 
85  // Constructors
86 
87  //- Construct from patch and internal field
89  (
90  const fvPatch&,
92  );
93 
94  //- Construct from patch, internal field and dictionary
96  (
97  const fvPatch&,
99  const dictionary&
100  );
101 
102  //- Construct by mapping given fixedFluxPressureFvPatchScalarField onto
103  // a new patch
105  (
107  const fvPatch&,
109  const fvPatchFieldMapper&
110  );
111 
112  //- Construct as copy
114  (
116  );
117 
118  //- Construct and return a clone
119  virtual tmp<fvPatchScalarField> clone() const
120  {
122  (
124  );
125  }
126 
127  //- Construct as copy setting internal field reference
129  (
132  );
133 
134  //- Construct and return a clone setting internal field reference
136  (
138  ) const
139  {
141  (
143  );
144  }
145 
146 
147  // Member functions
148 
149  //- Update the patch pressure gradient field from the given snGradp
150  virtual void updateSnGrad(const scalarField& snGradp);
151 
152  //- Update the patch pressure gradient field
153  virtual void updateCoeffs();
154 
155  //- Write
156  virtual void write(Ostream&) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #include "volFields.H"
167 
168 namespace Foam
169 {
170  template<class GradBC>
171  inline void setSnGrad
172  (
175  )
176  {
177  forAll(bf, patchi)
178  {
179  if (isA<GradBC>(bf[patchi]))
180  {
181  refCast<GradBC>(bf[patchi]).updateSnGrad(snGrad[patchi]);
182  }
183  }
184  }
185 
186  template<class GradBC>
187  inline void setSnGrad
188  (
190  const tmp<FieldField<fvsPatchField, scalar>>& tsnGrad
191  )
192  {
193  setSnGrad<GradBC>(bf, tsnGrad());
194  }
195 }
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
volFields.H
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
Foam::fixedFluxPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: fixedFluxPressureFvPatchScalarField.H:118
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the patch pressure gradient field.
Definition: fixedFluxPressureFvPatchScalarField.C:157
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::Field< scalar >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::setSnGrad
void setSnGrad(volScalarField::Boundary &bf, const FieldField< fvsPatchField, scalar > &snGrad)
Definition: fixedFluxPressureFvPatchScalarField.H:171
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fixedFluxPressureFvPatchScalarField::updateSnGrad
virtual void updateSnGrad(const scalarField &snGradp)
Update the patch pressure gradient field from the given snGradp.
Definition: fixedFluxPressureFvPatchScalarField.C:141
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fixedGradientFvPatchFields.H
Foam::GeometricField::Boundary
The boundary fields.
Definition: GeometricField.H:115
fvPatchFields.H
Foam::fixedFluxPressureFvPatchScalarField
This boundary condition sets the pressure gradient to the provided value such that the flux on the bo...
Definition: fixedFluxPressureFvPatchScalarField.H:68
Foam::fixedFluxPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: fixedFluxPressureFvPatchScalarField.C:174
Foam::fixedFluxPressureFvPatchScalarField::TypeName
TypeName("fixedFluxPressure")
Runtime type information.
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::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
fixedFluxPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: fixedFluxPressureFvPatchScalarField.C:38
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54