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-2020 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 dictionary
88  (
89  const fvPatch&,
91  const dictionary&,
92  const bool valueRequired=true
93  );
94 
95  //- Construct by mapping the given fixedValueFvPatchField<Type>
96  // onto a new patch
98  (
100  const fvPatch&,
102  const fvPatchFieldMapper&,
103  const bool mappingRequired=true
104  );
105 
106  //- Disallow copy without setting internal field reference
108 
109  //- Copy constructor setting internal field reference
111  (
114  );
115 
116  //- Construct and return a clone setting internal field reference
118  (
120  ) const
121  {
122  return tmp<fvPatchField<Type>>
123  (
124  new fixedValueFvPatchField<Type>(*this, iF)
125  );
126  }
127 
128 
129  // Member Functions
130 
131  // Attributes
132 
133  //- Return true if this patch field fixes a value.
134  // Needed to check if a level has to be specified while solving
135  // Poissons equations.
136  virtual bool fixesValue() const
137  {
138  return true;
139  }
140 
141  //- Return false: this patch field is not altered by assignment
142  virtual bool assignable() const
143  {
144  return false;
145  }
146 
147 
148  // Evaluation functions
149 
150  //- Return the matrix diagonal coefficients corresponding to the
151  // evaluation of the value of this patchField with given weights
153  (
154  const tmp<scalarField>&
155  ) const;
156 
157  //- Return the matrix source coefficients corresponding to the
158  // evaluation of the value of this patchField with given weights
160  (
161  const tmp<scalarField>&
162  ) const;
163 
164  //- Return the matrix diagonal coefficients corresponding to the
165  // evaluation of the gradient of this patchField
166  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
167 
168  //- Return the matrix source coefficients corresponding to the
169  // evaluation of the gradient of this patchField
170  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
171 
172 
173  //- Write
174  virtual void write(Ostream&) const;
175 
176 
177  // Member Operators
178 
179  virtual void operator=(const UList<Type>&) {}
180 
181  virtual void operator=(const fvPatchField<Type>&) {}
182  virtual void operator+=(const fvPatchField<Type>&) {}
183  virtual void operator-=(const fvPatchField<Type>&) {}
184  virtual void operator*=(const fvPatchField<scalar>&) {}
185  virtual void operator/=(const fvPatchField<scalar>&) {}
186 
187  virtual void operator+=(const Field<Type>&) {}
188  virtual void operator-=(const Field<Type>&) {}
189 
190  virtual void operator*=(const Field<scalar>&) {}
191  virtual void operator/=(const Field<scalar>&) {}
192 
193  virtual void operator=(const Type&) {}
194  virtual void operator+=(const Type&) {}
195  virtual void operator-=(const Type&) {}
196  virtual void operator*=(const scalar) {}
197  virtual void operator/=(const scalar) {}
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #ifdef NoRepository
208  #include "fixedValueFvPatchField.C"
209 #endif
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual bool fixesValue() const
Return true if this patch field fixes a value.
fixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator+=(const fvPatchField< Type > &)
TypeName("fixedValue")
Runtime type information.
virtual void operator/=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator-=(const fvPatchField< Type > &)
virtual void operator=(const UList< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.