ROMmodel.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 Namespace
27  Foam::ROMmodels
28 
29 Description
30  A namespace for various implementations of
31  reduced-order (ROM) field creation models.
32 
33 Class
34  Foam::ROMmodel
35 
36 Description
37  Abstract base class for reduced-order models
38  to handle specific model characteristics.
39 
40 SourceFiles
41  ROMmodel.C
42  ROMmodelNew.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef Foam_ROMmodel_H
47 #define Foam_ROMmodel_H
48 
49 #include "runTimeSelectionTables.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward Declarations
57 class Time;
58 class fvMesh;
59 class dictionary;
60 class instant;
61 typedef class List<instant> instantList;
62 
63 /*---------------------------------------------------------------------------*\
64  Class ROMmodel Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class ROMmodel
68 {
69 protected:
70 
71  // Protected Data
72 
73  //- Reference to the Time
74  // Need non-const access to use setTime
75  Time& runTime_;
76 
77  //- Reference to the fvMesh
78  // Need non-const access to use readFieldsHandler
79  fvMesh& mesh_;
80 
81  //- Const reference to the dictionary
82  const dictionary& dict_;
83 
84  //- Const reference to field times
85  const instantList& times_;
86 
87 
88 public:
89 
90  //- Runtime type information
91  TypeName("ROMmodel");
92 
93 
94  // Declare runtime constructor selection table
95 
97  (
98  autoPtr,
99  ROMmodel,
100  dictionary,
101  (
102  Time& runTime,
103  fvMesh& mesh,
104  const dictionary& dict,
105  const instantList& times
106  ),
107  (runTime, mesh, dict, times)
108  );
109 
110 
111  // Selectors
112 
113  //- Return a reference to the selected ROMmodel
114  static autoPtr<ROMmodel> New
115  (
116  Time& runTime,
117  fvMesh& mesh,
118  const dictionary& dict,
119  const instantList& times
120  );
121 
122 
123  // Constructors
124 
125  //- Construct from components
126  ROMmodel
127  (
128  Time& runTime,
129  fvMesh& mesh,
130  const dictionary& dict,
131  const instantList& times
132  );
133 
134  //- No copy construct
135  ROMmodel(const ROMmodel&) = delete;
136 
137  //- No copy assignment
138  void operator=(const ROMmodel&) = delete;
139 
140 
141  //- Destructor
142  virtual ~ROMmodel() = default;
143 
144 
145  // Member Functions
146 
147  //- Read model settings
148  virtual bool read(const dictionary& dict) = 0;
149 
150  //- Create and write fields
151  virtual bool createAndWrite() = 0;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
dictionary dict
virtual ~ROMmodel()=default
Destructor.
TypeName("ROMmodel")
Runtime type information.
void operator=(const ROMmodel &)=delete
No copy assignment.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
static autoPtr< ROMmodel > New(Time &runTime, fvMesh &mesh, const dictionary &dict, const instantList &times)
Return a reference to the selected ROMmodel.
Time & runTime_
Reference to the Time.
Definition: ROMmodel.H:74
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
dynamicFvMesh & mesh
fvMesh & mesh_
Reference to the fvMesh.
Definition: ROMmodel.H:81
Abstract base class for reduced-order models to handle specific model characteristics.
Definition: ROMmodel.H:63
virtual bool read(const dictionary &dict)=0
Read model settings.
declareRunTimeSelectionTable(autoPtr, ROMmodel, dictionary,(Time &runTime, fvMesh &mesh, const dictionary &dict, const instantList &times),(runTime, mesh, dict, times))
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
ROMmodel(Time &runTime, fvMesh &mesh, const dictionary &dict, const instantList &times)
Construct from components.
virtual bool createAndWrite()=0
Create and write fields.
const dictionary & dict_
Const reference to the dictionary.
Definition: ROMmodel.H:86
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
const instantList & times_
Const reference to field times.
Definition: ROMmodel.H:91
List< instant > instantList
List of instants.
Definition: instantList.H:41
Namespace for OpenFOAM.