-
Notifications
You must be signed in to change notification settings - Fork 904
[WIP] Implementation of eN transition model #1765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 76 commits
e960644
c4b6fca
1347597
56b93c1
fd51593
604aadb
c6e7c90
53b7914
9fc045d
e80c407
f928a49
d469819
f231a7f
8cdb955
3641563
2b905f4
9508e5e
c4ed8c9
36b4a00
988a6bd
96628ae
c1d6843
36fad1b
a30f6a4
3618e1a
0347127
aed8767
f337507
f264b2a
cfe99be
111ad42
e80b50f
7390c60
90d26ba
69055d9
c7826ba
2bcf4c5
4a8c4f7
84ab6a5
4dd5b85
c761a0c
c8c050e
a076372
668087c
359a123
fed8133
2b1fc32
b7028bc
3af0d91
7274d12
2c849ee
9e75d31
9f1a008
85d9931
398cd3e
6a3a27f
db6e709
3bd91c8
af49882
b5ec705
e2de13b
3747b22
835b705
cdd9113
173ac5c
13029b8
4b7e816
f1a7a50
20c6541
2b2c30f
a0b6e33
443fec6
74c2f47
09872f6
7389eb2
07a9321
d8f1195
11eed9d
14807c8
8251c65
cf992fc
5f58b05
f8648e2
4a8afaf
8831125
36089a7
93b5883
3c3136a
3293b11
4264ba0
8be56fd
543589e
3bd7d08
587f22b
ae58ced
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -323,3 +323,142 @@ class CSourcePieceWise_TransLM final : public CNumerics { | |
| return ResidualType<>(Residual, Jacobian_i, nullptr); | ||
| } | ||
| }; | ||
|
|
||
| /*! | ||
| * \class CSourcePieceWise_TranEN | ||
| * \brief Class for integrating the source terms of the e^N transition model equations. | ||
| * \ingroup SourceDiscr | ||
| * \author R. Roos | ||
| */ | ||
| template <class FlowIndices> | ||
| class CSourcePieceWise_TransEN final : public CNumerics { | ||
| private: | ||
| const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ | ||
|
|
||
| su2double Residual, *Jacobian_i; | ||
| su2double Jacobian_Buffer; /*!< \brief Static storage for the Jacobian (which needs to be pointer for return type). */ | ||
|
|
||
| public: | ||
| /*! | ||
| * \brief Constructor of the class. | ||
| * \param[in] val_nDim - Number of dimensions of the problem. | ||
| * \param[in] val_nVar - Number of variables of the problem. | ||
| * \param[in] config - Definition of the particular problem. | ||
| */ | ||
| CSourcePieceWise_TransEN(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) | ||
| : CNumerics(val_nDim, 1, config), | ||
| idx(val_nDim, config->GetnSpecies()) { | ||
|
|
||
| /*--- "Allocate" the Jacobian using the static buffer. ---*/ | ||
| Jacobian_i = &Jacobian_Buffer; | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Residual for source term integration. | ||
| * \param[in] config - Definition of the particular problem. | ||
| * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. | ||
| */ | ||
| ResidualType<> ComputeResidual(const CConfig* config) override { | ||
|
|
||
| AD::StartPreacc(); | ||
| AD::SetPreaccIn(V_i[idx.Density()], V_i[idx.Pressure()], V_i[idx.LaminarViscosity()], StrainMag_i, ScalarVar_i[0], Volume, dist_i); | ||
| AD::SetPreaccIn(&V_i[idx.Velocity()], nDim); | ||
| AD::SetPreaccIn(Vorticity_i, 3); | ||
| AD::SetPreaccIn(PrimVar_Grad_i + idx.Velocity(), nDim, nDim); | ||
| AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); | ||
|
|
||
| su2double rho = V_i[idx.Density()]; | ||
| su2double p = V_i[idx.Pressure()]; | ||
Check noticeCode scanning / CodeQL Unused local variable
Variable p is not used.
|
||
| su2double muLam = V_i[idx.LaminarViscosity()]; | ||
|
|
||
| const su2double VorticityMag = GeometryToolbox::Norm(3, Vorticity_i); | ||
|
|
||
| const su2double vel_u = V_i[idx.Velocity()]; | ||
| const su2double vel_v = V_i[1+idx.Velocity()]; | ||
| const su2double vel_w = (nDim ==3) ? V_i[2+idx.Velocity()] : 0.0; | ||
|
|
||
| const su2double vel_mag = sqrt(vel_u*vel_u + vel_v*vel_v + vel_w*vel_w); | ||
|
|
||
| su2double rhoInf = config->GetDensity_FreeStreamND(); | ||
Check noticeCode scanning / CodeQL Unused local variable
Variable rhoInf is not used.
|
||
| su2double pInf = config->GetPressure_FreeStreamND(); | ||
Check noticeCode scanning / CodeQL Unused local variable
Variable pInf is not used.
|
||
| const su2double *velInf = config->GetVelocity_FreeStreamND(); | ||
|
|
||
| su2double velInf2 = 0.0; | ||
| for(unsigned short iDim = 0; iDim < nDim; ++iDim) { | ||
| velInf2 += velInf[iDim]*velInf[iDim]; | ||
| } | ||
|
|
||
| Residual = 0.0; | ||
| Jacobian_i[0] = 0.0; | ||
|
|
||
| if (dist_i > 1e-10) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you use EPS? |
||
|
|
||
| su2double u_e; | ||
| if (config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE) { | ||
|
|
||
| /*--- Estimate of the equivalent flow velocity at the edge of the boundary layer based on compressible Bernoulli's equation ---*/ | ||
| const su2double Gamma = config->GetGamma(); | ||
| const su2double G_over_G = Gamma/(Gamma-1); | ||
|
|
||
| const su2double rho_e = pow(((pow(rhoInf,Gamma)/pInf)*p),(1/Gamma)); | ||
|
|
||
| /*--- Abs value taken to account of negative difference between pInf and local p ---*/ | ||
| //u_e = sqrt(2*(G_over_G*( (pInf/rhoInf) -(p/rho_e) )) + velInf2 ); | ||
|
||
| u_e = sqrt(2*(G_over_G*(pInf/rhoInf) + (velInf2/2) - G_over_G*(p/rho_e))); | ||
|
|
||
| } else { | ||
|
|
||
| /*--- Inviscid edge velocity based on incompressible Bernoulli's equation---*/ | ||
| //u_e = sqrt((rhoInf*velInf2 + 2*(pInf-p))/rho); | ||
|
||
| u_e = sqrt((rhoInf*velInf2 + 2*(p-pInf))/rho); | ||
|
|
||
| } | ||
|
|
||
| /*--- Local pressure-gradient parameter for the boundary layer shape factor. Minimum value of 0.328 for stability ---*/ | ||
| const su2double H_L = max(((StrainMag_i*dist_i)/u_e),0.328); | ||
|
|
||
| /*--- Integral shape factor ---*/ | ||
| const su2double H_12 = 13.9766*pow(H_L,4) - 22.9166*pow(H_L,3) + 13.7227*pow(H_L,2) - 1.0023*H_L + 1.6778; | ||
|
|
||
| /*--- F growth parameters ---*/ | ||
| const su2double DH_12 = (0.0616*pow(H_12,2) + 0.2339*H_12 + 3.4298)/ | ||
| (0.0047*pow(H_12,3) - 0.1056*pow(H_12,2) + 0.9350*H_12 - 1.2071); | ||
|
|
||
| const su2double lH_12 = (6.54*H_12 - 14.07)/pow(H_12,2); | ||
| const su2double mH_12 = (0.058*(pow((H_12 - 4),2)/(H_12 - 1)) - 0.068)*(1/lH_12); | ||
|
|
||
| const su2double F_growth = DH_12*((1 + mH_12)*lH_12)/2; | ||
|
|
||
| /*--- F crit parameters ---*/ | ||
| const su2double Re_y = (rho*vel_mag*dist_i)/muLam; | ||
| const su2double k_y = -0.00315*pow(H_12,3) + 0.0986*pow(H_12,2) - 0.242*H_12 + 3.739; | ||
| const su2double Re_d2_0 = pow(10,(0.7*tanh((14/(H_12 - 1)) - 9.24) + 2.492/pow((H_12 - 1),0.43) + 0.62)); | ||
| const su2double Re_y_0 = k_y * Re_d2_0; | ||
|
|
||
| short int F_crit = 0; | ||
| if (Re_y > Re_y_0){ | ||
| F_crit = 1; | ||
| } else { | ||
| F_crit = 0; | ||
| } | ||
|
|
||
| /*--- Source term expresses stream wise growth of Tollmien_schlichting instabilities ---*/ | ||
| const su2double dn_over_dRe_d2 = 0.028*(H_12 - 1) - 0.0345*exp(-pow((3.87/(H_12 - 1) - 2.52),2)); | ||
|
|
||
| /*--- Production term ---*/ | ||
| const su2double P_amplification = rho*VorticityMag*F_crit*F_growth*dn_over_dRe_d2; | ||
|
|
||
| /*--- Add Production to residual ---*/ | ||
| Residual += P_amplification * Volume; | ||
|
|
||
| /*--- Implicit part ---*/ | ||
| Jacobian_i[0] = (rho*VorticityMag*F_crit*F_growth) * Volume; | ||
|
|
||
| } | ||
|
|
||
| AD::SetPreaccOut(Residual); | ||
| AD::EndPreacc(); | ||
|
|
||
| return ResidualType<>(&Residual, &Jacobian_i, nullptr); | ||
| } | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run clang-format on new files please