diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp index e0c24506a5e5..214a74bdac70 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp @@ -444,6 +444,10 @@ class CFVMFlowSolverBase : public CSolver { ompMasterAssignBarrier(Min_Delta_Time,1e30, Max_Delta_Time,0.0, Global_Delta_UnstTimeND,1e30); + /*--- Edges between a point and its periodic image are left out, their states are tied. ---*/ + const bool skipImages = implicit_periodic; + if (skipImages) SetPeriodicMaster(geometry, config); + /*--- Loop domain points. ---*/ SU2_OMP_FOR_DYN(omp_chunk_size) @@ -461,6 +465,7 @@ class CFVMFlowSolverBase : public CSolver { for (unsigned short iNeigh = 0; iNeigh < geometry->nodes->GetnPoint(iPoint); ++iNeigh) { auto jPoint = geometry->nodes->GetPoint(iPoint,iNeigh); + if (skipImages && ArePeriodicImages(iPoint, jPoint)) continue; auto iEdge = geometry->nodes->GetEdge(iPoint,iNeigh); auto Normal = geometry->edges->GetNormal(iEdge); diff --git a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl index 48522979212f..54978dde434b 100644 --- a/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl +++ b/SU2_CFD/include/solvers/CFVMFlowSolverBase.inl @@ -1345,6 +1345,8 @@ void CFVMFlowSolverBase::BC_Periodic(CGeometry* geometry, CSolver** solver accumulated correctly during the communications. For implicit calculations, the Jacobians and linear system are also correctly adjusted here. ---*/ + CouplePeriodicJacobian(geometry, config); + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic() / 2; iPeriodic++) { InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); diff --git a/SU2_CFD/include/solvers/CScalarSolver.inl b/SU2_CFD/include/solvers/CScalarSolver.inl index 941d68928493..041730ba8029 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.inl +++ b/SU2_CFD/include/solvers/CScalarSolver.inl @@ -412,6 +412,8 @@ void CScalarSolver::BC_Periodic(CGeometry* geometry, CSolver** sol accumulated corectly during the communications. For implicit calculations the Jacobians and linear system are also correctly adjusted here. ---*/ + CouplePeriodicJacobian(geometry, config); + for (unsigned short iPeriodic = 1; iPeriodic <= config->GetnMarker_Periodic() / 2; iPeriodic++) { InitiatePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); CompletePeriodicComms(geometry, config, iPeriodic, PERIODIC_RESIDUAL); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 9d7b8b0ca886..27ef57df94a1 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -149,6 +149,9 @@ class CSolver { bool implicit_periodic; /*!< \brief Flag that controls whether the implicit system should be treated by the periodic BC comms. */ su2activematrix PeriodicProj; /*!< \brief Min/max reconstruction increments at periodic receive points (for limiters). */ std::unordered_map PeriodicProjIndex; /*!< \brief Local point to compact projection row. */ + vector PeriodicMaster; /*!< \brief Local master point of each coupled passive periodic point, or -1. */ + vector PeriodicMasterMarker; /*!< \brief Periodic marker of each passive point, gives its rotation. */ + vector PeriodicPassive; /*!< \brief Coupled passive periodic points. */ bool dynamic_grid; /*!< \brief Flag that determines whether the grid is dynamic (moving or deforming + grid velocities). */ @@ -326,6 +329,26 @@ class CSolver { unsigned short val_periodic_index, unsigned short commType); + /*! + * \brief Move the off-diagonal Jacobian blocks of passive periodic points to their masters, rotated. + * \note Call before the PERIODIC_RESIDUAL comms. A passive point is coupled if its master is on the same rank and + * all its blocks fit in the sparsity pattern. + */ + void CouplePeriodicJacobian(CGeometry *geometry, const CConfig *config); + + /*! + * \brief Map each coupled passive periodic point to its master on the same rank (built once). + */ + void SetPeriodicMaster(CGeometry *geometry, const CConfig *config); + + /*! + * \brief Whether two points are periodic images of each other on this rank. + */ + inline bool ArePeriodicImages(unsigned long iPoint, unsigned long jPoint) const { + if (PeriodicMaster.empty()) return false; + return PeriodicMaster[iPoint] == static_cast(jPoint) || PeriodicMaster[jPoint] == static_cast(iPoint); + } + /*! * \brief Set number of linear solver iterations. * \param[in] val_iterlinsolver - Number of linear iterations. diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index 5615050f97f9..1d1b281f0e3a 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1276,7 +1276,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, base_nodes->SetDelta_Time(iPoint,bufDRecv[buf_offset]); buf_offset++; - /*--- For implicit integration, we choose the first + /*--- For implicit integration, we choose the second periodic face of each pair to be the master/owner of the solution for the linear system while fixing the solution at the matching face during the solve. Here, @@ -1308,7 +1308,7 @@ void CSolver::CompletePeriodicComms(CGeometry *geometry, case PERIODIC_IMPLICIT: - /*--- For implicit integration, we choose the first + /*--- For implicit integration, we choose the second periodic face of each pair to be the master/owner of the solution for the linear system while fixing the solution at the matching face during the solve. Here, @@ -4631,3 +4631,179 @@ void CSolver::SavelibROM(CGeometry *geometry, CConfig *config, bool converged) { #endif } + +void CSolver::SetPeriodicMaster(CGeometry *geometry, const CConfig *config) { + if (config->GetnMarker_Periodic() == 0) return; + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + + const auto nPeriodic = config->GetnMarker_Periodic(); + const auto nPointAll = geometry->GetnPoint(); + + if (PeriodicMaster.size() != nPointAll) { + PeriodicMaster.assign(nPointAll, -1); + PeriodicMasterMarker.assign(nPointAll, 0); + vector nPeriodicMarker(nPointAll, 0); + vector passive(nPointAll, false); + + for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY) continue; + /*--- Points receiving from the second marker of a pair have their rows removed (CompletePeriodicComms). ---*/ + const bool isPassive = config->GetMarker_All_PerBound(iMarker) <= nPeriodic / 2; + for (auto iVertex = 0ul; iVertex < geometry->nVertex[iMarker]; iVertex++) { + const auto* vertex = geometry->vertex[iMarker][iVertex]; + const auto iPoint = vertex->GetNode(); + nPeriodicMarker[iPoint]++; + if (!isPassive) continue; + passive[iPoint] = true; + if (vertex->GetDonorProcessor() == rank && vertex->GetDonorPoint() >= 0) { + PeriodicMaster[iPoint] = vertex->GetDonorPoint(); + PeriodicMasterMarker[iPoint] = iMarker; + } + } + } + + /*--- Points on several periodic markers keep the treatment of the comms only. ---*/ + for (auto iPoint = 0ul; iPoint < nPointAll; iPoint++) { + const auto master = PeriodicMaster[iPoint]; + if (master < 0) continue; + if (nPeriodicMarker[iPoint] != 1 || nPeriodicMarker[master] != 1 || passive[master]) + PeriodicMaster[iPoint] = -1; + } + + /*--- A point is coupled only if all its blocks fit in the sparsity pattern of its master. Columns of passive + * points without a master are ignored, their increment is zero in the linear system. ---*/ + if (implicit_periodic) { + for (auto iPoint = 0ul; iPoint < nPointAll; iPoint++) { + const auto master = PeriodicMaster[iPoint]; + if (master < 0) continue; + bool fits = true; + for (const auto kPoint : geometry->nodes->GetPoints(iPoint)) { + if (iPoint < nPointDomain && (!passive[kPoint] || PeriodicMaster[kPoint] >= 0)) { + const unsigned long col = passive[kPoint] ? PeriodicMaster[kPoint] : kPoint; + fits = fits && Jacobian.GetBlockView(master, col); + } + if (kPoint < nPointDomain && !passive[kPoint]) fits = fits && Jacobian.GetBlockView(kPoint, master); + } + if (!fits) PeriodicMaster[iPoint] = -1; + } + } + + PeriodicPassive.clear(); + for (auto iPoint = 0ul; iPoint < nPointAll; iPoint++) + if (PeriodicMaster[iPoint] >= 0) PeriodicPassive.push_back(iPoint); + } + + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS +} + +void CSolver::CouplePeriodicJacobian(CGeometry *geometry, const CConfig *config) { + SU2_ZONE_SCOPED + if (!implicit_periodic) return; + + SetPeriodicMaster(geometry, config); + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + + /*--- Rotation from the frame of a passive point to the frame of its master. ---*/ + auto Rotation = [&](unsigned short iMarker, su2double (&Q)[3][3]) { + for (auto i = 0u; i < 3; i++) + for (auto j = 0u; j < 3; j++) Q[i][j] = (i == j); + if (!rotate_periodic) return false; + const auto* angles = config->GetPeriodicRotAngles(config->GetMarker_All_TagBound(iMarker)); + if (!GeometryToolbox::HasRotation(angles)) return false; + if (nDim == 2) { + su2double Q2[2][2]; + GeometryToolbox::RotationMatrix(angles[2], Q2); + for (auto i = 0u; i < 2; i++) + for (auto j = 0u; j < 2; j++) Q[i][j] = Q2[i][j]; + } else { + GeometryToolbox::RotationMatrix(angles[0], angles[1], angles[2], Q); + } + return true; + }; + + su2activematrix block(nVar, nVar), sum(nVar, nVar), zero(nVar, nVar); + zero = su2double(0.0); + su2double v[3]; + + /*--- Copy a block through its view, which also decodes quantized storage. ---*/ + auto ReadBlock = [&](unsigned long iRow, unsigned long iCol) { + const auto view = Jacobian.GetBlockView(iRow, iCol); + if (!view) return false; + for (auto i = 0u; i < nVar; i++) + for (auto j = 0u; j < nVar; j++) block(i, j) = view(i, j); + return true; + }; + + /*--- Add block to an existing block. Quantized storage cannot accumulate, it is decoded, added and re-encoded. ---*/ + auto AddBlock = [&](unsigned long iRow, unsigned long iCol) { + const auto view = Jacobian.GetBlockView(iRow, iCol); + if (view.ptr) { + Jacobian.SetBlock(iRow, iCol, block); + return; + } + for (auto i = 0u; i < nVar; i++) + for (auto j = 0u; j < nVar; j++) sum(i, j) = view(i, j) + block(i, j); + Jacobian.SetBlock(iRow, iCol, sum); + }; + + auto RotateRows = [&](const su2double (&Q)[3][3]) { + for (auto c = 0u; c < nVar; c++) { + for (auto d = 0u; d < nDim; d++) v[d] = block(1 + d, c); + for (auto d = 0u; d < nDim; d++) { + su2double s = 0.0; + for (auto e = 0u; e < nDim; e++) s += Q[d][e] * v[e]; + block(1 + d, c) = s; + } + } + }; + + /*--- Right product with Q^T: the passive increment is Q^T times the master increment. ---*/ + auto RotateColumns = [&](const su2double (&Q)[3][3]) { + for (auto r = 0u; r < nVar; r++) { + for (auto d = 0u; d < nDim; d++) v[d] = block(r, 1 + d); + for (auto d = 0u; d < nDim; d++) { + su2double s = 0.0; + for (auto e = 0u; e < nDim; e++) s += v[e] * Q[d][e]; + block(r, 1 + d) = s; + } + } + }; + + su2double Qp[3][3], Qk[3][3]; + + /*--- Rows of passive points go to the rows of their masters. ---*/ + for (const auto iPoint : PeriodicPassive) { + if (iPoint >= nPointDomain) continue; + const auto master = PeriodicMaster[iPoint]; + const bool rotP = Rotation(PeriodicMasterMarker[iPoint], Qp); + + for (const auto kPoint : geometry->nodes->GetPoints(iPoint)) { + const bool kPassive = PeriodicMaster[kPoint] >= 0; + const unsigned long col = kPassive ? PeriodicMaster[kPoint] : kPoint; + if (!Jacobian.GetBlockView(master, col) || !ReadBlock(iPoint, kPoint)) continue; + if (kPassive && Rotation(PeriodicMasterMarker[kPoint], Qk)) RotateColumns(Qk); + if (rotP) RotateRows(Qp); + AddBlock(master, col); + } + } + + /*--- Columns of passive points go to the columns of their masters. ---*/ + for (const auto iPoint : PeriodicPassive) { + const auto master = PeriodicMaster[iPoint]; + const bool rotP = Rotation(PeriodicMasterMarker[iPoint], Qp); + + for (const auto jPoint : geometry->nodes->GetPoints(iPoint)) { + if (jPoint >= nPointDomain || PeriodicMaster[jPoint] >= 0) continue; + if (!Jacobian.GetBlockView(jPoint, master) || !ReadBlock(jPoint, iPoint)) continue; + if (rotP) RotateColumns(Qp); + AddBlock(jPoint, master); + Jacobian.SetBlock(jPoint, iPoint, zero); + } + } + + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS +} diff --git a/TestCases/incomp_rans/morse_swirl_jet/inlet_jet.dat b/TestCases/incomp_rans/morse_swirl_jet/inlet_jet.dat new file mode 100644 index 000000000000..19f935ed891f --- /dev/null +++ b/TestCases/incomp_rans/morse_swirl_jet/inlet_jet.dat @@ -0,0 +1,65 @@ +NMARK= 1 +MARKER_TAG= inlet_jet +NROW=60 +NCOL=9 +# COORD-X COORD-Y COORD-Z TEMPERATURE VELOCITY NORMAL-X NORMAL-Y NORMAL-Z NU_TILDE +1.230000000000000e-02 4.915317250182741e-04 -2.146073858374531e-05 2.881500000000000e+02 3.404952035805443e+01 9.964500863218230e-01 3.977264224582153e-03 8.409165736575443e-02 2.108527391098338e-03 +1.230000000000000e-02 9.750124993671942e-04 -4.256996506995672e-05 2.881500000000000e+02 3.430313843595425e+01 9.880697227692148e-01 7.215987429835292e-03 1.538380722453961e-01 2.108527391098338e-03 +1.230000000000000e-02 9.750124993671942e-04 4.256996506995671e-05 2.881500000000000e+02 3.430313843595425e+01 9.880697227692148e-01 -6.219343030316790e-03 1.538815866796235e-01 2.108527391098338e-03 +1.230000000000000e-02 4.915317250182741e-04 2.146073858374531e-05 2.881500000000000e+02 3.404952035805443e+01 9.964500863218230e-01 -3.366941323155189e-03 8.411830463910938e-02 2.108527391098338e-03 +1.230000000000000e-02 1.458493273716226e-03 -6.367919155617299e-05 2.881500000000000e+02 3.454279085009219e+01 9.762877688261749e-01 1.014212659517094e-02 2.162390568526813e-01 2.108527391098338e-03 +1.230000000000000e-02 1.458493273716226e-03 6.367919155617298e-05 2.881500000000000e+02 3.454279085009220e+01 9.762877688261747e-01 -8.742942869563935e-03 2.163001465334435e-01 2.108527391098338e-03 +1.230000000000000e-02 1.941974048065509e-03 -8.478841804240026e-05 2.881500000000000e+02 3.473691736740481e+01 9.688679027627434e-01 1.201797138126057e-02 2.472863832886933e-01 2.108527391098338e-03 +1.230000000000000e-02 1.941974048065509e-03 8.478841804240026e-05 2.881500000000000e+02 3.473691736740481e+01 9.688679027627434e-01 -9.580189035078044e-03 2.473928191645333e-01 2.108527391098338e-03 +1.230000000000000e-02 2.425454822414266e-03 -1.058976445286045e-04 2.881500000000000e+02 3.491004480099832e+01 9.570479293413384e-01 1.437979231487217e-02 2.895729312564240e-01 2.108527391098338e-03 +1.230000000000000e-02 2.425454822414266e-03 1.058976445286045e-04 2.881500000000000e+02 3.491004480099832e+01 9.570479293413384e-01 -1.091287103953410e-02 2.897243003082949e-01 2.108527391098338e-03 +1.230000000000000e-02 2.908935596762439e-03 -1.270068710147833e-04 2.881500000000000e+02 3.511796986204671e+01 9.397713273854733e-01 1.714460373522862e-02 3.413735707211489e-01 2.108527391098338e-03 +1.230000000000000e-02 2.908935596762439e-03 1.270068710147833e-04 2.881500000000000e+02 3.511796986204671e+01 9.397713273854733e-01 -1.267330376870326e-02 3.415687918937142e-01 2.108527391098338e-03 +1.230000000000000e-02 3.392416371111116e-03 -1.481160975009841e-04 2.881500000000000e+02 3.528982116296100e+01 9.260512716016078e-01 1.892666174263513e-02 3.769228353925044e-01 2.108527391098338e-03 +1.230000000000000e-02 3.392416371111116e-03 1.481160975009841e-04 2.881500000000000e+02 3.528982116296100e+01 9.260512716016078e-01 -1.399634959659803e-02 3.771380974696337e-01 2.108527391098338e-03 +1.230000000000000e-02 3.875897145460034e-03 -1.692253239871954e-04 2.881500000000000e+02 3.551215523720097e+01 9.112425122050197e-01 2.065526075006717e-02 4.113519711313309e-01 2.108527391098338e-03 +1.230000000000000e-02 3.875897145460034e-03 1.692253239871954e-04 2.881500000000000e+02 3.551215523720097e+01 9.112425122050197e-01 -1.527502532774494e-02 4.115868772829392e-01 2.108527391098338e-03 +1.230000000000000e-02 4.359377919809123e-03 -1.903345504734142e-04 2.881500000000000e+02 3.573358919956365e+01 9.036946523831382e-01 2.172966451482030e-02 4.276257673880193e-01 2.108527391098338e-03 +1.230000000000000e-02 4.359377919809123e-03 1.903345504734141e-04 2.881500000000000e+02 3.573358919956365e+01 9.036946523831382e-01 -1.562306479376379e-02 4.278923872898056e-01 2.108527391098338e-03 +1.230000000000000e-02 4.842858694158044e-03 -2.114437769596256e-04 2.881500000000000e+02 3.596582688777886e+01 8.959717351739295e-01 2.278227706937255e-02 4.435263437733462e-01 2.108527391098338e-03 +1.230000000000000e-02 4.842858694158044e-03 2.114437769596256e-04 2.881500000000000e+02 3.596582688777886e+01 8.959717351739295e-01 -1.596028429275307e-02 4.438241984104884e-01 2.108527391098338e-03 +1.230000000000000e-02 5.326339468506962e-03 -2.325530034458370e-04 2.881500000000000e+02 3.597906269642409e+01 8.942078992003367e-01 2.331743914955868e-02 4.470442148593665e-01 2.108527391098338e-03 +1.230000000000000e-02 5.326339468506963e-03 2.325530034458369e-04 2.881500000000000e+02 3.597906269642409e+01 8.942078992003365e-01 -1.573376133324451e-02 4.473753253835411e-01 2.108527391098338e-03 +1.230000000000000e-02 5.809820242855882e-03 -2.536622299320483e-04 2.881500000000000e+02 3.598980701325640e+01 8.924123870269365e-01 2.385467051978150e-02 4.505897093535071e-01 2.108527391098338e-03 +1.230000000000000e-02 5.809820242855882e-03 2.536622299320483e-04 2.881500000000000e+02 3.598980701325640e+01 8.924123870269365e-01 -1.550758449662454e-02 4.509541509998167e-01 2.108527391098338e-03 +1.230000000000000e-02 6.293301017204801e-03 -2.747714564182597e-04 2.881500000000000e+02 3.585282925447235e+01 8.896639674444857e-01 2.453168460400286e-02 4.559563811171272e-01 2.108527391098338e-03 +1.230000000000000e-02 6.293301017204801e-03 2.747714564182596e-04 2.881500000000000e+02 3.585282925447235e+01 8.896639674444857e-01 -1.530088291903097e-02 4.563594066224945e-01 2.108527391098338e-03 +1.230000000000000e-02 6.776781791553593e-03 -2.958806829044656e-04 2.881500000000000e+02 3.571601787886337e+01 8.868903347339346e-01 2.521594161932737e-02 4.612913292527621e-01 2.108527391098338e-03 +1.230000000000000e-02 6.776781791553593e-03 2.958806829044654e-04 2.881500000000000e+02 3.571601787886337e+01 8.868903347339346e-01 -1.508420107551411e-02 4.617336905982094e-01 2.108527391098338e-03 +1.230000000000000e-02 7.260262565901019e-03 -3.169899093906116e-04 2.881500000000000e+02 3.548623354001720e+01 8.864116770742088e-01 2.614893873877201e-02 4.621586002113610e-01 2.108527391098338e-03 +1.230000000000000e-02 7.260262565901019e-03 3.169899093906116e-04 2.881500000000000e+02 3.548623354001720e+01 8.864116770742088e-01 -1.423034193634863e-02 4.626789773859011e-01 2.108527391098338e-03 +1.230000000000000e-02 7.743743340249600e-03 -3.380991358768083e-04 2.881500000000000e+02 3.525668118861410e+01 8.859251724448826e-01 2.709464097744716e-02 4.630361424973307e-01 2.108527391098338e-03 +1.230000000000000e-02 7.743743340249600e-03 3.380991358768082e-04 2.881500000000000e+02 3.525668118861410e+01 8.859251724448826e-01 -1.336472122993312e-02 4.636356037395652e-01 2.108527391098338e-03 +1.230000000000000e-02 8.227224114600015e-03 -3.592083623630850e-04 2.881500000000000e+02 3.506478345062848e+01 8.854458827588981e-01 2.818749458180924e-02 4.638868976965356e-01 2.108527391098338e-03 +1.230000000000000e-02 8.227224114600015e-03 3.592083623630849e-04 2.881500000000000e+02 3.506478345062848e+01 8.854458827588981e-01 -1.235017446476032e-02 4.645783700259899e-01 2.108527391098338e-03 +1.230000000000000e-02 8.710704888951459e-03 -3.803175888494065e-04 2.881500000000000e+02 3.487296185468804e+01 8.849593859884991e-01 2.929231168974371e-02 4.647460011949857e-01 2.108527391098338e-03 +1.230000000000000e-02 8.710704888951459e-03 3.803175888494064e-04 2.881500000000000e+02 3.487296185468804e+01 8.849593859884991e-01 -1.132443732297945e-02 4.655304955319002e-01 2.108527391098338e-03 +1.230000000000000e-02 9.194185663303368e-03 -4.014268153357484e-04 2.881500000000000e+02 3.409955958208356e+01 8.854079871950582e-01 3.041559804813040e-02 4.638184856240317e-01 2.108527391098338e-03 +1.230000000000000e-02 9.194185663303369e-03 4.014268153357484e-04 2.881500000000000e+02 3.409955958208356e+01 8.854079871950582e-01 -1.012458709981934e-02 4.647044102946019e-01 2.108527391098338e-03 +1.230000000000000e-02 9.677666437654643e-03 -4.225360418220627e-04 2.881500000000000e+02 3.331699155975138e+01 8.859007846674354e-01 3.159905365039384e-02 4.627972553224809e-01 2.109105393500574e-03 +1.230000000000000e-02 9.677666437654643e-03 4.225360418220626e-04 2.881500000000000e+02 3.331699155975138e+01 8.859007846674354e-01 -8.856628817969465e-03 4.637902110346906e-01 2.109105393500574e-03 +1.230000000000000e-02 1.016114721200506e-02 -4.436452683083394e-04 2.881500000000000e+02 3.202843334758530e+01 8.880303872600582e-01 3.344505778443284e-02 4.585667447739173e-01 2.150324507557260e-03 +1.230000000000000e-02 1.016114721200506e-02 4.436452683083392e-04 2.881500000000000e+02 3.202843334758530e+01 8.880303872600582e-01 -6.648935997922503e-03 4.597366887174077e-01 2.150324507557260e-03 +1.230000000000000e-02 1.064462798635547e-02 -4.647544947946160e-04 2.881500000000000e+02 2.931124680838526e+01 8.867853340771026e-01 3.559994489771646e-02 4.608084365428229e-01 1.769861196946197e-03 +1.230000000000000e-02 1.064462798635547e-02 4.647544947946160e-04 2.881500000000000e+02 2.931124680838526e+01 8.867853340771027e-01 -4.697625191813431e-03 4.621576609592430e-01 1.769861196946197e-03 +1.230000000000000e-02 1.112810876070589e-02 -4.858637212808926e-04 2.881500000000000e+02 2.511433201771983e+01 8.693698105783823e-01 3.824167144025443e-02 4.926801264718960e-01 1.630487557935555e-03 +1.230000000000000e-02 1.112810876070589e-02 4.858637212808926e-04 2.881500000000000e+02 2.511433201771983e+01 8.693698105783823e-01 -4.843752024720255e-03 4.941383111247607e-01 1.630487557935555e-03 +1.230000000000000e-02 1.161158953505630e-02 -5.069729477671694e-04 2.881500000000000e+02 2.068271201250798e+01 8.609729305189665e-01 3.996702674728404e-02 5.070781494864128e-01 1.435649787184269e-03 +1.230000000000000e-02 1.161158953505630e-02 5.069729477671693e-04 2.881500000000000e+02 2.068271201250798e+01 8.609729305189665e-01 -4.379832605461022e-03 5.086319199381131e-01 1.435649787184269e-03 +1.230000000000000e-02 1.209507030940672e-02 -5.280821742534461e-04 2.881500000000000e+02 1.425021780494439e+01 8.068188357102061e-01 3.404111642689164e-02 5.898174028762109e-01 1.164465134572247e-03 +1.230000000000000e-02 1.209507030940672e-02 5.280821742534461e-04 2.881500000000000e+02 1.425021780494439e+01 8.068188357102061e-01 -1.749439413157761e-02 5.905398483736696e-01 1.164465134572247e-03 +1.230000000000000e-02 1.257855108375714e-02 -5.491914007397227e-04 2.881500000000000e+02 9.891554779527372e+00 7.520381756169899e-01 2.135771076565043e-02 6.587734288854707e-01 1.158624905448327e-03 +1.230000000000000e-02 1.257855108375714e-02 5.491914007397226e-04 2.881500000000000e+02 9.891554779527372e+00 7.520381756169899e-01 -3.613944926881677e-02 6.581280442445954e-01 1.158624905448327e-03 +1.230000000000000e-02 1.306203185810882e-02 -5.703006272260550e-04 2.881500000000000e+02 6.393699027877189e+00 7.203924215589249e-01 -1.774214892046960e-02 6.933397256123091e-01 8.989716122905569e-04 +1.230000000000000e-02 1.306203185810882e-02 5.703006272260548e-04 2.881500000000000e+02 6.393699027877188e+00 7.203924215589250e-01 -7.810317344952432e-02 6.891550284642648e-01 8.989716122905569e-04 +1.230000000000000e-02 1.354551263246073e-02 -5.914098537123968e-04 2.881500000000000e+02 4.159475074460833e+00 6.958121544564141e-01 -1.056173699727177e-01 7.104156648545761e-01 8.550258250599377e-04 +1.230000000000000e-02 1.354551263246073e-02 5.914098537123966e-04 2.881500000000000e+02 4.159475074460833e+00 6.958121544564141e-01 -1.671322689231877e-01 6.985071584424246e-01 8.550258250599377e-04 +1.230000000000000e-02 1.402899340681264e-02 -6.125190801987386e-04 2.881500000000000e+02 3.466774653766527e+00 6.780817593465893e-01 -1.962656943156323e-01 7.082971868334907e-01 7.807626782637281e-04 +1.230000000000000e-02 1.402899340681264e-02 6.125190801987387e-04 2.881500000000000e+02 3.466774653766527e+00 6.780817593465893e-01 -2.572510114990779e-01 6.884962198328582e-01 7.807626782637281e-04 +1.230000000000000e-02 1.451247418116454e-02 -6.336283066850803e-04 2.881500000000000e+02 2.818095933870955e+00 6.413195442631660e-01 -3.269956285048218e-01 6.941059725177575e-01 7.066101318319812e-04 +1.230000000000000e-02 1.451247418116454e-02 6.336283066850801e-04 2.881500000000000e+02 2.818095933870956e+00 6.413195442631658e-01 -3.862466329960522e-01 6.629651428584297e-01 7.066101318319812e-04 diff --git a/TestCases/incomp_rans/morse_swirl_jet/morse_sa.cfg b/TestCases/incomp_rans/morse_swirl_jet/morse_sa.cfg new file mode 100644 index 000000000000..45a3bf2c8fed --- /dev/null +++ b/TestCases/incomp_rans/morse_swirl_jet/morse_sa.cfg @@ -0,0 +1,99 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Swirling jet in still air, S = 0.36, Re = 56,000 % +% (Morse 1980, ERCOFTAC Classic case 026), SA, 5 deg wedge % +% Author: Nijso Beishuizen % +% Institution: Bosch Thermotechnology % +% Date: Nov 15th, 2026 % +% File Version 8.6.0 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= INC_RANS +KIND_TURB_MODEL= SA +MATH_PROBLEM= DIRECT +RESTART_SOL= YES + +% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% +% +% Air; the far field carries a co-flow of 1% of the jet exit velocity (34.46 m/s). +FLUID_MODEL= CONSTANT_DENSITY +INC_DENSITY_INIT= 1.2 +INC_VELOCITY_INIT= ( 0.345, 0.0, 0.0 ) +INC_NONDIM= DIMENSIONAL + +% --------------------------- VISCOSITY MODEL ---------------------------------% +% +% Re = U_exit D / nu = 56,000 with D = 0.0246 m. +VISCOSITY_MODEL= CONSTANT_VISCOSITY +MU_CONSTANT= 1.82e-05 +FREESTREAM_NU_FACTOR= 3.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +% The jet enters at x/D = 0.5 with the profiles measured there (inlet_jet.dat). The far field supplies the +% entrained air through the inlet plane; at r = 30 D it suffices up to x/D = 100. +INC_INLET_TYPE= VELOCITY_INLET +MARKER_INLET= ( inlet_jet, 288.15, 34.10, 1.0, 0.0, 0.0 ) +SPECIFIED_INLET_PROFILE= YES +INLET_FILENAME= inlet_jet.dat +% The outlet is a far field too: a pressure outlet lets a reversed flow enter along the axis. +MARKER_FAR= ( farfield, outlet ) +MARKER_EULER= ( axis ) +MARKER_PERIODIC= ( periodic_1, periodic_2, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) +MARKER_PLOTTING= ( axis ) +MARKER_MONITORING= ( axis ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +NUM_METHOD_GRAD_RECON= LEAST_SQUARES +CFL_NUMBER= 25 +CFL_ADAPT= YES +CFL_ADAPT_PARAM= ( 0.5, 1.1, 25, 2500, 0.001 ) +ITER= 1000 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-4 +LINEAR_SOLVER_ITER= 50 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= FDS +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= VENKATAKRISHNAN +VENKAT_LIMITER_COEFF= 0.05 +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_FIELD= RMS_PRESSURE +CONV_RESIDUAL_MINVAL= -10 +CONV_STARTITER= 10 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= morse_wedge.su2 +MESH_FORMAT= SU2 +SOLUTION_FILENAME= solution_flow +RESTART_FILENAME= restart_flow +CONV_FILENAME= history +VOLUME_FILENAME= flow +SCREEN_OUTPUT= INNER_ITER, RMS_PRESSURE, RMS_VELOCITY-X, RMS_NU_TILDE, LINSOL_ITER, LINSOL_RESIDUAL, AVG_CFL +HISTORY_OUTPUT= ITER, RMS_RES, CFL_NUMBER +VOLUME_OUTPUT= COORDINATES, SOLUTION, PRIMITIVE, RESIDUAL +OUTPUT_FILES= RESTART, RESTART_ASCII, PARAVIEW +WRT_RESTART_COMPACT= NO +OUTPUT_WRT_FREQ= 100 diff --git a/TestCases/incomp_rans/morse_swirl_jet/morse_wedge.geo b/TestCases/incomp_rans/morse_swirl_jet/morse_wedge.geo new file mode 100644 index 000000000000..8e0323d752c5 --- /dev/null +++ b/TestCases/incomp_rans/morse_swirl_jet/morse_wedge.geo @@ -0,0 +1,100 @@ +// Structured wedge mesh for the Morse swirling jet (ERCOFTAC C26). +// The x-r plane is meshed at theta = -angle/2 and rotated about the jet axis (x) by the wedge angle, one cell thick. +// A slip wall at r = rmin replaces the axis, so all cells are hexahedra. Lengths are in nozzle diameters times D. +// +// gmsh morse_wedge.geo -3 -format su2 -o morse_wedge.su2 +// +// The mesh must be 3D (-3); a 2D mesh gives a file without volume elements. + +D = 0.0246; // nozzle diameter [m] +angle = 5; // wedge angle [deg] +x0 = 0.5; // inlet plane, x/D +xmax = 50; // outlet plane, x/D +rmin = 0.02; // slip wall replacing the axis, r/D +rjet = 0.5905; // outer radius of the measured inlet profile, r/D +rfine = 4; // end of the uniform radial spacing, r/D +rmax = 30; // far-field radius, r/D +dr = 0.02; // uniform radial spacing, r/D +dx0 = 0.02; // axial spacing at the inlet, x/D +dxmax = 0.25; // largest axial spacing, x/D +g = 1.03; // growth ratio of stretched spacings + +// Cells per segment: axial spacing grows from dx0 to dxmax, then stays uniform. +nx1 = Ceil(Log(dxmax / dx0) / Log(g)); +xg = x0 + dx0 * (g^nx1 - 1) / (g - 1); +nx2 = Round((xmax - xg) / dxmax); +nr1 = Round((rjet - rmin) / dr); +nr2 = Round((rfine - rjet) / dr); +nr3 = Round(Log(1 + (rmax - rfine) * (g - 1) / dr) / Log(g)); + +xs[] = {x0, xg, xmax}; +rs[] = {rmin, rjet, rfine, rmax}; +nxs[] = {nx1, nx2}; +gxs[] = {g, 1}; +nrs[] = {nr1, nr2, nr3}; +grs[] = {1, 1, g}; +a = -0.5 * angle * Pi / 180; + +For i In {0:2} + For j In {0:3} + p = newp; + Point(p) = {xs[i] * D, rs[j] * D * Cos(a), rs[j] * D * Sin(a)}; + P[i * 4 + j] = p; + EndFor +EndFor + +// Lines of constant r (H) and of constant x (V), all oriented towards larger x or r. +For i In {0:1} + For j In {0:3} + l = newl; + Line(l) = {P[i * 4 + j], P[(i + 1) * 4 + j]}; + Transfinite Curve{l} = nxs[i] + 1 Using Progression gxs[i]; + H[i * 4 + j] = l; + EndFor +EndFor +For i In {0:2} + For j In {0:2} + l = newl; + Line(l) = {P[i * 4 + j], P[i * 4 + j + 1]}; + Transfinite Curve{l} = nrs[j] + 1 Using Progression grs[j]; + V[i * 3 + j] = l; + EndFor +EndFor + +For i In {0:1} + For j In {0:2} + cl = newcl; + Curve Loop(cl) = {H[i * 4 + j], V[(i + 1) * 3 + j], -H[i * 4 + j + 1], -V[i * 3 + j]}; + s = news; + Plane Surface(s) = {cl}; + Transfinite Surface{s}; + Recombine Surface{s}; + S[i * 3 + j] = s; + EndFor +EndFor + +ext[] = Extrude {{1, 0, 0}, {0, 0, 0}, angle * Pi / 180} { Surface{S[]}; Layers{1}; Recombine; }; + +// Extrude returns, per source surface, the rotated copy, the volume and the four side surfaces. +For k In {0:5} + top[k] = ext[6 * k]; + vol[k] = ext[6 * k + 1]; +EndFor + +e = 1e-4 * D; +big = 2 * rmax * D; +inlet[] = Surface In BoundingBox{x0 * D - e, -big, -big, x0 * D + e, big, big}; +jet[] = Surface In BoundingBox{x0 * D - e, -big, -big, x0 * D + e, rjet * D + e, big}; +outlet[] = Surface In BoundingBox{xmax * D - e, -big, -big, xmax * D + e, big, big}; +axis[] = Surface In BoundingBox{x0 * D - e, -big, -big, xmax * D + e, rmin * D + e, big}; +side[] = Surface In BoundingBox{x0 * D - e, rmax * D * Cos(a) - e, -big, xmax * D + e, rmax * D + e, big}; +open[] = inlet[]; +open[] -= jet[]; + +Physical Surface("inlet_jet") = {jet[]}; +Physical Surface("farfield") = {open[], side[]}; +Physical Surface("outlet") = {outlet[]}; +Physical Surface("axis") = {axis[]}; +Physical Surface("periodic_1") = {S[]}; +Physical Surface("periodic_2") = {top[]}; +Physical Volume("fluid") = {vol[]}; diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e2cd6bf9c5c8..a7bdf3ef2f82 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -894,7 +894,7 @@ def main(): sp_pipeSlice_3d_dp_hf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/pipeSlice_3d" sp_pipeSlice_3d_dp_hf_tp.cfg_file = "sp_pipeSlice_3d_dp_hf_tp.cfg" sp_pipeSlice_3d_dp_hf_tp.test_iter = 10 - sp_pipeSlice_3d_dp_hf_tp.test_vals = [-11.119796, -11.234737, -9.429479, -0.000023] + sp_pipeSlice_3d_dp_hf_tp.test_vals = [-13.241752, -13.260502, -10.953562, -0.000025] test_list.append(sp_pipeSlice_3d_dp_hf_tp) # Same with the energy equation, periodic temperature and an integrated wall heat @@ -902,7 +902,7 @@ def main(): sp_pipeSlice_3d_dp_ihf_tp.cfg_dir = "incomp_navierstokes/streamwise_periodic/pipeSlice_3d" sp_pipeSlice_3d_dp_ihf_tp.cfg_file = "sp_pipeSlice_3d_dp_ihf_tp.cfg" sp_pipeSlice_3d_dp_ihf_tp.test_iter = 10 - sp_pipeSlice_3d_dp_ihf_tp.test_vals = [-11.120123, -5.196299, -0.000023, -0.015700] + sp_pipeSlice_3d_dp_ihf_tp.test_vals = [-12.253831, -5.369585, -0.000025, -0.015700] test_list.append(sp_pipeSlice_3d_dp_ihf_tp) # 2D pin array with heat transfer BC on pin surfaces @@ -925,6 +925,14 @@ def main(): inc_turb_naca0012.test_vals = [-4.758064, -10.974498, -0.000005, -0.028653, 3, -5.740545, 2, -5.036110] test_list.append(inc_turb_naca0012) + # Swirling jet on a one-cell wedge, rotational periodicity (Morse 1980) + inc_turb_morse_swirl_jet = TestCase('inc_turb_morse_swirl_jet') + inc_turb_morse_swirl_jet.cfg_dir = "incomp_rans/morse_swirl_jet" + inc_turb_morse_swirl_jet.cfg_file = "morse_sa.cfg" + inc_turb_morse_swirl_jet.test_iter = 10 + inc_turb_morse_swirl_jet.test_vals = [-10.569835, -8.376495, -9.323474, 12.000000, -4.059383, 71.328000] + test_list.append(inc_turb_morse_swirl_jet) + # NACA0012, SST_SUST inc_turb_naca0012_sst_sust = TestCase('inc_turb_naca0012_sst_sust') inc_turb_naca0012_sst_sust.cfg_dir = "incomp_rans/naca0012" diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index 879d3e7463ab..f92a7a2e53d0 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -251,7 +251,7 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79.000000, -7.555647, -10.335486, -10.356919, -13.629543] + discadj_trans_stator.test_vals = [79.000000, -7.555649, -10.335509, -10.356935, -13.629546] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.555647, -10.335486, -10.356919, -13.629543] test_list.append(discadj_trans_stator) diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index 05d44805e201..8fe4642b02dc 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -200,7 +200,7 @@ def main(): discadj_trans_stator.cfg_dir = "disc_adj_turbomachinery/transonic_stator_2D" discadj_trans_stator.cfg_file = "transonic_stator.cfg" discadj_trans_stator.test_iter = 79 - discadj_trans_stator.test_vals = [79.000000, -7.308168, -9.891121, -10.038669, -13.368502] + discadj_trans_stator.test_vals = [79.000000, -7.308175, -9.891136, -10.038680, -13.368508] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.308167, -9.891117, -10.038669, -13.368501] test_list.append(discadj_trans_stator)