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  );
104 
105  //- Construct by mapping the given fixedValueFvPatchField<Type>
106  // onto a new patch
108  (
110  const fvPatch&,
112  const fvPatchFieldMapper&
113  );
114 
115  //- Construct as copy
117  (
119  );
120 
121  //- Construct and return a clone
122  virtual tmp<fvPatchField<Type>> clone() const
123  {
124  return tmp<fvPatchField<Type>>
125  (
127  );
128  }
129 
130  //- Construct as copy setting internal field reference
132  (
135  );
136 
137  //- Construct and return a clone setting internal field reference
139  (
141  ) const
142  {
143  return tmp<fvPatchField<Type>>
144  (
145  new fixedValueFvPatchField<Type>(*this, iF)
146  );
147  }
149 
150  // Member functions
151 
152  // Attributes
153 
154  //- Return true if this patch field fixes a value.
155  // Needed to check if a level has to be specified while solving
156  // Poissons equations.
157  virtual bool fixesValue() const
158  {
159  return true;
160  }
161 
162  //- Return false: this patch field is not altered by assignment
163  virtual bool assignable() const
164  {
165  return false;
166  }
167 
168 
169  // Evaluation functions
170 
171  //- Return the matrix diagonal coefficients corresponding to the
172  // evaluation of the value of this patchField with given weights
174  (
175  const tmp<scalarField>&
176  ) const;
177 
178  //- Return the matrix source coefficients corresponding to the
179  // evaluation of the value of this patchField with given weights
181  (
182  const tmp<scalarField>&
183  ) const;
184 
185  //- Return the matrix diagonal coefficients corresponding to the
186  // evaluation of the gradient of this patchField
187  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
188 
189  //- Return the matrix source coefficients corresponding to the
190  // evaluation of the gradient of this patchField
191  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
192 
193 
194  //- Write
195  virtual void write(Ostream&) const;
196 
197 
198  // Member operators
199 
200  virtual void operator=(const UList<Type>&) {}
201 
202  virtual void operator=(const fvPatchField<Type>&) {}
203  virtual void operator+=(const fvPatchField<Type>&) {}
204  virtual void operator-=(const fvPatchField<Type>&) {}
205  virtual void operator*=(const fvPatchField<scalar>&) {}
206  virtual void operator/=(const fvPatchField<scalar>&) {}
207 
208  virtual void operator+=(const Field<Type>&) {}
209  virtual void operator-=(const Field<Type>&) {}
210 
211  virtual void operator*=(const Field<scalar>&) {}
212  virtual void operator/=(const Field<scalar>&) {}
214  virtual void operator=(const Type&) {}
215  virtual void operator+=(const Type&) {}
216  virtual void operator-=(const Type&) {}
217  virtual void operator*=(const scalar) {}
218  virtual void operator/=(const scalar) {}
219 };
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 } // End namespace Foam
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 #ifdef NoRepository
229  #include "fixedValueFvPatchField.C"
230 #endif
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual void operator/=(const fvPatchField< scalar > &)
virtual void operator=(const UList< Type > &)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
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:65
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
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.
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 > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual void operator-=(const fvPatchField< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.