Skip to content
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] Implementation of Amplification Factor Transport(AFT) 2019b tranistion model #2422

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

sun5k
Copy link
Contributor

@sun5k sun5k commented Jan 15, 2025

Proposed Changes

Hi, all.

This PR is for implementing well known subsonic transition model (SA-AFT2019b).

Coder's SA-AFT2019b model is composed of the amplification factor and the logarithmic intermittency transport equation as shown below.
image

Current State

The primary implementation of the model has been completed and is now in the validation. The validation problems are refer : https://doi.org/10.2514/6.2023-3530 and https://doi.org/10.2514/6.2019-0039.

The transition onset location and the amplification factor field are slightly different. I'm still debugging and checking various things.

Validation Problem of Current State

Firstly, I'm trying the validation problem for 2-D problems (flat plate and NLF-0416 airfoil).
The current results are shown below.

S&K Flat plate from https://doi.org/10.2514/6.2023-3530

image

NLF-0416 airfoil from https://doi.org/10.2514/6.2023-3530
image

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

Common/include/option_structure.hpp Fixed Show fixed Hide fixed
@@ -1407,6 +1451,25 @@
AddVolumeOutput("TURB_INDEX", "Turb_index", "PRIMITIVE", "Turbulence index");
break;

case TURB_TRANS_MODEL::AFT:
//nodes -> SetAFT_Wonder_Func(iPoint, HL, H12, dNdRet, Ret0, D_H12, l_H12, m_H12, kv, Rev, Rev0, F_growth, F_crit, PAF, Pg, Dg);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
SU2_CFD/src/solvers/CTransAFTSolver.cpp Fixed Show fixed Hide fixed
AFT2017b
Test_Strain
Copy link
Member

@pcarruscag pcarruscag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍 Looks good but we can re-use a lot of code from the LM solver and see the question about the aux var gradient which looks suspicious.

Comment on lines +1333 to +1335
NONE, /*!< \brief No option / default. */
AFT2017b, /*!< \brief using AFT2017b model. */
AFT2019b /*!< \brief using AFT2019b model. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align the start of the comments and add some links to reference papers.

Comment on lines +1365 to +1368
* \param[in] rank - MPI rank.
* \return Struct with AFT options.
*/
inline AFT_ParsedOptions ParseAFTOptions(const AFT_OPTIONS *AFT_Options, unsigned short nAFT_Options, int rank) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rank is not used, can you remove it from this function and maybe LMOptions if it is also not used there.

Comment on lines +6342 to +6345
switch (Kind_Turb_Model) {
case TURB_MODEL::NONE: SU2_MPI::Error("No turbulence model has been selected but AFT transition model is active.", CURRENT_FUNCTION); break;
case TURB_MODEL::SST: SU2_MPI::Error("k-w SST turbulence model has been selected but AFT transition model is active.", CURRENT_FUNCTION); break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block of code appears twice, please refactor this a little to avoid duplicating it.

Comment on lines +253 to +261
case AFT_CORRELATION::AFT2017b: {
dNdRet = 0.028*(H12 - 1.0) - 0.0345 * exp(-pow(3.87/(H12 -1.0) - 2.52, 2.0));
break;
}

case AFT_CORRELATION::AFT2019b: {
dNdRet = 0.028*(H12 - 1.0) - 0.0345 * exp(-pow(3.87/(H12 -1.0) - 2.52, 2.0));
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if there are other opportunities to avoid repeating formulas.

Suggested change
case AFT_CORRELATION::AFT2017b: {
dNdRet = 0.028*(H12 - 1.0) - 0.0345 * exp(-pow(3.87/(H12 -1.0) - 2.52, 2.0));
break;
}
case AFT_CORRELATION::AFT2019b: {
dNdRet = 0.028*(H12 - 1.0) - 0.0345 * exp(-pow(3.87/(H12 -1.0) - 2.52, 2.0));
break;
}
case AFT_CORRELATION::AFT2017b:
case AFT_CORRELATION::AFT2019b: {
dNdRet = 0.028*(H12 - 1.0) - 0.0345 * exp(-pow(3.87/(H12 -1.0) - 2.52, 2.0));
break;
}

Comment on lines +141 to +166
void FinishResidualCalc(const CConfig* config) override {
const bool implicit = config->GetKind_TimeIntScheme() == EULER_IMPLICIT;

/*--- Compute mean effective dynamic viscosity ---*/
const su2double diff_i_AF = Laminar_Viscosity_i + Eddy_Viscosity_i;
const su2double diff_j_AF = Laminar_Viscosity_j + Eddy_Viscosity_j;
const su2double diff_i_Gamma = Laminar_Viscosity_i + Eddy_Viscosity_i;
const su2double diff_j_Gamma = Laminar_Viscosity_j + Eddy_Viscosity_j;

const su2double diff_AF = 0.5*(diff_i_AF + diff_j_AF);
const su2double diff_Gamma = 0.5*(diff_i_Gamma + diff_j_Gamma);

Flux[0] = diff_AF*Proj_Mean_GradScalarVar[0];
Flux[1] = diff_Gamma*Proj_Mean_GradScalarVar[1];

/*--- For Jacobians -> Use of TSL (Thin Shear Layer) approx. to compute derivatives of the gradients ---*/
if (implicit) {
const su2double proj_on_rho_i = proj_vector_ij/Density_i;
Jacobian_i[0][0] = -diff_AF*proj_on_rho_i; Jacobian_i[0][1] = 0.0;
Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -diff_Gamma*proj_on_rho_i;

const su2double proj_on_rho_j = proj_vector_ij/Density_j;
Jacobian_j[0][0] = diff_AF*proj_on_rho_j; Jacobian_j[0][1] = 0.0;
Jacobian_j[1][0] = 0.0; Jacobian_j[1][1] = diff_Gamma*proj_on_rho_j;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only differs from LM by some constant factors, refactor it to use the same class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to find a way to share the common parts between the LM solver and this one, this way there is too much duplication.

Comment on lines +255 to +263
switch (config->GetKind_Gradient_Method()) {
case GREEN_GAUSS:
SetAuxVar_Gradient_GG(geometry, config);
break;
case WEIGHTED_LEAST_SQUARES:
SetAuxVar_Gradient_LS(geometry, config);
default:
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you computing the AuxVarGradient after you use it above instead of before?

Comment on lines +215 to +219
HLGradTerm = nodes->GetAuxVarGradient(iPoint, 1, 0) * nodes->GetAuxVarGradient(iPoint, 0, 0) + nodes->GetAuxVarGradient(iPoint, 1, 1) * nodes->GetAuxVarGradient(iPoint, 0, 1);

if(nDim == 3) {
HLGradTerm += nodes->GetAuxVarGradient(iPoint, 1, 2) * nodes->GetAuxVarGradient(iPoint, 0, 2);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeometryToolbox SquaredNorm

Comment on lines +203 to +204
su2double Temp3 = flowNodes->GetVelocity(iPoint, 0) * nodes->GetAuxVarGradient(iPoint, 0, 0);
su2double Temp4 = flowNodes->GetVelocity(iPoint, 1) * nodes->GetAuxVarGradient(iPoint, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some documentation please, if the initial aux var grad is 0 then you set the aux var to 0, then its gradient is 0 and this remains 0 forever? Looks like a bug.


/*-- destruction term of Intermeittency(Gamma) --*/
const su2double Dg = c_2 * Density_i * VorticityMag * F_turb * (c_3 * exp(lnIntermittency) - 1.0);
nodes -> SetAFT_Wonder_Func(iPoint, HL, H12, dNdRet, Ret0, D_H12, l_H12, m_H12, kv, Rev, Rev0, F_growth, F_crit, PAF, Pg, Dg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of memory and these variables are only used for post processing (output) right?
If so these can be computed in the output class when setting the output values.
That saves doing this work every iteration and storing all these variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants