@@ -2799,18 +2799,17 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
27992799 su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR];
28002800 su2double Volume_nM1, Volume_nP1, TimeStep;
28012801 const su2double *Normal = nullptr , *GridVel_i = nullptr , *GridVel_j = nullptr ;
2802- su2double Density, Cp ;
2802+ su2double Density;
28032803
28042804 const bool implicit = (config->GetKind_TimeIntScheme () == EULER_IMPLICIT);
28052805 const bool first_order = (config->GetTime_Marching () == TIME_MARCHING::DT_STEPPING_1ST);
28062806 const bool second_order = (config->GetTime_Marching () == TIME_MARCHING::DT_STEPPING_2ND);
28072807 const bool energy = config->GetEnergy_Equation ();
28082808
2809- const int ndim = nDim ;
2810- auto V2U = [ndim ](su2double Density, su2double Cp , const su2double* V, su2double* U) {
2809+ const int nvar = nVar ;
2810+ auto V2U = [nvar ](su2double Density, const su2double* V, su2double* U) {
28112811 U[0 ] = Density;
2812- for (int iDim = 0 ; iDim < ndim; iDim++) U[iDim+1 ] = Density*V[iDim+1 ];
2813- U[ndim+1 ] = Density*Cp*V[ndim+1 ];
2812+ for (int iVar = 1 ; iVar < nvar; ++iVar) U[iVar] = Density * V[iVar];
28142813 };
28152814
28162815 /* --- Store the physical time step ---*/
@@ -2837,16 +2836,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28372836 V_time_n = nodes->GetSolution_time_n (iPoint);
28382837 V_time_nP1 = nodes->GetSolution (iPoint);
28392838
2840- /* --- Access the density and Cp at this node (constant for now). ---*/
2839+ /* --- Access the density at this node (constant for now). ---*/
28412840
28422841 Density = nodes->GetDensity (iPoint);
2843- Cp = nodes->GetSpecificHeatCp (iPoint);
28442842
28452843 /* --- Compute the conservative variable vector for all time levels. ---*/
28462844
2847- V2U (Density, Cp, V_time_nM1, U_time_nM1);
2848- V2U (Density, Cp, V_time_n, U_time_n);
2849- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2845+ V2U (Density, V_time_nM1, U_time_nM1);
2846+ V2U (Density, V_time_n, U_time_n);
2847+ V2U (Density, V_time_nP1, U_time_nP1);
28502848
28512849 /* --- CV volume at time n+1. As we are on a static mesh, the volume
28522850 of the CV will remained fixed for all time steps. ---*/
@@ -2867,13 +2865,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28672865 /* --- Compute the Jacobian contribution due to the dual time source term. ---*/
28682866
28692867 if (implicit) {
2870- su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
2871-
2872- for (iDim = 0 ; iDim < nDim; iDim++)
2873- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
2868+ su2double delta = (second_order ? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
28742869
2875- if (energy) delta *= Cp;
2876- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
2870+ for (iVar = 1 ; iVar < nVar; ++iVar) Jacobian.AddVal2Diag (iPoint, iVar, delta);
28772871 }
28782872 }
28792873 END_SU2_OMP_FOR
@@ -2898,8 +2892,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28982892
28992893 V_time_n = nodes->GetSolution_time_n (iPoint);
29002894 Density = nodes->GetDensity (iPoint);
2901- Cp = nodes->GetSpecificHeatCp (iPoint);
2902- V2U (Density, Cp, V_time_n, U_time_n);
2895+ V2U (Density, V_time_n, U_time_n);
29032896
29042897 GridVel_i = geometry->nodes ->GetGridVel (iPoint);
29052898
@@ -2954,8 +2947,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29542947
29552948 V_time_n = nodes->GetSolution_time_n (iPoint);
29562949 Density = nodes->GetDensity (iPoint);
2957- Cp = nodes->GetSpecificHeatCp (iPoint);
2958- V2U (Density, Cp, V_time_n, U_time_n);
2950+ V2U (Density, V_time_n, U_time_n);
29592951
29602952 for (iVar = 0 ; iVar < nVar-!energy; iVar++)
29612953 LinSysRes (iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2981,16 +2973,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29812973 V_time_n = nodes->GetSolution_time_n (iPoint);
29822974 V_time_nP1 = nodes->GetSolution (iPoint);
29832975
2984- /* --- Access the density and Cp at this node (constant for now). ---*/
2976+ /* --- Access the density at this node (constant for now). ---*/
29852977
29862978 Density = nodes->GetDensity (iPoint);
2987- Cp = nodes->GetSpecificHeatCp (iPoint);
29882979
29892980 /* --- Compute the conservative variable vector for all time levels. ---*/
29902981
2991- V2U (Density, Cp, V_time_nM1, U_time_nM1);
2992- V2U (Density, Cp, V_time_n, U_time_n);
2993- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2982+ V2U (Density, V_time_nM1, U_time_nM1);
2983+ V2U (Density, V_time_n, U_time_n);
2984+ V2U (Density, V_time_nP1, U_time_nP1);
29942985
29952986 /* --- CV volume at time n-1 and n+1. In the case of dynamically deforming
29962987 grids, the volumes will change. On rigidly transforming grids, the
@@ -3016,11 +3007,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30163007 if (implicit) {
30173008 su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
30183009
3019- for (iDim = 0 ; iDim < nDim; iDim++)
3020- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
3021-
3022- if (energy) delta *= Cp;
3023- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
3010+ for (iVar = 1 ; iVar < nVar; ++iVar)
3011+ Jacobian.AddVal2Diag (iPoint, iVar, delta);
30243012 }
30253013 }
30263014 END_SU2_OMP_FOR
0 commit comments