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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fixedValueFvPatchField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This boundary condition supplies a fixed value constraint, and is the base
34  class for a number of other boundary conditions.
35 
36 Usage
37  \table
38  Property | Description | Required | Default value
39  value | Patch face values | yes |
40  \endtable
41 
42  Example of the boundary condition specification:
43  \verbatim
44  <patchName>
45  {
46  type fixedValue;
47  value uniform 0; // Example for scalar field usage
48  }
49  \endverbatim
50 
51 SourceFiles
52  fixedValueFvPatchField.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef fixedValueFvPatchField_H
57 #define fixedValueFvPatchField_H
58 
59 #include "fvPatchField.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class fixedValueFvPatchField Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type>
71 class fixedValueFvPatchField
72 :
73  public fvPatchField<Type>
74 {
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("fixedValue");
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 value
93  (
94  const fvPatch&,
96  const Type& value
97  );
98 
99  //- Construct from patch, internal field and dictionary
101  (
102  const fvPatch&,
104  const dictionary&,
105  const bool valueRequired=true
106  );
107 
108  //- Construct by mapping the given fixedValueFvPatchField<Type>
109  // onto a new patch
111  (
113  const fvPatch&,
115  const fvPatchFieldMapper&
116  );
117 
118  //- Construct as copy
120  (
122  );
123 
124  //- Construct and return a clone
125  virtual tmp<fvPatchField<Type>> clone() const
126  {
127  return tmp<fvPatchField<Type>>
128  (
130  );
131  }
132 
133  //- Construct as copy setting internal field reference
135  (
138  );
139 
140  //- Construct and return a clone setting internal field reference
142  (
144  ) const
145  {
146  return tmp<fvPatchField<Type>>
147  (
148  new fixedValueFvPatchField<Type>(*this, iF)
149  );
150  }
151 
152 
153  // Member functions
154 
155  // Attributes
156 
157  //- Return true if this patch field fixes a value.
158  // Needed to check if a level has to be specified while solving
159  // Poissons equations.
160  virtual bool fixesValue() const
161  {
162  return true;
163  }
164 
165  //- Return false: this patch field is not altered by assignment
166  virtual bool assignable() const
167  {
168  return false;
169  }
170 
171 
172  // Evaluation functions
173 
174  //- Return the matrix diagonal coefficients corresponding to the
175  // evaluation of the value of this patchField with given weights
177  (
178  const tmp<scalarField>&
179  ) const;
180 
181  //- Return the matrix source coefficients corresponding to the
182  // evaluation of the value of this patchField with given weights
184  (
185  const tmp<scalarField>&
186  ) const;
188  //- Return the matrix diagonal coefficients corresponding to the
189  // evaluation of the gradient of this patchField
190  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
191 
192  //- Return the matrix source coefficients corresponding to the
193  // evaluation of the gradient of this patchField
194  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 
200 
201  // Member operators
202 
203  virtual void operator=(const UList<Type>&) {}
204 
205  virtual void operator=(const fvPatchField<Type>&) {}
206  virtual void operator+=(const fvPatchField<Type>&) {}
207  virtual void operator-=(const fvPatchField<Type>&) {}
208  virtual void operator*=(const fvPatchField<scalar>&) {}
209  virtual void operator/=(const fvPatchField<scalar>&) {}
210 
211  virtual void operator+=(const Field<Type>&) {}
212  virtual void operator-=(const Field<Type>&) {}
213 
214  virtual void operator*=(const Field<scalar>&) {}
215  virtual void operator/=(const Field<scalar>&) {}
216 
217  virtual void operator=(const Type&) {}
218  virtual void operator+=(const Type&) {}
219  virtual void operator-=(const Type&) {}
220  virtual void operator*=(const scalar) {}
221  virtual void operator/=(const scalar) {}
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #ifdef NoRepository
232  #include "fixedValueFvPatchField.C"
233 #endif
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
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 a number of values (eg...
Definition: dictionary.H:120
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:68
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
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.
TypeName("fixedValue")
Runtime type information.
A FieldMapper for finite-volume patch fields.
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:55
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...
Definition: areaFieldsFwd.H:42
virtual void operator-=(const fvPatchField< Type > &)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.