Skip to content

Commit 25ef2c8

Browse files
committed
option 2 discretisation
1 parent 02878dd commit 25ef2c8

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

SU2_CFD/include/numerics/turbulent/turb_diffusion.hpp

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -274,28 +274,18 @@ class CAvgGrad_TurbSST final : public CAvgGrad_Scalar<FlowIndices> {
274274
const su2double diff_omega_T1 = 0.5*(diff_i_omega + diff_j_omega);
275275

276276
/*--- We aim to treat the cross-diffusion as a diffusion treat rather than a source term.
277-
* Re-writing the cross-diffusion contribution as λ ∇k ∇ω, where λ = (2 (1- F1) ρ σ_ω2)/ ω
278-
* and expanding using the product rule gives: ∇(λk∇ω) - k ∇(λ∇ω).
279-
* Discretising using FVM, gives a diffusion coefficient of: (λk)_ij - k_i λ_ij. ---*/
277+
* Re-writing the cross-diffusion contribution as λ/w ∇w ∇k, where λ = (2 (1- F1) ρ σ_ω2)
278+
* and expanding using the product rule for divergence theorem gives: ∇(λ∇k) - w ∇(λ∇k).
279+
* Discretising using FVM, gives: (λ_dw)_ij ∇k - w ∇(λ∇k); where λ_dw is λ_ij/w_ij. ---*/
280280

281-
const su2double lambda_i = 2 * (1 - F1_i) * Density_i * sigma_omega_i / ScalarVar_i[1];
282-
const su2double lambda_j = 2 * (1 - F1_j) * Density_j * sigma_omega_j / ScalarVar_j[1];
281+
const su2double lambda_i = 2 * (1 - F1_i) * Density_i * sigma_omega_i;
282+
const su2double lambda_j = 2 * (1 - F1_j) * Density_j * sigma_omega_j;
283283
const su2double lambda_ij = 0.5 * (lambda_i + lambda_j);
284-
const su2double k_ij = 0.5 * (ScalarVar_i[0] + ScalarVar_j[0]);
284+
const su2double w_ij = 0.5 * (ScalarVar_i[1] + ScalarVar_j[1]);
285285

286-
const su2double diff_omega_T2 = lambda_ij * k_ij;
286+
const su2double diff_omega_T2 = lambda_ij;
287287

288-
/*--- clipping k_c: if clipped to this, 0 diffusion is possible which greatly affects
289-
* convergence and accuracy. clipping to k_ij is better if needed, testing showed clipping
290-
* is not required. REMOVE LATER if more testing shows it is redundant ---*/
291-
const su2double mu_ij = 0.5 * (Laminar_Viscosity_i + Laminar_Viscosity_j);
292-
const su2double mut_ij = 0.5 * (Eddy_Viscosity_i + Eddy_Viscosity_j);
293-
const su2double Coi = 2 * sigma_omega_i * (1 - F1_i);
294-
const su2double Coj = 2 * sigma_omega_j * (1 - F1_j);
295-
const su2double Coij = 0.5 * (Coi + Coj);
296-
const su2double k_clip = (diff_omega_T1 + Coij*mu_ij)/(Coij * mut_ij/k_ij); //
297-
298-
const su2double diff_omega_T3 = -ScalarVar_i[0] * lambda_ij;
288+
const su2double diff_omega_T3 = -ScalarVar_i[1] * lambda_ij/w_ij;
299289

300290
const su2double diff_omega = diff_omega_T1 + diff_omega_T2 + diff_omega_T3;
301291

@@ -305,32 +295,35 @@ class CAvgGrad_TurbSST final : public CAvgGrad_Scalar<FlowIndices> {
305295
CNumerics::DiffCoeff_kw[2] = diff_omega_T1;
306296
CNumerics::DiffCoeff_kw[3] = diff_omega_T2;
307297
CNumerics::DiffCoeff_kw[4] = diff_omega_T3;
308-
CNumerics::DiffCoeff_kw[5] = k_clip;
298+
CNumerics::DiffCoeff_kw[5] = lambda_ij;
309299

310300
Flux[0] = diff_kine*Proj_Mean_GradScalarVar[0];
311-
Flux[1] = (diff_omega_T1 + diff_omega_T2 + diff_omega_T3)*Proj_Mean_GradScalarVar[1];
301+
Flux[1] = diff_omega_T1*Proj_Mean_GradScalarVar[1] + (diff_omega_T2 + diff_omega_T3)*Proj_Mean_GradScalarVar[0];
312302

313303
/*--- For Jacobians -> Use of TSL (Thin Shear Layer) approx. to compute derivatives of the gradients ---*/
314-
//Using Frozen Coefficient Jacobians, for stability during debugging.
315304
if (implicit) {
316305
const su2double proj_on_rho_i = proj_vector_ij/Density_i;
317306
const su2double proj_on_rho_j = proj_vector_ij/Density_j;
318-
Jacobian_i[0][0] = -diff_kine*proj_on_rho_i; Jacobian_i[0][1] = 0.0;
319-
Jacobian_i[1][0] = 0.0; Jacobian_i[1][1] = -diff_omega*proj_on_rho_i;
307+
Jacobian_i[0][0] = -diff_kine*proj_on_rho_i;
308+
Jacobian_i[0][1] = 0.0;
309+
Jacobian_i[1][0] = (diff_omega_T2+diff_omega_T3)*-proj_on_rho_i;
310+
Jacobian_i[1][1] = -diff_omega_T1*proj_on_rho_i;
320311

321-
Jacobian_j[0][0] = diff_kine*proj_on_rho_j; Jacobian_j[0][1] = 0.0;
322-
Jacobian_j[1][0] = 0.0; Jacobian_j[1][1] = diff_omega*proj_on_rho_j;
312+
Jacobian_j[0][0] = diff_kine*proj_on_rho_j;
313+
Jacobian_j[0][1] = 0.0;
314+
Jacobian_j[1][0] = (diff_omega_T2+diff_omega_T3)*proj_on_rho_j;
315+
Jacobian_j[1][1] = diff_omega_T1*proj_on_rho_j;
323316

324317
if (use_accurate_jacobians) {
325318
Jacobian_i[0][0] = -diff_kine*proj_on_rho_i;
326319
Jacobian_i[0][1] = 0.0;
327-
Jacobian_i[1][0] = -lambda_ij/2 * Proj_Mean_GradScalarVar[1];
328-
Jacobian_i[1][1] = (-k_ij+ScalarVar_i[0]) * (lambda_i/(2*ScalarVar_i[1]*ScalarVar_i[1])) * Proj_Mean_GradScalarVar[1] + diff_omega*-proj_on_rho_i ;
320+
Jacobian_i[1][0] = (diff_omega_T2 + diff_omega_T3)*-proj_on_rho_i;
321+
Jacobian_i[1][1] = -proj_on_rho_i * diff_omega_T1 - 2*lambda_ij*ScalarVar_j[1]/pow(ScalarVar_i[1]+ScalarVar_j[1],2) * Proj_Mean_GradScalarVar[0];
329322

330323
Jacobian_j[0][0] = diff_kine*proj_on_rho_j;
331324
Jacobian_j[0][1] = 0.0;
332-
Jacobian_j[1][0] = lambda_ij/2 * Proj_Mean_GradScalarVar[1];
333-
Jacobian_j[1][1] = (-k_ij+ScalarVar_i[0]) * (lambda_j/(2*ScalarVar_j[1]*ScalarVar_j[1])) * Proj_Mean_GradScalarVar[1] + diff_omega*proj_on_rho_j;
325+
Jacobian_j[1][0] = (diff_omega_T2 + diff_omega_T3)*proj_on_rho_j;
326+
Jacobian_j[1][1] = proj_on_rho_j * diff_omega_T1 + 2*lambda_ij*ScalarVar_i[1]/pow(ScalarVar_i[1]+ScalarVar_j[1],2) * Proj_Mean_GradScalarVar[0];
334327
}
335328
}
336329
}

0 commit comments

Comments
 (0)