37#ifndef INCREMENTALPOD_H
38#define INCREMENTALPOD_H
43#include "ITHACAparameters.H"
47#pragma GCC diagnostic push
48#pragma GCC diagnostic ignored "-Wold-style-cast"
49#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
50#include <Spectra/GenEigsSolver.h>
51#include <Spectra/SymEigsSolver.h>
53#include <unsupported/Eigen/SparseExtra>
54#pragma GCC diagnostic pop
64template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
100 double _tol, word _PODnorm);
110 void initialize(GeometricField<Type, PatchField, GeoMesh>& snapshot);
117 void addSnapshot(GeometricField<Type, PatchField, GeoMesh>& snapshot);
132 GeometricField<Type, PatchField, GeoMesh>& inputField,
133 label numberOfModes = 0);
145 GeometricField<Type, PatchField, GeoMesh>& inputField,
146 Eigen::MatrixXd Coeff,
158 GeometricField<Type, PatchField, GeoMesh>& snapshot,
159 label numberOfModes = 0);
169 PtrList<GeometricField<Type, PatchField, GeoMesh >> snapshots,
170 PtrList<GeometricField<Type, PatchField, GeoMesh >>& projSnapshots,
171 label numberOfModes = 0);
191 Eigen::MatrixXd& matrix,
192 Eigen::VectorXd& weights)
194 M_Assert(matrix.rows() == weights.rows(),
195 "Matrix and weights must have the same number of rows");
196 Eigen::MatrixXd Ortho = matrix;
199 for (label i = 0; i < matrix.cols(); i++)
201 for (label k = 0; k < i; k++)
203 double num = Ortho.col(k).transpose() * weights.asDiagonal()
205 double den = (Ortho.col(k).transpose() * weights.asDiagonal()
207 double fact = num / den;
208 Ortho.col(i) -= fact * Ortho.col(k) ;
211 Ortho.col(i).normalize();
Header file of the EigenFunctions class.
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.
Header file of the Modes class.
Implementation of a container class derived from PtrList.
Implementation of a incremental POD algorithm according to Oxberry et al.
void addSnapshot(GeometricField< Type, PatchField, GeoMesh > &snapshot)
Add a snapshot to the POD space.
void initialize(GeometricField< Type, PatchField, GeoMesh > &snapshot)
Initialize the incremental POD algorithm.
void fillPtrList()
Fill the POD modes prtList from the Eigen matrix.
Eigen::VectorXd singularValues
void writeModes()
Write to modes to file.
void projectSnapshots(PtrList< GeometricField< Type, PatchField, GeoMesh > > snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &projSnapshots, label numberOfModes=0)
Project a list of snapshots onto the reduced space.
Eigen::VectorXd project(GeometricField< Type, PatchField, GeoMesh > &inputField, label numberOfModes=0)
Project a field into the reduced space.
GeometricField< Type, PatchField, GeoMesh > reconstruct(GeometricField< Type, PatchField, GeoMesh > &inputField, Eigen::MatrixXd Coeff, word Name)
Reconstruct a field from the reduced coefficients.
incrementalPOD()
Constructors.
~incrementalPOD()
Destructor.
Eigen::VectorXd massVector
GeometricField< Type, PatchField, GeoMesh > projectSnapshot(GeometricField< Type, PatchField, GeoMesh > &snapshot, label numberOfModes=0)
Project a snapshot onto the POD space.
incrementalPOD(GeometricField< Type, PatchField, GeoMesh > &snapshot, double _tol, word _PODnorm)
Constructor with a first snapshot.
namespace for the computation of the POD, it exploits bot the method of snapshots and SVD.
void weightedGramSchmidt(Eigen::MatrixXd &matrix, Eigen::VectorXd &weights)
Weighted Gram-Schmidt orthogonalization.