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  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fixedValueFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions
32 
33 Description
34  This boundary condition supplies a fixed value constraint, and is the base
35  class for a number of other boundary conditions.
36 
37 Usage
38  \table
39  Property | Description | Required | Default value
40  value | Patch face values | yes |
41  \endtable
42 
43  Example of the boundary condition specification:
44  \verbatim
45  <patchName>
46  {
47  type fixedValue;
48  value uniform 0; // Example for scalar field usage
49  }
50  \endverbatim
51 
52 SourceFiles
53  fixedValueFvPatchField.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef Foam_fixedValueFvPatchField_H
58 #define Foam_fixedValueFvPatchField_H
59 
60 #include "fvPatchField.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class fixedValueFvPatchField Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class Type>
72 class fixedValueFvPatchField
73 :
74  public fvPatchField<Type>
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&,
106  );
107 
108  //- Compatibility (prefer with readOption)
110  (
111  const fvPatch& p,
113  const dictionary& dict,
114  const bool valueReqd
115  )
116  :
118  (
119  p, iF, dict,
120  (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
121  )
122  {}
123 
124  //- Construct by mapping the given fixedValue patch field
125  //- onto a new patch
127  (
129  const fvPatch&,
131  const fvPatchFieldMapper&
132  );
133 
134  //- Construct as copy
136  (
138  );
139 
140  //- Construct and return a clone
141  virtual tmp<fvPatchField<Type>> clone() const
142  {
143  return tmp<fvPatchField<Type>>
144  (
146  );
147  }
148 
149  //- Construct as copy setting internal field reference
151  (
154  );
155 
156  //- Construct and return a clone setting internal field reference
158  (
160  ) const
161  {
163  (
164  new fixedValueFvPatchField<Type>(*this, iF)
165  );
166  }
167 
168 
169  // Member Functions
170 
171  //- True: this patch field fixes a value.
172  virtual bool fixesValue() const { return true; }
173 
174  //- False: this patch field is not altered by assignment.
175  virtual bool assignable() const { return false; }
176 
177 
178  // Evaluation functions
179 
180  //- Return the matrix diagonal coefficients corresponding to the
181  // evaluation of the value of this patchField with given weights
182  virtual tmp<Field<Type>> valueInternalCoeffs
183  (
184  const tmp<scalarField>&
185  ) const;
186 
187  //- Return the matrix source coefficients corresponding to the
188  // evaluation of the value of this patchField with given weights
190  (
191  const tmp<scalarField>&
192  ) const;
193 
194  //- Return the matrix diagonal coefficients corresponding to the
195  // evaluation of the gradient of this patchField
196  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
197 
198  //- Return the matrix source coefficients corresponding to the
199  // evaluation of the gradient of this patchField
200  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
201 
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 
206 
207  // Member operators
208 
209  virtual void operator=(const UList<Type>&) {}
210 
211  virtual void operator=(const fvPatchField<Type>&) {}
212  virtual void operator+=(const fvPatchField<Type>&) {}
213  virtual void operator-=(const fvPatchField<Type>&) {}
214  virtual void operator*=(const fvPatchField<scalar>&) {}
215  virtual void operator/=(const fvPatchField<scalar>&) {}
216 
217  virtual void operator+=(const Field<Type>&) {}
218  virtual void operator-=(const Field<Type>&) {}
219 
220  virtual void operator*=(const Field<scalar>&) {}
221  virtual void operator/=(const Field<scalar>&) {}
222 
223  virtual void operator=(const Type&) {}
224  virtual void operator+=(const Type&) {}
225  virtual void operator-=(const Type&) {}
226  virtual void operator*=(const scalar) {}
227  virtual void operator/=(const scalar) {}
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
238  #include "fixedValueFvPatchField.C"
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
dictionary dict
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:129
virtual bool assignable() const
False: this patch field is not altered by assignment.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
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:56
virtual void operator+=(const fvPatchField< Type > &)
virtual bool fixesValue() const
True: this patch field fixes a value.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
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 > &)
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.