varyingVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  This file is modified from OpenFOAM's source code
7  src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H
8 
9  OpenFOAM: The Open Source CFD Toolbox
10 
11  Copyright (C): 2011-2016 OpenFOAM Foundation
12 
13  OpenFOAM License:
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28  Description:
29 
30  This boundary condition provides a varying velocity for the patch
31 
32  U[flowComponent] = U * cos(alpha)
33  U[normalComponent] = U * sin(alpha)
34  alpha = alpha0 + alphaRate * t
35  U = U0 + URate * t
36 
37  where
38 
39  flowComponent : velocity component parallel to the flow. Options are: 0, 1, or 2, which corresponds to x, y, and z
40  normalComponent : velocity component normal to the flow. Options are: 0, 1, or 2, which corresponds to x, y, and z
41  U0 : initial velocity magnitude [m/s]
42  URate : rate of change for the velocity magnitude
43  alpha0 : initial flow angle [rad]
44  alphaRate : rate of change for the flow angle [rad/s]
45 
46  Example of the boundary condition specification:
47  myPatch
48  {
49  type varyingVelocity;
50  U0 10;
51  URate -0.2;
52  flowComponent 0;
53  normalComponent 1;
54  alpha0 0;
55  alphaRate 0.1;
56  }
57 
58  This will change the flow direction with a rate of 0.1 rad/s starting from 0 rad
59  U[0] = (10-0.2*t)*cos(0+0.1*t)
60  U[1] = (10-0.2*t)*sin(0+0.1*t)
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef varyingVelocityFvPatchVectorFields_H
65 #define varyingVelocityFvPatchVectorFields_H
66 
67 #include "fixedValueFvPatchFields.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class varyingVelocityFvPatchVectorField Declaration
76 \*---------------------------------------------------------------------------*/
77 
79  : public fixedValueFvPatchVectorField
80 {
81  // Private data
82 
83  scalar U0_;
84  scalar URate_;
85  label flowComponent_;
86  label normalComponent_;
87  scalar alpha0_;
88  scalar alphaRate_;
89 
90 public:
91  //- Runtime type information
92  TypeName("varyingVelocity");
93 
94  // Constructors
95 
96  //- Construct from patch and internal field
98  const fvPatch&,
99  const DimensionedField<vector, volMesh>&);
100 
101  //- Construct from patch, internal field and dictionary
103  const fvPatch&,
104  const DimensionedField<vector, volMesh>&,
105  const dictionary&);
106 
107  //- Construct by mapping given varyingVelocityFvPatchVectorField onto
108  // a new patch
111  const fvPatch&,
112  const DimensionedField<vector, volMesh>&,
113  const fvPatchFieldMapper&);
114 
115  //- Construct as copy
118 
119  //- Construct and return a clone
120  virtual tmp<fvPatchVectorField> clone() const
121  {
122  return tmp<fvPatchVectorField>(
124  }
125 
126  //- Construct as copy setting internal field reference
129  const DimensionedField<vector, volMesh>&);
130 
131  //- Construct and return a clone setting internal field reference
132  virtual tmp<fvPatchVectorField> clone(
133  const DimensionedField<vector, volMesh>& iF) const
134  {
135  return tmp<fvPatchVectorField>(
136  new varyingVelocityFvPatchVectorField(*this, iF));
137  }
138 
139  // Member functions
140 
141  //- Update the patch field
142  virtual void updateCoeffs();
143 
144  //- Write
145  virtual void write(Ostream&) const;
146 };
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
Foam::varyingVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Definition: varyingVelocityFvPatchVectorField.H:132
Foam::varyingVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Definition: varyingVelocityFvPatchVectorField.C:117
Foam::varyingVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Definition: varyingVelocityFvPatchVectorField.C:137
Foam
Definition: checkGeometry.C:32
Foam::varyingVelocityFvPatchVectorField
Definition: varyingVelocityFvPatchVectorField.H:78
Foam::varyingVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Definition: varyingVelocityFvPatchVectorField.H:120
Foam::varyingVelocityFvPatchVectorField::TypeName
TypeName("varyingVelocity")
Foam::varyingVelocityFvPatchVectorField::varyingVelocityFvPatchVectorField
varyingVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Definition: varyingVelocityFvPatchVectorField.C:36