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 needValue
115  )
116  :
118  (
119  p, iF, dict,
120  (needValue? 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 as copy setting internal field reference
142  (
145  );
146 
147  //- Return a clone
148  virtual tmp<fvPatchField<Type>> clone() const
149  {
150  return fvPatchField<Type>::Clone(*this);
151  }
152 
153  //- Clone with an internal field reference
155  (
157  ) const
158  {
159  return fvPatchField<Type>::Clone(*this, iF);
160  }
161 
162 
163  // Member Functions
164 
165  //- True: this patch field fixes a value.
166  virtual bool fixesValue() const { return true; }
167 
168  //- False: this patch field is not altered by assignment.
169  virtual bool assignable() const { return false; }
170 
171  //- Write includes "value" entry
172  virtual void write(Ostream&) const;
173 
174 
175  // Evaluation functions
176 
177  //- Return the matrix diagonal coefficients corresponding to the
178  // evaluation of the value of this patchField with given weights
180  (
181  const tmp<scalarField>&
182  ) const;
183 
184  //- Return the matrix source coefficients corresponding to the
185  // evaluation of the value of this patchField with given weights
187  (
188  const tmp<scalarField>&
189  ) const;
190 
191  //- Return the matrix diagonal coefficients corresponding to the
192  // evaluation of the gradient of this patchField
194 
195  //- Return the matrix source coefficients corresponding to the
196  // evaluation of the gradient of this patchField
197  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
199 
200  // Member Operators
201 
202  virtual void operator=(const UList<Type>&) {}
203 
204  virtual void operator=(const fvPatchField<Type>&) {}
205  virtual void operator+=(const fvPatchField<Type>&) {}
206  virtual void operator-=(const fvPatchField<Type>&) {}
207  virtual void operator*=(const fvPatchField<scalar>&) {}
208  virtual void operator/=(const fvPatchField<scalar>&) {}
209 
210  virtual void operator+=(const Field<Type>&) {}
211  virtual void operator-=(const Field<Type>&) {}
212 
213  virtual void operator*=(const Field<scalar>&) {}
214  virtual void operator/=(const Field<scalar>&) {}
215 
216  virtual void operator=(const Type&) {}
217  virtual void operator+=(const Type&) {}
218  virtual void operator-=(const Type&) {}
219  virtual void operator*=(const scalar) {}
220  virtual void operator/=(const scalar) {}
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #ifdef NoRepository
231  #include "fixedValueFvPatchField.C"
232 #endif
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
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 includes "value" entry.
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
Return a clone.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:607
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...
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.