-
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 3 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 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||||||||||||||||||||
| /*! | ||||||||||||||||||||||||
| * \file trans_convection.hpp | ||||||||||||||||||||||||
| * \brief Delarations of numerics classes for discretization of | ||||||||||||||||||||||||
| * convective fluxes in transition problems. | ||||||||||||||||||||||||
| * \author R. Roos | ||||||||||||||||||||||||
| * \version 7.4.0 "Blackbird" | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * SU2 Project Website: https://su2code.github.io | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * The SU2 Project is maintained by the SU2 Foundation | ||||||||||||||||||||||||
| * (http://su2foundation.org) | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * SU2 is free software; you can redistribute it and/or | ||||||||||||||||||||||||
| * modify it under the terms of the GNU Lesser General Public | ||||||||||||||||||||||||
| * License as published by the Free Software Foundation; either | ||||||||||||||||||||||||
| * version 2.1 of the License, or (at your option) any later version. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * SU2 is distributed in the hope that it will be useful, | ||||||||||||||||||||||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||
| * Lesser General Public License for more details. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * You should have received a copy of the GNU Lesser General Public | ||||||||||||||||||||||||
| * License along with SU2. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| #pragma once | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| #include "../../scalar/scalar_convection.hpp" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /*! | ||||||||||||||||||||||||
| * \class CUpwSca_TransEN | ||||||||||||||||||||||||
| * \brief Class for doing a scalar upwind solver for the e^N transition model equations. | ||||||||||||||||||||||||
| * \ingroup ConvDiscr | ||||||||||||||||||||||||
| * \author R. Roos. | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| template <class FlowIndices> | ||||||||||||||||||||||||
| class CUpwSca_TransEN final : public CUpwScalar<FlowIndices> { | ||||||||||||||||||||||||
| private: | ||||||||||||||||||||||||
| using Base = CUpwScalar<FlowIndices>; | ||||||||||||||||||||||||
| using Base::nDim; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| using Base::nDim; |
Outdated
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.
Densities are missing here
Outdated
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.
| Flux[0] = a0*V_i[idx.Density()]*ScalarVar_i[0] + a1*V_j[idx.Density()]*ScalarVar_j[0]; | |
| Flux[0] = a0*V_i[idx.Density()]*ScalarVar_i[0] + a1*V_j[idx.Density()]*ScalarVar_j[0]; |
Outdated
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.
| * \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. | |
| */ | |
| CUpwSca_TransEN(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config) | |
| : CUpwScalar<FlowIndices>(val_nDim, val_nVar, config) {} | |
| * \param[in] val_nDim - Number of dimensions of the problem. | |
| * \param[in] config - Definition of the particular problem. | |
| */ | |
| CUpwSca_TransEN(unsigned short val_nDim, const CConfig* config) | |
| : CUpwScalar<FlowIndices>(val_nDim, 1, config) {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /*! | ||
| * \file trans_diffusion.hpp | ||
| * \brief Declarations of numerics classes for discretization of | ||
| * viscous fluxes in transition problems. | ||
| * \author R. Roos | ||
| * \version 7.4.0 "Blackbird" | ||
| * | ||
| * SU2 Project Website: https://su2code.github.io | ||
| * | ||
| * The SU2 Project is maintained by the SU2 Foundation | ||
| * (http://su2foundation.org) | ||
| * | ||
| * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) | ||
| * | ||
| * SU2 is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2.1 of the License, or (at your option) any later version. | ||
| * | ||
| * SU2 is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with SU2. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
| #pragma once | ||
|
|
||
|
|
||
| #include "../../scalar/scalar_diffusion.hpp" | ||
|
|
||
| /*! | ||
| * \class CAvgGrad_TransEN | ||
| * \brief Class for computing viscous term using average of gradient with correction (e^N transition model). | ||
| * \ingroup ViscDiscr | ||
| * \author R. Roos | ||
| */ | ||
| template <class FlowIndices> | ||
| class CAvgGrad_TransEN final : public CAvgGrad_Scalar<FlowIndices> { | ||
| private: | ||
| using Base = CAvgGrad_Scalar<FlowIndices>; | ||
| using Base::Laminar_Viscosity_i; | ||
| using Base::Laminar_Viscosity_j; | ||
| using Base::Eddy_Viscosity_i; | ||
| using Base::Eddy_Viscosity_j; | ||
| using Base::Density_i; | ||
| using Base::Density_j; | ||
| using Base::ScalarVar_i; | ||
| using Base::ScalarVar_j; | ||
| using Base::Proj_Mean_GradScalarVar; | ||
| using Base::proj_vector_ij; | ||
| using Base::implicit; | ||
| using Base::Flux; | ||
| using Base::Jacobian_i; | ||
| using Base::Jacobian_j; | ||
|
|
||
| const su2double sigma_n = 1.0; | ||
|
|
||
| /*! | ||
| * \brief Adds any extra variables to AD | ||
| */ | ||
| void ExtraADPreaccIn() override {} | ||
|
|
||
| /*! | ||
| * \brief SA specific steps in the ComputeResidual method | ||
| * \param[in] config - Definition of the particular problem. | ||
| */ | ||
| void FinishResidualCalc(const CConfig* config) override { | ||
|
|
||
| /*--- Compute mean effective dynamic viscosity ---*/ | ||
| const su2double diff_i_amplification = (Laminar_Viscosity_i + Eddy_Viscosity_i)/sigma_n; | ||
| const su2double diff_j_amplification = (Laminar_Viscosity_j + Eddy_Viscosity_j)/sigma_n; | ||
|
|
||
| const su2double diff_amplification = 0.5*(diff_i_amplification + diff_j_amplification); | ||
|
||
|
|
||
| Flux[0] = diff_amplification*Proj_Mean_GradScalarVar[0]; | ||
|
|
||
| /*--- For Jacobians -> Use of TSL approx. to compute derivatives of the gradients ---*/ | ||
|
|
||
| if (implicit) { | ||
| Jacobian_i[0][0] = (0.5*Proj_Mean_GradScalarVar[0]-diff_amplification*proj_vector_ij); | ||
| //const su2double proj_on_rho_i = proj_vector_ij/Density_i; | ||
| //Jacobian_i[0][0] = -diff_amplification*proj_on_rho_i; | ||
|
|
||
| Jacobian_j[0][0] = (0.5*Proj_Mean_GradScalarVar[0]+diff_amplification*proj_vector_ij); | ||
| //const su2double proj_on_rho_j = proj_vector_ij/Density_j; | ||
| //Jacobian_j[0][0] = diff_amplification*proj_on_rho_j; | ||
| } | ||
| } | ||
|
|
||
| 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] correct_grad - Whether to correct gradient for skewness. | ||
| * \param[in] config - Definition of the particular problem. | ||
| */ | ||
| CAvgGrad_TransEN(unsigned short val_nDim, unsigned short val_nVar, | ||
| bool correct_grad, const CConfig* config) | ||
| : CAvgGrad_Scalar<FlowIndices>(val_nDim, val_nVar, correct_grad, config) {} | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /*! | ||
| * \file trans_sources.hpp | ||
| * \brief Numerics classes for integration of source terms in transition problems. | ||
| * \author R. Roos | ||
| * \version 7.4.0 "Blackbird" | ||
| * | ||
| * SU2 Project Website: https://su2code.github.io | ||
| * | ||
| * The SU2 Project is maintained by the SU2 Foundation | ||
| * (http://su2foundation.org) | ||
| * | ||
| * Copyright 2012-2022, SU2 Contributors (cf. AUTHORS.md) | ||
| * | ||
| * SU2 is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 2.1 of the License, or (at your option) any later version. | ||
| * | ||
| * SU2 is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with SU2. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include "../../../../../Common/include/toolboxes/geometry_toolbox.hpp" | ||
| #include "../../scalar/scalar_sources.hpp" | ||
|
|
||
|
|
||
| /*! | ||
| * \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 g_eff_i, | ||
| g_eff_j, | ||
| g_sep_i, | ||
| g_sep_j; | ||
|
|
||
| su2double Vorticity; | ||
| 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 { | ||
|
|
||
| Residual = 0.0; | ||
| Jacobian_i[0] = 0.0; | ||
|
|
||
| if (dist_i > 1e-10) { | ||
|
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? |
||
|
|
||
| /*--- Source ---*/ | ||
| Residual = Volume; | ||
|
|
||
| /*--- Implicit part ---*/ | ||
| Jacobian_i[0] *= 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.
Formatting.
Should we also include LM in this switch
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks. Updated.
As for the LM option. There are a lot of locations that have this switch. For now I have left the 'case TURB_TRANS_MODEL::LM :' option out as it will be added to develop when the LM PR will be merged. I have done it in this way as in most locations the LM code is not there of course.
I should add that on these LM/EN switch locations the LM implementation has the same code set-up. The thought was that merging an extra case in the switch list would produce no problems?