@@ -1108,16 +1108,19 @@ bool CNEMOEulerSolver::CheckNonPhys(const su2double *V) const {
11081108
11091109void CNEMOEulerSolver::Source_Residual (CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) {
11101110
1111- unsigned short iVar;
1111+ unsigned short iVar, jVar ;
11121112 unsigned long iPoint;
11131113 unsigned long eAxi_local, eChm_local, eVib_local;
11141114 unsigned long eAxi_global, eChm_global, eVib_global;
11151115
11161116 /* --- Assign booleans ---*/
11171117 bool err = false ;
1118- // bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
1118+ bool implicit = (config->GetKind_TimeIntScheme_Flow () == EULER_IMPLICIT);
11191119 bool frozen = config->GetFrozen ();
11201120 bool monoatomic = config->GetMonoatomic ();
1121+ bool viscous = config->GetViscous ();
1122+ bool ideal_gas = (config->GetKind_FluidModel () == STANDARD_AIR) || (config->GetKind_FluidModel () == IDEAL_GAS);
1123+ bool rans = (config->GetKind_Turb_Model () != NONE);
11211124
11221125 CNumerics* numerics = numerics_container[SOURCE_FIRST_TERM];
11231126
@@ -1137,11 +1140,11 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
11371140 numerics->SetPrimitive (nodes->GetPrimitive (iPoint), nodes->GetPrimitive (iPoint) );
11381141
11391142 /* --- Pass supplementary information to CNumerics ---*/
1140- numerics->SetdPdU (nodes->GetdPdU (iPoint), nodes->GetdPdU (iPoint));
1141- numerics->SetdTdU (nodes->GetdTdU (iPoint), nodes->GetdTdU (iPoint));
1143+ numerics->SetdPdU (nodes->GetdPdU (iPoint), nodes->GetdPdU (iPoint));
1144+ numerics->SetdTdU (nodes->GetdTdU (iPoint), nodes->GetdTdU (iPoint));
11421145 numerics->SetdTvedU (nodes->GetdTvedU (iPoint), nodes->GetdTvedU (iPoint));
1143- numerics->SetEve (nodes->GetEve (iPoint), nodes->GetEve (iPoint));
1144- numerics->SetCvve (nodes->GetCvve (iPoint), nodes->GetCvve (iPoint));
1146+ numerics->SetEve (nodes->GetEve (iPoint), nodes->GetEve (iPoint));
1147+ numerics->SetCvve (nodes->GetCvve (iPoint), nodes->GetCvve (iPoint));
11451148
11461149 /* --- Set volume of the dual grid cell ---*/
11471150 numerics->SetVolume (geometry->nodes ->GetVolume (iPoint));
@@ -1150,25 +1153,102 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
11501153
11511154 /* --- Compute axisymmetric source terms (if needed) ---*/
11521155 if (config->GetAxisymmetric ()) {
1153- auto residual = numerics->ComputeAxisymmetric (config);
11541156
1155- /* --- Check for errors before applying source to the linear system ---*/
1156- err = false ;
1157- for (iVar = 0 ; iVar < nVar; iVar++)
1158- if (residual[iVar] != residual[iVar]) err = true ;
1159- // if (implicit)
1160- // for (iVar = 0; iVar < nVar; iVar++)
1161- // for (jVar = 0; jVar < nVar; jVar++)
1162- // if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true;
1157+ if (viscous) {
11631158
1164- /* --- Apply the update to the linear system ---*/
1165- if (!err) {
1166- LinSysRes.AddBlock (iPoint, residual);
1167- // if (implicit)
1168- // Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
1159+ for (iPoint = 0 ; iPoint < nPoint; iPoint++) {
1160+
1161+ su2double yCoord = geometry->nodes ->GetCoord (iPoint, 1 );
1162+ su2double yVelocity = nodes->GetVelocity (iPoint,1 );
1163+ su2double xVelocity = nodes->GetVelocity (iPoint,0 );
1164+ su2double Total_Viscosity = nodes->GetLaminarViscosity (iPoint) + nodes->GetEddyViscosity (iPoint);
1165+
1166+ if (yCoord > EPS){
1167+ su2double nu_v_on_y = Total_Viscosity*yVelocity/yCoord;
1168+ nodes->SetAuxVar (iPoint, 0 , nu_v_on_y);
1169+ nodes->SetAuxVar (iPoint, 1 , nu_v_on_y*yVelocity);
1170+ nodes->SetAuxVar (iPoint, 2 , nu_v_on_y*xVelocity);
1171+ }
1172+ }
1173+
1174+ /* --- Compute the auxiliary variable gradient with GG or WLS. ---*/
1175+ if (config->GetKind_Gradient_Method () == GREEN_GAUSS) {
1176+ SetAuxVar_Gradient_GG (geometry, config);
1177+ }
1178+ if (config->GetKind_Gradient_Method () == WEIGHTED_LEAST_SQUARES) {
1179+ SetAuxVar_Gradient_LS (geometry, config);
1180+ }
1181+ }
1182+
1183+ /* --- loop over points ---*/
1184+ SU2_OMP_FOR_DYN (omp_chunk_size)
1185+ for (iPoint = 0 ; iPoint < nPointDomain; iPoint++) {
1186+
1187+ /* --- Set solution ---*/
1188+ numerics->SetConservative (nodes->GetSolution (iPoint), nodes->GetSolution (iPoint));
1189+
1190+ /* --- Set control volume ---*/
1191+ numerics->SetVolume (geometry->nodes ->GetVolume (iPoint));
1192+
1193+ /* --- Set y coordinate ---*/
1194+ numerics->SetCoord (geometry->nodes ->GetCoord (iPoint), geometry->nodes ->GetCoord (iPoint));
1195+
1196+ /* --- Set primitive variables for viscous terms and/or generalised source ---*/
1197+ numerics->SetPrimitive (nodes->GetPrimitive (iPoint), nodes->GetPrimitive (iPoint));
1198+
1199+ /* --- If necessary, set variables needed for viscous computation ---*/
1200+ if (viscous) {
1201+
1202+ /* --- Set gradient of primitive variables ---*/
1203+ numerics->SetPrimVarGradient (nodes->GetGradient_Primitive (iPoint), nodes->GetGradient_Primitive (iPoint));
1204+
1205+ /* --- Set gradient of auxillary variables ---*/
1206+ numerics->SetAuxVarGrad (nodes->GetAuxVarGradient (iPoint), nullptr );
1207+
1208+ /* --- Set diffusion coefficient ---*/
1209+ numerics->SetDiffusionCoeff (nodes->GetDiffusionCoeff (iPoint), nodes->GetDiffusionCoeff (iPoint));
1210+
1211+ /* --- Laminar viscosity ---*/
1212+ numerics->SetLaminarViscosity (nodes->GetLaminarViscosity (iPoint), nodes->GetLaminarViscosity (iPoint));
1213+
1214+ /* --- Eddy viscosity ---*/
1215+ numerics->SetEddyViscosity (nodes->GetEddyViscosity (iPoint), nodes->GetEddyViscosity (iPoint));
1216+
1217+ /* --- Thermal conductivity ---*/
1218+ numerics->SetThermalConductivity (nodes->GetThermalConductivity (iPoint), nodes->GetThermalConductivity (iPoint));
1219+
1220+ /* --- Vib-el. thermal conductivity ---*/
1221+ numerics->SetThermalConductivity_ve (nodes->GetThermalConductivity_ve (iPoint), nodes->GetThermalConductivity_ve (iPoint));
1222+
1223+ /* --- Vib-el energy ---*/
1224+ numerics->SetEve (nodes->GetEve (iPoint), nodes->GetEve (iPoint));
1225+
1226+ /* --- Set turbulence kinetic energy ---*/
1227+ if (rans){
1228+ CVariable* turbNodes = solver_container[TURB_SOL]->GetNodes ();
1229+ numerics->SetTurbKineticEnergy (turbNodes->GetSolution (iPoint,0 ), turbNodes->GetSolution (iPoint,0 ));
1230+ }
1231+ }
1232+
1233+ auto residual = numerics->ComputeAxisymmetric (config);
1234+
1235+ /* --- Check for errors before applying source to the linear system ---*/
1236+ err = false ;
1237+ for (iVar = 0 ; iVar < nVar; iVar++)
1238+ if (residual[iVar] != residual[iVar]) err = true ;
1239+ if (implicit)
1240+ for (iVar = 0 ; iVar < nVar; iVar++)
1241+ for (jVar = 0 ; jVar < nVar; jVar++)
1242+ if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true ;
1243+
1244+ /* --- Apply the update to the linear system ---*/
1245+ if (!err) {
1246+ LinSysRes.AddBlock (iPoint, residual);
1247+ if (implicit)
1248+ Jacobian.AddBlock (iPoint, iPoint, Jacobian_i);
1249+ }else
1250+ eAxi_local++;
11691251 }
1170- else
1171- eAxi_local++;
11721252 }
11731253
11741254 if (!monoatomic){
0 commit comments