Loading...
Searching...
No Matches
Modes.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 EigenFunctions
26Description
27 Container that contains a list of modes with additional operations
28SourceFiles
29 Modes.C
30\*---------------------------------------------------------------------------*/
31
36
37
38#ifndef Modes_H
39#define Modes_H
40#pragma GCC diagnostic push
41#pragma GCC diagnostic ignored "-Wold-style-cast"
42#include <Eigen/Eigen>
43#include <unsupported/Eigen/SparseExtra>
44#include <unsupported/Eigen/CXX11/Tensor>
45#pragma GCC diagnostic pop
46#include "fvCFD.H"
47#include "Foam2Eigen.H"
48#include "ITHACAutilities.H"
49#include "ITHACAstream.H"
50
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54/*---------------------------------------------------------------------------*\
55 Class Modes Declaration
56\*---------------------------------------------------------------------------*/
57
58//--------------------------------------------------------------------------
67template<class Type, template<class> class PatchField, class GeoMesh>
68class Modes : public PtrList<GeometricField<Type, PatchField, GeoMesh >>
69{
70 public:
71
73 List<Eigen::MatrixXd> EigenModes;
74
76 label NBC;
77
79 List<Eigen::MatrixXd> toEigen();
80
81 //--------------------------------------------------------------------------
86 PtrList<GeometricField<Type, PatchField, GeoMesh >> & toPtrList()
87 {
88 return static_cast<PtrList<GeometricField<Type, PatchField, GeoMesh >>& >
89 (* this);
90 }
91
92 //----------------------------------------------------------------------
114 List<Eigen::MatrixXd> project(fvMatrix<Type>& Af, label numberOfModes = 0,
115 word projType = "G");
116
117 //----------------------------------------------------------------------
134 Eigen::MatrixXd project(GeometricField<Type, PatchField, GeoMesh>& field,
135 label numberOfModes = 0, word projType = "G", fvMatrix<Type>* Af = NULL);
136
137 //----------------------------------------------------------------------
154 Eigen::MatrixXd project(PtrList<GeometricField<Type, PatchField, GeoMesh >> &
155 fields,
156 label numberOfModes = 0, word projType = "G", fvMatrix<Type>* Af = NULL);
157
158 //----------------------------------------------------------------------
168 GeometricField<Type, PatchField, GeoMesh> projectSnapshot(
169 GeometricField<Type, PatchField, GeoMesh>& field,
170 label numberOfModes = 0, word projType = "G", fvMatrix<Type>* Af = NULL);
171
172 //----------------------------------------------------------------------
184 GeometricField<Type, PatchField, GeoMesh> reconstruct(
185 GeometricField<Type, PatchField, GeoMesh>& inputField, Eigen::MatrixXd Coeff,
186 word Name);
187
188 //----------------------------------------------------------------------
200 PtrList<GeometricField<Type, PatchField, GeoMesh >> reconstruct(
201 GeometricField<Type, PatchField, GeoMesh>& inputField,
202 List < Eigen::MatrixXd> Coeff,
203 word Name);
204
205 //----------------------------------------------------------------------
212 void projectSnapshots(PtrList<GeometricField<Type, PatchField, GeoMesh >>
213 snapshots, PtrList<GeometricField<Type, PatchField, GeoMesh >>& projSnapshots,
214 label numberOfModes = 0, word innerProduct = "L2");
215
216 //----------------------------------------------------------------------
222 void projectSnapshots(PtrList<GeometricField<Type, PatchField, GeoMesh >>
223 snapshots, PtrList<GeometricField<Type, PatchField, GeoMesh >>& projSnapshots,
224 word innerProduct = "L2");
225
226 //----------------------------------------------------------------------
234 void projectSnapshots(PtrList<GeometricField<Type, PatchField, GeoMesh >>
235 snapshots, PtrList<GeometricField<Type, PatchField, GeoMesh >>& projSnapshots,
236 PtrList<volScalarField> Volumes,
237 label numberOfModes = 0, word innerProduct = "L2");
238
239 //----------------------------------------------------------------------
246 void projectSnapshots(PtrList<GeometricField<Type, PatchField, GeoMesh >>
247 snapshots, PtrList<GeometricField<Type, PatchField, GeoMesh >>& projSnapshots,
248 PtrList<volScalarField> Volumes,
249 word innerProduct);
250
251 void operator=(const PtrList<GeometricField<Type, PatchField, GeoMesh >> &
252 modes);
253};
254
258
259#endif
260
261
Header file of the Foam2Eigen class.
Header file of the ITHACAstream class, it contains the implementation of several methods for input ou...
Header file of the ITHACAutilities namespace.
Modes< vector, fvPatchField, volMesh > volVectorModes
Definition Modes.H:256
Modes< scalar, fvPatchField, volMesh > volScalarModes
Definition Modes.H:255
Modes< scalar, fvsPatchField, surfaceMesh > surfaceScalarModes
Definition Modes.H:257
Implementation of a container class derived from PtrList.
Definition Modes.H:69
void projectSnapshots(PtrList< GeometricField< Type, PatchField, GeoMesh > > snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &projSnapshots, PtrList< volScalarField > Volumes, word innerProduct)
Function to project a list of fields into the modes manifold by the use of all the modes.
Definition Modes.C:399
PtrList< GeometricField< Type, PatchField, GeoMesh > > reconstruct(GeometricField< Type, PatchField, GeoMesh > &inputField, List< Eigen::MatrixXd > Coeff, word Name)
Function to reconstruct a list of fields starting from a list of coefficients, in this case the list ...
Definition Modes.C:314
GeometricField< Type, PatchField, GeoMesh > reconstruct(GeometricField< Type, PatchField, GeoMesh > &inputField, Eigen::MatrixXd Coeff, word Name)
Function to reconstruct the solution starting from the coefficients, in this case the field is passed...
Definition Modes.C:276
List< Eigen::MatrixXd > EigenModes
Definition Modes.H:73
List< Eigen::MatrixXd > toEigen()
Method that convert a PtrList of modes into Eigen matrices filling the EigenModes object.
Definition Modes.C:38
List< Eigen::MatrixXd > project(fvMatrix< Type > &Af, label numberOfModes=0, word projType="G")
A function that project an FvMatrix (OpenFoam linear System) on the modes.
Definition Modes.C:63
void projectSnapshots(PtrList< GeometricField< Type, PatchField, GeoMesh > > snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &projSnapshots, label numberOfModes=0, word innerProduct="L2")
Function to project a list of fields into the modes manifold.
Definition Modes.C:410
Eigen::MatrixXd project(GeometricField< Type, PatchField, GeoMesh > &field, label numberOfModes=0, word projType="G", fvMatrix< Type > *Af=NULL)
A function that project a field on the modes.
Definition Modes.C:119
void projectSnapshots(PtrList< GeometricField< Type, PatchField, GeoMesh > > snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &projSnapshots, PtrList< volScalarField > Volumes, label numberOfModes=0, word innerProduct="L2")
Function to project a list of fields into the modes manifold.
Definition Modes.C:332
void projectSnapshots(PtrList< GeometricField< Type, PatchField, GeoMesh > > snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &projSnapshots, word innerProduct="L2")
Function to project a list of fields into the modes manifold by the use of all the modes.
Definition Modes.C:470
PtrList< GeometricField< Type, PatchField, GeoMesh > > & toPtrList()
Function that returns the Modes object as a standard PtrList.
Definition Modes.H:86
GeometricField< Type, PatchField, GeoMesh > projectSnapshot(GeometricField< Type, PatchField, GeoMesh > &field, label numberOfModes=0, word projType="G", fvMatrix< Type > *Af=NULL)
A function that project and reconstruct a snapshot on the modes.
Definition Modes.C:195
Eigen::MatrixXd project(PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, label numberOfModes=0, word projType="G", fvMatrix< Type > *Af=NULL)
A function that project a list of fields on the modes.
Definition Modes.C:206
void operator=(const PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes)
Definition Modes.C:480