multiFreqVectorFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
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 an oscillating condition in terms of
31  (possibly multiple) amplitude and frequency.
32 
33  x_p[i] = x_ref[i] + a * sin(2 * pi * f * t + phase)
34 
35  where
36 
37  x_p : patch values
38  x_ref : reference value
39  a : amplitude
40  f : frequency [1/s]
41  t : time [s]
42  phase : phase in radian
43  i : component of the vector
44 
45  The input values are:
46 
47  Property | Description | Required
48  refVal | reference BC value | yes
49  amplitudes | oscillation amplitudes | yes
50  frequencies | oscillation frequencies | yes
51  phases | phase angles at zero | yes
52  component | component of the vector | yes
53  endTime | oscillation end time (default 1e8) | no
54 
55  Example of the boundary condition specification:
56  myPatch
57  {
58  type multiFreqVector;
59  refValue (1.0 0.0 0.0);
60  amplitudes (0.5 1.0);
61  frequencies (10.0 5.0);
62  phases (0.0 1.0);
63  component 0;
64  }
65 
66  This will add the oscillation with two frequencies to the 0th component
67  of the refValue (1 0 0) at myPatch
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef multiFreqVectorFvPatchFields_H
72 #define multiFreqVectorFvPatchFields_H
73 
74 #include "fixedValueFvPatchFields.H"
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 
81 /*---------------------------------------------------------------------------*\
82  Class multiFreqVectorFvPatchField Declaration
83 \*---------------------------------------------------------------------------*/
84 
86  : public fixedValueFvPatchVectorField
87 {
88  // Private data
89 
90  vector refValue_;
91  scalarList amplitudes_;
92  scalarList frequencies_;
93  scalarList phases_;
94  label component_;
95  scalar endTime_;
96 
97 public:
98  //- Runtime type information
99  TypeName("multiFreqVector");
100 
101  // Constructors
102 
103  //- Construct from patch and internal field
105  const fvPatch&,
106  const DimensionedField<vector, volMesh>&);
107 
108  //- Construct from patch, internal field and dictionary
110  const fvPatch&,
111  const DimensionedField<vector, volMesh>&,
112  const dictionary&);
113 
114  //- Construct by mapping given multiFreqVectorFvPatchField onto
115  // a new patch
118  const fvPatch&,
119  const DimensionedField<vector, volMesh>&,
120  const fvPatchFieldMapper&);
121 
122  //- Construct as copy
125 
126  //- Construct and return a clone
127  virtual tmp<fvPatchVectorField> clone() const
128  {
129  return tmp<fvPatchVectorField>(
130  new multiFreqVectorFvPatchField(*this));
131  }
132 
133  //- Construct as copy setting internal field reference
136  const DimensionedField<vector, volMesh>&);
137 
138  //- Construct and return a clone setting internal field reference
139  virtual tmp<fvPatchVectorField> clone(
140  const DimensionedField<vector, volMesh>& iF) const
141  {
142  return tmp<fvPatchVectorField>(
143  new multiFreqVectorFvPatchField(*this, iF));
144  }
145 
146  // Member functions
147 
148  //- Update the patch field
149  virtual void updateCoeffs();
150 
151  //- Write
152  virtual void write(Ostream&) const;
153 
154  //- Access the BC parameters
155  vector& refValue()
156  {
157  return refValue_;
158  }
159 };
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
Foam::multiFreqVectorFvPatchField::multiFreqVectorFvPatchField
multiFreqVectorFvPatchField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Definition: multiFreqVectorFvPatchField.C:36
Foam::multiFreqVectorFvPatchField::refValue
vector & refValue()
Definition: multiFreqVectorFvPatchField.H:155
Foam::multiFreqVectorFvPatchField::write
virtual void write(Ostream &) const
Definition: multiFreqVectorFvPatchField.C:144
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::multiFreqVectorFvPatchField::clone
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Definition: multiFreqVectorFvPatchField.H:139
Foam::multiFreqVectorFvPatchField::TypeName
TypeName("multiFreqVector")
Foam::multiFreqVectorFvPatchField::clone
virtual tmp< fvPatchVectorField > clone() const
Definition: multiFreqVectorFvPatchField.H:127
Foam::multiFreqVectorFvPatchField::updateCoeffs
virtual void updateCoeffs()
Definition: multiFreqVectorFvPatchField.C:116
Foam::multiFreqVectorFvPatchField
Definition: multiFreqVectorFvPatchField.H:85