@@ -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, Density_time_n, Density_time_nM1, Density_unsteady;
2802+ su2double Density, Density_time_n, Density_time_nM1, Density_unsteady;
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,18 +2836,17 @@ 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_time_nM1 = nodes->GetDensity_time_n1 (iPoint);
28432842 Density_time_n = nodes->GetDensity_time_n (iPoint);
28442843 Density = nodes->GetDensity (iPoint);
2845- Cp = nodes->GetSpecificHeatCp (iPoint);
2846-
2844+
28472845 /* --- Compute the conservative variable vector for all time levels. ---*/
2848- // nijso: note that we still assume that cp is constant in time.
2849- V2U (Density_time_nM1, Cp, V_time_nM1, U_time_nM1);
2850- V2U (Density_time_n, Cp, V_time_n, U_time_n);
2851- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2846+
2847+ V2U (Density_time_nM1, V_time_nM1, U_time_nM1);
2848+ V2U (Density_time_n, V_time_n, U_time_n);
2849+ V2U (Density, V_time_nP1, U_time_nP1);
28522850
28532851 /* --- CV volume at time n+1. As we are on a static mesh, the volume
28542852 of the CV will remained fixed for all time steps. ---*/
@@ -2869,13 +2867,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28692867 /* --- Compute the Jacobian contribution due to the dual time source term. ---*/
28702868
28712869 if (implicit) {
2872- su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
2870+ su2double delta = (second_order ? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
28732871
2874- for (iDim = 0 ; iDim < nDim; iDim++)
2875- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
2876-
2877- if (energy) delta *= Cp;
2878- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
2872+ for (iVar = 1 ; iVar < nVar; ++iVar) Jacobian.AddVal2Diag (iPoint, iVar, delta);
28792873 }
28802874 }
28812875 END_SU2_OMP_FOR
@@ -2900,8 +2894,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29002894
29012895 V_time_n = nodes->GetSolution_time_n (iPoint);
29022896 Density = nodes->GetDensity (iPoint);
2903- Cp = nodes->GetSpecificHeatCp (iPoint);
2904- V2U (Density, Cp, V_time_n, U_time_n);
2897+ V2U (Density, V_time_n, U_time_n);
29052898
29062899 GridVel_i = geometry->nodes ->GetGridVel (iPoint);
29072900
@@ -2956,8 +2949,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29562949
29572950 V_time_n = nodes->GetSolution_time_n (iPoint);
29582951 Density = nodes->GetDensity (iPoint);
2959- Cp = nodes->GetSpecificHeatCp (iPoint);
2960- V2U (Density, Cp, V_time_n, U_time_n);
2952+ V2U (Density, V_time_n, U_time_n);
29612953
29622954 for (iVar = 0 ; iVar < nVar-!energy; iVar++)
29632955 LinSysRes (iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2983,16 +2975,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29832975 V_time_n = nodes->GetSolution_time_n (iPoint);
29842976 V_time_nP1 = nodes->GetSolution (iPoint);
29852977
2986- /* --- Access the density and Cp at this node (constant for now). ---*/
2978+ /* --- Access the density at this node (constant for now). ---*/
29872979
29882980 Density = nodes->GetDensity (iPoint);
2989- Cp = nodes->GetSpecificHeatCp (iPoint);
29902981
29912982 /* --- Compute the conservative variable vector for all time levels. ---*/
29922983
2993- V2U (Density, Cp, V_time_nM1, U_time_nM1);
2994- V2U (Density, Cp, V_time_n, U_time_n);
2995- V2U (Density, Cp, V_time_nP1, U_time_nP1);
2984+ V2U (Density, V_time_nM1, U_time_nM1);
2985+ V2U (Density, V_time_n, U_time_n);
2986+ V2U (Density, V_time_nP1, U_time_nP1);
29962987
29972988 /* --- CV volume at time n-1 and n+1. In the case of dynamically deforming
29982989 grids, the volumes will change. On rigidly transforming grids, the
@@ -3018,11 +3009,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30183009 if (implicit) {
30193010 su2double delta = (second_order? 1.5 : 1.0 ) * Volume_nP1 * Density / TimeStep;
30203011
3021- for (iDim = 0 ; iDim < nDim; iDim++)
3022- Jacobian.AddVal2Diag (iPoint, iDim+1 , delta);
3023-
3024- if (energy) delta *= Cp;
3025- Jacobian.AddVal2Diag (iPoint, nDim+1 , delta);
3012+ for (iVar = 1 ; iVar < nVar; ++iVar)
3013+ Jacobian.AddVal2Diag (iPoint, iVar, delta);
30263014 }
30273015 }
30283016 END_SU2_OMP_FOR
0 commit comments