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_;
100 
101  //- Condition to supply the reference value
102  tmp<fvPatchField<Type>> refValuePtr_;
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  }
168 
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  // Force an assignment irrespective of form of patch
202 
203  virtual void operator==(const fvPatchField<Type>& ptf);
204  virtual void operator==(const Field<Type>& tf);
205  virtual void operator==(const Type& t);
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
PatchFunction1.H
Foam::scaledFixedValueFvPatchField
This condition applies a scalar multiplier to the value of another boundary condition.
Definition: scaledFixedValueFvPatchField.H:104
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
Foam::scaledFixedValueFvPatchField::scalePtr_
autoPtr< PatchFunction1< scalar > > scalePtr_
Scalar scale factor.
Definition: scaledFixedValueFvPatchField.H:113
Foam::scaledFixedValueFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: scaledFixedValueFvPatchField.C:171
Foam::scaledFixedValueFvPatchField::TypeName
TypeName("scaledFixedValue")
Runtime type information.
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::scaledFixedValueFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &m)
Map (and resize as needed) from self given a mapping object.
Definition: scaledFixedValueFvPatchField.C:116
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::scaledFixedValueFvPatchField::scaledFixedValueFvPatchField
scaledFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: scaledFixedValueFvPatchField.C:36
Foam::scaledFixedValueFvPatchField::refValue
const fvPatchField< Type > & refValue() const
Return the reference value condition.
Definition: scaledFixedValueFvPatchField.H:189
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
scaledFixedValueFvPatchField.C
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::scaledFixedValueFvPatchField::operator==
virtual void operator==(const fvPatchField< Type > &ptf)
Definition: scaledFixedValueFvPatchField.C:185
Foam::scaledFixedValueFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: scaledFixedValueFvPatchField.C:152
fixedValueFvPatchField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::scaledFixedValueFvPatchField::refValuePtr_
tmp< fvPatchField< Type > > refValuePtr_
Condition to supply the reference value.
Definition: scaledFixedValueFvPatchField.H:116
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::scaledFixedValueFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &ptf, const labelList &addr)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: scaledFixedValueFvPatchField.C:135
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::scaledFixedValueFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: scaledFixedValueFvPatchField.H:156