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 | Copyright (C) 2011-2013 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::fixedFluxPressureFvPatchScalarField
26 
27 Group
28  grpInletBoundaryConditions grpWallBoundaryConditions
29 
30 Description
31  This boundary condition sets the pressure gradient to the provided value
32  such that the flux on the boundary is that specified by the velocity
33  boundary condition.
34 
35  Example of the boundary condition specification:
36  \verbatim
37  myPatch
38  {
39  type fixedFluxPressure;
40  }
41  \endverbatim
42 
43 SeeAlso
44  Foam::fixedGradientFvPatchField
45 
46 SourceFiles
47  fixedFluxPressureFvPatchScalarField.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef fixedFluxPressureFvPatchScalarFields_H
52 #define fixedFluxPressureFvPatchScalarFields_H
53 
54 #include "fvPatchFields.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class fixedFluxPressureFvPatchScalarField Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 :
68  public fixedGradientFvPatchScalarField
69 {
70  // Private data
71 
72  //- Current time index (used for updating)
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("fixedFluxPressure");
80 
81 
82  // Constructors
83 
84  //- Construct from patch and internal field
86  (
87  const fvPatch&,
89  );
90 
91  //- Construct from patch, internal field and dictionary
93  (
94  const fvPatch&,
96  const dictionary&
97  );
98 
99  //- Construct by mapping given fixedFluxPressureFvPatchScalarField onto
100  // a new patch
102  (
104  const fvPatch&,
106  const fvPatchFieldMapper&
107  );
108 
109  //- Construct as copy
111  (
113  );
114 
115  //- Construct and return a clone
116  virtual tmp<fvPatchScalarField> clone() const
117  {
119  (
121  );
122  }
123 
124  //- Construct as copy setting internal field reference
126  (
129  );
130 
131  //- Construct and return a clone setting internal field reference
133  (
135  ) const
136  {
138  (
140  );
141  }
142 
143 
144  // Member functions
145 
146  //- Update the patch pressure gradient field from the given snGradp
147  virtual void updateCoeffs(const scalarField& snGradp);
148 
149  //- Update the patch pressure gradient field
150  virtual void updateCoeffs();
151 
152  //- Write
153  virtual void write(Ostream&) const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #include "volFields.H"
164 
165 namespace Foam
166 {
167  template<class GradBC>
168  inline void setSnGrad
169  (
172  )
173  {
174  forAll(bf, patchi)
175  {
176  if (isA<GradBC>(bf[patchi]))
177  {
178  refCast<GradBC>(bf[patchi]).updateCoeffs(snGrad[patchi]);
179  }
180  }
181  }
182 
183  template<class GradBC>
184  inline void setSnGrad
185  (
187  const tmp<FieldField<fvsPatchField, scalar> >& tsnGrad
188  )
189  {
190  setSnGrad<GradBC>(bf, tsnGrad());
191  }
192 }
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
volFields.H
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
Foam::fixedFluxPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: fixedFluxPressureFvPatchScalarField.H:115
Foam::FieldField
Generic field type.
Definition: FieldField.H:51
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fixedFluxPressureFvPatchScalarField::curTimeIndex_
label curTimeIndex_
Current time index (used for updating)
Definition: fixedFluxPressureFvPatchScalarField.H:72
Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the patch pressure gradient field.
Definition: fixedFluxPressureFvPatchScalarField.C:142
Foam::setSnGrad
void setSnGrad(volScalarField::GeometricBoundaryField &bf, const FieldField< fvsPatchField, scalar > &snGrad)
Definition: fixedFluxPressureFvPatchScalarField.H:168
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
fixedGradientFvPatchFields.H
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:65
Foam::fixedFluxPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: fixedFluxPressureFvPatchScalarField.C:159
Foam::fixedFluxPressureFvPatchScalarField::TypeName
TypeName("fixedFluxPressure")
Runtime type information.
patchi
label patchi
Definition: getPatchFieldScalar.H:1
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
fixedFluxPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: fixedFluxPressureFvPatchScalarField.C:35
Foam::GeometricField::GeometricBoundaryField
Definition: GeometricField.H:105
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51