fixedValueFvPatchField.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-2016 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::fixedValueFvPatchField
26 
27 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition supplies a fixed value constraint, and is the base
32  class for a number of other boundary conditions.
33 
34 Usage
35  \table
36  Property | Description | Required | Default value
37  value | Patch face values | yes |
38  \endtable
39 
40  Example of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  type fixedValue;
45  value uniform 0; // Example for scalar field usage
46  }
47  \endverbatim
48 
49 SourceFiles
50  fixedValueFvPatchField.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef fixedValueFvPatchField_H
55 #define fixedValueFvPatchField_H
56 
57 #include "fvPatchField.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class fixedValueFvPatchField Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<class Type>
69 class fixedValueFvPatchField
70 :
71  public fvPatchField<Type>
72 {
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("fixedValue");
78 
79 
80  // Constructors
81 
82  //- Construct from patch and internal field
84  (
85  const fvPatch&,
87  );
88 
89  //- Construct from patch, internal field and value
91  (
92  const fvPatch&,
94  const Type& value
95  );
96 
97  //- Construct from patch, internal field and dictionary
99  (
100  const fvPatch&,
102  const dictionary&,
103  const bool valueRequired=true
104  );
105 
106  //- Construct by mapping the given fixedValueFvPatchField<Type>
107  // onto a new patch
109  (
111  const fvPatch&,
113  const fvPatchFieldMapper&
114  );
115 
116  //- Construct as copy
118  (
120  );
121 
122  //- Construct and return a clone
123  virtual tmp<fvPatchField<Type>> clone() const
124  {
125  return tmp<fvPatchField<Type>>
126  (
128  );
129  }
130 
131  //- Construct as copy setting internal field reference
133  (
136  );
137 
138  //- Construct and return a clone setting internal field reference
140  (
142  ) const
143  {
144  return tmp<fvPatchField<Type>>
145  (
146  new fixedValueFvPatchField<Type>(*this, iF)
147  );
148  }
150 
151  // Member functions
152 
153  // Attributes
154 
155  //- Return true if this patch field fixes a value.
156  // Needed to check if a level has to be specified while solving
157  // Poissons equations.
158  virtual bool fixesValue() const
159  {
160  return true;
161  }
162 
163  //- Return false: this patch field is not altered by assignment
164  virtual bool assignable() const
165  {
166  return false;
167  }
168 
169 
170  // Evaluation functions
171 
172  //- Return the matrix diagonal coefficients corresponding to the
173  // evaluation of the value of this patchField with given weights
175  (
176  const tmp<scalarField>&
177  ) const;
178 
179  //- Return the matrix source coefficients corresponding to the
180  // evaluation of the value of this patchField with given weights
182  (
183  const tmp<scalarField>&
184  ) const;
185 
186  //- Return the matrix diagonal coefficients corresponding to the
187  // evaluation of the gradient of this patchField
188  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
189 
190  //- Return the matrix source coefficients corresponding to the
191  // evaluation of the gradient of this patchField
192  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
193 
194 
195  //- Write
196  virtual void write(Ostream&) const;
197 
198 
199  // Member operators
200 
201  virtual void operator=(const UList<Type>&) {}
202 
203  virtual void operator=(const fvPatchField<Type>&) {}
204  virtual void operator+=(const fvPatchField<Type>&) {}
205  virtual void operator-=(const fvPatchField<Type>&) {}
206  virtual void operator*=(const fvPatchField<scalar>&) {}
207  virtual void operator/=(const fvPatchField<scalar>&) {}
208 
209  virtual void operator+=(const Field<Type>&) {}
210  virtual void operator-=(const Field<Type>&) {}
211 
212  virtual void operator*=(const Field<scalar>&) {}
213  virtual void operator/=(const Field<scalar>&) {}
215  virtual void operator=(const Type&) {}
216  virtual void operator+=(const Type&) {}
217  virtual void operator-=(const Type&) {}
218  virtual void operator*=(const scalar) {}
219  virtual void operator/=(const scalar) {}
220 };
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 } // End namespace Foam
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 #ifdef NoRepository
230  #include "fixedValueFvPatchField.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void operator/=(const fvPatchField< scalar > &)
virtual void operator=(const UList< Type > &)
virtual void write(Ostream &) const
Write.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Pre-declare SubField and related Field type.
Definition: Field.H:57
TypeName("fixedValue")
Runtime type information.
Foam::fvPatchFieldMapper.
virtual void operator*=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
fixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void operator+=(const fvPatchField< Type > &)
virtual bool fixesValue() const
Return true if this patch field fixes a value.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void operator-=(const fvPatchField< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.