DMD.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::ROMmodels::DMD
28 
29 Description
30  Field creation model using the streaming total dynamic mode
31  decomposition method (STDMD).
32 
33  The governing equations of the field creation are as follows:
34 
35  \f[
36  \mathbf{x}_\tau \approx
37  \tilde{\mathbf{x}_\tau} =
38  \left( \sum_{i=0}^{N-1} \phi_i \alpha_i v_i^\tau \right)_{real}​
39  \f]
40 
41  with
42 
43  \f[
44  \tau = \frac{t - t_o}{\Delta t}​
45  \f]
46 
47  where:
48 
49  \vartable
50  \mathbf{x} | Field snapshot at time t
51  \tilde{\mathbf{x}} | Reconstructed field snapshot at time t (complex)
52  N | Number of modes
53  i | Mode index
54  \tau | Nondimensional time
55  t | Time [s]
56  t_o | Start time (of mode decomposition calculations) [s]
57  \Delta t | Time-step size of mode decomposition [s]
58  \phi | Mode (complex)
59  \alpha | Mode amplitude (complex)
60  v | Mode eigenvalue (complex)
61  \endvartable
62 
63  References:
64  \verbatim
65  Governing equations (tag:K):
66  Kiewat, M. (2019).
67  Streaming modal decomposition approaches for vehicle aerodynamics.
68  PhD thesis. Munich: Technical University of Munich.
69  URL:mediatum.ub.tum.de/doc/1482652/1482652.pdf
70  \endverbatim
71 
72  Operands:
73  \table
74  Operand | Type | Location
75  input | {vol,surface}<Type>Field | <time>/<inpField>
76  output file | - | -
77  output field | {vol,surface}<Type>Field | <time>/<outField>
78  \endtable
79 
80  where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
81 
82 Usage
83  Minimal example by using \c system/ROMfieldsDict:
84  \verbatim
85  // Mandatory entries
86  field <word>;
87  object <word>;
88  deltaT <scalar>;
89  time <scalar>;
90  modes <labelList>;
91  amplitudes <complexList>;
92  eigenvalues <complexList>;
93 
94  // Optional entries
95  startTime <scalar>;
96  dimensions <dimensionSet>;
97  \endverbatim
98 
99  where the entries mean:
100  \table
101  Property | Description | Type | Reqd | Deflt
102  field | Name of reconstructed field | word | yes | -
103  object | Name of operand function object | word | yes | -
104  deltaT | Time-step size of mode decomposition | scalar | yes | -
105  time | Time instant where modes are located | scalar | yes | -
106  modes | List of mode indices | labelList | yes | -
107  amplitudes | Amplitude coefficients | complexList | yes | -
108  eigenvalues | Eigenvalues | complexList | yes | -
109  startTime | Start time for mode-information collection | scalar | no | 0
110  dimensions | Dimensions of reconstructed fields | dimensionSet | no | -
111  \endtable
112 
113 SourceFiles
114  DMD.C
115  DMDImpl.C
116 
117 \*---------------------------------------------------------------------------*/
118 
119 #ifndef ROMmodels_DMD_H
120 #define ROMmodels_DMD_H
121 
123 #include "dimensionSet.H"
124 #include "complex.H"
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 namespace Foam
129 {
130 namespace ROMmodels
131 {
132 /*---------------------------------------------------------------------------*\
133  Class DMD Declaration
134 \*---------------------------------------------------------------------------*/
135 
136 class DMD
137 :
138  public ROMmodel
139 {
140  // Private Typedefs
141 
142  typedef List<complex> complexList;
143 
144 
145  // Private Data
146 
147  //- Name of reconstructed field
148  word fieldName_;
149 
150  //- Name of operand function object
151  word objectName_;
152 
153  //- Time-step size of mode decomposition (not that of the simulation)
154  scalar deltaT_;
155 
156  //- Time instant where modes are located
157  scalar time_;
158 
159  //- Start time for mode-information collection
160  scalar startTime_;
161 
162  //- List of mode indices
163  labelList modes_;
164 
165  //- Dimensions of reconstructed fields
166  dimensionSet dims_;
167 
168  //- Amplitude coefficients
169  complexList amps_;
170 
171  //- Eigenvalues
172  complexList evals_;
173 
174 
175  // Private Member Functions
176 
177  //- Return names of mode fields
178  wordList modeNames(const word& modeType) const;
179 
180  //- Implementation for creating and writing fields
181  template<class GeoType>
182  bool createAndWriteImpl() const;
183 
184 
185 public:
186 
187  //- Runtime type information
188  TypeName("DMD");
189 
190 
191  // Constructors
192 
193  //- Construct from components
194  DMD
195  (
196  Time& runTime,
197  fvMesh& mesh,
198  const dictionary& dict,
199  const instantList& times
200  );
201 
202  //- No copy construct
203  DMD(const DMD&) = delete;
204 
205  //- No copy assignment
206  void operator=(const DMD&) = delete;
207 
208 
209  //- Destructor
210  virtual ~DMD() = default;
211 
212 
213  // Member Functions
214 
215  //- Read model settings
216  virtual bool read(const dictionary& dict);
217 
218  //- Create and write fields
219  virtual bool createAndWrite();
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace ROMmodels
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
virtual bool createAndWrite()
Create and write fields.
dictionary dict
void operator=(const DMD &)=delete
No copy assignment.
virtual ~DMD()=default
Destructor.
engineTime & runTime
DMD(Time &runTime, fvMesh &mesh, const dictionary &dict, const instantList &times)
Construct from components.
dynamicFvMesh & mesh
TypeName("DMD")
Runtime type information.
List< word > wordList
List of word.
Definition: fileName.H:59
List< label > labelList
A List of labels.
Definition: List.H:62
List< instant > instantList
List of instants.
Definition: instantList.H:41
virtual bool read(const dictionary &dict)
Read model settings.
Namespace for OpenFOAM.