DMDModel.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) 2020-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Namespace
27 Foam::DMDModels
28
29Description
30 A namespace for various dynamic mode
31 decomposition (DMD) model implementations.
32
33Class
34 Foam::DMDModel
35
36Description
37 Abstract base class for DMD models to handle DMD
38 characteristics for the \c DMD function object.
39
40SourceFiles
41 DMDModel.C
42 DMDModelNew.C
43 DMDModelTemplates.C
44
45\*---------------------------------------------------------------------------*/
46
47#ifndef DMDModel_H
48#define DMDModel_H
49
50#include "fvMesh.H"
51#include "dictionary.H"
52#include "HashSet.H"
54#include "writeFile.H"
55#include "OFstream.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class DMDModel Declaration
64\*---------------------------------------------------------------------------*/
66class DMDModel
67:
69{
72
73
74protected:
75
76 // Protected Data
77
78 //- Reference to the mesh
79 const fvMesh& mesh_;
80
81 //- Name of operand function object
82 const word name_;
83
84
85 // Protected Member Functions
86
87 // Evaluation
88
89 //- Compute and write mode dynamics
90 virtual bool dynamics() = 0;
91
92 //- Compute and write modes
93 virtual bool modes() = 0;
94
95
96public:
97
98 //- Runtime type information
99 TypeName("DMDModel");
100
101
102 // Declare runtime constructor selection table
105 (
106 autoPtr,
107 DMDModel,
109 (
110 const fvMesh& mesh,
111 const word& name,
112 const dictionary& dict
113 ),
114 (mesh, name, dict)
115 );
116
117
118 // Selectors
119
120 //- Return a reference to the selected DMD model
122 (
123 const fvMesh& mesh,
124 const word& name,
125 const dictionary& dict
126 );
127
128
129 // Constructors
130
131 //- Construct from components
133 (
134 const fvMesh& mesh,
135 const word& name,
136 const dictionary& dict
137 );
138
139 //- No copy construct
140 DMDModel(const DMDModel&) = delete;
141
142 //- No copy assignment
143 void operator=(const DMDModel&) = delete;
144
145
146 //- Destructor
147 virtual ~DMDModel() = default;
148
149
150 // Member Functions
151
152 // Evaluation
153
154 //- Initialise model data members with a given snapshot
155 virtual bool initialise(const RMatrix& snapshot) = 0;
156
157 //- Update model data members with a given snapshot
158 virtual bool update(const RMatrix& snapshot) = 0;
159
160 //- Compute and write modes and
161 //- mode dynamics of model data members
162 virtual bool fit() = 0;
163
164 //- Compute and write a reconstruction of flow field
165 //- based on given modes and mode dynamics (currently no-op)
166 virtual void reconstruct(const wordList modes)
167 {
169 }
170
171
172 // I-O
173
174 //- Read model settings
175 virtual bool read(const dictionary& dict) = 0;
176};
177
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181} // End namespace Foam
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185#endif
186
187// ************************************************************************* //
Abstract base class for DMD models to handle DMD characteristics for the DMD function object.
Definition: DMDModel.H:68
TypeName("DMDModel")
Runtime type information.
virtual bool modes()=0
Compute and write modes.
const fvMesh & mesh_
Reference to the mesh.
Definition: DMDModel.H:78
virtual bool update(const RMatrix &snapshot)=0
Update model data members with a given snapshot.
static autoPtr< DMDModel > New(const fvMesh &mesh, const word &name, const dictionary &dict)
Return a reference to the selected DMD model.
Definition: DMDModelNew.C:33
virtual bool initialise(const RMatrix &snapshot)=0
Initialise model data members with a given snapshot.
DMDModel(const DMDModel &)=delete
No copy construct.
virtual ~DMDModel()=default
Destructor.
declareRunTimeSelectionTable(autoPtr, DMDModel, dictionary,(const fvMesh &mesh, const word &name, const dictionary &dict),(mesh, name, dict))
virtual void reconstruct(const wordList modes)
Definition: DMDModel.H:165
virtual bool dynamics()=0
Compute and write mode dynamics.
virtual bool fit()=0
void operator=(const DMDModel &)=delete
No copy assignment.
virtual bool read(const dictionary &dict)=0
Read model settings.
const word name_
Name of operand function object.
Definition: DMDModel.H:81
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements,...
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SquareMatrix.H:66
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class for writing single files from the function objects.
Definition: writeFile.H:120
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for handling words, derived from Foam::string.
Definition: word.H:68
mesh update()
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73