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

SA 2D axisymmetric source terms #2197

Merged
merged 23 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d90e8e1
Implemented SA axisymmetric source terms
Corentinthomee Jan 12, 2024
32144a2
Fix reorder warning
Corentinthomee Jan 12, 2024
d9f6fa2
Remove useless call to getAxisymmetric()
Corentinthomee Jan 12, 2024
0e8fd7d
Merge branch 'develop' into master
Corentinthomee Jan 12, 2024
e2b1778
Merge branch 'develop' into master
bigfooted Feb 7, 2024
ac9fffe
Merge branch 'develop' into master
bigfooted Feb 8, 2024
6853d25
Merge branch 'develop' into master
Cristopher-Morales Feb 26, 2024
06b33ee
Merge branch 'develop' into master
Cristopher-Morales Feb 28, 2024
4c1f277
Merge branch 'develop' into master
bigfooted Mar 5, 2024
347bf02
Merge branch 'develop' into master
Cristopher-Morales Mar 14, 2024
afbd80b
Merge branch 'develop' into master
Cristopher-Morales Mar 18, 2024
a196698
Merge branch 'develop' into master
Cristopher-Morales Apr 3, 2024
fa2a704
Merge branch 'develop' into master
Cristopher-Morales Apr 15, 2024
f6eff50
Merge branch 'develop' into master
bigfooted Apr 20, 2024
fa1a42d
Merge branch 'develop' into master
Cristopher-Morales Apr 21, 2024
c785933
Merge branch 'develop' into master
bigfooted May 10, 2024
dc6d3d7
Merge branch 'develop' into master
Cristopher-Morales May 16, 2024
22ff5aa
Merge branch 'develop' into master
Cristopher-Morales May 18, 2024
436934d
Merge branch 'develop' into master
Cristopher-Morales Jun 10, 2024
0bf999c
Merge branch 'develop' into master
bigfooted Jul 16, 2024
bb0f9de
Merge branch 'develop' into master
pcarruscag Aug 4, 2024
169d591
Merge branch 'develop' into master
bigfooted Aug 5, 2024
b947b55
Merge branch 'develop' into master
bigfooted Aug 5, 2024
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
5 changes: 0 additions & 5 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3487,11 +3487,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("COMPRESSIBILITY-WILCOX only supported for SOLVER= RANS", CURRENT_FUNCTION);
}

/*--- Check if turbulence model can be used for AXISYMMETRIC case---*/
if (Axisymmetric && Kind_Turb_Model != TURB_MODEL::NONE && Kind_Turb_Model != TURB_MODEL::SST){
SU2_MPI::Error("Axisymmetry is currently only supported for KIND_TURB_MODEL chosen as SST", CURRENT_FUNCTION);
}

/*--- Postprocess LM_OPTIONS into structure. ---*/
if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) {
lmParsedOptions = ParseLMOptions(LM_Options, nLM_Options, rank, Kind_Turb_Model);
Expand Down
49 changes: 49 additions & 0 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,41 @@ class CSourceBase_TurbSA : public CNumerics {

const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */
const SA_ParsedOptions options; /*!< \brief Struct with SA options. */
const bool axisymmetric = false;

bool transition_LM;

/*!
* \brief Add contribution from diffusion due to axisymmetric formulation to 2D residual
*/
inline void ResidualAxisymmetricDiffusion(su2double sigma) {
if (Coord_i[1] < EPS) return;

const su2double yinv = 1.0 / Coord_i[1];
const su2double& nue = ScalarVar_i[0];

const auto& density = V_i[idx.Density()];
const auto& laminar_viscosity = V_i[idx.LaminarViscosity()];

const su2double nu = laminar_viscosity/density;

su2double nu_e;

if (options.version == SA_OPTIONS::NEG && nue < 0.0) {
const su2double cn1 = 16.0;
const su2double Xi = nue / nu;
const su2double fn = (cn1 + Xi*Xi*Xi) / (cn1 - Xi*Xi*Xi);
nu_e = nu + fn * nue;
} else {
nu_e = nu + nue;
}

/* Diffusion source term */
const su2double dv_axi = (1.0/sigma)*nu_e*ScalarVar_Grad_i[0][1];

Residual += yinv * dv_axi * Volume;
pcarruscag marked this conversation as resolved.
Show resolved Hide resolved
}

public:
/*!
* \brief Constructor of the class.
Expand All @@ -90,6 +122,7 @@ class CSourceBase_TurbSA : public CNumerics {
: CNumerics(nDim, 1, config),
idx(nDim, config->GetnSpecies()),
options(config->GetSAParsedOptions()),
axisymmetric(config->GetAxisymmetric()),
transition_LM(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
/*--- Setup the Jacobian pointer, we need to return su2double** but we know
* the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/
Expand Down Expand Up @@ -217,6 +250,9 @@ class CSourceBase_TurbSA : public CNumerics {
SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]);

Residual = (Production - Destruction + CrossProduction) * Volume;

if (axisymmetric) ResidualAxisymmetricDiffusion(var.sigma);

Jacobian_i[0] *= Volume;
}

Expand Down Expand Up @@ -520,6 +556,19 @@ class CCompressibilityCorrection final : public ParentClass {
const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume;
const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection;

/*--- Axisymmetric contribution ---*/
if (this->axisymmetric && this->Coord_i[1] > EPS) {
const su2double yinv = 1.0 / this->Coord_i[1];
const su2double nue = ScalarVar_i[0];
const su2double v = V_i[idx.Velocity() + 1];

const su2double d_axiCorrection = 2.0 * c5 * nue * pow(v * yinv / sound_speed, 2) * Volume;
const su2double axiCorrection = 0.5 * nue * d_axiCorrection;

this->Residual -= axiCorrection;
this->Jacobian_i[0] -= d_axiCorrection;
}

this->Residual -= CompCorrection;
this->Jacobian_i[0] -= d_CompCorrection;

Expand Down
7 changes: 7 additions & 0 deletions SU2_CFD/src/solvers/CTurbSASolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ void CTurbSASolver::Viscous_Residual(const unsigned long iEdge, const CGeometry*
void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_container,
CNumerics **numerics_container, CConfig *config, unsigned short iMesh) {

bool axisymmetric = config->GetAxisymmetric();

const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
const bool harmonic_balance = (config->GetTime_Marching() == TIME_MARCHING::HARMONIC_BALANCE);
const bool transition_BC = config->GetSAParsedOptions().bc;
Expand Down Expand Up @@ -383,6 +385,11 @@ void CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver **solver_contai
numerics->SetIntermittency(solver_container[TRANS_SOL]->GetNodes()->GetSolution(iPoint, 0));
}

if (axisymmetric) {
/*--- Set y coordinate ---*/
numerics->SetCoord(geometry->nodes->GetCoord(iPoint), geometry->nodes->GetCoord(iPoint));
}

/*--- Compute the source term ---*/

auto residual = numerics->ComputeResidual(config);
Expand Down