multiFreqScalarFvPatchField.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 = x_ref + 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 
44  The input values are:
45 
46  Property | Description | Required
47  refVal | reference BC value | yes
48  amplitudes | oscillation amplitudes | yes
49  frequencies | oscillation frequencies | yes
50  phases | phase angles at zero | yes
51  endTime | oscillation end time (default 1e8) | no
52 
53  Example of the boundary condition specification:
54  myPatch
55  {
56  type multiFreqVector;
57  refValue 1.0;
58  amplitudes (0.5 1.0);
59  frequencies (10.0 5.0);
60  phases (0.0 1.0);
61  }
62 
63  This will add the oscillation with two frequencies to the refValue
64  1.0 at myPatch
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef multiFreqScalarFvPatchFields_H
69 #define multiFreqScalarFvPatchFields_H
70 
71 #include "fixedValueFvPatchFields.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class multiFreqScalarFvPatchField Declaration
80 \*---------------------------------------------------------------------------*/
81 
83  : public fixedValueFvPatchScalarField
84 {
85  // Private data
86 
87  scalar refValue_;
88  scalarList amplitudes_;
89  scalarList frequencies_;
90  scalarList phases_;
91 
92 public:
93  //- Runtime type information
94  TypeName("multiFreqScalar");
95 
96  // Constructors
97 
98  //- Construct from patch and internal field
100  const fvPatch&,
101  const DimensionedField<scalar, volMesh>&);
102 
103  //- Construct from patch, internal field and dictionary
105  const fvPatch&,
106  const DimensionedField<scalar, volMesh>&,
107  const dictionary&);
108 
109  //- Construct by mapping given multiFreqScalarFvPatchField onto
110  // a new patch
113  const fvPatch&,
114  const DimensionedField<scalar, volMesh>&,
115  const fvPatchFieldMapper&);
116 
117  //- Construct as copy
120 
121  //- Construct and return a clone
122  virtual tmp<fvPatchScalarField> clone() const
123  {
124  return tmp<fvPatchScalarField>(
125  new multiFreqScalarFvPatchField(*this));
126  }
127 
128  //- Construct as copy setting internal field reference
131  const DimensionedField<scalar, volMesh>&);
132 
133  //- Construct and return a clone setting internal field reference
134  virtual tmp<fvPatchScalarField> clone(
135  const DimensionedField<scalar, volMesh>& iF) const
136  {
137  return tmp<fvPatchScalarField>(
138  new multiFreqScalarFvPatchField(*this, iF));
139  }
140 
141  // Member functions
142 
143  //- Update the patch field
144  virtual void updateCoeffs();
145 
146  //- Write
147  virtual void write(Ostream&) const;
148 };
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
Foam::multiFreqScalarFvPatchField::write
virtual void write(Ostream &) const
Definition: multiFreqScalarFvPatchField.C:132
Foam::multiFreqScalarFvPatchField::updateCoeffs
virtual void updateCoeffs()
Definition: multiFreqScalarFvPatchField.C:107
Foam::multiFreqScalarFvPatchField::TypeName
TypeName("multiFreqScalar")
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::multiFreqScalarFvPatchField::clone
virtual tmp< fvPatchScalarField > clone() const
Definition: multiFreqScalarFvPatchField.H:122
Foam::multiFreqScalarFvPatchField::clone
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Definition: multiFreqScalarFvPatchField.H:134
Foam::multiFreqScalarFvPatchField
Definition: multiFreqScalarFvPatchField.H:82
Foam::multiFreqScalarFvPatchField::multiFreqScalarFvPatchField
multiFreqScalarFvPatchField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Definition: multiFreqScalarFvPatchField.C:36