Skip to content

Commit 823c335

Browse files
committed
negative model
1 parent 57db642 commit 823c335

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class CAvgGrad_TurbSA_Neg final : public CAvgGrad_Scalar<FlowIndices> {
132132

133133
const su2double sigma = 2.0/3.0;
134134
const su2double cn1 = 16.0;
135+
const su2double cb2 = 0.622;
135136

136137
/*!
137138
* \brief Adds any extra variables to AD
@@ -151,26 +152,43 @@ class CAvgGrad_TurbSA_Neg final : public CAvgGrad_Scalar<FlowIndices> {
151152
const su2double nu_j = Laminar_Viscosity_j/Density_j;
152153

153154
const su2double nu_ij = 0.5*(nu_i+nu_j);
154-
const su2double nu_tilde_ij = 0.5*(ScalarVar_i[0] + ScalarVar_j[0]);
155-
156-
su2double nu_e;
157-
158-
if (nu_tilde_ij > 0.0) {
159-
nu_e = nu_ij + nu_tilde_ij;
155+
const su2double nu_tilde_i = ScalarVar_i[0];
156+
const su2double nu_tilde_j = ScalarVar_j[0];
157+
const su2double nu_tilde_ij = 0.5*(nu_tilde_i + nu_tilde_j);
158+
su2double Xi_ij = nu_tilde_ij/nu_ij;
159+
160+
/*--- First Term (LHS) ---*/
161+
su2double fn_ij; //face average fn
162+
163+
if (nu_tilde_ij >= 0.0) {
164+
fn_ij = 1.0;
165+
} else {
166+
fn_ij = (cn1 + Xi_ij*Xi_ij*Xi_ij)/(cn1 - Xi_ij*Xi_ij*Xi_ij);
160167
}
161-
else {
162-
const su2double Xi = nu_tilde_ij/nu_ij;
163-
const su2double fn = (cn1 + Xi*Xi*Xi)/(cn1 - Xi*Xi*Xi);
164-
nu_e = nu_ij + fn*nu_tilde_ij;
168+
169+
/*--- Second Term (LHS) ---*/
170+
su2double zeta_i = ((1 + cb2)*nu_tilde_ij - cb2*nu_tilde_i)/nu_ij;
171+
su2double fn_i;
172+
if (zeta_i >= 0.0) {
173+
fn_i = 1.0;
174+
} else {
175+
fn_i = (cn1 + zeta_i*zeta_i*zeta_i)/(cn1 - zeta_i*zeta_i*zeta_i);
165176
}
166177

167-
Flux[0] = nu_e*Proj_Mean_GradScalarVar[0]/sigma;
178+
/* Following Diskin's implementation from 10.2514/1.J064629, they propose a new fn function
179+
to be evaluated at the cell to maintain positivity in the diffusion coefficient, which is
180+
used in both terms. The new fn term averaged across the face reverts to the original fn
181+
function. */
182+
183+
su2double term_1 = (nu_ij + (1 + cb2)*nu_tilde_ij*fn_i) * Proj_Mean_GradScalarVar[0]/sigma;
184+
su2double term_2 = cb2*nu_tilde_i*fn_i* Proj_Mean_GradScalarVar[0]/sigma;
185+
Flux[0] = term_1 - term_2;
168186

169187
/*--- For Jacobians -> Use of TSL approx. to compute derivatives of the gradients ---*/
170188

171-
if (implicit) {
172-
Jacobian_i[0][0] = (0.5*Proj_Mean_GradScalarVar[0]-nu_e*proj_vector_ij)/sigma;
173-
Jacobian_j[0][0] = (0.5*Proj_Mean_GradScalarVar[0]+nu_e*proj_vector_ij)/sigma;
189+
if (implicit) {
190+
Jacobian_i[0][0] = (0.5*Proj_Mean_GradScalarVar[0]-nu_ij*proj_vector_ij)/sigma;
191+
Jacobian_j[0][0] = (0.5*Proj_Mean_GradScalarVar[0]+nu_ij*proj_vector_ij)/sigma;
174192
}
175193
}
176194

0 commit comments

Comments
 (0)