-
Notifications
You must be signed in to change notification settings - Fork 847
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
[WIP] PGOMEGA Implementation #2354
base: develop
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -50,9 +50,12 @@ | |||||||||
const su2double cr1 = 0.5; | ||||||||||
const su2double CRot = 1.0; | ||||||||||
const su2double c2 = 0.7, c3 = 0.9; | ||||||||||
const su2double cpw1=0.94,cpw2=2.66,cpw3=4.8;//pgomega by Xiao He 2022 | ||||||||||
su2double beta_PGO = 0.0;//pgomega by Xiao He 2022 | ||||||||||
|
||||||||||
/*--- List of auxiliary functions ---*/ | ||||||||||
su2double ft2, d_ft2, r, d_r, g, d_g, glim, fw, d_fw, Ji, d_Ji, S, Shat, d_Shat, fv1, d_fv1, fv2, d_fv2; | ||||||||||
|
||||||||||
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.
Suggested change
|
||||||||||
|
||||||||||
/*--- List of helpers ---*/ | ||||||||||
su2double Omega, dist_i_2, inv_k2_d2, inv_Shat, g_6, norm2_Grad; | ||||||||||
|
@@ -129,7 +132,6 @@ | |||||||||
Jacobian_i = &Jacobian_Buffer; | ||||||||||
} | ||||||||||
|
||||||||||
|
||||||||||
/*! | ||||||||||
* \brief Residual for source term integration. | ||||||||||
* \param[in] config - Definition of the particular problem. | ||||||||||
|
@@ -142,6 +144,7 @@ | |||||||||
AD::StartPreacc(); | ||||||||||
AD::SetPreaccIn(density, laminar_viscosity, StrainMag_i, ScalarVar_i[0], Volume, dist_i, roughness_i); | ||||||||||
AD::SetPreaccIn(Vorticity_i, 3); | ||||||||||
AD::SetPreaccIn(Coord_i, 3); | ||||||||||
AD::SetPreaccIn(PrimVar_Grad_i + idx.Velocity(), nDim, nDim); | ||||||||||
AD::SetPreaccIn(ScalarVar_Grad_i[0], nDim); | ||||||||||
|
||||||||||
|
@@ -152,7 +155,43 @@ | |||||||||
Jacobian_i[0] = 0.0; | ||||||||||
|
||||||||||
/*--- Evaluate Omega with a rotational correction term. ---*/ | ||||||||||
|
||||||||||
// pgomega by Xiao He 2022 | ||||||||||
if (options.pgomga) { | ||||||||||
|
||||||||||
/*!\brief PG-OMEGA*/ | ||||||||||
su2double dpds = 0, dpomg = 0, omg = 0, velocityMag = 0; | ||||||||||
su2double Velocity_Rel[3] = {0.0, 0.0, 0.0}; | ||||||||||
su2double Vorticity_Rel[3] = {0.0, 0.0, 0.0}; | ||||||||||
su2double RotationalVelocity[3] = {0.0, 0.0, 0.0}; | ||||||||||
su2double RotationVelocityCrossR[3] = {0.0, 0.0, 0.0}; | ||||||||||
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.
Suggested change
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. or, since you are already doing static allocation:
Suggested change
and you do not rely on the initial value being 0 as far as I see |
||||||||||
for (int iDim = 0; iDim < nDim; iDim++) { | ||||||||||
RotationalVelocity[iDim] = config->GetRotation_Rate(iDim) / config->GetOmega_Ref(); | ||||||||||
} | ||||||||||
|
||||||||||
GeometryToolbox::CrossProduct( RotationalVelocity,Coord_i, RotationVelocityCrossR); | ||||||||||
|
||||||||||
for (int iDim = 0; iDim < nDim; iDim++) { | ||||||||||
Velocity_Rel[iDim] = V_i[idx.Velocity() + iDim] - RotationVelocityCrossR[iDim]; | ||||||||||
Vorticity_Rel[iDim] = Vorticity_i[iDim] - RotationalVelocity[iDim]; | ||||||||||
|
||||||||||
} | ||||||||||
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. If this model only works for 3D flows (I assume you only use it in these cases) you should not allow users to select it with a 2D calculation |
||||||||||
|
||||||||||
velocityMag = max(GeometryToolbox::Norm(3, Velocity_Rel), 0.001); | ||||||||||
omg = max(GeometryToolbox::Norm(3, Vorticity_Rel), 0.001); | ||||||||||
|
||||||||||
for (int iDim = 0; iDim < nDim; iDim++) dpds += PrimVar_Grad_i[idx.Pressure()][iDim] * Velocity_Rel[iDim]; | ||||||||||
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. Check capitialisation for consistency, should this be 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. Same with line 162 |
||||||||||
|
||||||||||
if (dpds >= 0.0) { | ||||||||||
su2double RefReynold = 1.0e6; | ||||||||||
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.
Suggested change
const all the things possible :) |
||||||||||
dpomg = GeometryToolbox::DotProduct(3, PrimVar_Grad_i[idx.Pressure()], Vorticity_Rel) * laminar_viscosity * | ||||||||||
RefReynold / (omg * pow(velocityMag, 3) * pow(density, 2)); // reynold should be modified | ||||||||||
//cout<<"dpomg="<<dpomg<<endl; | ||||||||||
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. Remove comments |
||||||||||
dpomg=abs(dpomg); | ||||||||||
var.beta_PGO = var.cpw1 * tanh(var.cpw2 * pow(dpomg, var.cpw3)); | ||||||||||
} | ||||||||||
|
||||||||||
//var.Omega = omg * (1.0 + var.beta_PGO); | ||||||||||
Check notice Code scanning / CodeQL Commented-out code Note
This comment appears to contain commented-out code.
|
||||||||||
} | ||||||||||
Omega::get(Vorticity_i, nDim, PrimVar_Grad_i + idx.Velocity(), var); | ||||||||||
|
||||||||||
/*--- Dacles-Mariani et. al. rotation correction ("-R"). ---*/ | ||||||||||
|
@@ -231,19 +270,20 @@ | |||||||||
var.intermittency = intermittency_eff_i; | ||||||||||
var.interDestrFactor = 1; | ||||||||||
|
||||||||||
} else if (transition_LM){ | ||||||||||
|
||||||||||
} else if (transition_LM) { | ||||||||||
var.intermittency = intermittency_eff_i; | ||||||||||
//var.intermittency = 1.0; | ||||||||||
// Is wrong the reference from NASA? | ||||||||||
// Original max(min(gamma, 0.5), 1.0) always gives 1 as result. | ||||||||||
// var.intermittency = 1.0; | ||||||||||
// Is wrong the reference from NASA? | ||||||||||
// Original max(min(gamma, 0.5), 1.0) always gives 1 as result. | ||||||||||
var.interDestrFactor = min(max(intermittency_i, 0.5), 1.0); | ||||||||||
|
||||||||||
} else { | ||||||||||
/*--- Do not modify the production. ---*/ | ||||||||||
var.intermittency = 1.0; | ||||||||||
var.interDestrFactor = 1.0; | ||||||||||
} | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
/*--- Compute production, destruction and cross production and jacobian ---*/ | ||||||||||
su2double Production = 0.0, Destruction = 0.0, CrossProduction = 0.0; | ||||||||||
|
@@ -283,7 +323,7 @@ | |||||||||
struct Bsl { | ||||||||||
template <class MatrixType> | ||||||||||
static void get(const su2double* vorticity, unsigned short, const MatrixType&, CSAVariables& var) { | ||||||||||
var.Omega = GeometryToolbox::Norm(3, vorticity); | ||||||||||
var.Omega = GeometryToolbox::Norm(3, vorticity)*(1.0 + var.beta_PGO); | ||||||||||
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. I am not familiar with the PGOMGA model but my guess is that we can better fit it into the current modular structure than it is done here. E.g. under the Currently also in the ComputeResidual routine there is specific PGOMGA contributions which would be great to move into specialized PGOMGA contributions following the current structure |
||||||||||
} | ||||||||||
}; | ||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -42,6 +42,7 @@ class CTurbSAVariable final : public CTurbVariable { | |||
VectorType DES_LengthScale; | ||||
VectorType Vortex_Tilting; | ||||
|
||||
|
||||
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.
Suggested change
|
||||
public: | ||||
/*! | ||||
* \brief Constructor of the class. | ||||
|
@@ -87,4 +88,5 @@ class CTurbSAVariable final : public CTurbVariable { | |||
*/ | ||||
inline su2double GetVortex_Tilting(unsigned long iPoint) const override { return Vortex_Tilting(iPoint); } | ||||
|
||||
|
||||
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.
Suggested change
|
||||
}; |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1413,6 +1413,7 @@ void CFlowOutput::SetVolumeOutputFieldsScalarPrimitive(const CConfig* config) { | |||
|
||||
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) { | ||||
AddVolumeOutput("EDDY_VISCOSITY", "Eddy_Viscosity", "PRIMITIVE", "Turbulent eddy viscosity"); | ||||
|
||||
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.
Suggested change
|
||||
} | ||||
|
||||
} | ||||
|
@@ -1544,6 +1545,7 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con | |||
SetVolumeOutputValue("EDDY_VISCOSITY", iPoint, Node_Flow->GetEddyViscosity(iPoint)); | ||||
SetVolumeOutputValue("TURB_DELTA_TIME", iPoint, Node_Turb->GetDelta_Time(iPoint)); | ||||
SetVolumeOutputValue("TURB_CFL", iPoint, Node_Turb->GetLocalCFL(iPoint)); | ||||
|
||||
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.
Suggested change
|
||||
} | ||||
|
||||
if (config->GetSAParsedOptions().bc) { | ||||
|
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.
Please add the DOI address of your reference somewhere (maybe here), i.e. some
https://doi.org/<the DOI string>
address