@@ -1147,6 +1147,57 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
11471147 numerics->SetCoord (geometry->nodes ->GetCoord (iPoint),
11481148 geometry->nodes ->GetCoord (iPoint) );
11491149
1150+ /* --- Compute finite rate chemistry ---*/
1151+
1152+ if (!monoatomic){
1153+ if (!frozen){
1154+ /* --- Compute the non-equilibrium chemistry ---*/
1155+ auto residual = numerics->ComputeChemistry (config);
1156+
1157+ /* --- Check for errors before applying source to the linear system ---*/
1158+ err = false ;
1159+ for (iVar = 0 ; iVar < nVar; iVar++)
1160+ if (residual[iVar] != residual[iVar]) err = true ;
1161+ // if (implicit)
1162+ // for (iVar = 0; iVar < nVar; iVar++)
1163+ // for (jVar = 0; jVar < nVar; jVar++)
1164+ // if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true;
1165+
1166+ /* --- Apply the chemical sources to the linear system ---*/
1167+ if (!err) {
1168+ LinSysRes.SubtractBlock (iPoint, residual);
1169+ // if (implicit)
1170+ // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
1171+ } else
1172+ eChm_local++;
1173+ }
1174+ }
1175+
1176+ /* --- Compute vibrational energy relaxation ---*/
1177+ // / NOTE: Jacobians don't account for relaxation time derivatives
1178+
1179+ if (!monoatomic){
1180+ auto residual = numerics->ComputeVibRelaxation (config);
1181+
1182+ /* --- Check for errors before applying source to the linear system ---*/
1183+ err = false ;
1184+ for (iVar = 0 ; iVar < nVar; iVar++)
1185+ if (residual[iVar] != residual[iVar]) err = true ;
1186+ // if (implicit)
1187+ // for (iVar = 0; iVar < nVar; iVar++)
1188+ // for (jVar = 0; jVar < nVar; jVar++)
1189+ // if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true;
1190+
1191+ /* --- Apply the vibrational relaxation terms to the linear system ---*/
1192+ if (!err) {
1193+ LinSysRes.SubtractBlock (iPoint, residual);
1194+ // if (implicit)
1195+ // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
1196+ } else
1197+ eVib_local++;
1198+ }
1199+
1200+ }
11501201 /* --- Compute axisymmetric source terms (if needed) ---*/
11511202 if (config->GetAxisymmetric ()) {
11521203
@@ -1180,18 +1231,6 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
11801231 SU2_OMP_FOR_DYN (omp_chunk_size)
11811232 for (iPoint = 0 ; iPoint < nPointDomain; iPoint++) {
11821233
1183- /* --- Set solution ---*/
1184- numerics->SetConservative (nodes->GetSolution (iPoint), nodes->GetSolution (iPoint));
1185-
1186- /* --- Set control volume ---*/
1187- numerics->SetVolume (geometry->nodes ->GetVolume (iPoint));
1188-
1189- /* --- Set y coordinate ---*/
1190- numerics->SetCoord (geometry->nodes ->GetCoord (iPoint), geometry->nodes ->GetCoord (iPoint));
1191-
1192- /* --- Set primitive variables for viscous terms and/or generalised source ---*/
1193- numerics->SetPrimitive (nodes->GetPrimitive (iPoint), nodes->GetPrimitive (iPoint));
1194-
11951234 /* --- If necessary, set variables needed for viscous computation ---*/
11961235 if (viscous) {
11971236
@@ -1216,9 +1255,6 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
12161255 /* --- Vib-el. thermal conductivity ---*/
12171256 numerics->SetThermalConductivity_ve (nodes->GetThermalConductivity_ve (iPoint), nodes->GetThermalConductivity_ve (iPoint));
12181257
1219- /* --- Vib-el energy ---*/
1220- numerics->SetEve (nodes->GetEve (iPoint), nodes->GetEve (iPoint));
1221-
12221258 /* --- Set turbulence kinetic energy ---*/
12231259 if (rans){
12241260 CVariable* turbNodes = solver_container[TURB_SOL]->GetNodes ();
@@ -1247,55 +1283,6 @@ void CNEMOEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_con
12471283 }
12481284 }
12491285
1250- if (!monoatomic){
1251- if (!frozen){
1252- /* --- Compute the non-equilibrium chemistry ---*/
1253- auto residual = numerics->ComputeChemistry (config);
1254-
1255- /* --- Check for errors before applying source to the linear system ---*/
1256- err = false ;
1257- for (iVar = 0 ; iVar < nVar; iVar++)
1258- if (residual[iVar] != residual[iVar]) err = true ;
1259- // if (implicit)
1260- // for (iVar = 0; iVar < nVar; iVar++)
1261- // for (jVar = 0; jVar < nVar; jVar++)
1262- // if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true;
1263-
1264- /* --- Apply the chemical sources to the linear system ---*/
1265- if (!err) {
1266- LinSysRes.SubtractBlock (iPoint, residual);
1267- // if (implicit)
1268- // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
1269- } else
1270- eChm_local++;
1271- }
1272- }
1273-
1274- /* --- Compute vibrational energy relaxation ---*/
1275- // / NOTE: Jacobians don't account for relaxation time derivatives
1276-
1277- if (!monoatomic){
1278- auto residual = numerics->ComputeVibRelaxation (config);
1279-
1280- /* --- Check for errors before applying source to the linear system ---*/
1281- err = false ;
1282- for (iVar = 0 ; iVar < nVar; iVar++)
1283- if (residual[iVar] != residual[iVar]) err = true ;
1284- // if (implicit)
1285- // for (iVar = 0; iVar < nVar; iVar++)
1286- // for (jVar = 0; jVar < nVar; jVar++)
1287- // if (Jacobian_i[iVar][jVar] != Jacobian_i[iVar][jVar]) err = true;
1288-
1289- /* --- Apply the vibrational relaxation terms to the linear system ---*/
1290- if (!err) {
1291- LinSysRes.SubtractBlock (iPoint, residual);
1292- // if (implicit)
1293- // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
1294- } else
1295- eVib_local++;
1296- }
1297- }
1298-
12991286 /* --- Checking for NaN ---*/
13001287 eAxi_global = eAxi_local;
13011288 eChm_global = eChm_local;
0 commit comments