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-2020 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  //- Disallow copy without setting internal field reference
148  (
150  ) = delete;
151 
152  //- Copy constructor setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
166  (
167  new SRFVelocityFvPatchVectorField(*this, iF)
168  );
169  }
170 
171 
172  // Member Functions
173 
174  // Access
175 
176  //- Return const access to the relative flag
177  const Switch& relative() const
178  {
179  return relative_;
180  }
181 
182 
183  // Mapping functions
185  //- Map (and resize as needed) from self given a mapping object
186  // Used to update fields following mesh topology change
187  virtual void autoMap(const fvPatchFieldMapper&);
188 
189  //- Reverse map the given fvPatchField onto this fvPatchField
190  // Used to reconstruct fields
191  virtual void rmap(const fvPatchVectorField&, const labelList&);
192 
193  // Evaluation functions
194 
195  //- Update the coefficients associated with the patch field
196  virtual void updateCoeffs();
197 
198 
199  // I-O
201  //- Write
202  virtual void write(Ostream&) const;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
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:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
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/any.
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:54
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void write(Ostream &) const
Write.
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...