32#include "simpleControl.H"
33#include "simpleControl.H"
34#include "fvMeshSubset.H"
47 volScalarField
yPos =
S.mesh().C().component(vector::Y).ref();
48 volScalarField
xPos =
S.mesh().C().component(vector::X).ref();
50 for (
auto i = 0;
i <
S.size();
i++)
52 S[
i] = std::exp(- 2 * std::pow(
xPos[
i] - mu(0) - 1,
53 2) - 2 * std::pow(
yPos[
i] - mu(1) - 0.5, 2));
78int main(
int argc,
char* argv[])
81#include "setRootCase.H"
82 Foam::Time
runTime(Foam::Time::controlDictName, args);
87 Foam::fvMesh::defaultRegion,
90 Foam::IOobject::MUST_READ
94 int NDEIM =
para->ITHACAdict->lookupOrDefault<
int>(
"NDEIM", 15);
98 PtrList<volScalarField> Sp;
111 dimensionedScalar(
"zero", dimensionSet(0, 0, -1, 1, 0, 0, 0), 0)
121 for (
int i = 0;
i < 100;
i++)
124 Sp.append((
S).clone());
128 Eigen::MatrixXd snapshotsModes;
139 Eigen::VectorXi initSeeds(0);
150 Eigen::MatrixXd par_new(2, 1);
int main(int argc, char *argv[])
Header file of the Foam2Eigen class.
Header file of the ITHACAPOD class.
Header file of the ITHACAstream class, it contains the implementation of several methods for input ou...
Header file of the ITHACAutilities namespace.
HyperReduction(label n_modes, label n_nodes, Eigen::VectorXi initialSeeds, word problemName, SnapshotsLists &&...snapshotsLists)
Construct HyperReduction class, interpolation-based.
static volScalarField evaluate_expression(volScalarField &S, Eigen::MatrixXd mu)
autoPtr< volScalarField > subField
Eigen::VectorXd onlineCoeffs(Eigen::MatrixXd mu)
PtrList< volScalarField > fields
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.
static Eigen::MatrixXd PtrList2Eigen(PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, label Nfields=-1)
Convert a PtrList of snapshots to Eigen matrix (only internal field)
void generateSubmesh(label layers, const fvMesh &mesh)
Compute the submesh common to all fields in SnapshotsLists.
autoPtr< FieldType > interpolateField(const FieldType &field)
TODO.
void offlineGappyDEIM(Eigen::MatrixXd &snapshotsModes, Eigen::VectorXd &normalizingWeights)
Methods implemented: 'GappyDEIM' from "DEIM, Chaturantabut, Saifon, and Danny C. Sorensen....
Eigen::MatrixXd MatrixOnline
Online Matrix.
List< label > localNodePoints
HyperReduction(label n_modes, label n_nodes, Eigen::VectorXi initialSeeds, word problemName, SnapshotsLists &&...snapshotsLists)
Construct HyperReduction class, interpolation-based.
autoPtr< IOList< label > > nodePoints
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
std::tuple< List< Eigen::SparseMatrix< double > >, List< Eigen::VectorXd > > DEIMmodes(List< Eigen::SparseMatrix< double > > &A, List< Eigen::VectorXd > &b, label nmodesA, label nmodesB, word MatrixName)
Get the DEIM modes for a generic non a parametrized matrix coming from a differential operator functi...
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.
double errorL2Rel(GeometricField< T, fvPatchField, volMesh > &field1, GeometricField< T, fvPatchField, volMesh > &field2, List< label > *labels)
Computes the relative error between two geometric Fields in L2 norm.
Eigen::VectorXd getMassMatrixFV(GeometricField< Type, PatchField, GeoMesh > &snapshot)
Gets a vector containing the volumes of each cell of the mesh.
Eigen::MatrixXd rand(label rows, label cols, double min, double max)
Generates random matrix with random values in an interval.
simpleControl simple(mesh)
volScalarField S(IOobject("S", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), T.mesh(), dimensionedScalar("zero", dimensionSet(0, 0, -1, 1, 0, 0, 0), 0))