33#include "viscosityModel.H"
42 _args = autoPtr<argList>
44 new argList(argc, argv)
47 if (!
_args->checkRootCase())
49 Foam::FatalError.exit();
52 argList& args =
_args();
55 _simple = autoPtr<simpleControl>
66#pragma GCC diagnostic push
67#pragma GCC diagnostic ignored "-Wunused-variable"
68#include "initContinuityErrs.H"
69#pragma GCC diagnostic pop
87 "The BC method must be set to lift or penalty in ITHACAdict");
102 volScalarField&
p =
_p();
103 volVectorField&
U =
_U();
104 surfaceScalarField&
phi =
_phi();
107 IOMRFZoneList& MRF =
_MRF();
122 for (label
i = 0;
i < mu_now.size();
i++)
136 "./ITHACAoutput/Offline");
143 ct1Tensor.resize(nModes, nModes, nModes);
145 for (label
i = 0;
i < nModes;
i++)
147 for (label j = 0; j < nModes; j++)
149 for (label k = 0; k < nModes; k++)
157 if (Pstream::parRun())
159 reduce(
ct1Tensor, sumOp<Eigen::Tensor<double, 3 >> ());
164 "ct1_" + name(nModes) +
"_t");
171 ct2Tensor.resize(nModes, nModes, nModes);
173 for (label
i = 0;
i < nModes;
i++)
175 for (label j = 0; j < nModes; j++)
177 for (label k = 0; k < nModes; k++)
185 if (Pstream::parRun())
187 reduce(
ct2Tensor, sumOp<Eigen::Tensor<double, 3 >> ());
192 "ct2_" + name(nModes) +
"_t");
198 Eigen::MatrixXd
btMatrix(nModes, nModes);
202 for (label
i = 0;
i < nModes;
i++)
204 for (label j = 0; j < nModes; j++)
214 "bt_" + name(nModes) +
"_t");
223 word bStr =
"b_" + name(nModes);
233 word btStr =
"bt_" + name(nModes);
243 word kStr =
"k_" + name(nModes);
253 word cStr =
"c_" + name(nModes) +
"_t";
263 word ct1Str =
"ct1_" + name(nModes) +
"_t";
273 word ct2Str =
"ct2_" + name(nModes) +
"_t";
307 if (
para->exportPython)
312 "./ITHACAoutput/Matrices/");
314 "./ITHACAoutput/Matrices/");
316 "./ITHACAoutput/Matrices/");
318 "./ITHACAoutput/Matrices/");
321 if (
para->exportMatlab)
326 "./ITHACAoutput/Matrices/");
328 "./ITHACAoutput/Matrices/");
330 "./ITHACAoutput/Matrices/");
332 "./ITHACAoutput/Matrices/");
341 "./ITHACAoutput/Matrices/c");
343 "./ITHACAoutput/Matrices/ct1");
345 "./ITHACAoutput/Matrices/ct2");
356 bMatrix.resize(nModes, nModes);
359 for (label
i = 0;
i < nModes;
i++)
361 for (label j = 0; j < nModes; j++)
364 dimensionedScalar(
"1", dimless, 1),
Umodes[j])).value();
368 if (Pstream::parRun())
370 reduce(
bMatrix, sumOp<Eigen::MatrixXd>());
374 "b_" + name(nModes));
383 for (label
i = 0;
i < nModes;
i++)
385 for (label j = 0; j < nModes; j++)
387 for (label k = 0; k < nModes; k++)
396 if (Pstream::parRun())
398 reduce(
convTensor, sumOp<Eigen::Tensor<double, 3 >> ());
403 "c_" + name(nModes) +
"_t");
409 Eigen::MatrixXd
kMatrix(nModes, nModes);
412 for (label
i = 0;
i < nModes;
i++)
414 for (label j = 0; j < nModes; j++)
421 if (Pstream::parRun())
423 reduce(
kMatrix, sumOp<Eigen::MatrixXd>());
427 "k_" + name(nModes));
445 for (label
i = 0;
i < nModes;
i++)
453 "./ITHACAoutput/Matrices/bcVelVec");
460 List < Eigen::MatrixXd >
bcVelMat(BCUsize);
472 for (label
i = 0;
i < nModes;
i++)
474 for (label j = 0; j < nModes; j++)
478 Umodes[j].boundaryField()[BCind].component(BCcomp));
484 "./ITHACAoutput/Matrices/bcVelMat");
#define M_Assert(Expr, Msg)
Header file of the SteadyNSTurbIntrusive class.
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
Eigen::MatrixXd diffusiveTerm(label nModes)
Diffusive Term.
Eigen::MatrixXd bTotalMatrix
Total B Matrix.
PtrList< volScalarField > nutModes
List of POD modes for eddy viscosity.
Eigen::MatrixXd btTurbulence(label nModes)
bt added matrix for the turbulence treatement
Eigen::Tensor< double, 3 > turbulenceTensor2(label nModes)
Method to compute one of the turbulence eddy viscosity tensors.
Eigen::Tensor< double, 3 > convTensor
Convective tensor.
PtrList< volScalarField > nutFields
List of snapshots for the solution for eddy viscosity.
List< Eigen::MatrixXd > bcVelocityVec(label nModes)
Boundary integral modes on boundary used by the penaly method.
Eigen::Tensor< double, 3 > cTotalTensor
Total Turbulent tensor.
Eigen::Tensor< double, 3 > convectiveTerm(label nModes)
The method for computing the convective term tensor.
autoPtr< volScalarField > _nut
Eddy viscosity field.
Eigen::MatrixXd kMatrix
Pressure Gradient matrix.
Eigen::MatrixXd btMatrix
Turbulent viscosity matrix.
List< Eigen::MatrixXd > bcVelocityMat(label nModes)
Boundary integral modes on boundary used by the penaly method.
Eigen::Tensor< double, 3 > turbulenceTensor1(label nModes)
Method to compute one of the turbulence eddy viscosity tensors.
Eigen::MatrixXd pressureGradientTerm(label nModes)
The method for computing the pressure gradient term with number of modes of pressure being equal to t...
label nModesOnline
Number of modes used in the online stage.
Eigen::MatrixXd bMatrix
Diffusive matrix.
Eigen::Tensor< double, 3 > ct2Tensor
Turbulent viscosity tensor.
Eigen::Tensor< double, 3 > ct1Tensor
Turbulent viscosity tensor.
void project()
General projection operation.
void writeMu(List< scalar > mu_now)
Write out a list of scalar corresponding to the parameters used in the truthSolve.
Eigen::MatrixXd mu_samples
Matrix of parameters to be used for PODI, where each row corresponds to a sample point....
label counter
Counter used for the output of the full order solutions.
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
IOdictionary * ITHACAdict
dictionary to store input output infos
Eigen::MatrixXd mu
Row matrix of parameters.
autoPtr< argList > _args
argList
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 truthSolve()
Perform a TruthSolve.
List< Eigen::MatrixXd > bcVelVec
Boundary term for penalty method - vector.
scalar maxIter
Number of maximum iterations to be done for the computation of the truth solution.
bool supex
Boolean variable to check the existence of the supremizer modes.
autoPtr< surfaceScalarField > _phi
Flux.
autoPtr< simpleControl > _simple
simpleControl
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
autoPtr< fv::options > _fvOptions
fvOptions
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.
scalar tolerance
Tolerance for the residual of the stationary problems, there is the same tolerance for velocity and p...
autoPtr< fvMesh > _mesh
Mesh.
autoPtr< singlePhaseTransportModel > _laminarTransport
Laminar transport (used by turbulence model)
autoPtr< IOMRFZoneList > _MRF
MRF variable.
autoPtr< incompressible::turbulenceModel > turbulence
Turbulence model.
List< Eigen::MatrixXd > bcVelMat
Boundary term for penalty method - matrix.
autoPtr< volVectorField > _U
Velocity field.
volScalarModes Pmodes
List of pointers used to form the pressure modes.
word bcMethod
Boundary Method.
autoPtr< volScalarField > _p
Pressure field.
void ReadDenseMatrix(MatrixType &Matrix, word folder, word MatrixName)
Read a dense matrix from a binary format file.
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.
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 ...
void SaveDenseMatrix(MatrixType &Matrix, word folder, word MatrixName)
Save a dense matrix to a binary format file.
void ReadDenseTensor(TensorType &Tensor, word folder, word MatrixName)
Read a dense tensor from file.
void exportTensor(Eigen::Tensor< T, 3 > tensor, word Name, word type, word folder)
Export the reduced tensor in numpy (tipo=python), matlab (tipo=matlab) and txt (tipo=eigen) format.
void SaveDenseTensor(TensorType &Tensor, word folder, word MatrixName)
Save a dense tensor to file.
bool check_pod()
Check if the POD data folder "./ITHACAoutput/POD" exists.
bool check_off()
Check if the offline data folder "./ITHACAoutput/Offline" exists.
bool check_folder(word folder)
Checks if a folder exists.
bool check_file(std::string fileName)
Function that returns true if a file exists.
bool check_sup()
Check if the supremizer folder exists.
simpleControl simple(mesh)
singlePhaseTransportModel & laminarTransport
Header file of the steadyNS class.