@@ -2810,18 +2810,17 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28102810 su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR];
28112811 su2double Volume_nM1, Volume_nP1, TimeStep;
28122812 const su2double *Normal = nullptr , *GridVel_i = nullptr , *GridVel_j = nullptr ;
2813- su2double Density, Cp ;
2813+ su2double Density;
28142814
28152815 const bool implicit = (config->GetKind_TimeIntScheme () == EULER_IMPLICIT);
28162816 const bool first_order = (config->GetTime_Marching () == TIME_MARCHING::DT_STEPPING_1ST);
28172817 const bool second_order = (config->GetTime_Marching () == TIME_MARCHING::DT_STEPPING_2ND);
28182818 const bool energy = config->GetEnergy_Equation ();
28192819
2820- const int ndim = nDim ;
2821- auto V2U = [ndim ](su2double Density, su2double Cp , const su2double* V, su2double* U) {
2820+ const int nvar = nVar ;
2821+ auto V2U = [nvar ](su2double Density, const su2double* V, su2double* U) {
28222822 U[0 ] = Density;
2823- for (int iDim = 0 ; iDim < ndim; iDim++) U[iDim+1 ] = Density*V[iDim+1 ];
2824- U[ndim+1 ] = Density*Cp*V[ndim+1 ];
2823+ for (int iVar = 1 ; iVar < nvar; ++iVar) U[iVar] = Density * V[iVar];
28252824 };
28262825
28272826 /* --- Store the physical time step ---*/
@@ -2848,16 +2847,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28482847 V_time_n = nodes->GetSolution_time_n (iPoint);
28492848 V_time_nP1 = nodes->GetSolution (iPoint);
28502849
2851- /* --- Access the density and Cp at this node (constant for now). ---*/
2850+ /* --- Access the density at this node (constant for now). ---*/
28522851
28532852 Density = nodes->GetDensity (iPoint);
2854- Cp = nodes->GetSpecificHeatCp (iPoint);
28552853
28562854 /* --- Compute the conservative variable vector for all time levels. ---*/
28572855
2858- V2U (Density, Cp, V_time_nM1, U_time_nM1);
2859- V2U (Density, Cp, V_time_n, U_time_n);
2860- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2856+ V2U (Density, V_time_nM1, U_time_nM1);
2857+ V2U (Density, V_time_n, U_time_n);
2858+ V2U (Density, V_time_nP1, U_time_nP1);
28612859
28622860 /* --- CV volume at time n+1. As we are on a static mesh, the volume
28632861 of the CV will remained fixed for all time steps. ---*/
@@ -2878,13 +2876,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28782876 /* --- Compute the Jacobian contribution due to the dual time source term. ---*/
28792877
28802878 if (implicit) {
2881- su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
2882-
2883- for (iDim = 0 ; iDim < nDim; iDim++)
2884- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
2879+ su2double delta = (second_order ? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
28852880
2886- if (energy) delta *= Cp;
2887- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
2881+ for (iVar = 1 ; iVar < nVar; ++iVar) Jacobian.AddVal2Diag (iPoint, iVar, delta);
28882882 }
28892883 }
28902884 END_SU2_OMP_FOR
@@ -2909,8 +2903,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29092903
29102904 V_time_n = nodes->GetSolution_time_n (iPoint);
29112905 Density = nodes->GetDensity (iPoint);
2912- Cp = nodes->GetSpecificHeatCp (iPoint);
2913- V2U (Density, Cp, V_time_n, U_time_n);
2906+ V2U (Density, V_time_n, U_time_n);
29142907
29152908 GridVel_i = geometry->nodes ->GetGridVel (iPoint);
29162909
@@ -2965,8 +2958,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29652958
29662959 V_time_n = nodes->GetSolution_time_n (iPoint);
29672960 Density = nodes->GetDensity (iPoint);
2968- Cp = nodes->GetSpecificHeatCp (iPoint);
2969- V2U (Density, Cp, V_time_n, U_time_n);
2961+ V2U (Density, V_time_n, U_time_n);
29702962
29712963 for (iVar = 0 ; iVar < nVar-!energy; iVar++)
29722964 LinSysRes (iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2992,16 +2984,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29922984 V_time_n = nodes->GetSolution_time_n (iPoint);
29932985 V_time_nP1 = nodes->GetSolution (iPoint);
29942986
2995- /* --- Access the density and Cp at this node (constant for now). ---*/
2987+ /* --- Access the density at this node (constant for now). ---*/
29962988
29972989 Density = nodes->GetDensity (iPoint);
2998- Cp = nodes->GetSpecificHeatCp (iPoint);
29992990
30002991 /* --- Compute the conservative variable vector for all time levels. ---*/
30012992
3002- V2U (Density, Cp, V_time_nM1, U_time_nM1);
3003- V2U (Density, Cp, V_time_n, U_time_n);
3004- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2993+ V2U (Density, V_time_nM1, U_time_nM1);
2994+ V2U (Density, V_time_n, U_time_n);
2995+ V2U (Density, V_time_nP1, U_time_nP1);
30052996
30062997 /* --- CV volume at time n-1 and n+1. In the case of dynamically deforming
30072998 grids, the volumes will change. On rigidly transforming grids, the
@@ -3027,11 +3018,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30273018 if (implicit) {
30283019 su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
30293020
3030- for (iDim = 0 ; iDim < nDim; iDim++)
3031- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
3032-
3033- if (energy) delta *= Cp;
3034- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
3021+ for (iVar = 1 ; iVar < nVar; ++iVar)
3022+ Jacobian.AddVal2Diag (iPoint, iVar, delta);
30353023 }
30363024 }
30373025 END_SU2_OMP_FOR
0 commit comments