fixedValueFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 Description
28  This boundary condition supplies a fixed value constraint, and is the base
29  class for a number of other boundary conditions.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  value | Patch face values | yes |
35  \endtable
36 
37  Example of the boundary condition specification:
38  \verbatim
39  <patchName>
40  {
41  type fixedValue;
42  value uniform 0; // Example for scalar field usage
43  }
44  \endverbatim
45 
46 SourceFiles
47  fixedValueFvPatchField.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef fixedValueFvPatchField_H
52 #define fixedValueFvPatchField_H
53 
54 #include "fvPatchField.H"
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 namespace Foam
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class fixedValueFvPatchField Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
66 class fixedValueFvPatchField
67 :
68  public fvPatchField<Type>
69 {
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("fixedValue");
75 
76 
77  // Constructors
78 
79  //- Construct from patch and internal field
81  (
82  const fvPatch&,
84  );
85 
86  //- Construct from patch, internal field and value
88  (
89  const fvPatch&,
91  const Type& value
92  );
93 
94  //- Construct from patch, internal field and dictionary
96  (
97  const fvPatch&,
99  const dictionary&,
100  const bool valueRequired=true
101  );
102 
103  //- Construct by mapping the given fixedValueFvPatchField<Type>
104  // onto a new patch
106  (
108  const fvPatch&,
110  const fvPatchFieldMapper&
111  );
112 
113  //- Construct as copy
115  (
117  );
118 
119  //- Construct and return a clone
120  virtual tmp<fvPatchField<Type>> clone() const
121  {
122  return tmp<fvPatchField<Type>>
123  (
125  );
126  }
127 
128  //- Construct as copy setting internal field reference
130  (
133  );
134 
135  //- Construct and return a clone setting internal field reference
137  (
139  ) const
140  {
141  return tmp<fvPatchField<Type>>
142  (
143  new fixedValueFvPatchField<Type>(*this, iF)
144  );
145  }
147 
148  // Member functions
149 
150  // Attributes
151 
152  //- Return true if this patch field fixes a value.
153  // Needed to check if a level has to be specified while solving
154  // Poissons equations.
155  virtual bool fixesValue() const
156  {
157  return true;
158  }
159 
160  //- Return false: this patch field is not altered by assignment
161  virtual bool assignable() const
162  {
163  return false;
164  }
165 
166 
167  // Evaluation functions
168 
169  //- Return the matrix diagonal coefficients corresponding to the
170  // evaluation of the value of this patchField with given weights
172  (
173  const tmp<scalarField>&
174  ) const;
175 
176  //- Return the matrix source coefficients corresponding to the
177  // evaluation of the value of this patchField with given weights
179  (
180  const tmp<scalarField>&
181  ) const;
182 
183  //- Return the matrix diagonal coefficients corresponding to the
184  // evaluation of the gradient of this patchField
185  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
186 
187  //- Return the matrix source coefficients corresponding to the
188  // evaluation of the gradient of this patchField
189  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
190 
191 
192  //- Write
193  virtual void write(Ostream&) const;
194 
195 
196  // Member operators
197 
198  virtual void operator=(const UList<Type>&) {}
199 
200  virtual void operator=(const fvPatchField<Type>&) {}
201  virtual void operator+=(const fvPatchField<Type>&) {}
202  virtual void operator-=(const fvPatchField<Type>&) {}
203  virtual void operator*=(const fvPatchField<scalar>&) {}
204  virtual void operator/=(const fvPatchField<scalar>&) {}
205 
206  virtual void operator+=(const Field<Type>&) {}
207  virtual void operator-=(const Field<Type>&) {}
208 
209  virtual void operator*=(const Field<scalar>&) {}
210  virtual void operator/=(const Field<scalar>&) {}
212  virtual void operator=(const Type&) {}
213  virtual void operator+=(const Type&) {}
214  virtual void operator-=(const Type&) {}
215  virtual void operator*=(const scalar) {}
216  virtual void operator/=(const scalar) {}
217 };
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 } // End namespace Foam
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 #ifdef NoRepository
227  #include "fixedValueFvPatchField.C"
228 #endif
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
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.