Loading...
Searching...
No Matches
Foam2Eigen Class Reference

Class to converts OpenFOAM objects into Eigen and viceversa. More...

#include <Foam2Eigen.H>

Public Member Functions

template<>
Eigen::VectorXd field2Eigen (const Field< scalar > &field)
 
template<>
Eigen::VectorXd field2Eigen (const Field< vector > &field)
 
template<>
Eigen::VectorXd field2Eigen (const Field< tensor > &field)
 
template<>
Eigen::VectorXd field2Eigen (const DimensionedField< scalar, Foam::volMesh > &field)
 
template<>
volScalarField Eigen2field (volScalarField &field_in, Eigen::VectorXd &eigen_vector, bool correctBC)
 
template<>
Field< scalar > Eigen2field (Field< scalar > &field, Eigen::MatrixXd &matrix, bool correctBC)
 
template<>
Field< vector > Eigen2field (Field< vector > &field, Eigen::MatrixXd &matrix, bool correctBC)
 
template<>
Field< tensor > Eigen2field (Field< tensor > &field, Eigen::MatrixXd &matrix, bool correctBC)
 
template<>
void fvMatrix2Eigen (fvMatrix< scalar > foam_matrix, Eigen::MatrixXd &A, Eigen::VectorXd &b)
 
template<>
void fvMatrix2Eigen (fvMatrix< vector > foam_matrix, Eigen::MatrixXd &A, Eigen::VectorXd &b)
 
template<>
void fvMatrix2Eigen (fvMatrix< scalar > foam_matrix, Eigen::SparseMatrix< double > &A, Eigen::VectorXd &b)
 
template<>
void fvMatrix2Eigen (fvMatrix< vector > foam_matrix, Eigen::SparseMatrix< double > &A, Eigen::VectorXd &b)
 
template<>
void fvMatrix2EigenM (fvMatrix< scalar > &foam_matrix, Eigen::MatrixXd &A)
 
template<>
void fvMatrix2EigenM (fvMatrix< scalar > &foam_matrix, Eigen::SparseMatrix< double > &A)
 
template<>
void fvMatrix2EigenM (fvMatrix< vector > &foam_matrix, Eigen::MatrixXd &A)
 
template<>
void fvMatrix2EigenM (fvMatrix< vector > &foam_matrix, Eigen::SparseMatrix< double > &A)
 
template<>
void fvMatrix2EigenV (fvMatrix< scalar > &foam_matrix, Eigen::VectorXd &b)
 
template<>
void fvMatrix2EigenV (fvMatrix< vector > &foam_matrix, Eigen::VectorXd &b)
 
template<>
Eigen::MatrixXd field2Eigen (const List< vector > &field)
 
template<>
Eigen::MatrixXd field2Eigen (const List< scalar > &field)
 

Static Public Member Functions

template<class type_foam_matrix , class type_A , class type_B >
static void fvMatrix2Eigen (fvMatrix< type_foam_matrix > foam_matrix, type_A &A, type_B &b)
 Convert a FvMatrix OpenFOAM matrix (Linear System) into a Eigen Matrix A and a source vector b.
 
template<class type_foam_matrix , class type_A >
static void fvMatrix2EigenM (fvMatrix< type_foam_matrix > &foam_matrix, type_A &A)
 Convert a ldu OpenFOAM matrix into a Eigen Matrix A.
 
template<class type_foam_matrix , class type_B >
static void fvMatrix2EigenV (fvMatrix< type_foam_matrix > &foam_matrix, type_B &b)
 Convert a ldu OpenFOAM matrix into a source vector b.
 
template<class Type , template< class > class PatchField, class GeoMesh >
static Eigen::MatrixXd PtrList2Eigen (PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, label Nfields=-1)
 Convert a PtrList of snapshots to Eigen matrix (only internal field)
 
template<template< class > class PatchField, class GeoMesh >
static Eigen::VectorXd field2Eigen (GeometricField< tensor, PatchField, GeoMesh > &field)
 Convert a vector OpenFOAM field into an Eigen Vector.
 
template<template< class > class PatchField, class GeoMesh >
static Eigen::VectorXd field2Eigen (GeometricField< vector, PatchField, GeoMesh > &field)
 Convert a vector OpenFOAM field into an Eigen Vector.
 
template<template< class > class PatchField, class GeoMesh >
static Eigen::VectorXd field2Eigen (GeometricField< scalar, PatchField, GeoMesh > &field)
 Convert a scalar OpenFOAM field into an Eigen Vector.
 
template<template< class > class PatchField, class GeoMesh >
static Eigen::Map< Eigen::MatrixXd > field2EigenMap (GeometricField< scalar, PatchField, GeoMesh > &field)
 Convert a scalar OpenFOAM field into an Eigen Vector.
 
template<template< class > class PatchField, class GeoMesh >
static Eigen::Map< Eigen::MatrixXd > field2EigenMapBC (GeometricField< scalar, PatchField, GeoMesh > &field, int BC_index)
 Map a scalar OpenFOAM field boundary into an Eigen Matrix.
 
template<class Type , class GeoMesh >
static Eigen::VectorXd field2Eigen (const DimensionedField< Type, GeoMesh > &field)
 Convert an OpenFOAM field into an Eigen Vector.
 
template<class Type >
static Eigen::VectorXd field2Eigen (const Field< Type > &field)
 Convert an OpenFOAM field into an Eigen Vector.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::VectorXd > field2EigenBC (GeometricField< scalar, PatchField, GeoMesh > &field)
 Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::VectorXd > field2EigenBC (GeometricField< vector, PatchField, GeoMesh > &field)
 Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::VectorXd > field2EigenBC (GeometricField< tensor, PatchField, GeoMesh > &field)
 Convert an OpenFOAM tensor field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::MatrixXd > PtrList2EigenBC (PtrList< GeometricField< scalar, PatchField, GeoMesh > > &fields, label Nfields=-1)
 Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::MatrixXd > PtrList2EigenBC (PtrList< GeometricField< vector, PatchField, GeoMesh > > &fields, label Nfields=-1)
 Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static List< Eigen::MatrixXd > PtrList2EigenBC (PtrList< GeometricField< tensor, PatchField, GeoMesh > > &fields, label Nfields=-1)
 Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
 
template<template< class > class PatchField, class GeoMesh >
static GeometricField< scalar, PatchField, GeoMesh > Eigen2field (GeometricField< scalar, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true)
 Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.
 
template<template< class > class PatchField, class GeoMesh >
static GeometricField< vector, PatchField, GeoMesh > Eigen2field (GeometricField< vector, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true)
 Convert a vector in Eigen format into an OpenFOAM vector GeometricField.
 
template<template< class > class PatchField, class GeoMesh >
static GeometricField< scalar, PatchField, GeoMesh > Eigen2field (GeometricField< scalar, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, List< Eigen::VectorXd > &eigen_vector_boundary)
 Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.
 
template<template< class > class PatchField, class GeoMesh >
static GeometricField< vector, PatchField, GeoMesh > Eigen2field (GeometricField< vector, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, List< Eigen::VectorXd > &eigen_vector_boundary)
 Convert a vector in Eigen format into an OpenFOAM vector GeometricField.
 
template<template< class > class PatchField, class GeoMesh >
static GeometricField< tensor, PatchField, GeoMesh > Eigen2field (GeometricField< tensor, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true)
 Convert a vector in Eigen format into an OpenFOAM tensor GeometricField.
 
template<class Type >
static Field< Type > Eigen2field (Field< Type > &field, Eigen::MatrixXd &matrix, bool correctBC=true)
 Converts a matrix in Eigen format into an OpenFOAM Field.
 
template<class Type , template< class > class PatchField, class GeoMesh >
static std::tuple< Eigen::MatrixXd, Eigen::VectorXd > projectFvMatrix (fvMatrix< Type > &matrix, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes)
 Obtain the Mass Matrix from a list of reduced basis.
 
template<class Type , template< class > class PatchField, class GeoMesh >
static Eigen::VectorXd projectField (GeometricField< Type, PatchField, GeoMesh > &field, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes)
 Perform the projection of an OpenFOAM field onto a set of modes using the Eigen matrix multiplication.
 
template<class Type , template< class > class PatchField, class GeoMesh >
static Eigen::MatrixXd MassMatrix (PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes)
 Obtain the Mass Matrix from a list of reduced basis.
 
template<class Type >
static std::tuple< List< Eigen::SparseMatrix< double > >, List< Eigen::VectorXd > > LFvMatrix2LSM (PtrList< fvMatrix< Type > > &MatrixList)
 Convert a PtrList of OpenFOAM fvMatrix into a tuple of lists of Eigen Sparse Matrices and source vectors.
 
template<class type_matrix >
static Eigen::Matrix< type_matrix, Eigen::Dynamic, Eigen::Dynamic > List2EigenMatrix (List< type_matrix > list)
 Convert a Foam List into an Eigen matrix with one column.
 
template<class type_matrix >
static List< type_matrix > EigenMatrix2List (Eigen::Matrix< type_matrix, Eigen::Dynamic, Eigen::Dynamic > matrix)
 Convert an Eigen matrix with one column into a Foam List.
 
template<class type_list >
static Eigen::MatrixXd field2Eigen (const List< type_list > &list)
 Function to convert an OpenFOAM list to an Eigen Matrix.
 

Detailed Description

Class to converts OpenFOAM objects into Eigen and viceversa.

Definition at line 58 of file Foam2Eigen.H.

Member Function Documentation

◆ Eigen2field() [1/10]

template<>
Field< scalar > Foam2Eigen::Eigen2field ( Field< scalar > & field,
Eigen::MatrixXd & matrix,
bool correctBC )

Definition at line 556 of file Foam2Eigen.C.

◆ Eigen2field() [2/10]

template<>
Field< tensor > Foam2Eigen::Eigen2field ( Field< tensor > & field,
Eigen::MatrixXd & matrix,
bool correctBC )

Definition at line 617 of file Foam2Eigen.C.

◆ Eigen2field() [3/10]

template<class Type >
static Field< Type > Foam2Eigen::Eigen2field ( Field< Type > & field,
Eigen::MatrixXd & matrix,
bool correctBC = true )
static

Converts a matrix in Eigen format into an OpenFOAM Field.

Parameters
[in/out]field OpenFOAM Field
[in]matrixMatrix in Eigen format
Template Parameters
Typevector or scalar.
Returns
OpenFOAM Field

◆ Eigen2field() [4/10]

template<>
Field< vector > Foam2Eigen::Eigen2field ( Field< vector > & field,
Eigen::MatrixXd & matrix,
bool correctBC )

Definition at line 585 of file Foam2Eigen.C.

◆ Eigen2field() [5/10]

template<template< class > class PatchField, class GeoMesh >
GeometricField< scalar, PatchField, GeoMesh > Foam2Eigen::Eigen2field ( GeometricField< scalar, PatchField, GeoMesh > & field,
Eigen::VectorXd & eigen_vector,
bool correctBC = true )
static

Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.

Parameters
[in/out]field OpenFOAM GeometricField
[in]eigen_vectorVector in Eigen format
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
OpenFOAM GeometricField
Examples
08DEIM.C, and 09DEIM_ROM.C.

Definition at line 517 of file Foam2Eigen.C.

◆ Eigen2field() [6/10]

template<template< class > class PatchField, class GeoMesh >
GeometricField< scalar, PatchField, GeoMesh > Foam2Eigen::Eigen2field ( GeometricField< scalar, PatchField, GeoMesh > & field,
Eigen::VectorXd & eigen_vector,
List< Eigen::VectorXd > & eigen_vector_boundary )
static

Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.

Parameters
[in/out]field OpenFOAM GeometricField
[in]eigen_vectorVector in Eigen format
[in]eigen_vector_boundaryVector in Eigen format
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
OpenFOAM GeometricField

Definition at line 465 of file Foam2Eigen.C.

◆ Eigen2field() [7/10]

template<template< class > class PatchField, class GeoMesh >
GeometricField< tensor, PatchField, GeoMesh > Foam2Eigen::Eigen2field ( GeometricField< tensor, PatchField, GeoMesh > & field,
Eigen::VectorXd & eigen_vector,
bool correctBC = true )
static

Convert a vector in Eigen format into an OpenFOAM tensor GeometricField.

Parameters
[in/out]field OpenFOAM GeometricField
[in]eigen_vectorVector in Eigen format
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
OpenFOAM GeometricField

Definition at line 410 of file Foam2Eigen.C.

◆ Eigen2field() [8/10]

template<template< class > class PatchField, class GeoMesh >
GeometricField< vector, PatchField, GeoMesh > Foam2Eigen::Eigen2field ( GeometricField< vector, PatchField, GeoMesh > & field,
Eigen::VectorXd & eigen_vector,
bool correctBC = true )
static

Convert a vector in Eigen format into an OpenFOAM vector GeometricField.

Parameters
[in/out]field OpenFOAM GeometricField
[in]eigen_vectorVector in Eigen format
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
OpenFOAM GeometricField

Definition at line 491 of file Foam2Eigen.C.

◆ Eigen2field() [9/10]

template<template< class > class PatchField, class GeoMesh >
GeometricField< vector, PatchField, GeoMesh > Foam2Eigen::Eigen2field ( GeometricField< vector, PatchField, GeoMesh > & field,
Eigen::VectorXd & eigen_vector,
List< Eigen::VectorXd > & eigen_vector_boundary )
static

Convert a vector in Eigen format into an OpenFOAM vector GeometricField.

Parameters
[in/out]field OpenFOAM GeometricField
[in]eigen_vectorVector in Eigen format
[in]eigen_vector_boundaryVector in Eigen format
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
OpenFOAM GeometricField

Definition at line 436 of file Foam2Eigen.C.

◆ Eigen2field() [10/10]

template<>
volScalarField Foam2Eigen::Eigen2field ( volScalarField & field_in,
Eigen::VectorXd & eigen_vector,
bool correctBC )

Definition at line 537 of file Foam2Eigen.C.

◆ EigenMatrix2List()

template<class type_matrix >
template List< double > Foam2Eigen::EigenMatrix2List ( Eigen::Matrix< type_matrix, Eigen::Dynamic, Eigen::Dynamic > matrix)
static

Convert an Eigen matrix with one column into a Foam List.

Parameters
[in]matrixThe Eigen matrix
Template Parameters
type_matrixThe type of data in the List (int or double)
Returns
The Foam List

Definition at line 1243 of file Foam2Eigen.C.

◆ field2Eigen() [1/12]

template<>
Eigen::VectorXd Foam2Eigen::field2Eigen ( const DimensionedField< scalar, Foam::volMesh > & field)

Definition at line 172 of file Foam2Eigen.C.

◆ field2Eigen() [2/12]

template<class Type , class GeoMesh >
static Eigen::VectorXd Foam2Eigen::field2Eigen ( const DimensionedField< Type, GeoMesh > & field)
static

Convert an OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
Typevector or scalar.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

◆ field2Eigen() [3/12]

template<>
Eigen::VectorXd Foam2Eigen::field2Eigen ( const Field< scalar > & field)

Definition at line 124 of file Foam2Eigen.C.

◆ field2Eigen() [4/12]

template<>
Eigen::VectorXd Foam2Eigen::field2Eigen ( const Field< tensor > & field)

Definition at line 155 of file Foam2Eigen.C.

◆ field2Eigen() [5/12]

template<class Type >
static Eigen::VectorXd Foam2Eigen::field2Eigen ( const Field< Type > & field)
static

Convert an OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
TypeType of the field can be volScalarField or volVectorField
Returns
Dense Eigen vector

◆ field2Eigen() [6/12]

template<>
Eigen::VectorXd Foam2Eigen::field2Eigen ( const Field< vector > & field)

Definition at line 138 of file Foam2Eigen.C.

◆ field2Eigen() [7/12]

template<>
Eigen::MatrixXd Foam2Eigen::field2Eigen ( const List< scalar > & field)

Definition at line 1288 of file Foam2Eigen.C.

◆ field2Eigen() [8/12]

template<class type_list >
static Eigen::MatrixXd Foam2Eigen::field2Eigen ( const List< type_list > & list)
static

Function to convert an OpenFOAM list to an Eigen Matrix.

Parameters
[in]listThe OpenFOAM list
Template Parameters
type_listThe type of the list, only scalar and vector are supported
Returns
An Eigen::MatrixXd Matrix containing the OpenFOAM values

◆ field2Eigen() [9/12]

template<>
Eigen::MatrixXd Foam2Eigen::field2Eigen ( const List< vector > & field)

Definition at line 1271 of file Foam2Eigen.C.

◆ field2Eigen() [10/12]

template<template< class > class PatchField, class GeoMesh >
Eigen::VectorXd Foam2Eigen::field2Eigen ( GeometricField< scalar, PatchField, GeoMesh > & field)
static

Convert a scalar OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 82 of file Foam2Eigen.C.

◆ field2Eigen() [11/12]

template<template< class > class PatchField, class GeoMesh >
Eigen::VectorXd Foam2Eigen::field2Eigen ( GeometricField< tensor, PatchField, GeoMesh > & field)
static

Convert a vector OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 40 of file Foam2Eigen.C.

◆ field2Eigen() [12/12]

template<template< class > class PatchField, class GeoMesh >
Eigen::VectorXd Foam2Eigen::field2Eigen ( GeometricField< vector, PatchField, GeoMesh > & field)
static

Convert a vector OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 61 of file Foam2Eigen.C.

◆ field2EigenBC() [1/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::VectorXd > Foam2Eigen::field2EigenBC ( GeometricField< scalar, PatchField, GeoMesh > & field)
static

Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 244 of file Foam2Eigen.C.

◆ field2EigenBC() [2/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::VectorXd > Foam2Eigen::field2EigenBC ( GeometricField< tensor, PatchField, GeoMesh > & field)
static

Convert an OpenFOAM tensor field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 187 of file Foam2Eigen.C.

◆ field2EigenBC() [3/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::VectorXd > Foam2Eigen::field2EigenBC ( GeometricField< vector, PatchField, GeoMesh > & field)
static

Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 215 of file Foam2Eigen.C.

◆ field2EigenMap()

template<template< class > class PatchField, class GeoMesh >
template Eigen::Map< Eigen::MatrixXd > Foam2Eigen::field2EigenMap ( GeometricField< scalar, PatchField, GeoMesh > & field)
static

Convert a scalar OpenFOAM field into an Eigen Vector.

Parameters
[in]fieldThe field
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen vector

Definition at line 97 of file Foam2Eigen.C.

◆ field2EigenMapBC()

template<template< class > class PatchField, class GeoMesh >
template Eigen::Map< Eigen::MatrixXd > Foam2Eigen::field2EigenMapBC ( GeometricField< scalar, PatchField, GeoMesh > & field,
int BC_index )
static

Map a scalar OpenFOAM field boundary into an Eigen Matrix.

Parameters
[in]fieldThe field
[in]BC_indexThe index of the BC you want to Map
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen Map Matrix

Definition at line 105 of file Foam2Eigen.C.

◆ fvMatrix2Eigen() [1/5]

template<>
void Foam2Eigen::fvMatrix2Eigen ( fvMatrix< scalar > foam_matrix,
Eigen::MatrixXd & A,
Eigen::VectorXd & b )

Definition at line 695 of file Foam2Eigen.C.

◆ fvMatrix2Eigen() [2/5]

template<>
void Foam2Eigen::fvMatrix2Eigen ( fvMatrix< scalar > foam_matrix,
Eigen::SparseMatrix< double > & A,
Eigen::VectorXd & b )

Definition at line 778 of file Foam2Eigen.C.

◆ fvMatrix2Eigen() [3/5]

template<class type_foam_matrix , class type_A , class type_B >
static void Foam2Eigen::fvMatrix2Eigen ( fvMatrix< type_foam_matrix > foam_matrix,
type_A & A,
type_B & b )
static

Convert a FvMatrix OpenFOAM matrix (Linear System) into a Eigen Matrix A and a source vector b.

Parameters
[in]foam_matrixThe foam matrix can be fvScalarMatrix or fvVectorMatrix
[out]AThe matrix or the list of matrices, can be dense or sparse
[out]bThe source term vector or the list of source term vectors, always dense
Template Parameters
type_foam_matrixThe type of foam matrix can be scalar or vector
type_AThe type of matrix or the list of matrices, can be dense (Eigen::MatrixXd) or sparse (Eigen::SparseMatrix<double>) or a List of them
type_BThe type source term vector or the list can be Eigen::VectorXd or List<Eigen::VectorXd>
Examples
09DEIM_ROM.C.

◆ fvMatrix2Eigen() [4/5]

template<>
void Foam2Eigen::fvMatrix2Eigen ( fvMatrix< vector > foam_matrix,
Eigen::MatrixXd & A,
Eigen::VectorXd & b )

Definition at line 731 of file Foam2Eigen.C.

◆ fvMatrix2Eigen() [5/5]

template<>
void Foam2Eigen::fvMatrix2Eigen ( fvMatrix< vector > foam_matrix,
Eigen::SparseMatrix< double > & A,
Eigen::VectorXd & b )

Definition at line 819 of file Foam2Eigen.C.

◆ fvMatrix2EigenM() [1/5]

template<>
void Foam2Eigen::fvMatrix2EigenM ( fvMatrix< scalar > & foam_matrix,
Eigen::MatrixXd & A )

Definition at line 879 of file Foam2Eigen.C.

◆ fvMatrix2EigenM() [2/5]

template<>
void Foam2Eigen::fvMatrix2EigenM ( fvMatrix< scalar > & foam_matrix,
Eigen::SparseMatrix< double > & A )

Definition at line 910 of file Foam2Eigen.C.

◆ fvMatrix2EigenM() [3/5]

template<class type_foam_matrix , class type_A >
static void Foam2Eigen::fvMatrix2EigenM ( fvMatrix< type_foam_matrix > & foam_matrix,
type_A & A )
static

Convert a ldu OpenFOAM matrix into a Eigen Matrix A.

Parameters
[in]foam_matrixThe foam matrix can be fvScalarMatrix or fvVectorMatrix
[out]AThe matrix or the list of matrices, can be dense or sparse
Template Parameters
type_foam_matrixThe type of foam matrix can be fvScalarMatrix or fvVectorMatrix
type_AThe type of matrix or the list of matrices, can be dense (Eigen::MatrixXd) or sparse (Eigen::SparseMatrix<double>) or a List of them

◆ fvMatrix2EigenM() [4/5]

template<>
void Foam2Eigen::fvMatrix2EigenM ( fvMatrix< vector > & foam_matrix,
Eigen::MatrixXd & A )

Definition at line 948 of file Foam2Eigen.C.

◆ fvMatrix2EigenM() [5/5]

template<>
void Foam2Eigen::fvMatrix2EigenM ( fvMatrix< vector > & foam_matrix,
Eigen::SparseMatrix< double > & A )

Definition at line 988 of file Foam2Eigen.C.

◆ fvMatrix2EigenV() [1/3]

template<>
void Foam2Eigen::fvMatrix2EigenV ( fvMatrix< scalar > & foam_matrix,
Eigen::VectorXd & b )

Definition at line 1041 of file Foam2Eigen.C.

◆ fvMatrix2EigenV() [2/3]

template<class type_foam_matrix , class type_B >
static void Foam2Eigen::fvMatrix2EigenV ( fvMatrix< type_foam_matrix > & foam_matrix,
type_B & b )
static

Convert a ldu OpenFOAM matrix into a source vector b.

Parameters
[in]foam_matrixThe foam matrix can be fvScalarMatrix or fvVectorMatrix
[out]bThe source term vector or the list of source term vectors, always dense
Template Parameters
type_foam_matrixThe type of foam matrix can be fvScalarMatrix or fvVectorMatrix
type_BThe type source term vector or the list can be Eigen::VectorXd or List<Eigen::VectorXd>

◆ fvMatrix2EigenV() [3/3]

template<>
void Foam2Eigen::fvMatrix2EigenV ( fvMatrix< vector > & foam_matrix,
Eigen::VectorXd & b )

Definition at line 1064 of file Foam2Eigen.C.

◆ LFvMatrix2LSM()

template<class Type >
template std::tuple< List< Eigen::SparseMatrix< double > >, List< Eigen::VectorXd > > Foam2Eigen::LFvMatrix2LSM ( PtrList< fvMatrix< Type > > & MatrixList)
static

Convert a PtrList of OpenFOAM fvMatrix into a tuple of lists of Eigen Sparse Matrices and source vectors.

Parameters
[in]MatrixListThe matrix list
Template Parameters
Type{ description }
[in]Type type of fvMatrix can be either scalar or vectorial
Returns
a tuple containing a list of sparse matrices and a list of source vectors

Definition at line 1195 of file Foam2Eigen.C.

◆ List2EigenMatrix()

template<class type_matrix >
template Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Foam2Eigen::List2EigenMatrix ( List< type_matrix > list)
static

Convert a Foam List into an Eigen matrix with one column.

Parameters
[in]listThe Foam List
Template Parameters
type_matrixThe type of data in the List (int or double)
Returns
The Eigen matrix

Definition at line 1224 of file Foam2Eigen.C.

◆ MassMatrix()

template<class Type , template< class > class PatchField, class GeoMesh >
Eigen::MatrixXd Foam2Eigen::MassMatrix ( PtrList< GeometricField< Type, PatchField, GeoMesh > > & modes,
label Nmodes )
static

Obtain the Mass Matrix from a list of reduced basis.

Parameters
modesThe OpenFOAM modes contained in a PtrList
[in]NmodesThe number of requested modes
Template Parameters
Typevector or scalar.
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Eigen matrix containing the mass matrix

Definition at line 1159 of file Foam2Eigen.C.

◆ projectField()

template<class Type , template< class > class PatchField, class GeoMesh >
Eigen::VectorXd Foam2Eigen::projectField ( GeometricField< Type, PatchField, GeoMesh > & field,
PtrList< GeometricField< Type, PatchField, GeoMesh > > & modes,
label Nmodes )
static

Perform the projection of an OpenFOAM field onto a set of modes using the Eigen matrix multiplication.

It is the standard Galerkin projection of a field onto a reduced basis:

\[ \mathbf{f} \in R^{Nx1} , \mathbf{f_r} \in R^{nx1} , \mathbf{M} \in R^{Nxn} \]

        @f[ \mathbf{f_r} = \mathbf{M^T f}

@f]

Parameters
[in]fieldThe f OpenFOAM field
[in]modesThe M OpenFOAM modes contained in a PtrList
[in]NmodesThe n number of modes you want to use (The size of input modes can be bigger than the requested number of modes)
Template Parameters
Typevector or scalar.
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Eigen vector with the projected field

Definition at line 1091 of file Foam2Eigen.C.

◆ projectFvMatrix()

template<class Type , template< class > class PatchField, class GeoMesh >
std::tuple< Eigen::MatrixXd, Eigen::VectorXd > Foam2Eigen::projectFvMatrix ( fvMatrix< Type > & matrix,
PtrList< GeometricField< Type, PatchField, GeoMesh > > & modes,
label Nmodes )
static

Obtain the Mass Matrix from a list of reduced basis.

Parameters
matrixThe matrix
[in]modesThe OpenFOAM modes contained in a PtrList
[in]NmodesNumber of requested modes
Template Parameters
Typevector or scalar.
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
An Eigen matrix containing the mass matrix

Definition at line 1116 of file Foam2Eigen.C.

◆ PtrList2Eigen()

template<class Type , template< class > class PatchField, class GeoMesh >
template Eigen::MatrixXd Foam2Eigen::PtrList2Eigen< tensor, fvPatchField, volMesh > ( PtrList< GeometricField< Type, PatchField, GeoMesh > > & fields,
label Nfields = -1 )
static

Convert a PtrList of snapshots to Eigen matrix (only internal field)

Parameters
[in]fieldsThe fields can be a PtrList<volScalarField> or PtrList<volVectorField>
[in]NfieldsThe nfields
Template Parameters
Typevector or scalar.
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
An Eigen matrix containing as columns the snapshots
Examples
08DEIM.C, and 09DEIM_ROM.C.

Definition at line 649 of file Foam2Eigen.C.

◆ PtrList2EigenBC() [1/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::MatrixXd > Foam2Eigen::PtrList2EigenBC ( PtrList< GeometricField< scalar, PatchField, GeoMesh > > & fields,
label Nfields = -1 )
static

Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldsThe field
[in]NfieldsThe nfields
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen matrix

Definition at line 268 of file Foam2Eigen.C.

◆ PtrList2EigenBC() [2/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::MatrixXd > Foam2Eigen::PtrList2EigenBC ( PtrList< GeometricField< tensor, PatchField, GeoMesh > > & fields,
label Nfields = -1 )
static

Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldsThe field
[in]NfieldsThe nfields
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen matrix

Definition at line 364 of file Foam2Eigen.C.

◆ PtrList2EigenBC() [3/3]

template<template< class > class PatchField, class GeoMesh >
List< Eigen::MatrixXd > Foam2Eigen::PtrList2EigenBC ( PtrList< GeometricField< vector, PatchField, GeoMesh > > & fields,
label Nfields = -1 )
static

Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.

Parameters
[in]fieldsThe field
[in]NfieldsThe nfields
Template Parameters
PatchFieldfvPatchField or fvsPatchField.
GeoMeshvolMesh or surfaceMesh.
Returns
Dense Eigen matrix

Definition at line 317 of file Foam2Eigen.C.


The documentation for this class was generated from the following files: