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");
134 example.inletIndex.resize(1, 2);
135 example.inletIndex(0, 0) = 0;
136 example.inletIndex(0, 1) = 0;
138 example.maxIter = para->ITHACAdict->lookupOrDefault<
int>(
"maxIter", 2000);
140 example.offlineSolve();
143 example.computeLift(example.Ufield, example.liftfield, example.Uomfield);
155 example.podex, 0, 0, example.NNutModesOut);
157 example.getTurbRBF(example.NNutModes);
162 PtrList<volVectorField> U_rec_list;
163 PtrList<volScalarField> P_rec_list;
165 word vel_file(para->ITHACAdict->lookup(
"online_velocities"));
168 reduced.maxIterOn = para->ITHACAdict->lookupOrDefault<
int>(
"maxIterOn", 2000);
171 for (label k = 0; k < parOn.size(); k++)
173 scalar mu_now = parOn(k, 0);
175 example.change_viscosity(mu_now);
176 reduced.setOnlineVelocity(vel);
180 reduced.solveOnline_Simple(mu_now, example.NUmodes, example.NPmodes,
185 reduced.solveOnline_Simple(mu_now, example.NUmodes, example.NPmodes,
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...
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
SteadyNSSimple()
Null constructor.
void truthSolve2(List< scalar > mu_now, word Folder="./ITHACAoutput/Offline/")
Offline solver for the whole Navier-Stokes problem.
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.
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.
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
Eigen::MatrixXd mu
Row matrix of parameters.
void change_viscosity(double mu)
Function to change the viscosity.
autoPtr< surfaceScalarField > _phi
Flux.
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
autoPtr< fvMesh > _mesh
Mesh.
autoPtr< volVectorField > Uinl
Initial dummy field with all Dirichlet boundary conditions.
autoPtr< volVectorField > _U
Velocity field.
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.