scaledFixedValueFvPatchField.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) 2019 OpenCFD Ltd.
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::scaledFixedValueFvPatchField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This condition applies a scalar multiplier to the value of another
34  boundary condition.
35 
36 Usage
37  \table
38  Property | Description | Required | Default value
39  scale | Time varying scale | yes |
40  patch | patchField providing the raw patch value | yes |
41  \endtable
42 
43  Example of the boundary condition specification to scale a reference
44  velocity of (15 0 0) supplied as a fixedValue by a table of values
45  that ramps the scale from 0 to 1 over 1 second:
46  \verbatim
47  <patchName>
48  {
49  type scaledFixedValue;
50 
51  scale table
52  (
53  ( 0 0)
54  ( 1.0 1.0)
55  (100.0 1.0)
56  );
57 
58  refValue
59  {
60  type fixedValue;
61  value uniform (15 0 0);
62  }
63  }
64  \endverbatim
65 
66 SourceFiles
67  scaledFixedValueFvPatchField.C
68 
69 SeeAlso
70  Foam::PatchFunction1
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef scaledFixedValueFvPatchField_H
75 #define scaledFixedValueFvPatchField_H
76 
77 #include "fixedValueFvPatchField.H"
78 #include "PatchFunction1.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class scaledFixedValueFvPatchField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class Type>
90 class scaledFixedValueFvPatchField
91 :
92  public fixedValueFvPatchField<Type>
93 {
94 protected:
95 
96  // Protected data
97 
98  //- Scalar scale factor
99  autoPtr<PatchFunction1<scalar>> scalePtr_;
101  //- Condition to supply the reference value
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("scaledFixedValue");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given a scaledFixedValueFvPatchField onto
129  //- a new patch
131  (
133  const fvPatch&,
135  const fvPatchFieldMapper&
136  );
137 
138  //- Construct as copy
140 
141  //- Construct and return a clone
142  virtual tmp<fvPatchField<Type>> clone() const
143  {
144  return tmp<fvPatchField<Type>>
145  (
147  );
148  }
149 
150  //- Construct as copy setting internal field reference
152  (
155  );
156 
157  //- Construct and return a clone setting internal field reference
159  (
161  ) const
162  {
163  return tmp<fvPatchField<Type>>
164  (
165  new scaledFixedValueFvPatchField(*this, iF)
166  );
167  }
169 
170  // Member functions
171 
172  // Access
173 
174  //- Return the reference value condition
175  const fvPatchField<Type>& refValue() const
176  {
177  return refValuePtr_();
178  }
179 
180 
181  // Mapping functions
182 
183  //- Map (and resize as needed) from self given a mapping object
184  virtual void autoMap(const fvPatchFieldMapper& m);
185 
186  //- Reverse map the given fvPatchField onto this fvPatchField
187  virtual void rmap
188  (
189  const fvPatchField<Type>& ptf,
190  const labelList& addr
191  );
192 
193 
194  //- Update the coefficients associated with the patch field
195  virtual void updateCoeffs();
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 
200 
201  // Member Operators
202 
203  // Force an assignment, applying scaling to refValue
204 
205  virtual void operator==(const fvPatchField<Type>&);
206  virtual void operator==(const Field<Type>&);
207  virtual void operator==(const Type&);
208 
209  // Prevent automatic comparison rewriting (c++20)
210  bool operator!=(const fvPatchField<Type>&) const = delete;
211  bool operator!=(const Field<Type>&) const = delete;
212  bool operator!=(const Type&) const = delete;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #ifdef NoRepository
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
bool operator!=(const fvPatchField< Type > &) const =delete
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...
tmp< fvPatchField< Type > > refValuePtr_
Condition to supply the reference value.
TypeName("scaledFixedValue")
Runtime type information.
This condition applies a scalar multiplier to the value of another boundary condition.
Generic templated field type.
Definition: Field.H:62
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
autoPtr< PatchFunction1< scalar > > scalePtr_
Scalar scale factor.
scaledFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void rmap(const fvPatchField< Type > &ptf, const labelList &addr)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void operator==(const fvPatchField< Type > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual void autoMap(const fvPatchFieldMapper &m)
Map (and resize as needed) from self given a mapping object.
const fvPatchField< Type > & refValue() const
Return the reference value condition.
Namespace for OpenFOAM.