Skip to content

Commit 28bc96d

Browse files
committed
testing with CENTRAL_INC_JACOBIAN_FIX_FACTOR
1 parent c68b498 commit 28bc96d

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,9 @@ class CConfig {
594594
Kappa_4th_Flow, /*!< \brief JST 4th order dissipation coefficient for flow equations. */
595595
Kappa_2nd_Heat, /*!< \brief 2nd order dissipation coefficient for heat equation. */
596596
Kappa_4th_Heat, /*!< \brief 4th order dissipation coefficient for heat equation. */
597-
Cent_Jac_Fix_Factor; /*!< \brief Multiply the dissipation contribution to the Jacobian of central schemes
597+
Cent_Jac_Fix_Factor, /*!< \brief Multiply the dissipation contribution to the Jacobian of central schemes
598598
by this factor to make the global matrix more diagonal dominant. */
599+
Cent_Inc_Jac_Fix_Factor; /*!< \brief Multiply the dissipation contribution to the Jacobian of incompressible central schemes */
599600
su2double Geo_Waterline_Location; /*!< \brief Location of the waterline. */
600601

601602
su2double Min_Beta_RoeTurkel, /*!< \brief Minimum value of Beta for the Roe-Turkel low Mach preconditioner. */
@@ -4538,6 +4539,12 @@ class CConfig {
45384539
*/
45394540
su2double GetCent_Jac_Fix_Factor(void) const { return Cent_Jac_Fix_Factor; }
45404541

4542+
/*!
4543+
* \brief Factor by which to multiply the dissipation contribution to Jacobians of incompressible central schemes.
4544+
* \return The factor.
4545+
*/
4546+
su2double GetCent_Inc_Jac_Fix_Factor(void) const { return Cent_Inc_Jac_Fix_Factor; }
4547+
45414548
/*!
45424549
* \brief Get the kind of integration scheme (explicit or implicit)
45434550
* for the adjoint flow equations.

Common/src/CConfig.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,8 @@ void CConfig::SetConfig_Options() {
17911791
addBoolOption("USE_ACCURATE_FLUX_JACOBIANS", Use_Accurate_Jacobians, false);
17921792
/*!\brief CENTRAL_JACOBIAN_FIX_FACTOR \n DESCRIPTION: Improve the numerical properties (diagonal dominance) of the global Jacobian matrix, 3 to 4 is "optimum" (central schemes) \ingroup Config*/
17931793
addDoubleOption("CENTRAL_JACOBIAN_FIX_FACTOR", Cent_Jac_Fix_Factor, 4.0);
1794+
/*!\brief CENTRAL_JACOBIAN_FIX_FACTOR \n DESCRIPTION: Control numerical properties of the global Jacobian matrix using a multiplication factor for incompressible central schemes \ingroup Config*/
1795+
addDoubleOption("CENTRAL_INC_JACOBIAN_FIX_FACTOR", Cent_Inc_Jac_Fix_Factor, 1.0);
17941796

17951797
/*!\brief CONV_NUM_METHOD_ADJFLOW
17961798
* \n DESCRIPTION: Convective numerical method for the adjoint solver.

SU2_CFD/include/numerics/flow/convection/centered.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ class CCentLaxInc_Flow final : public CNumerics {
252252
variable_density, /*!< \brief Variable density incompressible flows. */
253253
energy; /*!< \brief computation with the energy equation. */
254254

255+
su2double fix_factor; /*!< \brief Fix factor for Jacobians. */
256+
255257
su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
256258
su2double** Jacobian_j = nullptr; /*!< \brief The Jacobian w.r.t. point j after computation. */
257259

@@ -312,6 +314,8 @@ class CCentJSTInc_Flow final : public CNumerics {
312314
variable_density, /*!< \brief Variable density incompressible flows. */
313315
energy; /*!< \brief computation with the energy equation. */
314316

317+
su2double fix_factor; /*!< \brief Fix factor for Jacobians. */
318+
315319
su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
316320
su2double** Jacobian_j = nullptr; /*!< \brief The Jacobian w.r.t. point j after computation. */
317321

SU2_CFD/src/numerics/flow/convection/centered.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ CCentLaxInc_Flow::CCentLaxInc_Flow(unsigned short val_nDim, unsigned short val_n
344344
variable_density = (config->GetKind_DensityModel() == VARIABLE);
345345
/* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
346346
dynamic_grid = config->GetDynamic_Grid();
347+
fix_factor = config->GetCent_Inc_Jac_Fix_Factor();
347348
energy = config->GetEnergy_Equation();
348349

349350
/*--- Artificial dissipation part ---*/
@@ -531,8 +532,8 @@ CNumerics::ResidualType<> CCentLaxInc_Flow::ComputeResidual(const CConfig* confi
531532
for (jVar = 0; jVar < nVar; jVar++) {
532533
ProjFlux[iVar] += Precon[iVar][jVar]*Epsilon_0*Diff_V[jVar]*StretchingFactor*MeanLambda;
533534
if (implicit) {
534-
Jacobian_i[iVar][jVar] += Precon[iVar][jVar]*Epsilon_0*StretchingFactor*MeanLambda;
535-
Jacobian_j[iVar][jVar] -= Precon[iVar][jVar]*Epsilon_0*StretchingFactor*MeanLambda;
535+
Jacobian_i[iVar][jVar] += fix_factor*Precon[iVar][jVar]*Epsilon_0*StretchingFactor*MeanLambda;
536+
Jacobian_j[iVar][jVar] -= fix_factor*Precon[iVar][jVar]*Epsilon_0*StretchingFactor*MeanLambda;
536537
}
537538
}
538539
}
@@ -564,6 +565,7 @@ CCentJSTInc_Flow::CCentJSTInc_Flow(unsigned short val_nDim, unsigned short val_n
564565
energy = config->GetEnergy_Equation();
565566
/* A grid is defined as dynamic if there's rigid grid movement or grid deformation AND the problem is time domain */
566567
dynamic_grid = config->GetDynamic_Grid();
568+
fix_factor = config->GetCent_Inc_Jac_Fix_Factor();
567569

568570
/*--- Artifical dissipation part ---*/
569571

@@ -759,8 +761,8 @@ CNumerics::ResidualType<> CCentJSTInc_Flow::ComputeResidual(const CConfig* confi
759761
for (jVar = 0; jVar < nVar; jVar++) {
760762
ProjFlux[iVar] += Precon[iVar][jVar]*(Epsilon_2*Diff_V[jVar] - Epsilon_4*Diff_Lapl[jVar])*StretchingFactor*MeanLambda;
761763
if (implicit) {
762-
Jacobian_i[iVar][jVar] += Precon[iVar][jVar]*(Epsilon_2 + Epsilon_4*su2double(Neighbor_i+1))*StretchingFactor*MeanLambda;
763-
Jacobian_j[iVar][jVar] -= Precon[iVar][jVar]*(Epsilon_2 + Epsilon_4*su2double(Neighbor_j+1))*StretchingFactor*MeanLambda;
764+
Jacobian_i[iVar][jVar] += fix_factor*Precon[iVar][jVar]*(Epsilon_2 + Epsilon_4*su2double(Neighbor_i+1))*StretchingFactor*MeanLambda;
765+
Jacobian_j[iVar][jVar] -= fix_factor*Precon[iVar][jVar]*(Epsilon_2 + Epsilon_4*su2double(Neighbor_j+1))*StretchingFactor*MeanLambda;
764766
}
765767
}
766768
}

0 commit comments

Comments
 (0)