33#include "viscosityModel.H"
41 _args = autoPtr<argList>
43 new argList(argc, argv)
46 if (!
_args->checkRootCase())
48 Foam::FatalError.exit();
51 argList& args =
_args();
54 _simple = autoPtr<simpleControl>
65#pragma GCC diagnostic push
66#pragma GCC diagnostic ignored "-Wunused-variable"
67#include "initContinuityErrs.H"
68#pragma GCC diagnostic pop
86 "The BC method must be set to lift or penalty in ITHACAdict");
101 volScalarField&
p =
_p();
102 volVectorField&
U =
_U();
103 surfaceScalarField&
phi =
_phi();
106 IOMRFZoneList& MRF =
_MRF();
121 for (label
i = 0;
i < mu_now.size();
i++)
135 "./ITHACAoutput/Offline");
142 ct1Tensor.resize(nModes, nModes, nModes);
144 for (label
i = 0;
i < nModes;
i++)
146 for (label j = 0; j < nModes; j++)
148 for (label k = 0; k < nModes; k++)
156 if (Pstream::parRun())
158 reduce(
ct1Tensor, sumOp<Eigen::Tensor<double, 3>>());
163 "ct1_" + name(nModes) +
"_t");
170 ct2Tensor.resize(nModes, nModes, nModes);
172 for (label
i = 0;
i < nModes;
i++)
174 for (label j = 0; j < nModes; j++)
176 for (label k = 0; k < nModes; k++)
184 if (Pstream::parRun())
186 reduce(
ct2Tensor, sumOp<Eigen::Tensor<double, 3>>());
191 "ct2_" + name(nModes) +
"_t");
197 Eigen::MatrixXd
btMatrix(nModes, nModes);
201 for (label
i = 0;
i < nModes;
i++)
203 for (label j = 0; j < nModes; j++)
213 "bt_" + name(nModes) +
"_t");
223 word bStr =
"b_" + name(nModes);
234 word btStr =
"bt_" + name(nModes);
245 word kStr =
"k_" + name(nModes);
256 word cStr =
"c_" + name(nModes) +
"_t";
267 word ct1Str =
"ct1_" + name(nModes) +
"_t";
278 word ct2Str =
"ct2_" + name(nModes) +
"_t";
317 "./ITHACAoutput/Matrices/");
319 "./ITHACAoutput/Matrices/");
321 "./ITHACAoutput/Matrices/");
323 "./ITHACAoutput/Matrices/");
331 "./ITHACAoutput/Matrices/");
333 "./ITHACAoutput/Matrices/");
335 "./ITHACAoutput/Matrices/");
337 "./ITHACAoutput/Matrices/");
346 "./ITHACAoutput/Matrices/c");
348 "./ITHACAoutput/Matrices/ct1");
350 "./ITHACAoutput/Matrices/ct2");
361 bMatrix.resize(nModes, nModes);
364 for (label
i = 0;
i < nModes;
i++)
366 for (label j = 0; j < nModes; j++)
369 dimensionedScalar(
"1", dimless, 1),
Umodes[j])).value();
373 if (Pstream::parRun())
375 reduce(
bMatrix, sumOp<Eigen::MatrixXd>());
379 "b_" + name(nModes));
388 for (label
i = 0;
i < nModes;
i++)
390 for (label j = 0; j < nModes; j++)
392 for (label k = 0; k < nModes; k++)
401 if (Pstream::parRun())
403 reduce(
convTensor, sumOp<Eigen::Tensor<double, 3>>());
408 "c_" + name(nModes) +
"_t");
414 Eigen::MatrixXd
kMatrix(nModes, nModes);
417 for (label
i = 0;
i < nModes;
i++)
419 for (label j = 0; j < nModes; j++)
426 if (Pstream::parRun())
428 reduce(
kMatrix, sumOp<Eigen::MatrixXd>());
432 "k_" + name(nModes));
450 for (label
i = 0;
i < nModes;
i++)
458 "./ITHACAoutput/Matrices/bcVelVec");
465 List < Eigen::MatrixXd >
bcVelMat(BCUsize);
477 for (label
i = 0;
i < nModes;
i++)
479 for (label j = 0; j < nModes; j++)
483 Umodes[j].boundaryField()[BCind].component(BCcomp));
489 "./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.