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

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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 @@ -3475,11 +3475,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
saParsedOptions = ParseSAOptions(SA_Options, nSA_Options, rank);
}

/*--- 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;
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth including the contribution to the Jacobian?

}

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