Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e960644
Starting up eN transition implementation
RichRoos Sep 20, 2022
c4b6fca
General file structure
RichRoos Sep 20, 2022
1347597
Forgot some files. Now compilable structure.
RichRoos Sep 20, 2022
56b93c1
Complilable and runnable dry-case (-d) code
RichRoos Sep 22, 2022
fd51593
Merge branch 'su2code:master' into SU2_feature_eN_PR01
RichRoos Sep 22, 2022
604aadb
Merge branch 'develop' into SU2_feature_eN_PR01
bigfooted Sep 22, 2022
c6e7c90
Removing mesh and fixing lgtm error.
RichRoos Sep 23, 2022
53b7914
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Sep 29, 2022
9fc045d
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Oct 3, 2022
e80c407
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Oct 7, 2022
f928a49
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Oct 13, 2022
d469819
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Oct 19, 2022
f231a7f
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Oct 30, 2022
8cdb955
Merging eN and LM transition model + adding some improvements on eN
RichRoos Nov 5, 2022
3641563
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Nov 5, 2022
2b905f4
Last change to conclude addition of eN to LM.
RichRoos Nov 5, 2022
9508e5e
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Nov 11, 2022
c4ed8c9
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Nov 13, 2022
36b4a00
Cleaning up interaction with SA
RichRoos Nov 13, 2022
988a6bd
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Nov 13, 2022
96628ae
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Nov 24, 2022
c1d6843
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 1, 2022
36fad1b
Reducing N value growth
RichRoos Dec 1, 2022
a30f6a4
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 3, 2022
3618e1a
Slight change in control parameters for better results for smaller grids
RichRoos Dec 5, 2022
0347127
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 6, 2022
aed8767
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 9, 2022
f337507
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 14, 2022
f264b2a
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 19, 2022
cfe99be
Save before difficult? develop merge.
RichRoos Dec 20, 2022
111ad42
Merge remote-tracking branch 'upstream/develop' into SU2_feature_eN_PR01
RichRoos Dec 20, 2022
e80b50f
Create mesh_NACA0012_inv.su2
RichRoos Dec 20, 2022
7390c60
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 20, 2022
90d26ba
Slight changes and better merge of LM and eN code
RichRoos Dec 21, 2022
69055d9
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Dec 21, 2022
c7826ba
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Dec 31, 2022
2bcf4c5
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 9, 2023
4a8c4f7
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 9, 2023
84ab6a5
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 10, 2023
4dd5b85
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 11, 2023
c761a0c
General clean-up and save before merge with local files
RichRoos Jan 12, 2023
c8c050e
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Jan 12, 2023
a076372
Last bit of clean-up. Stable simulation again.
RichRoos Jan 13, 2023
668087c
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 13, 2023
359a123
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 14, 2023
fed8133
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 16, 2023
2b1fc32
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 19, 2023
b7028bc
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 22, 2023
3af0d91
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jan 23, 2023
7274d12
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 1, 2023
2c849ee
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 6, 2023
9e75d31
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 7, 2023
9f1a008
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 12, 2023
85d9931
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 20, 2023
398cd3e
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Feb 22, 2023
6a3a27f
Abs(pInf - p) change
RichRoos Feb 22, 2023
db6e709
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Feb 22, 2023
3bd91c8
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 2, 2023
af49882
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 7, 2023
b5ec705
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 9, 2023
e2de13b
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 13, 2023
3747b22
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 17, 2023
835b705
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 17, 2023
cdd9113
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 20, 2023
173ac5c
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 21, 2023
13029b8
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 22, 2023
4b7e816
Merge branch 'develop' into pr/1765
RichRoos Mar 27, 2023
f1a7a50
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Mar 27, 2023
20c6541
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 27, 2023
2b2c30f
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 29, 2023
a0b6e33
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Mar 30, 2023
443fec6
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 1, 2023
74c2f47
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 3, 2023
09872f6
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 5, 2023
7389eb2
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 10, 2023
07a9321
Reverting some values to achieve transition again
RichRoos Apr 11, 2023
d8f1195
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 12, 2023
11eed9d
Merge branch 'develop' into pr/1765
RichRoos Apr 17, 2023
14807c8
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 22, 2023
8251c65
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Apr 24, 2023
cf992fc
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos May 1, 2023
5f58b05
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos May 10, 2023
f8648e2
Quick test with AFT2019b
RichRoos May 19, 2023
4a8afaf
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos May 19, 2023
8831125
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos May 22, 2023
36089a7
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos May 27, 2023
93b5883
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jun 4, 2023
3c3136a
Quick update with output variables to solve conflict with develop
RichRoos Jun 4, 2023
3293b11
Merge branch 'SU2_feature_eN_PR01' of https://github.com/RichRoos/SU2…
RichRoos Jun 4, 2023
4264ba0
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jun 11, 2023
8be56fd
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jun 28, 2023
543589e
Merge branch 'develop' into SU2_feature_eN_PR01
RichRoos Jul 10, 2023
3bd7d08
Few changes. Mainly removing bug with "dryrun" and the calculation of…
RichRoos Jul 12, 2023
587f22b
small updates
RichRoos Jul 12, 2023
ae58ced
Save point after removal of debug values
RichRoos Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ class CConfig {
Tke_FreeStream, /*!< \brief Total turbulent kinetic energy of the fluid. */
Intermittency_FreeStream, /*!< \brief Freestream intermittency (for sagt transition model) of the fluid. */
TurbulenceIntensity_FreeStream, /*!< \brief Freestream turbulent intensity (for sagt transition model) of the fluid. */
AmplificationFactor_FreeStream, /*!< \brief Freestream amplifictation factor for the eN 1 equation transition model. */
Turb2LamViscRatio_FreeStream, /*!< \brief Ratio of turbulent to laminar viscosity. */
NuFactor_FreeStream, /*!< \brief Ratio of turbulent to laminar viscosity. */
NuFactor_Engine, /*!< \brief Ratio of turbulent to laminar viscosity at the engine. */
Expand Down Expand Up @@ -1934,6 +1935,12 @@ class CConfig {
* \return Non-dimensionalized freestream intermittency.
*/
su2double GetIntermittency_FreeStream(void) const { return Intermittency_FreeStream; }

/*!
* \brief Get the value of the non-dimensionalized freestream amplification factor.
* \return Non-dimensionalized freestream amplification factor.
*/
su2double GetAmplificationFactor_FreeStream(void) const { return AmplificationFactor_FreeStream; }

/*!
* \brief Get the value of the non-dimensionalized freestream turbulence intensity.
Expand Down
2 changes: 2 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,10 +1166,12 @@ inline SA_ParsedOptions ParseSAOptions(const SA_OPTIONS *SA_Options, unsigned sh
enum class TURB_TRANS_MODEL {
NONE, /*!< \brief No transition model. */
LM, /*!< \brief Kind of transition model (Langtry-Menter (LM) for SST and Spalart-Allmaras). */
EN, /*!< \brief Kind of transition model using Amplification factor purely for Spalart-Allmaras*/
};
static const MapType<std::string, TURB_TRANS_MODEL> Trans_Model_Map = {
MakePair("NONE", TURB_TRANS_MODEL::NONE)
MakePair("LM", TURB_TRANS_MODEL::LM)
MakePair("EN", TURB_TRANS_MODEL::EN)
};

/*!
Expand Down
8 changes: 8 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4722,6 +4722,10 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) {
SU2_MPI::Error("The LM transition model is under maintenance.", CURRENT_FUNCTION);
}

if ((Kind_Turb_Model != TURB_MODEL::SA) && Kind_Trans_Model == TURB_TRANS_MODEL::EN) {
SU2_MPI::Error("eN transition model currently only available in combination with SA (basic/FT2) turbulence model!", CURRENT_FUNCTION);
}

if(Turb_Fixed_Values && !OptionIsSet("TURB_FIXED_VALUES_DOMAIN")){
SU2_MPI::Error("TURB_FIXED_VALUES activated, but no domain set with TURB_FIXED_VALUES_DOMAIN.", CURRENT_FUNCTION);
Expand Down Expand Up @@ -6032,6 +6036,10 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
cout << "." << endl;
break;
}
switch (Kind_Trans_Model) {
case TURB_TRANS_MODEL::NONE: break;
case TURB_TRANS_MODEL::EN: cout << "Low-turbulence Transition model: eN 1 equation model (2014)" << endl; break;
}
Copy link
Contributor

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

Copy link
Author

@RichRoos RichRoos Sep 21, 2022

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?

cout << "Hybrid RANS/LES: ";
switch (Kind_HybridRANSLES) {
case NO_HYBRIDRANSLES: cout << "No Hybrid RANS/LES" << endl; break;
Expand Down
83 changes: 83 additions & 0 deletions SU2_CFD/include/numerics/turbulent/transition/trans_convection.hpp
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;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
using Base::nDim;

using Base::V_i;
using Base::V_j;
using Base::a0;
using Base::a1;
using Base::Flux;
using Base::Jacobian_i;
using Base::Jacobian_j;
using Base::ScalarVar_i;
using Base::ScalarVar_j;
using Base::implicit;
using Base::idx;

/*!
* \brief Adds any extra variables to AD.
*/
void ExtraADPreaccIn() override {}
Copy link
Member

Choose a reason for hiding this comment

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

Densities are missing here


/*!
* \brief SA specific steps in the ComputeResidual method
* \param[in] config - Definition of the particular problem.
*/
void FinishResidualCalc(const CConfig* config) override {
Flux[0] = a0*V_i[idx.Density()]*ScalarVar_i[0] + a1*V_j[idx.Density()]*ScalarVar_j[0];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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];


if (implicit) {
Jacobian_i[0][0] = a0;
Jacobian_j[0][0] = a1;
}
}

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.
*/
CUpwSca_TransEN(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config)
: CUpwScalar<FlowIndices>(val_nDim, val_nVar, config) {}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* \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) {}

};
103 changes: 103 additions & 0 deletions SU2_CFD/include/numerics/turbulent/transition/trans_diffusion.hpp
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);
Copy link
Member

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


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) {}
};
93 changes: 93 additions & 0 deletions SU2_CFD/include/numerics/turbulent/transition/trans_sources.hpp
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) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use EPS?
And return early instead of indenting the code


/*--- Source ---*/
Residual = Volume;

/*--- Implicit part ---*/
Jacobian_i[0] *= Volume;
}

AD::SetPreaccOut(Residual);
AD::EndPreacc();

return ResidualType<>(&Residual, &Jacobian_i, nullptr);
}
};

6 changes: 6 additions & 0 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3145,6 +3145,12 @@ class CSolver {
* \return Value of the turbulent frequency.
*/
inline virtual su2double GetOmega_Inf(void) const { return 0; }

/*!
* \brief Get value of the Amplification Factor.
* \return Value of the Amplification Factor.
*/
inline virtual su2double GetAmplificationFactor_Inf() const { return 0; }

/*!
* \brief A virtual member.
Expand Down
Loading