55 surfaceScalarField&
phi;
60 Vector<double> inl(0, 0, 0);
61 List<scalar> mu_now(1);
68 auto nut =
_mesh().lookupObject<volScalarField>(
"nut");
82 Vector<double>
Uinl(1, 0, 0);
85 for (label
i = 0;
i <
mu.rows();
i++)
92 auto nut =
_mesh().lookupObject<volScalarField>(
"nut");
100int main(
int argc,
char* argv[])
108 std::ifstream exFileOff(
"./parsOff_mat.txt");
116 example.
mu = Eigen::VectorXd::LinSpaced(50, 1.00e-04, 1.00e-05);
120 Eigen::MatrixXd parOn;
121 std::ifstream exFileOn(
"./parsOn_mat.txt");
162 PtrList<volVectorField> U_rec_list;
163 PtrList<volScalarField> P_rec_list;
165 word vel_file(para->
ITHACAdict->lookup(
"online_velocities"));
171 for (label k = 0; k < parOn.size(); k++)
173 scalar mu_now = parOn(k, 0);
int main(int argc, char *argv[])
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 reducedSteadyNS class.
Header file of the steadyNS class.
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
IOdictionary * ITHACAdict
Dictionary for input objects from file.
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
Implementation of a parametrized full order steady NS problem and preparation of the the reduced ma...
void getTurbRBF(label NNutModes)
Function to calculate RBF weights for turbulence.
void truthSolve2(List< scalar > mu_now, word Folder="./ITHACAoutput/Offline/")
Offline solver for the whole Navier-Stokes problem.
volScalarModes nutModes
List of POD modes for eddy viscosity.
PtrList< volScalarField > nutFields
List of snapshots for the solution for eddy viscosity.
Class where it is implemented a reduced problem for the steady Navier-stokes problem.
void solveOnline_Simple(scalar mu_now, int NmodesUproj, int NmodesPproj, int NmodesNut=0, int NmodesSup=0, word Folder="./ITHACAoutput/Reconstruct/")
Method to perform an online solve using a PPE stabilisation method.
int maxIterOn
Maximum iterations number for the online step.
void setOnlineVelocity(Eigen::MatrixXd vel)
It checks if the number of imposed boundary conditions is correct and set the inlet velocity equal to...
Eigen::MatrixXd mu_samples
Matrix of parameters to be used for PODI, where each row corresponds to a sample point....
void assignIF(T &s, G &value)
Assign internal field condition.
void computeLift(T &Lfield, T &liftfield, T &omfield)
Homogenize the snapshot matrix, it works with PtrList of volVectorField and volScalarField.
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
Eigen::MatrixXd mu
Row matrix of parameters.
Eigen::MatrixXi inletIndex
Matrix that contains informations about the inlet boundaries.
bool podex
Boolean variable, it is 1 if the POD has already been computed, else 0.
void change_viscosity(double mu)
Function to change the viscosity.
scalar maxIter
Number of maximum iterations to be done for the computation of the truth solution.
void restart()
set U and P back to the values into the 0 folder
label NPmodes
Number of pressure modes used for the projection.
autoPtr< surfaceScalarField > _phi
Flux.
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
autoPtr< Time > _runTime
Time.
volVectorModes Umodes
List of pointers used to form the velocity modes.
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
autoPtr< fvMesh > _mesh
Mesh.
label NUmodes
Number of velocity modes used for the projection.
PtrList< volVectorField > liftfield
List of pointers used to form the list of lifting functions.
PtrList< volVectorField > Uomfield
List of pointers used to form the homogeneous velocity snapshots.
label NNutModesOut
Number of nut modes to be calculated.
label NNutModes
Number of nut modes used for the projection.
label NUmodesOut
Number of velocity modes to be calculated.
autoPtr< volVectorField > Uinl
Initial dummy field with all Dirichlet boundary conditions.
label NPmodesOut
Number of pressure modes to be calculated.
autoPtr< volVectorField > _U
Velocity field.
volScalarModes Pmodes
List of pointers used to form the pressure modes.
autoPtr< volScalarField > _p
Pressure field.
void offlineSolve()
Perform an Offline solve.
volVectorField & U
Velocity field.
volScalarField & p
Pressure field.
tutorial18(int argc, char *argv[])
Constructor.
void getModes(PtrList< GeometricField< Type, PatchField, GeoMesh > > &snapshots, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, word fieldName, bool podex, bool supex, bool sup, label nmodes, bool correctBC)
Computes the bases or reads them for a field.
void readConvergedFields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename)
Function to read a list of volVectorField from name of the field including only converged snapshots.
void readMiddleFields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename)
Funtion to read a list of volVectorField from name of the field including all the intermediate snapsh...
void exportMatrix(Eigen::Matrix< T, -1, dim > &matrix, word Name, word type, word folder)
Export the reduced matrices in numpy (type=python), matlab (type=matlab) and txt (type=eigen) format ...
List< Eigen::MatrixXd > readMatrix(word folder, word mat_name)
Read a three dimensional matrix from a txt file in Eigen format.
void read_fields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, word Name, fileName casename, int first_snap, int n_snap)
Function to read a list of fields from the name of the field and casename.
void readLastFields(PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, const GeometricField< Type, PatchField, GeoMesh > &field, const fileName casename)
Funtion to read a list of volVectorField from name of the field including only the last snapshots.
Eigen::MatrixXd rand(label rows, label cols, double min, double max)
Generates random matrix with random values in an interval.
bool isTurbulent()
This function checks if the case is turbulent.