35#ifndef UnsteadyNSTurb_H
36#define UnsteadyNSTurb_H
38#include "IOMRFZoneList.H"
39#include "IOporosityModelList.H"
40#include "fixedFluxPressureFvPatchScalarField.H"
43#include "pimpleControl.H"
44#include "singlePhaseTransportModel.H"
46#include "turbulentTransportModel.H"
50#include <bsplinebuilder.h>
58#include "Smagorinsky.H"
59#include "kOmegaSSTBase.H"
60#include "DESModelBase.H"
62#include "kOmegaSSTDES.H"
63#include "StoredParameters.H"
81 UnsteadyNSTurb(
int argc,
char* argv[]);
84 UnsteadyNSTurb(
const Parameters* myParameters);
104 PtrList<volScalarField> nutAvgModes;
105 PtrList<volScalarField> nutFluctModes;
106 PtrList<volScalarField> nutAvgFields;
107 PtrList<volScalarField> nutFluctFields;
109 List<SPLINTER::RBFSpline*> rbfSplinesNutAvg;
110 List<SPLINTER::RBFSpline*> rbfSplinesNutFluct;
112 List<SPLINTER::DataTable*> samplesNutAvg;
113 List<SPLINTER::DataTable*> samplesNutFluct;
116 std::vector<SPLINTER::RBFSpline*> rbfSplines;
125 Eigen::MatrixXd L_vector;
128 Eigen::MatrixXd pressurePPE_L(label
NPmodes);
177 Eigen::MatrixXd P_matrix;
187 Eigen::Tensor<double, 3> cTotalFluctTensor;
188 Eigen::Tensor<double, 3> cTotalPPEFluctTensor;
215 autoPtr<surfaceVectorField>
_Uf;
380 void truthSolve(List<scalar> mu_now, std::string& offlinepath);
398 bool rbfInterp =
true);
417 bool rbfInterp =
true);
435 Eigen::VectorXd initSnapInd,
436 Eigen::VectorXd timeSnap);
448 List<Eigen::MatrixXd>
velParCoeff(Eigen::MatrixXd A, Eigen::MatrixXd G);
467 Eigen::VectorXd initSnapInd,
468 Eigen::VectorXd timeSnap);
513 std::optional<PtrList<volVectorField>> modesU = std::nullopt);
540 volVectorField
computeSmagTerm_at_time(
const word& snap_time, std::optional<PtrList<volVectorField>> modesU = std::nullopt);
590 static volScalarField
diffusion(
const T& coefDiff,
const volScalarField& phi);
601 static volVectorField
diffusion(
const T& coefDiff,
const volVectorField& u);
625 Info <<
"Output field with this call to computeNonLinearSnapshot_at_time is scalar" << endl;
660 Info <<
"Input fields for this call to computeProjSmagTerm_fromSmag_fromMode are vectors" << endl;
666 Info <<
"Output field for this call to computeProjSmagTerm_fromSmag_fromMode is scalar" << endl;
689 volVectorField& modeU_proj , volVectorField& modeU_grad);
692 volVectorField& modeU_proj , volVectorField& modeU_grad)
694 Info <<
"Output field with this call to computeNonLinearSnapshot_at_time is scalar" << endl;
716 const volVectorField& modeU_grad);
730 const volVectorField& modeU_proj,
const volVectorField& modeU_grad);
733 const volVectorField& modeU_proj,
const volVectorField& modeU_grad)
735 Info <<
"Output field for this call to computeProjSmagFromNut_fromNut_fromModes is a scalar field" << endl;
740 const volVectorField& modeU_proj,
const volVectorField& modeU_grad)
742 Info <<
"Input field for this call to computeProjSmagFromNut_fromNut_fromModes is a scalar field" << endl;
756 const volVectorField& u,
const volVectorField& v);
776 std::optional<PtrList<volVectorField>> modesU = std::nullopt);
797 volScalarField
computeNut_at_time(
const word& snap_time, std::optional<PtrList<volVectorField>> modesU = std::nullopt);
826 static volTensorField
computeS_fromU(
const volVectorField& snapshotj);
Class that contains all parameters of the stochastic POD.
volVectorField computeSmagTerm_fromU(const volVectorField &snapshotj)
Compute Smagorinsky Snapshot for a given velocity field U.
void computeProjSmagFromNut_fromNut_fromModes(volScalarField &phi, const volScalarField &Nut, const volVectorField &modeU_proj, const volVectorField &modeU_grad)
Compute projSmagFromNut given Nut and 2 velocity modes.
Eigen::Tensor< double, 3 > ct1PPEFluctTensor
Turbulent fluctuation viscosity tensor for the splitting approach in the PPE equation.
autoPtr< surfaceVectorField > _Uf
Face velocity field.
Eigen::Tensor< double, 3 > cTotalTensor
Turbulent total viscosity tensor.
Eigen::Tensor< double, 3 > turbulenceAveTensor2(label NUmodes, label NSUPmodes)
ct2Ave added tensor for approximation of the averaged part of the eddy viscosity
Eigen::Tensor< double, 3 > ct1Tensor
Turbulent viscosity tensor.
Eigen::Tensor< double, 3 > cTotalPPETensor
Turbulent total viscosity tensor in the PPE equation.
volScalarField computeNut_fromU(const volVectorField &snapshotj)
Compute turbulent viscosity Snapshot for a given velocity field U.
PtrList< volScalarField > nutAve
List of for eddy viscosity time-averaged fields.
scalar _pRefValue
Pressure reference value.
Eigen::MatrixXd btTurbulence(label NUmodes, label NSUPmodes)
bt added matrix for the turbulence treatement
List< Eigen::MatrixXd > velParDerivativeCoeff(Eigen::MatrixXd A, Eigen::MatrixXd G, Eigen::VectorXd initSnapInd, Eigen::VectorXd timeSnap)
A method to compute the two matrices needed for the RBF interpolation by combining the parameter valu...
Eigen::Tensor< double, 3 > ct2Tensor
Turbulent viscosity tensor.
Eigen::Tensor< double, 3 > turbulencePPETensor1(label NUmodes, label NSUPmodes, label NPmodes, label nNutModes)
ct1PPE added tensor for the turbulence treatement in the PPE method
Eigen::Tensor< double, 3 > turbulenceAveTensor1(label NUmodes, label NSUPmodes)
ct1Ave added tensor for approximation of the averaged part of the eddy viscosity
Eigen::Tensor< double, 3 > ct2PPEAveTensor
Turbulent average viscosity tensor for the splitting approach in the PPE equation.
volVectorField initSmagFunction()
Initialize Smagorinsky term with values at time 0.
Eigen::Tensor< double, 3 > ct1PPETensor
Turbulent viscosity tensor in the PPE equation.
void projectSUP(fileName folder, label NUmodes, label NPmodes, label NSUPmodes, label nNutModes, bool rbfInterp=true)
Project using a supremizer approach.
volScalarField computeNut_fromS(const volTensorField &S)
Compute turbulent viscosity Snapshot for a given tensor Field S.
static volTensorField computeS_fromU(const volVectorField &snapshotj)
Compute S deformation tensor for a given vector field U.
Eigen::Tensor< double, 3 > cTotalAveTensor
Turbulent total average viscosity tensor for the splitting approach.
Eigen::Tensor< double, 3 > turbulencePPEAveTensor1(label NUmodes, label NSUPmodes, label NPmodes)
ct1PPEAve added tensor for approximation of the averaged part of the eddy viscosity with the usage of...
Eigen::Tensor< double, 3 > turbulenceFluctTensor1(label NUmodes, label NSUPmodes)
ct1Fluct added tensor for approximation of the fluctuating part of the eddy viscosity
volScalarField computeSmagTermPhi_at_time(const word &snap_time, const volScalarField template_field_phi)
Compute Smagorinsky Snapshot of a tracer phi at a given time.
volScalarField computeSmagTermPhi_fromUPhi(const volVectorField &snapshotj, const volScalarField &phij)
Compute Smagorinsky Snapshot for given velocity field U and tracer phi.
volScalarField initNutFunction()
Initialize Nut term with values at time 0.
Eigen::Tensor< double, 3 > ct1PPEAveTensor
Turbulent average viscosity tensor for the splitting approach in the PPE equation.
Eigen::Tensor< double, 3 > ct1FluctTensor
Turbulent fluctuation viscosity tensor for the splitting approach.
Eigen::Tensor< double, 3 > turbulenceTensor2(label NUmodes, label NSUPmodes, label nNutModes)
ct2 added tensor for the turbulence treatement
Eigen::Tensor< double, 3 > turbulencePPEFluctTensor2(label NUmodes, label NSUPmodes, label NPmodes)
ct2PPEFluct added tensor for approximation of the fluctuating part of the eddy viscosity with the usa...
autoPtr< volScalarField > _nut
Eddy viscosity field.
label interChoice
Interpolation independent variable choice.
Eigen::MatrixXd coeffL2
The matrix of L2 projection coefficients for the eddy viscosity.
volScalarField computeNut_at_time(const word &snap_time, std::optional< PtrList< volVectorField > > modesU=std::nullopt)
Compute non linear Snapshot at a given time.
Eigen::MatrixXd btMatrix
Turbulent viscosity term.
volScalarModes nutModes
List of POD modes for eddy viscosity.
Eigen::Tensor< double, 3 > turbulenceFluctTensor2(label NUmodes, label NSUPmodes)
ct2Fluct added tensor for approximation of the fluctuating part of the eddy viscosity
volScalarField initSmagPhiFunction(const volScalarField template_field_phi)
Initialize Smagorinsky term of a tracer phi with values at time 0.
static volScalarField projDiffusionIBP(const volScalarField &coefDiff, const volVectorField &u, const volVectorField &v)
Compute projected diffusion term with the integration by parts (IBP) equation for a given vector fiel...
Eigen::Tensor< double, 3 > turbulencePPEAveTensor2(label NUmodes, label NSUPmodes, label NPmodes)
ct2PPEAve added tensor for approximation of the averaged part of the eddy viscosity with the usage of...
Eigen::Tensor< double, 3 > ct2FluctTensor
Turbulent fluctuation viscosity tensor for the splitting approach.
double e
RBF functions radius.
Eigen::Tensor< double, 3 > ct1AveTensor
Turbulent average viscosity tensor for the splitting approach.
Eigen::Tensor< double, 3 > ct2PPEFluctTensor
Turbulent fluctuation viscosity tensor for the splitting approach in the PPE equation.
PtrList< volScalarField > nutFields
List of snapshots for the solution for eddy viscosity.
volScalarField initProjSmagFromNutFunction()
Initialize projSmagFromNut with values at time 0.
static volScalarField diffusion(const T &coefDiff, const volScalarField &phi)
Compute diffusion term for a given scalar field phi.
label _pRefCell
Pressure reference cell.
volVectorField computeSmagTerm_at_time(const word &snap_time, std::optional< PtrList< volVectorField > > modesU=std::nullopt)
Compute Smagorinsky Snapshot at a given time.
List< Eigen::MatrixXd > velParCoeff(Eigen::MatrixXd A, Eigen::MatrixXd G)
A method to compute the two matrices needed for the RBF interpolation by combining the parameter samp...
volScalarField initProjSmagFunction()
Initialize projFullStressFunction with values at time 0.
Eigen::MatrixXd bTotalMatrix
Total B Matrix.
List< Eigen::MatrixXd > velDerivativeCoeff(Eigen::MatrixXd A, Eigen::MatrixXd G, Eigen::VectorXd initSnapInd, Eigen::VectorXd timeSnap)
A method to compute the two matrices needed for the RBF interpolation by combining the velocity L2 pr...
volScalarField computeProjSmagFromNut_at_time_fromModes(const word &snap_time, const volVectorField &modeU_proj, const volVectorField &modeU_grad)
Compute projSmagFromNut snapshot at a given time from 2 velocity modes.
label nNutModes
Number of viscoisty modes used for the projection.
Eigen::Tensor< double, 3 > ct2AveTensor
Turbulent average viscosity tensor for the splitting approach.
void computeProjSmagTerm_fromSmag_fromMode(volScalarField &phi, const volVectorField &Smag, const volVectorField &mode)
Compute projFullStressFunction given the Smagorinsky term and the velocity mode.
Eigen::Tensor< double, 3 > turbulencePPEFluctTensor1(label NUmodes, label NSUPmodes, label NPmodes)
ct1PPEFluct added tensor for approximation of the fluctuating part of the eddy viscosity with the usa...
void projectPPE(fileName folder, label NUmodes, label NPmodes, label NSUPmodes, label nNutModes, bool rbfInterp=true)
Project using the Poisson Equation for pressure.
Eigen::VectorXd radii
RBF shape parameters vector.
Eigen::Tensor< double, 3 > turbulencePPETensor2(label NUmodes, label NSUPmodes, label NPmodes, label nNutModes)
ct2PPE added tensor for the turbulence treatement in the PPE method
Eigen::MatrixXd z
Time-parameter combined matrix.
std::vector< SPLINTER::DataTable * > samples
Create a Rbf splines for interpolation.
Eigen::MatrixXd velRBF
Velocity coefficients for RBF interpolation.
Eigen::Tensor< double, 3 > turbulenceTensor1(label NUmodes, label NSUPmodes, label nNutModes)
ct1 added tensor for the turbulence treatement
Eigen::Tensor< double, 3 > ct2PPETensor
Turbulent viscosity tensor in the PPE equation.
volScalarField computeProjSmagTerm_at_time_fromMode(const word &snap_time, const volVectorField &mode)
Compute projFullStressFunction snapshot at a given time projected on the given mode.
Eigen::Tensor< double, 3 > cTotalPPEAveTensor
Turbulent total average viscosity tensor for the splitting approach in the PPE equation.
void computeNonLinearSnapshot_at_time(const word &snap_time, volVectorField &Smag, std::optional< PtrList< volVectorField > > modesU=std::nullopt)
Compute non linear Snapshot at a given time.
void truthSolve()
Perform a TruthSolve.
label NPmodes
Number of pressure modes used for the projection.
label NUmodes
Number of velocity modes used for the projection.
label NSUPmodes
Number of supremizer modes used for the projection.
unsteadyNS()
Construct Null.
Header file of the steadyNS class.
Header file of the unsteadyNS class.