SRFVelocityFvPatchVectorField.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-2018 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::SRFVelocityFvPatchVectorField
26 
27 Description
28  Velocity condition to be used in conjunction with the single
29  rotating frame (SRF) model (see: SRFModel class)
30 
31  Given the free stream velocity in the absolute frame, the condition
32  applies the appropriate rotation transformation in time and space to
33  determine the local velocity.
34 
35  The optional \c relative flag switches the behaviour of the patch
36  such that:
37 
38  - relative = yes: inlet velocity applied 'as is':
39 
40  \f[
41  U_p = U_{in}
42  \f]
43 
44  - relative = no : SRF velocity is subtracted from the inlet velocity:
45 
46  \f[
47  U_p = U_{in} - U_{p,srf}
48  \f]
49 
50  where
51  \vartable
52  U_p = patch velocity [m/s]
53  U_{in} = user-specified inlet velocity
54  U_{p,srf} = SRF velocity
55  \endvartable
56 
57 
58 Usage
59  \table
60  Property | Description | Required | Default value
61  inletValue | inlet velocity | yes |
62  relative | inletValue relative motion to the SRF? | yes |
63  \endtable
64 
65  Example of the boundary condition specification:
66  \verbatim
67  <patchName>
68  {
69  type SRFVelocity;
70  inletValue uniform (0 0 0);
71  relative yes;
72  value uniform (0 0 0); // initial value
73  }
74  \endverbatim
75 
76 See also
77  Foam::fixedValueFvPatchField
78 
79 SourceFiles
80  SRFVelocityFvPatchVectorField.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef SRFVelocityFvPatchVectorField_H
85 #define SRFVelocityFvPatchVectorField_H
86 
87 #include "fvPatchFields.H"
89 #include "Switch.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class SRFVelocityFvPatchVectorField Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 class SRFVelocityFvPatchVectorField
101 :
102  public fixedValueFvPatchVectorField
103 {
104  // Private data
105 
106  //- Is the supplied inlet value relative to the SRF
107  Switch relative_;
108 
109  //- Inlet value [m/s]
110  vectorField inletValue_;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("SRFVelocity");
117 
118 
119  // Constructors
120 
121  //- Construct from patch and internal field
123  (
124  const fvPatch&,
126  );
127 
128  //- Construct from patch, internal field and dictionary
130  (
131  const fvPatch&,
133  const dictionary&
134  );
135 
136  //- Construct by mapping given SRFVelocityFvPatchVectorField
137  // onto a new patch
139  (
141  const fvPatch&,
143  const fvPatchFieldMapper&
144  );
145 
146  //- Construct as copy
148  (
150  );
151 
152  //- Construct and return a clone
153  virtual tmp<fvPatchVectorField> clone() const
154  {
156  (
158  );
159  }
160 
161  //- Construct as copy setting internal field reference
163  (
166  );
167 
168  //- Construct and return a clone setting internal field reference
170  (
172  ) const
173  {
175  (
177  );
178  }
179 
180 
181  // Member functions
182 
183  // Access
184 
185  //- Return const access to the relative flag
186  const Switch& relative() const
187  {
188  return relative_;
189  }
190 
191 
192  // Mapping functions
194  //- Map (and resize as needed) from self given a mapping object
195  virtual void autoMap
196  (
197  const fvPatchFieldMapper&
198  );
199 
200  //- Reverse map the given fvPatchField onto this fvPatchField
201  virtual void rmap
202  (
203  const fvPatchVectorField&,
204  const labelList&
205  );
206 
207 
208  // Evaluation functions
210  //- Update the coefficients associated with the patch field
211  virtual void updateCoeffs();
212 
213 
214  // I-O
215 
216  //- Write
217  virtual void write(Ostream&) const;
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
SRFVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
const Switch & relative() const
Return const access to the relative flag.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
TypeName("SRFVelocity")
Runtime type information.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
Velocity condition to be used in conjunction with the single rotating frame (SRF) model (see: SRFMode...