diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 99078f030608..1284de232919 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -601,7 +601,8 @@ class CConfig { MUSCL_Heat, /*!< \brief MUSCL scheme for the (fvm) heat equation.*/ MUSCL_AdjFlow, /*!< \brief MUSCL scheme for the adj flow equations.*/ MUSCL_AdjTurb, /*!< \brief MUSCL scheme for the adj turbulence equations.*/ - MUSCL_Species; /*!< \brief MUSCL scheme for the species equations.*/ + MUSCL_Species, /*!< \brief MUSCL scheme for the species equations.*/ + MUSCL_FirstOrderWallEnds; /*!< \brief First-order reconstruction at no-slip wall ends and sharp wall edges.*/ su2double MUSCL_Kappa, /*!< \brief Blending coefficient for U-MUSCL scheme (for the runtime eq. system). */ MUSCL_Kappa_Flow, /*!< \brief Blending coefficient for U-MUSCL scheme for the flow equations.*/ MUSCL_Kappa_Turb, /*!< \brief Blending coefficient for U-MUSCL scheme for the turbulence equations.*/ @@ -1118,6 +1119,7 @@ class CConfig { su2double ParMETIS_tolerance; /*!< \brief Load balancing tolerance for ParMETIS. */ long ParMETIS_pointWgt; /*!< \brief Load balancing weight given to points. */ long ParMETIS_edgeWgt; /*!< \brief Load balancing weight given to edges. */ + bool ParMETIS_anisotropyWgt; /*!< \brief Weight graph edges by cell anisotropy and keep anisotropic lines on one rank. */ unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */ bool DiscreteAdjoint, /*!< \brief AD-based discrete adjoint mode. */ DiscreteAdjointDebug; /*!< \brief Discrete adjoint debug mode using tags. */ @@ -1149,6 +1151,7 @@ class CConfig { bool RelFrame_SlidingPlane; /*!< \brief option for relative frame slidingplane */ bool RampMotionFrame; /*!< \brief option for ramping up or down the motion Frame values */ bool RampOutlet; /*!< \brief option for ramping up or down the outlet values */ + unsigned short Turb_SubIter; /*!< \brief Turbulence iterations per flow iteration. */ bool RampMUSCL; bool RampRotatingFrame; /*!< \brief option for ramping up or down the motion Frame values */ bool RampTranslationFrame; /*!< \brief option for ramping up or down the outlet values */ @@ -1178,6 +1181,8 @@ class CConfig { unsigned short *MG_PreSmooth_p{nullptr}, *MG_PostSmooth_p{nullptr}, *MG_CorrecSmooth_p{nullptr}; unsigned short nMG_CflScaling_p{0}; su2double *MG_CflScaling_p{nullptr}; + unsigned short nMG_LinSolIter_p{0}; + unsigned short *MG_LinSolIter_p{nullptr}; ENUM_STREAMWISE_PERIODIC Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */ bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */ @@ -3907,6 +3912,14 @@ class CConfig { */ const CMGOptions& GetMGOptions() const { return MGOptions; } + /*! + * \brief Linear solver iterations on a multigrid level. The finest active level, also during the + * full-multigrid startup, uses LINEAR_SOLVER_ITER. + */ + unsigned long GetMG_LinSolIter(unsigned short iMesh) const { + return (iMesh <= FinestMesh) ? Linear_Solver_Iter : MGOptions.MG_LinSolIter[iMesh]; + } + /*! * \brief plane of the FFD (I axis) that should be fixed. * \param[in] val_index - Index of the arrray with all the planes in the I direction that should be fixed. @@ -4867,6 +4880,11 @@ class CConfig { /*! \brief Whether the heat equation reconstructs. */ bool GetMUSCL_Heat(void) const { return MUSCL_Heat; } + /*! + * \brief Get if edges at no-slip wall ends and sharp wall edges are reconstructed to first order. + */ + bool GetMUSCL_FirstOrderWallEnds(void) const { return MUSCL_FirstOrderWallEnds; } + /*! * \brief Get if the upwind scheme used MUSCL or not. * \return MUSCL scheme. @@ -7450,6 +7468,11 @@ class CConfig { */ su2double GetCFLRedCoeff_Turb(void) const { return CFLRedCoeff_Turb; } + /*! + * \brief Get the number of turbulence iterations per flow iteration. + */ + unsigned short GetTurb_SubIter(void) const { return Turb_SubIter; } + /*! * \brief Value of the CFL reduction in species problems. * \return Value of the CFL reduction in species problems. @@ -10310,6 +10333,11 @@ class CConfig { */ long GetParMETIS_EdgeWeight() const { return ParMETIS_edgeWgt; } + /*! + * \brief Whether ParMETIS weights graph edges by cell anisotropy and partitions with coordinates. + */ + bool GetParMETIS_AnisotropyWeight() const { return ParMETIS_anisotropyWgt; } + /*! * \brief Find the marker index (if any) that is part of a given interface pair. * \param[in] iInterface - Number of the interface pair being tested, starting at 0. diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 19a0484c65f2..a9a2785dee5f 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -110,7 +110,8 @@ class CMultiGridGeometry final : public CGeometry { vector> normal; /*!< \brief Unit normal there, pointing into the domain. */ vector strength; /*!< \brief Local anisotropy, the ordering key. */ vector tier; /*!< \brief Paving order: 0 viscous wall, 1 Euler - wall, 2 anything else. */ + wall, 2 anything else; one more once the + mixed nodes are put first. */ unsigned long nRefusedCurvature = 0; /*!< \brief Euler wall nodes the curvature limit kept out. */ }; diff --git a/Common/include/geometry/CPhysicalGeometry.hpp b/Common/include/geometry/CPhysicalGeometry.hpp index 832dce0e1249..1ea891139083 100644 --- a/Common/include/geometry/CPhysicalGeometry.hpp +++ b/Common/include/geometry/CPhysicalGeometry.hpp @@ -337,6 +337,46 @@ class CPhysicalGeometry final : public CGeometry { */ void PrepareAdjacency(const CConfig* config); +#if defined(HAVE_MPI) && defined(HAVE_PARMETIS) + /*! + * \brief ParMETIS edge weights that make cutting across the short edges of anisotropic cells expensive. + * \param[in] maxWeight - Cap on the weight of any edge. + * \return One weight per entry of the adjacency array. + */ + vector ComputeAnisotropyEdgeWeights(long maxWeight) const; + + /*! + * \brief Reads, for any global points of the linear partition, a value each rank holds for its own points. + * \param[in] wanted - Global indices to read. + * \param[in] localValue - Value of every local point. + * \return The value of each wanted point. + */ + vector FetchFromOwners(const vector& wanted, + const vector& localValue) const; + + /*! + * \brief Joins points into lines along the strong anisotropic edges and names each line by its lowest global index. + * \param[in] adjwgt - Anisotropy weight of every entry of the adjacency array. + * \param[out] lineEdge - Whether each entry of the adjacency array is a line edge. + * \return Global index of the root of the line of every local point, the point itself when it is on no line. + */ + vector LinkAnisotropicLines(const vector& adjwgt, vector& lineEdge) const; + + /*! + * \brief Moves each split line to the partition that holds most of its points and stays within the load tolerance. + * \param[in] root - Line roots from LinkAnisotropicLines. + * \param[in] vwgt - Vertex weight of every local point. + * \param[in] maxImbalance - Largest partition load over the mean load. + * \param[in,out] part - Partition of every local point. + * \param[out] longestLine - Number of points of the longest line. + * \param[out] nSplit - Number of lines left split. + * \return Number of points that changed partition, summed over all ranks. + */ + unsigned long KeepLinesTogether(const vector& root, const vector& vwgt, + passivedouble maxImbalance, vector& part, unsigned long& longestLine, + unsigned long& nSplit) const; +#endif + /*! * \brief Find repeated nodes between two elements to identify the common face. * \param[in] first_elem - Identification of the first element. diff --git a/Common/include/linear_algebra/CSysSolve.hpp b/Common/include/linear_algebra/CSysSolve.hpp index 0642f7885f74..3ee9320e2a05 100644 --- a/Common/include/linear_algebra/CSysSolve.hpp +++ b/Common/include/linear_algebra/CSysSolve.hpp @@ -455,9 +455,10 @@ class CSysSolve { * \param[in,out] LinSysSol - Linear system solution * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. + * \param[in] maxIter - Iteration cap replacing LINEAR_SOLVER_ITER in standard mode, 0 keeps the config value. */ unsigned long Solve(MatrixType& Jacobian, const CSysVector& LinSysRes, CSysVector& LinSysSol, - CGeometry* geometry, const CConfig* config); + CGeometry* geometry, const CConfig* config, unsigned long maxIter = 0); /*! * \brief Solve the adjoint linear system using a Krylov subspace method diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index dddd503d9890..850c31723e83 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -80,6 +80,7 @@ const unsigned int MAX_NUMBER_FFD = 15; /*!< \brief Maximum number of FFDB enum: unsigned int{MAX_SOLS = 14}; /*!< \brief Maximum number of solutions at the same time (dimension of solution container array). */ const unsigned int MAX_TERMS = 7; /*!< \brief Maximum number of terms in the numerical equations (dimension of solver container array). */ const unsigned int MAX_ZONES = 3; /*!< \brief Maximum number of zones. */ +const unsigned short MAX_MGLEVELS = 10; /*!< \brief Maximum number of coarse multigrid levels, which bounds the per-level arrays of the multigrid integration. */ const unsigned int MAX_FE_KINDS = 7; /*!< \brief Maximum number of Finite Elements. */ const unsigned int NO_RK_ITER = 0; /*!< \brief No Runge-Kutta iteration. */ @@ -1243,10 +1244,13 @@ struct CMGOptions { std::vector MG_PostSmooth; /*!< \brief Multigrid post-smoothing iterations per level. */ std::vector MG_CorrecSmooth; /*!< \brief Multigrid Jacobi correction-smoothing per level. */ std::vector MG_CflScaling; /*!< \brief Per-level CFL scaling factors relative to the previous (finer) level. Entry [i] scales level i+1 from level i. Size = nMGLevels. */ + std::vector MG_LinSolIter; /*!< \brief Linear solver iteration cap per MG level (entry 0 = finest). */ bool MG_Smooth_EarlyExit{false}; /*!< \brief Enable early exit for MG smoothing iterations. */ bool MG_Smooth_Output{false}; /*!< \brief Output compact per-cycle smoothing summary. */ su2double MG_Smooth_StagnationTol{0.0}; /*!< \brief Stagnation early exit: stop if current_rms >= prev_rms * tol. 0 = disabled. */ bool MG_Implicit_Lines{false}; /*!< \brief Enable implicit-lines agglomeration from walls. */ + bool MG_Linear_Prolongation{false}; /*!< \brief Prolong the correction with a limited least-squares + gradient instead of piecewise-constant injection. */ unsigned long MG_Startup_Iter{100}; /*!< \brief Iterations per mesh during FMG startup, and the length of each level's CFL ramp. 0 = no iteration budget. */ su2double MG_Startup_Convergence{-2.0}; /*!< \brief FMG: orders of magnitude (log10) that CONV_FIELD must drop on the active level before promoting to the next finer one. Negative is a @@ -2949,6 +2953,7 @@ enum class MPI_QUANTITIES { COORDINATES , /*!< \brief Vertex coordinates communication. */ COORDINATES_OLD , /*!< \brief Old vertex coordinates communication. */ MAX_LENGTH , /*!< \brief Maximum length communication. */ + WALL_DISTANCE , /*!< \brief Wall distance and roughness of the nearest wall communication. */ GRID_VELOCITY , /*!< \brief Grid velocity communication. */ SOLUTION_EDDY , /*!< \brief Turbulent solution plus eddy viscosity communication. */ STOCH_SOURCE_LANG , /*!< \brief Stochastic source term for Langevin equations communication. */ @@ -2966,6 +2971,7 @@ enum class MPI_QUANTITIES { MOM_COEFF , /*!< \brief Momentum coefficient for the Rhie-Chow scheme. */ MOM_CORRECTION , /*!< \brief Momentum correction for the pressure-based poisson solver (used when computing HbyA). */ HBYA_CORRECTION , /*!< \brief HbyA correction for the pressure-based poisson solver. */ + FIRST_ORDER_RECONSTRUCTION, /*!< \brief First-order reconstruction flag at wall ends. */ }; /*! diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index a3f397f4d2e9..5ed0cc3ff514 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1952,6 +1952,8 @@ void CConfig::SetConfig_Options() { addDoubleOption("CFL_REDUCTION_ADJFLOW", CFLRedCoeff_AdjFlow, 0.8); /* DESCRIPTION: Reduction factor of the CFL coefficient in the level set problem */ addDoubleOption("CFL_REDUCTION_TURB", CFLRedCoeff_Turb, 1.0); + /* DESCRIPTION: Number of turbulence iterations per flow iteration. */ + addUnsignedShortOption("TURB_SUBITER", Turb_SubIter, 1); /* DESCRIPTION: Reduction factor of the CFL coefficient in the turbulent adjoint problem */ addDoubleOption("CFL_REDUCTION_ADJTURB", CFLRedCoeff_AdjTurb, 1.0); /*!\brief CFL_REDUCTION_SPECIES \n DESCRIPTION: Reduction factor of the CFL coefficient in the species problem \n DEFAULT: 1.0 */ @@ -2114,11 +2116,11 @@ void CConfig::SetConfig_Options() { addUShortListOption("MG_POST_SMOOTH", nMG_PostSmooth_p, MG_PostSmooth_p); /*!\brief MG_CORRECTION_SMOOTH\n DESCRIPTION: Jacobi implicit smoothing of the correction \ingroup Config*/ addUShortListOption("MG_CORRECTION_SMOOTH", nMG_CorrecSmooth_p, MG_CorrecSmooth_p); - /*!\brief MG_DAMP_RESTRICTION\n DESCRIPTION: Damping factor for the residual restriction. DEFAULT: 0.75 \ingroup Config*/ + /*!\brief MG_DAMP_RESTRICTION\n DESCRIPTION: Damping factor for the residual restriction. DEFAULT: 0.5 \ingroup Config*/ addDoubleOption("MG_DAMP_RESTRICTION", Damp_Res_Restric, 0.5); - /*!\brief MG_DAMP_PROLONGATION\n DESCRIPTION: Damping factor for the correction prolongation. DEFAULT 0.75 \ingroup Config*/ + /*!\brief MG_DAMP_PROLONGATION\n DESCRIPTION: Damping factor for the correction prolongation. DEFAULT: 0.5 \ingroup Config*/ addDoubleOption("MG_DAMP_PROLONGATION", Damp_Correc_Prolong, 0.5); - /*!\brief MG_SMOOTH_EARLY_EXIT\n DESCRIPTION: Enable early exit for MG smoothing when RMS drops below threshold. DEFAULT: NO \ingroup Config*/ + /*!\brief MG_SMOOTH_EARLY_EXIT\n DESCRIPTION: Enable early exit for MG smoothing when RMS drops below threshold. DEFAULT: YES \ingroup Config*/ addBoolOption("MG_SMOOTH_EARLY_EXIT", MGOptions.MG_Smooth_EarlyExit, true); /*!\brief MG_SMOOTH_RES_THRESHOLD\n DESCRIPTION: Early exit smoothing when current_rms drops below threshold * initial_rms. DEFAULT: 0.9 \ingroup Config*/ addDoubleOption("MG_SMOOTH_RES_THRESHOLD", MGOptions.MG_Smooth_Res_Threshold, 0.9); @@ -2135,6 +2137,10 @@ void CConfig::SetConfig_Options() { /*!\brief MG_IMPLICIT_LINES\n DESCRIPTION: Pave the coarse grid with advancing fronts raised from boundaries * that carry a stretched layer normal to themselves. DEFAULT: NO \ingroup Config*/ addBoolOption("MG_IMPLICIT_LINES", MGOptions.MG_Implicit_Lines, false); + /*!\brief MG_LINEAR_PROLONGATION\n DESCRIPTION: Prolong the multigrid correction with a limited least-squares + * gradient over the coarse control volume instead of injecting the parent value into every child. Coarse CVs on + * walls and symmetry planes keep the constant operator. DEFAULT: NO \ingroup Config*/ + addBoolOption("MG_LINEAR_PROLONGATION", MGOptions.MG_Linear_Prolongation, false); /*!\brief MG_STARTUP_ITER\n DESCRIPTION: Max number of iterations spent on each mesh during the Full * Multigrid (FMG) startup phase. DEFAULT: 100 \ingroup Config*/ addUnsignedLongOption("MG_STARTUP_ITER", MGOptions.MG_Startup_Iter, 100); @@ -2143,15 +2149,20 @@ void CConfig::SetConfig_Options() { * DEFAULT: -2 \ingroup Config*/ addDoubleOption("MG_STARTUP_CONVERGENCE", MGOptions.MG_Startup_Convergence, -2.0); /*!\brief MG_STARTUP_STAGNATION\n DESCRIPTION: Full-MG promotion on stagnation. If the active level's residual ratio - * between successive iterations exceeds this value for MG_STARTUP_STAGNATION_ITER consecutive iterations, promote to - * the next finer level without waiting out MG_STARTUP_ITER. 0 disables it. DEFAULT: 0.99 \ingroup Config*/ + * between successive iterations stays between this value and its inverse for MG_STARTUP_STAGNATION_ITER consecutive + * iterations, promote to the next finer level without waiting out MG_STARTUP_ITER. 0 disables it. + * DEFAULT: 0.99 \ingroup Config*/ addDoubleOption("MG_STARTUP_STAGNATION", MGOptions.MG_Startup_Stagnation, 0.99); /*!\brief MG_STARTUP_STAGNATION_ITER\n DESCRIPTION: Consecutive stalled iterations required before Full-MG promotes * on stagnation. 0 disables it, as MG_STARTUP_STAGNATION= 0 does. DEFAULT: 5 \ingroup Config*/ addUnsignedLongOption("MG_STARTUP_STAGNATION_ITER", MGOptions.MG_Startup_Stagnation_Iter, 5); /*!\brief MG_CFL_SCALING\n DESCRIPTION: Per-level CFL scaling factors for coarse MG levels. Entry i is the ratio CFL(i+1)/CFL(i). - * If fewer values than nMGLevels are given, the last value is repeated. DEFAULT: 0.25 (i.e., 1/4 per level) \ingroup Config*/ + * If fewer values than nMGLevels are given, the last value is repeated. DEFAULT: 0.5 \ingroup Config*/ addDoubleListOption("MG_CFL_SCALING", nMG_CflScaling_p, MG_CflScaling_p); + /*!\brief MG_LINEAR_SOLVER_ITER\n DESCRIPTION: Maximum linear solver iterations on coarse MG levels. Entry i applies to level i+1; + * the last value is repeated, and the cap never exceeds LINEAR_SOLVER_ITER. The active Full-MG startup level and + * the discrete adjoint are not capped. DEFAULT: 3 \ingroup Config*/ + addUShortListOption("MG_LINEAR_SOLVER_ITER", nMG_LinSolIter_p, MG_LinSolIter_p); /*!\par CONFIG_CATEGORY: Spatial Discretization \ingroup Config*/ /*--- Options related to the spatial discretization ---*/ @@ -2182,6 +2193,10 @@ void CConfig::SetConfig_Options() { /*!\brief MUSCL_FLOW \n DESCRIPTION: Check if the MUSCL scheme should be used \ingroup Config*/ addBoolOption("MUSCL_FLOW", MUSCL_Flow, true); + /*!\brief MUSCL_FIRST_ORDER_WALL_ENDS \n DESCRIPTION: Reconstruct the flow to first order on the edges of points + * where a no-slip wall ends on a boundary continuing its surface, or has a sharp edge such as a trailing edge, and + * skip the multigrid correction of the flow there \ingroup Config*/ + addBoolOption("MUSCL_FIRST_ORDER_WALL_ENDS", MUSCL_FirstOrderWallEnds, false); /*!\brief MUSCL_KAPPA_FLOW \n DESCRIPTION: Blending coefficient for the U-MUSCL scheme \ingroup Config*/ addDoubleOption("MUSCL_KAPPA_FLOW", MUSCL_Kappa_Flow, 0.0); /*!\brief RAMP_MUSCL \n DESCRIPTION: Enable ramping of the MUSCL scheme from 1st to 2nd order using specified method*/ @@ -3110,6 +3125,9 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: ParMETIS load balancing weight for edges (equiv. to neighbors) */ addLongOption("PARMETIS_EDGE_WEIGHT", ParMETIS_edgeWgt, 1); + /* DESCRIPTION: Weight ParMETIS graph edges by cell anisotropy and keep anisotropic lines on one rank */ + addBoolOption("PARMETIS_ANISOTROPY_WEIGHT", ParMETIS_anisotropyWgt, false); + /*--- options that are used in the Hybrid RANS/LES Simulations ---*/ /*!\par CONFIG_CATEGORY:Hybrid_RANSLES Options\ingroup Config*/ @@ -5041,6 +5059,17 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i } } + if (RampMUSCL && !(MUSCL_Flow || MUSCL_Turb || MUSCL_Species || MUSCL_Heat)) { + if (rank == MASTER_NODE) cout << "WARNING: RAMP_MUSCL is ignored because no MUSCL reconstruction is active." << endl; + RampMUSCL = false; + } + + if (Turb_SubIter == 0) SU2_MPI::Error("TURB_SUBITER must be at least 1.", CURRENT_FUNCTION); + + if (MUSCL_FirstOrderWallEnds && ((Kind_Regime == ENUM_REGIME::INCOMPRESSIBLE) || GetNEMOProblem())) { + SU2_MPI::Error("MUSCL_FIRST_ORDER_WALL_ENDS is only implemented for the compressible flow solver.", CURRENT_FUNCTION); + } + if(RampMUSCL && !DiscreteAdjoint){ if (RampMUSCLParam.RampMUSCLPower <= 0.0) SU2_MPI::Error("RAMP_MUSCL_POWER cannot be less than or equal to zero!", CURRENT_FUNCTION); rampMUSCLValue = 0.0; @@ -5265,6 +5294,13 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i Kappa_2nd_AdjFlow = jst_adj_coeff[0]; Kappa_4th_AdjFlow = jst_adj_coeff[1]; + /*--- The multigrid integration carries per-level arrays of this size. ---*/ + + if (nMGLevels > MAX_MGLEVELS) { + SU2_MPI::Error("MGLEVEL is larger than the supported maximum of " + std::to_string(MAX_MGLEVELS) + ".", + CURRENT_FUNCTION); + } + /*--- Fill MG smooth vectors to size nMGLevels+1. Use parsed values (truncating or extending by repeat) or defaults if not set. ---*/ @@ -5293,7 +5329,17 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i MGOptions.MG_CflScaling[i] = (i < nMG_CflScaling_p) ? MG_CflScaling_p[i] : MG_CflScaling_p[nMG_CflScaling_p - 1]; } else { for (unsigned short i = 0; i < nMGLevels; ++i) - MGOptions.MG_CflScaling[i] = 0.25; + MGOptions.MG_CflScaling[i] = 0.5; + } + + /*--- Linear solver iteration cap per level; level 0 always uses LINEAR_SOLVER_ITER. The discrete + * adjoint transposes each recorded solve with LINEAR_SOLVER_ITER, so it caps no level. ---*/ + for (unsigned short i = 0; i < nMG_LinSolIter_p; ++i) + if (MG_LinSolIter_p[i] == 0) SU2_MPI::Error("MG_LINEAR_SOLVER_ITER entries must be positive.", CURRENT_FUNCTION); + MGOptions.MG_LinSolIter.assign(nMGLevels + 1, Linear_Solver_Iter); + for (unsigned short i = 1; (i <= nMGLevels) && !DiscreteAdjoint; ++i) { + const unsigned long cap = (nMG_LinSolIter_p != 0) ? MG_LinSolIter_p[min(i - 1, nMG_LinSolIter_p - 1)] : 3; + MGOptions.MG_LinSolIter[i] = min(cap, Linear_Solver_Iter); } } diff --git a/Common/src/geometry/CGeometry.cpp b/Common/src/geometry/CGeometry.cpp index f7179721bbd4..c1bfc022a157 100644 --- a/Common/src/geometry/CGeometry.cpp +++ b/Common/src/geometry/CGeometry.cpp @@ -627,6 +627,10 @@ void CGeometry::GetCommCountAndType(const CConfig* config, MPI_QUANTITIES commTy COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE::DOUBLE; break; + case MPI_QUANTITIES::WALL_DISTANCE: + COUNT_PER_POINT = 2; + MPI_TYPE = COMM_TYPE::DOUBLE; + break; case MPI_QUANTITIES::NEIGHBORS: COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE::UNSIGNED_SHORT; @@ -718,6 +722,10 @@ void CGeometry::InitiateComms(CGeometry* geometry, const CConfig* config, MPI_QU case MPI_QUANTITIES::MAX_LENGTH: bufDSend[buf_offset] = nodes->GetMaxLength(iPoint); break; + case MPI_QUANTITIES::WALL_DISTANCE: + bufDSend[buf_offset] = nodes->GetWall_Distance(iPoint); + bufDSend[buf_offset + 1] = nodes->GetRoughnessHeight(iPoint); + break; case MPI_QUANTITIES::NEIGHBORS: bufSSend[buf_offset] = geometry->nodes->GetnNeighbor(iPoint); break; @@ -811,6 +819,10 @@ void CGeometry::CompleteComms(CGeometry* geometry, const CConfig* config, MPI_QU case MPI_QUANTITIES::MAX_LENGTH: nodes->SetMaxLength(iPoint, bufDRecv[buf_offset]); break; + case MPI_QUANTITIES::WALL_DISTANCE: + nodes->SetWall_Distance(iPoint, bufDRecv[buf_offset]); + nodes->SetRoughnessHeight(iPoint, bufDRecv[buf_offset + 1]); + break; case MPI_QUANTITIES::NEIGHBORS: nodes->SetnNeighbor(iPoint, bufSRecv[buf_offset]); break; @@ -2891,6 +2903,12 @@ void CGeometry::UpdateGeometry(CGeometry** geometry_container, CConfig* config) geometry_container[iMesh]->SetBoundControlVolume(geometry_container[iMesh - 1], config, UPDATE); geometry_container[iMesh]->SetCoord(geometry_container[iMesh - 1]); geometry_container[iMesh]->UpdatePeriodicVolumes(config); + + /*--- SetCoord centred a halo agglomerate on the partial child list this rank holds. Take + the owner's coordinate, otherwise coarse stencils depend on the partitioning. ---*/ + + geometry_container[iMesh]->InitiateComms(geometry_container[iMesh], config, MPI_QUANTITIES::COORDINATES); + geometry_container[iMesh]->CompleteComms(geometry_container[iMesh], config, MPI_QUANTITIES::COORDINATES); } /*--- Compute the global surface areas for all markers. ---*/ @@ -4736,6 +4754,45 @@ su2double NearestNeighborDistance(CGeometry* geometry, const CConfig* config, co const su2double Vol = geometry->nodes->GetVolume(iPoint) + geometry->nodes->GetPeriodicVolume(iPoint); return 2 * Vol / GeometryToolbox::Norm(3, Normal); } + +/*--- Volume-averages the wall distance and roughness of the children onto a coarse grid, then sets the + * nearest-neighbor distance of its viscous wall vertices. ---*/ +void RestrictWallDistance(const CGeometry* geo_fine, CGeometry* geo_coarse, const CConfig* config) { + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) + for (auto iPoint = 0ul; iPoint < geo_coarse->GetnPointDomain(); iPoint++) { + su2double dist = 0.0, roughness = 0.0, vol = 0.0; + for (auto iChild = 0u; iChild < geo_coarse->nodes->GetnChildren_CV(iPoint); iChild++) { + const auto jPoint = geo_coarse->nodes->GetChildren_CV(iPoint, iChild); + const su2double volChild = geo_fine->nodes->GetVolume(jPoint); + dist += geo_fine->nodes->GetWall_Distance(jPoint) * volChild; + roughness += geo_fine->nodes->GetRoughnessHeight(jPoint) * volChild; + vol += volChild; + } + geo_coarse->nodes->SetWall_Distance(iPoint, (vol > 0.0) ? su2double(dist / vol) : su2double(0.0)); + geo_coarse->nodes->SetRoughnessHeight(iPoint, (vol > 0.0) ? su2double(roughness / vol) : su2double(0.0)); + } + END_SU2_OMP_FOR + + /*--- A halo agglomerate only holds the children on this rank, so take the owner's values. ---*/ + + geo_coarse->InitiateComms(geo_coarse, config, MPI_QUANTITIES::WALL_DISTANCE); + geo_coarse->CompleteComms(geo_coarse, config, MPI_QUANTITIES::WALL_DISTANCE); + + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); ++iMarker) { + const auto viscous = config->GetViscous_Wall(iMarker); + + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->nVertex[iMarker], omp_get_num_threads())) + for (auto iVertex = 0u; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { + const auto iPoint = geo_coarse->vertex[iMarker][iVertex]->GetNode(); + const su2double dist = (viscous && geo_coarse->nodes->GetDomain(iPoint)) + ? NearestNeighborDistance(geo_coarse, config, iPoint) + : geo_coarse->nodes->GetWall_Distance(iPoint); + geo_coarse->vertex[iMarker][iVertex]->SetNearestNeighborDistance(dist); + } + END_SU2_OMP_FOR + } +} + /*! \brief Average the vertex normals of a wall element and normalize the result. * With active = false the vertex normals are read as passive values. */ std::array WallElementNormal(const CGeometry* geometry, unsigned short iMarker, unsigned long iElem, @@ -4862,6 +4919,12 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo for (int iZone = 0; iZone < nZone; iZone++) { CGeometry* geometry = geometry_container[iZone][iInst][MESH_0]; geometry->SetWallDistance(noWallDistance); + + if (!wallDistanceNeeded[iZone]) continue; + for (unsigned short iMesh = 1; iMesh <= config_container[iZone]->GetnMGLevels(); iMesh++) { + RestrictWallDistance(geometry_container[iZone][iInst][iMesh - 1], geometry_container[iZone][iInst][iMesh], + config_container[iZone]); + } } continue; } @@ -4943,6 +5006,13 @@ void CGeometry::ComputeWallDistance(const CConfig* const* config_container, CGeo } END_SU2_OMP_FOR } + + /*--- The Full-MG startup solves the turbulence model on coarse grids. ---*/ + + for (unsigned short iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) { + RestrictWallDistance(geometry_container[iZone][iInst][iMesh - 1], geometry_container[iZone][iInst][iMesh], + config); + } } } } diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index c2bb90e71023..6c9c902218a2 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -69,6 +69,39 @@ vector MarkerSetClasses(unsigned long nEntity, vectorGetnDim(); + if ((nDim != 3) || (config->GetMarker_All_KindBC(iMarker) != SYMMETRY_PLANE)) return false; + + auto unitNormal = [&](unsigned short jMarker, su2double* n) { + const long iVertex = grid->nodes->GetVertex(iPoint, jMarker); + if (iVertex < 0) return false; + grid->vertex[jMarker][iVertex]->GetNormal(n); + const su2double nrm = GeometryToolbox::Norm(nDim, n); + if (nrm <= 0.0) return false; + for (unsigned short d = 0; d < nDim; ++d) n[d] /= nrm; + return true; + }; + + su2double nSym[3] = {0.0}, nOther[3] = {0.0}; + if (!unitNormal(iMarker, nSym)) return false; + + bool hasOther = false; + for (auto jMarker = 0u; jMarker < grid->GetnMarker(); jMarker++) { + const auto bc = config->GetMarker_All_KindBC(jMarker); + if ((bc == SEND_RECEIVE) || (bc == SYMMETRY_PLANE) || (grid->nodes->GetVertex(iPoint, jMarker) < 0)) continue; + if ((bc == PERIODIC_BOUNDARY) || !unitNormal(jMarker, nOther)) return false; + if (fabs(GeometryToolbox::DotProduct(nDim, nSym, nOther)) >= sqrt(0.5)) return false; + hasOther = true; + } + return hasOther; +} + +bool HasElements(const CGeometry* grid); + } // namespace CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, unsigned short iMesh) : CGeometry() { @@ -387,6 +420,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un vector inCV(fine_grid->GetnPoint(), 0); vector isCandidate(fine_grid->GetnPoint(), 0); vector members, candidates; + vector> wholeCells; members.reserve(maxAgglomSize); /*--- A local frame at the seed: up to nDim of its incident edges, as mutually orthogonal as @@ -434,6 +468,56 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un addMember(iPoint); + /*--- A seed standing in a free quadrilateral or hexahedron takes that element whole, the one + * pressing hardest against what is already agglomerated, so leftover structured mesh is + * tiled by whole cells. A grid without elements, a coarse one, offers the 4-cycles of its + * connectivity as quadrilaterals. ---*/ + wholeCells.clear(); + if (HasElements(fine_grid)) { + for (auto iElem = 0u; iElem < fine_grid->nodes->GetnElem(iPoint); ++iElem) { + const auto* elem = fine_grid->elem[fine_grid->nodes->GetElem(iPoint, iElem)]; + if ((elem->GetVTK_Type() != QUADRILATERAL) && (elem->GetVTK_Type() != HEXAHEDRON)) continue; + wholeCells.emplace_back(); + for (auto iNode = 0u; iNode < elem->GetnNodes(); ++iNode) + if (elem->GetNode(iNode) != static_cast(iPoint)) + wholeCells.back().push_back(elem->GetNode(iNode)); + } + } else if (nDim == 2) { + const auto neighbours = fine_grid->nodes->GetPoints(iPoint); + auto touching = [&](unsigned long a, unsigned long b) { + const auto around = fine_grid->nodes->GetPoints(a); + return std::find(around.begin(), around.end(), b) != around.end(); + }; + for (auto a : neighbours) + for (auto b : neighbours) { + if ((a >= b) || touching(a, b)) continue; + for (auto m : fine_grid->nodes->GetPoints(a)) + if ((m != iPoint) && touching(m, b) && !touching(m, iPoint)) wholeCells.push_back({a, m, b}); + } + } + + auto bestCell = NO_CV; + unsigned long bestContact = 0, bestKey = NO_CV; + for (auto iCell = 0ul; iCell < wholeCells.size(); ++iCell) { + bool free = true; + unsigned long contact = 0, key = fine_grid->nodes->GetGlobalIndex(iPoint); + for (auto kPoint : wholeCells[iCell]) { + key = std::min(key, fine_grid->nodes->GetGlobalIndex(kPoint)); + free = free && !fine_grid->nodes->GetAgglomerate(kPoint) && fine_grid->nodes->GetDomain(kPoint) && + GeometricalCheck(kPoint, fine_grid, config); + if (!free) break; + for (auto mPoint : fine_grid->nodes->GetPoints(kPoint)) contact += fine_grid->nodes->GetAgglomerate(mPoint); + } + if (!free) continue; + if ((bestCell == NO_CV) || (contact > bestContact) || ((contact == bestContact) && (key < bestKey))) { + bestCell = iCell; + bestContact = contact; + bestKey = key; + } + } + if (bestCell != NO_CV) + for (auto kPoint : wholeCells[bestCell]) addMember(kPoint); + edgeDir.clear(); edgeLen.clear(); su2double seedShortest = std::numeric_limits::max(); @@ -494,7 +578,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un } unsigned long best = NO_CV; - unsigned short best_shared = 0; + unsigned short best_shared = 0, best_flush = 0; su2double best_dist = std::numeric_limits::max(); for (auto CVPoint : candidates) { @@ -502,6 +586,27 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un unsigned short shared = 0; for (auto jPoint : fine_grid->nodes->GetPoints(CVPoint)) shared += inCV[jPoint]; + /*--- In 2D a CV of three or more nodes only takes nodes touching two members, so it cannot + * grow into a chain. ---*/ + if ((nDim == 2) && (nChildren >= 3) && (shared < 2)) continue; + + /*--- A pair does not grow into a line of three, the third node then seeds a pair of its own, + * so the cells of a row keep the phase of the cells beside them. ---*/ + if ((nDim == 2) && (nChildren == 2) && (shared == 1)) { + const auto around = fine_grid->nodes->GetPoints(CVPoint); + const bool firstTouches = std::find(around.begin(), around.end(), members[0]) != around.end(); + const auto tip = firstTouches ? members[0] : members[1], tail = firstTouches ? members[1] : members[0]; + su2double along[MAXNDIM] = {0.0}, across[MAXNDIM] = {0.0}; + for (unsigned short d = 0; d < nDim; ++d) { + along[d] = fine_grid->nodes->GetCoord(CVPoint, d) - fine_grid->nodes->GetCoord(tip, d); + across[d] = fine_grid->nodes->GetCoord(tip, d) - fine_grid->nodes->GetCoord(tail, d); + } + const su2double lenAlong = GeometryToolbox::Norm(nDim, along); + const su2double lenAcross = GeometryToolbox::Norm(nDim, across); + if ((lenAlong > 0.0) && (lenAcross > 0.0) && + (GeometryToolbox::DotProduct(nDim, along, across) > 0.5 * lenAlong * lenAcross)) + continue; + } /*--- Distance to the centroid in cells: the offset is scaled by the seed edge pointing * most nearly along it. ---*/ @@ -522,9 +627,24 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un dist = r * r; } - if ((shared > best_shared) || ((shared == best_shared) && (dist < best_dist))) { + /*--- Between equals, the node lying flush against the same neighbouring CVs as the members + * keeps the cells of a structured mesh in line with those already made. ---*/ + unsigned short flush = 0; + for (auto jPoint : fine_grid->nodes->GetPoints(CVPoint)) { + if (!fine_grid->nodes->GetAgglomerate(jPoint) || inCV[jPoint]) continue; + bool lies = false; + for (auto kPoint : members) + for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) + lies = lies || ((lPoint != jPoint) && fine_grid->nodes->GetAgglomerate(lPoint) && !inCV[lPoint] && + (fine_grid->nodes->GetParent_CV(lPoint) == fine_grid->nodes->GetParent_CV(jPoint))); + flush += lies; + } + + if ((shared > best_shared) || ((shared == best_shared) && (flush > best_flush)) || + ((shared == best_shared) && (flush == best_flush) && (dist < best_dist))) { best = CVPoint; best_shared = shared; + best_flush = flush; best_dist = dist; } } @@ -638,18 +758,52 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un nodes->SetnChildren_CV(fromCV, 0); }; - /*--- Neighbour with the fewest children that may take this CV, NO_CV if there is none. Neighbours - * an earlier merge in the same pass emptied are not revived. ---*/ - auto smallestPartner = [&](unsigned long iCV, unsigned short maxPartnerSize, bool keepOffPartition) { + /*--- Take one fine point out of the children of a coarse CV. ---*/ + auto removeChild = [&](unsigned long fromCV, unsigned long iFinePoint) { + vector kept; + for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(fromCV); iChildren++) + if (nodes->GetChildren_CV(fromCV, iChildren) != iFinePoint) + kept.push_back(nodes->GetChildren_CV(fromCV, iChildren)); + nodes->SetChildren_CV(fromCV, kept); + nodes->SetnChildren_CV(fromCV, kept.size()); + }; + + /*--- Dual-face area and number of fine edges between the children of two coarse CVs. ---*/ + auto sharedFaces = [&](unsigned long iCV, unsigned long jCV) { + su2double area = 0.0; + unsigned short nEdges = 0; + for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(iCV); iChildren++) { + const auto iFinePoint = nodes->GetChildren_CV(iCV, iChildren); + for (auto iNeigh = 0u; iNeigh < fine_grid->nodes->GetnPoint(iFinePoint); iNeigh++) { + if (fine_grid->nodes->GetParent_CV(fine_grid->nodes->GetPoint(iFinePoint, iNeigh)) != jCV) continue; + area += GeometryToolbox::Norm(nDim, fine_grid->edges->GetNormal(fine_grid->nodes->GetEdge(iFinePoint, iNeigh))); + nEdges++; + } + } + return std::make_pair(area, nEdges); + }; + + /*--- Neighbour sharing the most dual-face area that may take this CV, the one with fewer children on + * a tie, NO_CV if there is none. A compact merge must join the two through at least as many fine + * edges as the smaller one has children. Neighbours an earlier merge in the same pass emptied are + * not revived. ---*/ + auto bestPartner = [&](unsigned long iCV, unsigned short maxPartnerSize, bool keepOffPartition, bool compact) { auto best = NO_CV; auto best_nChildren = std::numeric_limits::max(); + su2double best_area = -1.0; for (auto jCV : nodes->GetPoints(iCV)) { const auto nChildren = nodes->GetnChildren_CV(jCV); - if ((nChildren == 0) || (nChildren > maxPartnerSize) || (nChildren >= best_nChildren)) continue; + if ((nChildren == 0) || (nChildren > maxPartnerSize)) continue; if (keepOffPartition && touchesPartition[jCV]) continue; if (!mayMerge(iCV, jCV)) continue; - best_nChildren = nChildren; - best = jCV; + const auto shared = sharedFaces(iCV, jCV); + if (compact && (shared.second < min(nChildren, nodes->GetnChildren_CV(iCV)))) continue; + if ((shared.first > best_area * (1.0 + 1e-6)) || + ((shared.first >= best_area * (1.0 - 1e-6)) && (nChildren < best_nChildren))) { + best_nChildren = nChildren; + best_area = shared.first; + best = jCV; + } } return best; }; @@ -686,8 +840,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un mergeInto(iCoarsePoint, iTarget); } - /*--- A CV left holding a single child joins the neighbour with the fewest, even where that takes - the neighbour one past maxAgglomSize. ---*/ + /*--- A CV left holding a single child joins the neighbour it shares the most face with, even where + that takes the neighbour one past maxAgglomSize. ---*/ for (auto iCoarsePoint = 0ul; iCoarsePoint < nPointDomain; iCoarsePoint++) { if (nodes->GetnChildren_CV(iCoarsePoint) != 1) continue; @@ -695,12 +849,12 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Already handled above, or truly islanded. ---*/ if (nodes->GetnPoint(iCoarsePoint) <= 1) continue; - const auto iTarget = smallestPartner(iCoarsePoint, std::numeric_limits::max(), false); + const auto iTarget = bestPartner(iCoarsePoint, std::numeric_limits::max(), false, false); if (iTarget != NO_CV) mergeInto(iCoarsePoint, iTarget); } - /*--- Merge a paved CV of at most SMALL_STACK_CV children into an equally small neighbour, which - the two passes above do not reach. Two of them can never exceed maxAgglomSize together. ---*/ + /*--- Merge a paved CV of at most SMALL_STACK_CV children into an equally small neighbour it joins + compactly, which the two passes above do not reach. Two of them can never exceed maxAgglomSize together. ---*/ constexpr unsigned short SMALL_STACK_CV = 2; /*!< \brief The block size a narrow stack emits between flushes; see BlockFor. */ @@ -712,10 +866,169 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Interior stack fragments only, a boundary row keeps its footprint. ---*/ if (cvOnBoundary[iCoarsePoint]) continue; - const auto iTarget = smallestPartner(iCoarsePoint, SMALL_STACK_CV, true); + const auto iTarget = bestPartner(iCoarsePoint, SMALL_STACK_CV, true, true); if (iTarget != NO_CV) mergeInto(iCoarsePoint, iTarget); } + /*--- In 2D, a CV of three nodes bent round a corner takes the fourth node of its quadrilateral from + * a neighbouring three-node CV that can spare it, which turns staggered seams into rectangles. ---*/ + if (nDim == 2) { + auto adjacent = [&](unsigned long iFinePoint, unsigned long jFinePoint) { + const auto neighbours = fine_grid->nodes->GetPoints(iFinePoint); + return std::find(neighbours.begin(), neighbours.end(), jFinePoint) != neighbours.end(); + }; + + for (auto iPass = 0u; iPass < 4; iPass++) { + bool changed = false; + + for (auto iCoarsePoint = 0ul; iCoarsePoint < nPointDomain; iCoarsePoint++) { + if (nodes->GetnChildren_CV(iCoarsePoint) != 3) continue; + if (mustStayAlone[iCoarsePoint] || isStackBase(iCoarsePoint) || touchesPartition[iCoarsePoint]) continue; + if ((iCoarsePoint >= firstLineCV) && (iCoarsePoint < endLineCV)) continue; + + /*--- The middle node of the bend touches the other two, which do not touch each other. ---*/ + unsigned long child[3]; + for (auto k = 0u; k < 3; k++) child[k] = nodes->GetChildren_CV(iCoarsePoint, k); + long corner = -1; + for (auto k = 0u; k < 3; k++) { + const auto a = child[(k + 1) % 3], b = child[(k + 2) % 3]; + if (adjacent(child[k], a) && adjacent(child[k], b) && !adjacent(a, b)) corner = k; + } + if (corner < 0) continue; + const auto a = child[(corner + 1) % 3], b = child[(corner + 2) % 3]; + + /*--- The node closing the quadrilateral touches both ends of the bend, not its middle. ---*/ + auto donor = NO_CV; + unsigned long fourth = NO_CV; + for (auto m : fine_grid->nodes->GetPoints(a)) { + const auto jCoarsePoint = fine_grid->nodes->GetParent_CV(m); + if ((jCoarsePoint == NO_CV) || (jCoarsePoint >= nPointDomain) || (jCoarsePoint == iCoarsePoint)) continue; + if (!adjacent(m, b) || adjacent(m, child[corner])) continue; + if (nodes->GetnChildren_CV(jCoarsePoint) != 3) continue; + if (mustStayAlone[jCoarsePoint] || isStackBase(jCoarsePoint) || touchesPartition[jCoarsePoint]) continue; + if ((jCoarsePoint >= firstLineCV) && (jCoarsePoint < endLineCV)) continue; + if (cvMarkerClass[jCoarsePoint] != cvMarkerClass[iCoarsePoint]) continue; + + /*--- What the donor keeps must stay connected. ---*/ + vector kept; + for (auto k = 0u; k < 3; k++) + if (nodes->GetChildren_CV(jCoarsePoint, k) != m) kept.push_back(nodes->GetChildren_CV(jCoarsePoint, k)); + if (!adjacent(kept[0], kept[1])) continue; + + donor = jCoarsePoint; + fourth = m; + break; + } + if (donor == NO_CV) continue; + + removeChild(donor, fourth); + giveChild(fourth, iCoarsePoint); + changed = true; + } + + if (!changed) break; + } + } + + /*--- A group of halo points whose neighbors on this rank all lie in one coarse CV is enclosed by it. + * The rank owning the group then gets a coarse CV with one neighbor and cancelling face normals, + * so one member around the group moves to another CV. ---*/ + + { + const auto nFineDomain = fine_grid->GetnPointDomain(); + const auto nRepaired = nPointDomain; + vector visited(fine_grid->GetnPoint(), 0); + vector group, around; + + auto isChildOf = [&](unsigned long iFinePoint, unsigned long iCV, unsigned long except) { + return (iFinePoint != except) && (iFinePoint < nFineDomain) && + (fine_grid->nodes->GetParent_CV(iFinePoint) == iCV); + }; + + /*--- Whether the children of a CV other than one excluded point form one connected set. ---*/ + auto connectedWithout = [&](unsigned long iCV, unsigned long except) { + vector stack, reached; + for (auto iChildren = 0u; iChildren < nodes->GetnChildren_CV(iCV); iChildren++) { + if (nodes->GetChildren_CV(iCV, iChildren) == except) continue; + stack.push_back(nodes->GetChildren_CV(iCV, iChildren)); + break; + } + if (stack.empty()) return false; + reached = stack; + while (!stack.empty()) { + const auto iFinePoint = stack.back(); + stack.pop_back(); + for (auto jFinePoint : fine_grid->nodes->GetPoints(iFinePoint)) { + if (!isChildOf(jFinePoint, iCV, except)) continue; + if (find(reached.begin(), reached.end(), jFinePoint) != reached.end()) continue; + reached.push_back(jFinePoint); + stack.push_back(jFinePoint); + } + } + return reached.size() + 1 == nodes->GetnChildren_CV(iCV); + }; + + for (auto iSeed = nFineDomain; iSeed < fine_grid->GetnPoint(); iSeed++) { + if (visited[iSeed]) continue; + + /*--- Collect the connected group of halo points and the domain points around it. ---*/ + group.assign(1, iSeed); + around.clear(); + visited[iSeed] = 1; + for (auto k = 0ul; k < group.size(); k++) { + for (auto jFinePoint : fine_grid->nodes->GetPoints(group[k])) { + if (jFinePoint >= nFineDomain) { + if (!visited[jFinePoint]) { + visited[jFinePoint] = 1; + group.push_back(jFinePoint); + } + } else if (find(around.begin(), around.end(), jFinePoint) == around.end()) { + around.push_back(jFinePoint); + } + } + } + if (around.empty()) continue; + + const auto enclosing = fine_grid->nodes->GetParent_CV(around[0]); + bool enclosed = (enclosing < nRepaired); + for (auto iFinePoint : around) enclosed = enclosed && (fine_grid->nodes->GetParent_CV(iFinePoint) == enclosing); + if (!enclosed || (nodes->GetnChildren_CV(enclosing) < 2)) continue; + + /*--- Move the member around the group with the largest face to a neighboring CV, keeping the + * enclosing CV connected when possible. A new CV takes it when no neighbor may. ---*/ + unsigned long moved = NO_CV, toCV = NO_CV; + su2double bestArea = -1.0; + for (const bool needConnected : {true, false}) { + for (auto iFinePoint : around) { + if (needConnected && !connectedWithout(enclosing, iFinePoint)) continue; + for (auto iNeigh = 0u; iNeigh < fine_grid->nodes->GetnPoint(iFinePoint); iNeigh++) { + const auto jCV = fine_grid->nodes->GetParent_CV(fine_grid->nodes->GetPoint(iFinePoint, iNeigh)); + if ((jCV >= nRepaired) || (jCV == enclosing) || !mayMerge(enclosing, jCV)) continue; + const auto area = + GeometryToolbox::Norm(nDim, fine_grid->edges->GetNormal(fine_grid->nodes->GetEdge(iFinePoint, iNeigh))); + if (area > bestArea) { + bestArea = area; + moved = iFinePoint; + toCV = jCV; + } + } + } + if (moved != NO_CV) break; + } + if (moved == NO_CV) { + moved = around[0]; + toCV = Index_CoarseCV++; + nodes->SetnChildren_CV(toCV, 0); + nodes->SetAgglomerate_Indirect(toCV, fine_grid->nodes->GetAgglomerate_Indirect(moved)); + nPointDomain = Index_CoarseCV; + nPoint = Index_CoarseCV; + } + + removeChild(enclosing, moved); + giveChild(moved, toCV); + } + } + /*--- Compact the coarse numbering, squeezing out the indices the repair passes emptied. The children lists, indirect-agglomeration flags and owned parent indices are remapped. ---*/ @@ -996,6 +1309,7 @@ vector CMultiGridGeometry::FindMixedBoundaryNodes(const CGeometry* fine_gr const auto bc = static_cast(config->GetMarker_All_KindBC(iMarker)); for (auto iVertex = 0ul; iVertex < fine_grid->GetnVertex(iMarker); iVertex++) { const auto iPoint = fine_grid->vertex[iMarker][iVertex]->GetNode(); + if (AbsorbedSymmetry(fine_grid, config, iPoint, iMarker)) continue; if (firstBC[iPoint] < 0) firstBC[iPoint] = bc; else if (firstBC[iPoint] != bc) @@ -1618,7 +1932,7 @@ CMultiGridGeometry::CFrontSeeds CMultiGridGeometry::SeedFrontNodes(const CGeomet /*--- Paving order: a no-slip wall first, a slip wall next, everything else last. ---*/ auto tierOfBC = [](unsigned short bc) -> char { if ((bc == HEAT_FLUX) || (bc == ISOTHERMAL) || (bc == CHT_WALL_INTERFACE) || (bc == SMOLUCHOWSKI_MAXWELL)) return 0; - return (bc == EULER_WALL) ? 1 : 2; + return ((bc == EULER_WALL) || (bc == SYMMETRY_PLANE)) ? 1 : 2; }; for (auto iMarker = 0u; iMarker < fine_grid->GetnMarker(); iMarker++) { @@ -1650,6 +1964,7 @@ CMultiGridGeometry::CFrontSeeds CMultiGridGeometry::SeedFrontNodes(const CGeomet std::array n0{}; for (unsigned short d = 0; d < nDim; ++d) n0[d] = Normal[d]; + seeds.node.push_back(iPoint); seeds.normal.push_back(n0); seeds.strength.push_back(strength); @@ -1896,9 +2211,15 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co const auto nPointFine = fine_grid->GetnPoint(); constexpr auto NO_COLUMN = std::numeric_limits::max(); const short int maxAgglomSize = MaxAgglomSize(nDim); + /*--- Largest CV a parity leftover may form by joining its neighbour. ---*/ + const size_t maxOversize = 3 * maxAgglomSize / 2; /*--- SeedFrontNodes returns the seeds ordered by anisotropy. ---*/ - const auto seeds = SeedFrontNodes(fine_grid, config); + auto seeds = SeedFrontNodes(fine_grid, config); + + /*--- A node where two conditions meet stays a CV of its own, and the column above it is paved + * before any other, so no column from either side reaches over to the other. ---*/ + for (auto si = 0ul; si < seeds.node.size(); ++si) seeds.tier[si] = mixedBC[seeds.node[si]] ? 0 : seeds.tier[si] + 1; vector walkOf; const auto patches = BuildFrontPatches(seeds, fine_grid, config, mixedBC, walkOf); @@ -2018,7 +2339,7 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co /*--- One tier is paved out everywhere before the next starts, so an inherited column belongs to * the tier that is running. ---*/ - constexpr char N_TIER = 3; + constexpr char N_TIER = 4; vector active; for (char tier = 0; tier < N_TIER; ++tier) { /*--- The columns of this tier still advancing, in seed order. A column that stops drops out at @@ -2131,7 +2452,7 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co if (admissible(best)) { candidates.push_back(best); - stepDir.push_back(bestStep); + stepDir.push_back(marching); } else if (!fine_grid->nodes->GetDomain(best) && (haloSlot[best] >= 0) && (haloClaim[best] == NO_COLUMN)) { haloWanted.push_back(best); @@ -2147,10 +2468,72 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co std::sort(distinct.begin(), distinct.end()); distinct.erase(std::unique(distinct.begin(), distinct.end()), distinct.end()); if (distinct.size() != width) return false; + /*--- The layer must stay connected, or its blocks split into strands. ---*/ + vector reached(1, distinct[0]); + for (size_t k = 0; k < reached.size(); ++k) + for (auto jPoint : fine_grid->nodes->GetPoints(reached[k])) + if (std::binary_search(distinct.begin(), distinct.end(), jPoint) && + (std::find(reached.begin(), reached.end(), jPoint) == reached.end())) + reached.push_back(jPoint); + return reached.size() == width; + }; + + /*--- A column follows the stiff direction of the mesh. A step whose edges couple far more + * weakly than the stiffest edge at their node runs along a thin layer, not across it, + * and is left to a column crossing that layer. A column rising from a no-slip wall + * stops only at a much thinner layer, so moderate stretching does not cut it short. ---*/ + auto stiffStep = [&](const vector& set) { + const passivedouble STIFF_FRACTION = (tierOf[iColumn] <= 1) ? 0.01 : 0.1; + passivedouble ratio = 0.0; + for (auto iPoint : layer[iColumn]) { + passivedouble wStep = 0.0, wMax = 0.0; + for (auto iNeigh = 0u; iNeigh < fine_grid->nodes->GetnPoint(iPoint); ++iNeigh) { + const auto jPoint = fine_grid->nodes->GetPoint(iPoint, iNeigh); + const auto iEdge = fine_grid->nodes->GetEdge(iPoint, iNeigh); + const passivedouble w = SU2_TYPE::GetValue( + GeometryToolbox::Norm(nDim, fine_grid->edges->GetNormal(iEdge)) * + (1.0 / fine_grid->nodes->GetVolume(iPoint) + 1.0 / fine_grid->nodes->GetVolume(jPoint))); + wMax = std::max(wMax, w); + if (std::find(set.begin(), set.end(), jPoint) != set.end()) wStep = std::max(wStep, w); + } + ratio += (wMax > 0.0) ? wStep / wMax : 1.0; + } + return ratio >= STIFF_FRACTION * passivedouble(layer[iColumn].size()); + }; + + /*--- Whether every node of the step reaches a physical boundary within a few steps on the + * way it travels. A band two coarse cells thin is taken, the domain pass tiles it poorly. ---*/ + auto nearBoundary = [&](const vector& set, + const vector>& dirs) { + constexpr unsigned short THIN_BAND = 4; + for (size_t k = 0; k < set.size(); ++k) { + auto iPoint = set[k]; + bool reached = false; + for (unsigned short iStep = 0; (iStep < THIN_BAND) && !reached; ++iStep) { + auto next = NO_COLUMN; + su2double bestAlign = 0.0; + for (auto jPoint : fine_grid->nodes->GetPoints(iPoint)) { + su2double step[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, fine_grid->nodes->GetCoord(jPoint), + fine_grid->nodes->GetCoord(iPoint), step); + const su2double len = GeometryToolbox::Norm(nDim, step); + if (len <= 0.0) continue; + const su2double align = GeometryToolbox::DotProduct(nDim, step, dirs[k].data()) / len; + if (align > bestAlign) { + bestAlign = align; + next = jPoint; + } + } + if (next == NO_COLUMN) return false; + reached = onPhysBoundary[next]; + iPoint = next; + } + if (!reached) return false; + } return true; }; - if (complete(candidates)) { + if (complete(candidates) && (stiffStep(candidates) || nearBoundary(candidates, stepDir))) { for (auto jPoint : candidates) { columnOf[jPoint] = iColumn; layerOf[jPoint] = iRound; @@ -2311,6 +2694,28 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co } } + /*--- Last-layer nodes whose next step, the way they travel, lands on free mesh. ---*/ + vector openAhead(nPointFine, 0); + for (auto iColumn = 0ul; iColumn < layer.size(); ++iColumn) { + for (size_t k = 0; k < layer[iColumn].size(); ++k) { + const auto iPoint = layer[iColumn][k]; + auto next = NO_COLUMN; + su2double bestAlign = 0.0; + for (auto jPoint : fine_grid->nodes->GetPoints(iPoint)) { + su2double step[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, fine_grid->nodes->GetCoord(jPoint), fine_grid->nodes->GetCoord(iPoint), step); + const su2double len = GeometryToolbox::Norm(nDim, step); + if (len <= 0.0) continue; + const su2double align = GeometryToolbox::DotProduct(nDim, step, dirOf[iColumn][k].data()) / len; + if (align > bestAlign) { + bestAlign = align; + next = jPoint; + } + } + openAhead[iPoint] = (next != NO_COLUMN) && admissible(next); + } + } + /*--- Gather each column by layer. ---*/ const auto nColumn = layer.size(); vector>> byLayer(nColumn); @@ -2321,6 +2726,75 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co byLayer[iColumn][layerOf[iPoint]].push_back(iPoint); } + /*--- A boundary run with an odd number of seeds, and every node where two boundaries meet, + * leaves one column a single node wide. Two such columns side by side are emitted together, + * so the domain gets square cells instead of a file of narrow ones. ---*/ + vector partnerOf(nColumn, -1); + { + auto isNarrow = [&](unsigned long iColumn) { + return isSeeded[iColumn] && (byLayer[iColumn].size() > 1) && (byLayer[iColumn][0].size() == 1); + }; + + /*--- Both columns must stand shoulder to shoulder over every layer they share, otherwise the + * cells the merge makes are not compact. ---*/ + auto aligned = [&](unsigned long iColumn, unsigned long jColumn) { + const auto nCommon = std::min(byLayer[iColumn].size(), byLayer[jColumn].size()); + for (auto iLayer = 1ul; iLayer < nCommon; ++iLayer) { + const auto iPoint = byLayer[iColumn][iLayer].front(); + const auto& jLayer = byLayer[jColumn][iLayer]; + bool touch = false; + for (auto kPoint : fine_grid->nodes->GetPoints(iPoint)) + touch = touch || (std::find(jLayer.begin(), jLayer.end(), kPoint) != jLayer.end()); + if (!touch) return false; + } + return nCommon > 1; + }; + + /*--- Taken in global index order, so the pairing does not depend on the partitioning. ---*/ + vector narrow; + for (auto iColumn = 0ul; iColumn < nColumn; ++iColumn) + if (isNarrow(iColumn)) narrow.push_back(iColumn); + std::sort(narrow.begin(), narrow.end(), [&](unsigned long a, unsigned long b) { + return fine_grid->nodes->GetGlobalIndex(byLayer[a][0].front()) < + fine_grid->nodes->GetGlobalIndex(byLayer[b][0].front()); + }); + + /*--- A column a narrow one may lean on when no narrow neighbour is left: seeded, grown, and + * narrow enough that the merged block stays within the oversize limit. ---*/ + auto isWide = [&](unsigned long iColumn) { + return isSeeded[iColumn] && (byLayer[iColumn].size() > 1) && (byLayer[iColumn][0].size() > 1) && + (2 * (byLayer[iColumn][0].size() + 1) <= maxOversize); + }; + + /*--- Narrow neighbours pair first, the narrow columns left over then join a wide one. ---*/ + for (const bool toWide : {false, true}) { + for (auto iColumn : narrow) { + if (partnerOf[iColumn] >= 0) continue; + auto best = NO_COLUMN; + auto bestKey = std::numeric_limits::max(); + + for (auto jPoint : fine_grid->nodes->GetPoints(byLayer[iColumn][1].front())) { + const auto jColumn = columnOf[jPoint]; + if ((jColumn == NO_COLUMN) || (jColumn == iColumn) || (partnerOf[jColumn] >= 0)) continue; + if (toWide ? !isWide(jColumn) : !isNarrow(jColumn)) continue; + /*--- The column above a corner, tier 0, may pair with either side. ---*/ + if ((tierOf[jColumn] != tierOf[iColumn]) && (tierOf[jColumn] != 0) && (tierOf[iColumn] != 0)) continue; + if (!aligned(iColumn, jColumn)) continue; + + const auto key = fine_grid->nodes->GetGlobalIndex(byLayer[jColumn][0].front()); + if (key < bestKey) { + bestKey = key; + best = jColumn; + } + } + + if (best == NO_COLUMN) continue; + partnerOf[iColumn] = static_cast(best); + partnerOf[best] = static_cast(iColumn); + } + } + } + auto emitGroup = [&](const vector& group) { nodes->SetChildren_CV(Index_CoarseCV, group); for (auto iPoint : group) { @@ -2333,11 +2807,12 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co auto minDepth = std::numeric_limits::max(), maxDepth = 0ul; vector group; + vector> paired; /*--- Hand a set of nodes out as coarse CVs, each connected and within the size limit. ---*/ vector inSet(nPointFine, 0); vector chunk, stack; - auto emitConnected = [&](const vector& set) { + auto emitConnected = [&](const vector& set, size_t maxSize) { for (auto iPoint : set) inSet[iPoint] = 1; for (auto iSeed : set) { @@ -2346,13 +2821,13 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co stack.assign(1, iSeed); inSet[iSeed] = 0; - while (!stack.empty() && (chunk.size() < static_cast(maxAgglomSize))) { + while (!stack.empty() && (chunk.size() < maxSize)) { const auto iPoint = stack.back(); stack.pop_back(); chunk.push_back(iPoint); for (auto jPoint : fine_grid->nodes->GetPoints(iPoint)) { if (!inSet[jPoint]) continue; - if (chunk.size() + stack.size() >= static_cast(maxAgglomSize)) break; + if (chunk.size() + stack.size() >= maxSize) break; inSet[jPoint] = 0; stack.push_back(jPoint); } @@ -2378,7 +2853,8 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co auto iLayer = 0ul; if (isSeeded[iColumn]) { - /*--- The boundary row is a coarse CV of its own, which fixes the footprint above it. ---*/ + /*--- The boundary row is a coarse CV of its own, which fixes the footprint above it. A + * paired column keeps its own row, which may hold a boundary condition of its own. ---*/ const auto baseCV = emitGroup(layers[0]); ct[P_CVS]++; ct[P_COVERED] += layers[0].size(); @@ -2386,22 +2862,58 @@ string CMultiGridGeometry::PaveAdvancingFronts(unsigned long& Index_CoarseCV, co iLayer = 1; } + /*--- Of a pair, the column of lower index emits what stands above both boundary rows. ---*/ + if ((partnerOf[iColumn] >= 0) && (partnerOf[iColumn] < static_cast(iColumn))) continue; + + const auto* emitted = &layers; + /*--- The block depth follows the widest of the columns, as it would for each on its own. ---*/ + auto blockWidth = layers.back().size(); + auto maxSize = static_cast(maxAgglomSize); + if (partnerOf[iColumn] > static_cast(iColumn)) { + const auto& other = byLayer[partnerOf[iColumn]]; + paired = layers; + for (auto k = 1ul; k < other.size(); ++k) { + if (k < paired.size()) + paired[k].insert(paired[k].end(), other[k].begin(), other[k].end()); + else + paired.push_back(other[k]); + } + emitted = &paired; + blockWidth = std::max(blockWidth, other.back().size()); + /*--- A narrow column leaning on a wide one is a parity strip, its cells may be oversized. ---*/ + if (blockWidth > 1) maxSize = maxOversize; + } + const auto block = BlockFor(maxAgglomSize, blockWidth); + /*--- Above it, consecutive layers are blocked so the coarse cell coarsens by the same ratio * along the column as the patch does across it. ---*/ - while (iLayer < layers.size()) { + while (iLayer < emitted->size()) { group.clear(); - const auto block = BlockFor(maxAgglomSize, layers[iLayer].size()); - for (auto k = 0ul; (k < block) && (iLayer < layers.size()); ++k) { - if (!group.empty() && (group.size() + layers[iLayer].size() > static_cast(maxAgglomSize))) break; - group.insert(group.end(), layers[iLayer].begin(), layers[iLayer].end()); + auto groupSize = maxSize; + for (auto k = 0ul; (k < block) && (iLayer < emitted->size()); ++k) { + if (!group.empty() && (group.size() + (*emitted)[iLayer].size() > maxSize)) break; + group.insert(group.end(), (*emitted)[iLayer].begin(), (*emitted)[iLayer].end()); iLayer++; } /*--- A single layer wider than the limit still has to go somewhere. ---*/ if (group.empty()) { - group = layers[iLayer]; + group = (*emitted)[iLayer]; iLayer++; } - emitConnected(group); + /*--- An odd last layer facing free mesh is left to the domain pass, which can pair it with + * that mesh. Otherwise it joins the block below instead of standing one layer thick. ---*/ + if ((block > 1) && (iLayer + 1 == emitted->size())) { + bool open = true; + for (auto iPoint : emitted->back()) open = open && openAhead[iPoint]; + if (open) { + iLayer++; + } else if (group.size() + emitted->back().size() <= static_cast(maxOversize)) { + group.insert(group.end(), emitted->back().begin(), emitted->back().end()); + groupSize = group.size(); + iLayer++; + } + } + emitConnected(group, groupSize); } } if (minDepth == std::numeric_limits::max()) minDepth = 0; diff --git a/Common/src/geometry/CPhysicalGeometry.cpp b/Common/src/geometry/CPhysicalGeometry.cpp index fd3e0e0b1cef..03dcf5a81232 100644 --- a/Common/src/geometry/CPhysicalGeometry.cpp +++ b/Common/src/geometry/CPhysicalGeometry.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #ifdef _MSC_VER @@ -2426,9 +2427,9 @@ void CPhysicalGeometry::LoadSurfaceElements(CConfig* config, CGeometry* geometry unsigned long Local_Nodes[N_POINTS_HEXAHEDRON]; - vector > Line_List; - vector > BoundTria_List; - vector > BoundQuad_List; + vector> Line_List; + vector> BoundTria_List; + vector> BoundQuad_List; vector Marker_Local; @@ -2967,14 +2968,14 @@ void CPhysicalGeometry::SetSendReceive(const CConfig* config) { unsigned short iNode, jNode; vector::iterator it; - vector > + vector> SendTransfLocal; /*!< \brief Vector to store the type of transformation for this send point. */ - vector > + vector> ReceivedTransfLocal; /*!< \brief Vector to store the type of transformation for this received point. */ - vector > SendDomainLocal; /*!< \brief SendDomain[from domain][to domain] and return the point - index of the node that must me sended. */ - vector > ReceivedDomainLocal; /*!< \brief SendDomain[from domain][to domain] and return the - point index of the node that must me sended. */ + vector> SendDomainLocal; /*!< \brief SendDomain[from domain][to domain] and return the point + index of the node that must me sended. */ + vector> ReceivedDomainLocal; /*!< \brief SendDomain[from domain][to domain] and return the + point index of the node that must me sended. */ unordered_map::const_iterator MI; @@ -4426,7 +4427,7 @@ void CPhysicalGeometry::SetPositive_ZArea(CConfig* config) { } void CPhysicalGeometry::SetPoint_Connectivity() { - vector > points(nPoint); + vector> points(nPoint); SU2_OMP_PARALLEL { unsigned short Node_Neighbor, iNode, iNeighbor; @@ -4434,7 +4435,7 @@ void CPhysicalGeometry::SetPoint_Connectivity() { /*--- Loop over all the elements ---*/ BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { - vector > elems(nPoint); + vector> elems(nPoint); for (iElem = 0; iElem < nElem; iElem++) { /*--- Loop over all the nodes of an element ---*/ @@ -7363,6 +7364,324 @@ void CPhysicalGeometry::SetBoundTecPlot(char mesh_filename[MAX_STRING_SIZE], boo Tecplot_File.close(); } +#if defined(HAVE_MPI) && defined(HAVE_PARMETIS) +vector CPhysicalGeometry::FetchFromOwners(const vector& wanted, + const vector& localValue) const { + CLinearPartitioner pointPartitioner(Global_nPointDomain, 0); + const unsigned long firstIndex = pointPartitioner.GetFirstIndexOnRank(rank); + + vector nSend(size, 0), nRecv(size), sendDisp(size + 1, 0), recvDisp(size + 1, 0); + for (const auto iGlobal : wanted) nSend[pointPartitioner.GetRankContainingIndex(iGlobal)]++; + SU2_MPI::Alltoall(nSend.data(), 1, MPI_INT, nRecv.data(), 1, MPI_INT, SU2_MPI::GetComm()); + for (int iRank = 0; iRank < size; iRank++) { + sendDisp[iRank + 1] = sendDisp[iRank] + nSend[iRank]; + recvDisp[iRank + 1] = recvDisp[iRank] + nRecv[iRank]; + } + + vector sendIndex(sendDisp[size]), slotOf(wanted.size()), recvIndex(recvDisp[size]); + vector next(sendDisp.begin(), sendDisp.end() - 1); + for (auto k = 0ul; k < wanted.size(); k++) { + const auto slot = next[pointPartitioner.GetRankContainingIndex(wanted[k])]++; + sendIndex[slot] = wanted[k]; + slotOf[k] = slot; + } + SU2_MPI::Alltoallv(sendIndex.data(), nSend.data(), sendDisp.data(), MPI_UNSIGNED_LONG, recvIndex.data(), nRecv.data(), + recvDisp.data(), MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + + vector reply(recvIndex.size()), answer(sendIndex.size()), result(wanted.size()); + for (auto k = 0ul; k < recvIndex.size(); k++) reply[k] = localValue[recvIndex[k] - firstIndex]; + SU2_MPI::Alltoallv(reply.data(), nRecv.data(), recvDisp.data(), MPI_UNSIGNED_LONG, answer.data(), nSend.data(), + sendDisp.data(), MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + + for (auto k = 0ul; k < wanted.size(); k++) result[k] = answer[slotOf[k]]; + return result; +} + +vector CPhysicalGeometry::LinkAnisotropicLines(const vector& adjwgt, + vector& lineEdge) const { + /*--- An edge at least this many times shorter than its element can join its points into a line. ---*/ + constexpr idx_t LINE_WEIGHT = 4; + + const unsigned long firstIndex = CLinearPartitioner(Global_nPointDomain, 0).GetFirstIndexOnRank(rank); + const vector neighbor(adjacency.begin(), adjacency.end()); + + vector strongest(nPoint, 0); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) + for (auto k = xadj[iPoint]; k < xadj[iPoint + 1]; k++) + strongest[iPoint] = max(strongest[iPoint], static_cast(adjwgt[k])); + const auto neighborStrongest = FetchFromOwners(neighbor, strongest); + + /*--- An edge joins a line if it is the strongest at one end, or nearly so at both. Equal or + * slowly varying spacing then keeps a line whole instead of splitting it where weights tie. ---*/ + lineEdge.assign(adjacency.size(), 0); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + for (auto k = xadj[iPoint]; k < xadj[iPoint + 1]; k++) { + const auto w = static_cast(adjwgt[k]); + if (w < static_cast(LINE_WEIGHT)) continue; + const bool strongestAtEnd = (w == strongest[iPoint]) || (w == neighborStrongest[k]); + const bool strongAtBoth = (2 * w >= strongest[iPoint]) && (2 * w >= neighborStrongest[k]); + lineEdge[k] = strongestAtEnd || strongAtBoth; + } + } + + /*--- Each line is named by its lowest global index, found by propagating labels along the line + * edges and pointer jumping. ---*/ + vector root(nPoint); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) root[iPoint] = firstIndex + iPoint; + for (;;) { + unsigned long changed = 0, changedGlobal = 0; + const auto neighborRoot = FetchFromOwners(neighbor, root); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + for (auto k = xadj[iPoint]; k < xadj[iPoint + 1]; k++) { + if (lineEdge[k] && (neighborRoot[k] < root[iPoint])) { + root[iPoint] = neighborRoot[k]; + changed++; + } + } + } + const auto rootOfRoot = FetchFromOwners(root, root); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + if (rootOfRoot[iPoint] < root[iPoint]) { + root[iPoint] = rootOfRoot[iPoint]; + changed++; + } + } + SU2_MPI::Allreduce(&changed, &changedGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + if (changedGlobal == 0) break; + } + return root; +} + +unsigned long CPhysicalGeometry::KeepLinesTogether(const vector& root, const vector& vwgt, + passivedouble maxImbalance, vector& part, + unsigned long& longestLine, unsigned long& nSplit) const { + CLinearPartitioner pointPartitioner(Global_nPointDomain, 0); + + /*--- The owner of each root collects, per partition, the points and vertex weight of its line. ---*/ + vector nSend(size, 0), nRecv(size), sendDisp(size + 1, 0), recvDisp(size + 1, 0); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) nSend[pointPartitioner.GetRankContainingIndex(root[iPoint])] += 3; + SU2_MPI::Alltoall(nSend.data(), 1, MPI_INT, nRecv.data(), 1, MPI_INT, SU2_MPI::GetComm()); + for (int iRank = 0; iRank < size; iRank++) { + sendDisp[iRank + 1] = sendDisp[iRank] + nSend[iRank]; + recvDisp[iRank + 1] = recvDisp[iRank] + nRecv[iRank]; + } + vector sendBuf(sendDisp[size]), recvBuf(recvDisp[size]); + vector next(sendDisp.begin(), sendDisp.end() - 1); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + auto& slot = next[pointPartitioner.GetRankContainingIndex(root[iPoint])]; + sendBuf[slot++] = root[iPoint]; + sendBuf[slot++] = static_cast(part[iPoint]); + sendBuf[slot++] = static_cast(vwgt[iPoint]); + } + SU2_MPI::Alltoallv(sendBuf.data(), nSend.data(), sendDisp.data(), MPI_UNSIGNED_LONG, recvBuf.data(), nRecv.data(), + recvDisp.data(), MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + + map>> lines; + for (auto k = 0ul; k < recvBuf.size(); k += 3) { + auto& share = lines[recvBuf[k]][recvBuf[k + 1]]; + share.first++; + share.second += recvBuf[k + 2]; + } + + unsigned long longest = 0; + for (const auto& line : lines) { + unsigned long length = 0; + for (const auto& share : line.second) length += share.second.first; + longest = max(longest, length); + } + SU2_MPI::Allreduce(&longest, &longestLine, 1, MPI_UNSIGNED_LONG, MPI_MAX, SU2_MPI::GetComm()); + + /*--- Every rank gets the split lines, as root, number of partitions, then partition, points and + * weight per partition. Ranks own consecutive roots, so the gathered list is in root order. ---*/ + vector mine; + for (const auto& line : lines) { + if (line.second.size() < 2) continue; + mine.push_back(line.first); + mine.push_back(line.second.size()); + for (const auto& share : line.second) { + mine.push_back(share.first); + mine.push_back(share.second.first); + mine.push_back(share.second.second); + } + } + const int nMine = mine.size(); + vector nAll(size), allDisp(size + 1, 0); + SU2_MPI::Allgather(&nMine, 1, MPI_INT, nAll.data(), 1, MPI_INT, SU2_MPI::GetComm()); + for (int iRank = 0; iRank < size; iRank++) allDisp[iRank + 1] = allDisp[iRank] + nAll[iRank]; + vector all(allDisp[size]); + SU2_MPI::Allgatherv(mine.data(), nMine, MPI_UNSIGNED_LONG, all.data(), nAll.data(), allDisp.data(), MPI_UNSIGNED_LONG, + SU2_MPI::GetComm()); + + vector load(size, 0), loadGlobal(size); + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) load[part[iPoint]] += vwgt[iPoint]; + SU2_MPI::Allreduce(load.data(), loadGlobal.data(), size, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + const passivedouble maxLoad = + maxImbalance * passivedouble(accumulate(loadGlobal.begin(), loadGlobal.end(), 0ul)) / size; + + /*--- Each line goes to the partition holding most of it that stays within the load tolerance and + * leaves no partition empty. All ranks take the same decisions in the same order. ---*/ + unordered_map target; + vector> shares; + nSplit = 0; + for (auto k = 0ul; k < all.size();) { + const auto lineRoot = all[k]; + const auto nShares = all[k + 1]; + k += 2; + shares.resize(nShares); + unsigned long weight = 0; + for (auto& share : shares) { + share = {all[k], all[k + 1], all[k + 2]}; + weight += share[2]; + k += 3; + } + sort(shares.begin(), shares.end(), + [](const auto& a, const auto& b) { return (a[1] > b[1]) || ((a[1] == b[1]) && (a[0] < b[0])); }); + + bool placed = false; + for (const auto& to : shares) { + if (passivedouble(loadGlobal[to[0]] + weight - to[2]) > maxLoad) continue; + bool empties = false; + for (const auto& from : shares) empties = empties || ((from[0] != to[0]) && (loadGlobal[from[0]] == from[2])); + if (empties) continue; + + for (const auto& from : shares) loadGlobal[from[0]] -= from[2]; + loadGlobal[to[0]] += weight; + target[lineRoot] = to[0]; + placed = true; + break; + } + nSplit += !placed; + } + + unsigned long moved = 0, movedGlobal = 0; + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + const auto it = target.find(root[iPoint]); + if ((it == target.end()) || (static_cast(part[iPoint]) == it->second)) continue; + part[iPoint] = static_cast(it->second); + moved++; + } + SU2_MPI::Allreduce(&moved, &movedGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + return movedGlobal; +} + +/*! + * \brief Compute graph edge weights that encode mesh anisotropy for partitioning. + * + * The routine builds edge weights from geometric information of neighboring points. + * Since element connectivity can reference points owned by other MPI ranks, it first + * exchanges the remote coordinates that are required locally. The resulting weights are + * scaled/clamped to the user-provided \p maxWeight and returned in graph-edge order. + * + * \param[in] maxWeight Upper bound used when converting anisotropy metrics to integer + * partitioning weights. + * \return Edge weights suitable for graph partitioning (one value per graph edge entry). + */ +vector CPhysicalGeometry::ComputeAnisotropyEdgeWeights(long maxWeight) const { + /*--- Build local/global point-index helpers used throughout communication. ---*/ + CLinearPartitioner pointPartitioner(Global_nPointDomain, 0); + const unsigned long firstIndex = pointPartitioner.GetFirstIndexOnRank(rank); + const auto isLocal = [&](unsigned long iGlobal) { + return (iGlobal >= firstIndex) && (iGlobal - firstIndex < nPoint); + }; + + /*--- Identify remote element nodes whose coordinates must be requested. ---*/ + vector> request(size); + for (auto iElem = 0ul; iElem < nElem; iElem++) { + for (auto iNode = 0u; iNode < elem[iElem]->GetnNodes(); iNode++) { + const auto iGlobal = elem[iElem]->GetNode(iNode); + if (!isLocal(iGlobal)) request[pointPartitioner.GetRankContainingIndex(iGlobal)].push_back(iGlobal); + } + } + + /*--- Exchange request sizes (after deduplication) to prepare all-to-all transfers. ---*/ + vector nSend(size), nRecv(size), sendDisp(size + 1, 0), recvDisp(size + 1, 0); + for (int iRank = 0; iRank < size; iRank++) { + auto& list = request[iRank]; + sort(list.begin(), list.end()); + list.erase(unique(list.begin(), list.end()), list.end()); + nSend[iRank] = static_cast(list.size()); + } + SU2_MPI::Alltoall(nSend.data(), 1, MPI_INT, nRecv.data(), 1, MPI_INT, SU2_MPI::GetComm()); + + for (int iRank = 0; iRank < size; iRank++) { + sendDisp[iRank + 1] = sendDisp[iRank] + nSend[iRank]; + recvDisp[iRank + 1] = recvDisp[iRank] + nRecv[iRank]; + } + + vector sendIndex, recvIndex(recvDisp[size]); + sendIndex.reserve(sendDisp[size]); + for (const auto& list : request) sendIndex.insert(sendIndex.end(), list.begin(), list.end()); + + SU2_MPI::Alltoallv(sendIndex.data(), nSend.data(), sendDisp.data(), MPI_UNSIGNED_LONG, recvIndex.data(), nRecv.data(), + recvDisp.data(), MPI_UNSIGNED_LONG, SU2_MPI::GetComm()); + + vector replyCoord(recvIndex.size() * nDim), remoteCoord(sendIndex.size() * nDim); + for (auto i = 0ul; i < recvIndex.size(); i++) + for (auto iDim = 0u; iDim < nDim; iDim++) + replyCoord[i * nDim + iDim] = SU2_TYPE::GetValue(nodes->GetCoord(recvIndex[i] - firstIndex, iDim)); + + for (int iRank = 0; iRank < size; iRank++) { + nSend[iRank] *= nDim; + nRecv[iRank] *= nDim; + sendDisp[iRank] *= nDim; + recvDisp[iRank] *= nDim; + } + SU2_MPI::Alltoallv(replyCoord.data(), nRecv.data(), recvDisp.data(), MPI_DOUBLE, remoteCoord.data(), nSend.data(), + sendDisp.data(), MPI_DOUBLE, SU2_MPI::GetComm()); + + unordered_map remoteSlot; + for (auto i = 0ul; i < sendIndex.size(); i++) remoteSlot[sendIndex[i]] = i; + + auto getCoord = [&](unsigned long iGlobal, unsigned short iDim) -> passivedouble { + if (isLocal(iGlobal)) return SU2_TYPE::GetValue(nodes->GetCoord(iGlobal - firstIndex, iDim)); + return remoteCoord[remoteSlot.at(iGlobal) * nDim + iDim]; + }; + + /*--- Weight is the longest node distance of the element over the edge length, maximized over elements. ---*/ + + vector weight(adjacency.size(), 1); + + for (auto iElem = 0ul; iElem < nElem; iElem++) { + const auto nNodes = elem[iElem]->GetnNodes(); + passivedouble coord[N_POINTS_HEXAHEDRON][MAXNDIM] = {}; + for (auto iNode = 0u; iNode < nNodes; iNode++) + for (auto iDim = 0u; iDim < nDim; iDim++) coord[iNode][iDim] = getCoord(elem[iElem]->GetNode(iNode), iDim); + + auto distance2 = [&](unsigned short a, unsigned short b) { + passivedouble d2 = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) d2 += pow(coord[a][iDim] - coord[b][iDim], 2); + return d2; + }; + + passivedouble maxDist2 = 0.0; + for (auto a = 0u; a < nNodes; a++) + for (auto b = a + 1; b < nNodes; b++) maxDist2 = max(maxDist2, distance2(a, b)); + + for (auto a = 0u; a < nNodes; a++) { + const auto iGlobal = elem[iElem]->GetNode(a); + if (!isLocal(iGlobal)) continue; + const auto iLocal = iGlobal - firstIndex; + const auto begin = adjacency.begin() + xadj[iLocal]; + const auto end = adjacency.begin() + xadj[iLocal + 1]; + + for (auto b = 0u; b < nNodes; b++) { + const auto d2 = distance2(a, b); + if ((b == a) || (d2 <= 0.0)) continue; + + const auto jGlobal = static_cast(elem[iElem]->GetNode(b)); + const auto it = lower_bound(begin, end, jGlobal); + if ((it == end) || (*it != jGlobal)) continue; + + const passivedouble ratio = min(passivedouble(maxWeight), max(1.0, sqrt(maxDist2 / d2))); + auto& w = weight[it - adjacency.begin()]; + w = max(w, static_cast(ratio)); + } + } + } + return weight; +} +#endif + void CPhysicalGeometry::SetColorGrid_Parallel(const CConfig* config) { /*--- We need to have parallel support with MPI and have the ParMETIS library compiled and linked for parallel graph partitioning. ---*/ @@ -7414,6 +7733,35 @@ void CPhysicalGeometry::SetColorGrid_Parallel(const CConfig* config) { vwgt[iPoint] = wp + we * (xadj[iPoint + 1] - xadj[iPoint]); } + /*--- Keep partition boundaries off the short edges of anisotropic cells. The edges that chain + * points into wall-normal lines get the largest weight, so the graph coarsening merges each + * line before it balances. The cap keeps the sum of all edge weights within half the range of idx_t. ---*/ + + const bool anisotropic = config->GetParMETIS_AnisotropyWeight(); + vector adjwgt; + vector lineRoot; + if (anisotropic) { + unsigned long nEntries = adjacency.size(), nEntriesGlobal = 0; + SU2_MPI::Allreduce(&nEntries, &nEntriesGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); + + constexpr long MAX_WEIGHT = 1000000; + constexpr long MIN_WEIGHT = 16; + const long maxWeight = min( + MAX_WEIGHT, static_cast(numeric_limits::max() / 2 / max(nEntriesGlobal, 1))); + if (maxWeight < MIN_WEIGHT) { + SU2_MPI::Error( + "PARMETIS_ANISOTROPY_WEIGHT needs 64-bit ParMETIS indices for a graph of this size, the edge weights " + "would overflow.", + CURRENT_FUNCTION); + } + adjwgt = ComputeAnisotropyEdgeWeights(maxWeight); + vector lineEdge; + lineRoot = LinkAnisotropicLines(adjwgt, lineEdge); + for (auto k = 0ul; k < adjwgt.size(); k++) + if (lineEdge[k]) adjwgt[k] = maxWeight; + wgtflag = 3; + } + /*--- Create some structures that ParMETIS needs to output the partitioning. ---*/ idx_t edgecut; @@ -7422,12 +7770,32 @@ void CPhysicalGeometry::SetColorGrid_Parallel(const CConfig* config) { /*--- Calling ParMETIS ---*/ if (rank == MASTER_NODE) cout << "Calling ParMETIS..."; - auto err = - ParMETIS_V3_PartKway(vtxdist.data(), xadj.data(), adjacency.data(), vwgt.data(), nullptr, &wgtflag, &numflag, - &ncon, &nparts, tpwgts.data(), &ubvec, options, &edgecut, part.data(), &comm); + const int err = ParMETIS_V3_PartKway(vtxdist.data(), xadj.data(), adjacency.data(), vwgt.data(), + anisotropic ? adjwgt.data() : nullptr, &wgtflag, &numflag, &ncon, &nparts, + tpwgts.data(), &ubvec, options, &edgecut, part.data(), &comm); if (err != METIS_OK) SU2_MPI::Error("Partitioning failed.", CURRENT_FUNCTION); if (rank == MASTER_NODE) { - cout << " graph partitioning complete (" << edgecut << " edge cuts)." << endl; + cout << " graph partitioning complete (" << edgecut << (anisotropic ? " weighted" : "") << " edge cuts)." << endl; + } + + /*--- A line split between ranks loses its strongest couplings in the preconditioner, and its + * fragments give tangled coarse control volumes. ---*/ + + if (anisotropic) { + unsigned long longestLine = 0, nSplit = 0; + const auto moved = KeepLinesTogether(lineRoot, vwgt, ubvec, part, longestLine, nSplit); + /*--- The imbalance is measured in the vertex weights ParMETIS balances. ---*/ + vector load(size, 0), loadGlobal(size); + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) load[part[iPoint]] += vwgt[iPoint]; + SU2_MPI::Allreduce(load.data(), loadGlobal.data(), size, MPI_UNSIGNED_LONG, MPI_SUM, comm); + const auto maxLoad = *max_element(loadGlobal.begin(), loadGlobal.end()); + const auto sumLoad = accumulate(loadGlobal.begin(), loadGlobal.end(), 0ul); + if (rank == MASTER_NODE) { + cout << "Longest anisotropic line " << longestLine << " points, moved " << moved + << " points to keep lines on one rank, " << nSplit + << " lines left split by the load tolerance, load imbalance " << double(maxLoad) * size / sumLoad << "." + << endl; + } } /*--- Store the results of the partitioning (note that this is local diff --git a/Common/src/linear_algebra/CSysSolve.cpp b/Common/src/linear_algebra/CSysSolve.cpp index d70be3f6047a..1156007c4409 100644 --- a/Common/src/linear_algebra/CSysSolve.cpp +++ b/Common/src/linear_algebra/CSysSolve.cpp @@ -1404,8 +1404,8 @@ bool CSysSolve::SetupInnerSolver(unsigned short kind_solver, const C template unsigned long CSysSolve::Solve(CSysMatrix& Jacobian, const CSysVector& LinSysRes, - CSysVector& LinSysSol, CGeometry* geometry, - const CConfig* config) { + CSysVector& LinSysSol, CGeometry* geometry, const CConfig* config, + unsigned long maxIter) { SU2_ZONE_SCOPED /*--- A word about the templated types. It is assumed that the residual and solution vectors are always of su2doubles, @@ -1458,7 +1458,7 @@ unsigned long CSysSolve::Solve(CSysMatrix& Jacobian, con default: { KindSolver = config->GetKind_Linear_Solver(); KindPrecond = config->GetKind_Linear_Solver_Prec(); - MaxIter = config->GetLinear_Solver_Iter(); + MaxIter = (maxIter != 0) ? maxIter : config->GetLinear_Solver_Iter(); SolverTol = SU2_TYPE::GetValue(config->GetLinear_Solver_Error()); ScreenOutput = false; break; diff --git a/SU2_CFD/include/integration/CMultiGridIntegration.hpp b/SU2_CFD/include/integration/CMultiGridIntegration.hpp index 524ab1aa9baf..956e399f4466 100644 --- a/SU2_CFD/include/integration/CMultiGridIntegration.hpp +++ b/SU2_CFD/include/integration/CMultiGridIntegration.hpp @@ -26,6 +26,9 @@ */ #include "CIntegration.hpp" +#include "../../../Common/include/containers/container_decorators.hpp" + +class CEulerVariable; /*! * \class CMultiGridIntegration @@ -75,23 +78,28 @@ class CMultiGridIntegration final : public CIntegration { * \param[in] iMesh - Index of the mesh in multigrid computations. * \param[in] mu - Variable for controlling the kind of multigrid algorithm. * \param[in] RunTime_EqSystem - System of equations which is going to be solved. - * \param[in] Iteration - Current iteration. + * \param[in] residualReady - The residual and time step of iMesh are already computed at its current solution. */ void MultiGrid_Cycle(CGeometry ****geometry, CSolver *****solver_container, CNumerics ******numerics_container, CConfig **config, unsigned short iMesh, unsigned short mu, unsigned short RunTime_EqSystem, - unsigned short iZone, unsigned short iInst); + unsigned short iZone, unsigned short iInst, bool residualReady); /*! - * \brief Compute the forcing term. + * \brief Store the restricted fine-grid defect in the truncation error of the coarse grid. * \param[in] sol_fine - Pointer to the solution on the fine grid. * \param[in] sol_coarse - Pointer to the solution on the coarse grid. - * \param[in] geo_fine - Geometrical definition of the fine grid. * \param[in] geo_coarse - Geometrical definition of the coarse grid. * \param[in] config - Definition of the particular problem. */ - void SetForcing_Term(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, - CGeometry *geo_coarse, CConfig *config, unsigned short iMesh); + void SetRestricted_Residual(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_coarse, CConfig *config); + + /*! + * \brief Subtract the coarse-grid residual from the restricted defect, which gives the forcing term. + * \param[in] sol_coarse - Pointer to the solution on the coarse grid. + * \param[in] geo_coarse - Geometrical definition of the coarse grid. + */ + void SetForcing_Term(CSolver *sol_coarse, CGeometry *geo_coarse); /*! * \brief Add the truncation error to the residual. @@ -103,10 +111,12 @@ class CMultiGridIntegration final : public CIntegration { /*! * \brief Set the value of the corrected fine grid solution. * \param[out] sol_fine - Pointer to the solution on the fine grid. + * \param[in] sol_flow - Flow solver on the fine grid, which flags the points that get no correction. * \param[in] geo_fine - Geometrical definition of the fine grid. * \param[in] config - Definition of the particular problem. */ - void SetProlongated_Correction(CSolver *sol_fine, CGeometry *geo_fine, CConfig *config, unsigned short iMesh); + void SetProlongated_Correction(CSolver *sol_fine, CSolver *sol_flow, CGeometry *geo_fine, CConfig *config, + unsigned short iMesh); /*! * \brief Compute the gradient in coarse grid using the fine grid information. @@ -141,9 +151,22 @@ class CMultiGridIntegration final : public CIntegration { * \param[in] geo_fine - Geometrical definition of the fine grid. * \param[in] geo_coarse - Geometrical definition of the coarse grid. * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the coarse mesh. */ void SetProlongated_Solution(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, - CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config); + CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config, unsigned short iMesh); + + /*! + * \brief Set the solution of every fine child from its coarse parent, constant or linearly reconstructed. + * \param[in,out] sol_fine - Solver on the fine grid. + * \param[in] sol_coarse - Solver on the coarse grid. + * \param[in] geo_fine - Geometrical definition of the fine grid. + * \param[in] geo_coarse - Geometrical definition of the coarse grid. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the coarse mesh. + */ + void InterpolateSolutionToChildren(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, + CGeometry *geo_coarse, CConfig *config, unsigned short iMesh); /*! @@ -175,11 +198,12 @@ class CMultiGridIntegration final : public CIntegration { * \param[in] iMesh - Index of the mesh in multigrid computations. * \param[in] iZone - Index of the zone. * \param[in] iRKLimit - Number of Runge-Kutta steps. + * \param[in] residualReady - The first step starts from the residual and time step already computed. */ void PreSmoothing(unsigned short RunTime_EqSystem, CGeometry**** geometry, CSolver***** solver_container, CConfig **config_container, CSolver* solver_fine, CNumerics** numerics_fine, CGeometry* geometry_fine, CSolver** solver_container_fine, CConfig *config, - unsigned short iMesh, unsigned short iZone, unsigned short iRKLimit); + unsigned short iMesh, unsigned short iZone, unsigned short iRKLimit, bool residualReady); /*! * \brief Compute the fine grid correction from the coarse solution. @@ -190,7 +214,21 @@ class CMultiGridIntegration final : public CIntegration { * \param[in] config - Definition of the particular problem. */ void GetProlongated_Correction(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, - CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config); + CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config, + unsigned short iMesh); + + /*! + * \brief Least-squares gradient of the coarse-grid correction, limited so no child value + * leaves the range of the coarse stencil. + * \param[in] sol_coarse - Solver holding the correction in Solution_Old, or the solution itself. + * \param[in] geo_coarse - Geometrical definition of the coarse grid. + * \param[in] geo_fine - Geometrical definition of the fine grid. + * \param[in] config - Definition of the particular problem. + * \param[in] iMesh - Index of the coarse mesh. + * \param[in] useSolution - Differentiate Solution instead of Solution_Old. + */ + void ComputeProlongationGradient(CSolver *sol_coarse, CGeometry *geo_coarse, CGeometry *geo_fine, + const CConfig *config, unsigned short iMesh, bool useSolution); /*! * \brief Do an implicit smoothing of the prolongated correction. @@ -296,9 +334,11 @@ class CMultiGridIntegration final : public CIntegration { * \param[in] geo_coarse - Geometry of the level handing over. * \param[in] config - Definition of the particular problem. * \param[in] eddy_viscosity - Carry the eddy viscosity across as well. + * \param[in] iMesh - Index of the coarse mesh. */ void SetProlongated_ScalarSolution(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, - CGeometry *geo_coarse, CConfig *config, bool eddy_viscosity); + CGeometry *geo_coarse, CConfig *config, bool eddy_viscosity, + unsigned short iMesh); /*! * \brief Helper function for early-exit logic during pre/post-smoothing. @@ -319,7 +359,8 @@ class CMultiGridIntegration final : public CIntegration { passivedouble lastRMS[2], char& exitReason, passivedouble& worstStepRatio, unsigned short& worstStep); - static constexpr int MAX_MG_LEVELS = 10; + /*--- CConfig rejects a larger MGLEVEL, so the per-level arrays below always fit. ---*/ + static constexpr int MAX_MG_LEVELS = MAX_MGLEVELS; /*--- Bounds the fixed-size stack buffers in the restriction and prolongation kernels, * independently of the CSysMatrix limit of the same name. ---*/ @@ -334,6 +375,20 @@ class CMultiGridIntegration final : public CIntegration { passivedouble mg_fine_rms_ema = 0.0; /*!< \brief EMA of fine-grid pre-smooth RMS across cycles; cross-cycle trend signal. */ passivedouble last_crossCycleRatio = 1.0; /*!< \brief crossCycleRatio from the most recent cycle; stored for display only. */ + /*--- Diagnostics of MG_SMOOTH_OUTPUT, with work in finest-grid equivalents. ---*/ + passivedouble mg_prev_cycle_defect = 0.0; /*!< \brief Finest-level defect after the previous cycle's pre-smoothing. */ + passivedouble mg_work_weight[MAX_MG_LEVELS+1] = {}; /*!< \brief Points of each level over those of the finest grid. */ + passivedouble mg_work_residual = 0.0; /*!< \brief Accumulated residual evaluations. */ + passivedouble mg_work_linear = 0.0; /*!< \brief Accumulated linear solver iterations. */ + + /*! + * \brief Add one residual evaluation and its linear iterations on a level to the work counters. + */ + void AddWork(const CConfig* config, unsigned short iMesh, unsigned long linIters) { + mg_work_residual += mg_work_weight[iMesh]; + if (config->GetKind_TimeIntScheme() == EULER_IMPLICIT) mg_work_linear += mg_work_weight[iMesh] * linIters; + } + /*--- Actual iteration counts per MG level, filled each cycle for the compact output summary. ---*/ unsigned short lastPreSmoothIters[MAX_MG_LEVELS+1] = {}; unsigned short lastPostSmoothIters[MAX_MG_LEVELS+1] = {}; @@ -354,6 +409,14 @@ class CMultiGridIntegration final : public CIntegration { unsigned short lastPreSmoothWorstStep[MAX_MG_LEVELS+1] = {}; unsigned short lastPostSmoothWorstStep[MAX_MG_LEVELS+1] = {}; + /*--- Linear solver iterations and final relative residual of each smoothing step, per level. ---*/ + struct LinSolInfo { + unsigned long iters; + passivedouble res; + }; + std::vector lastPreLinSol[MAX_MG_LEVELS+1]; + std::vector lastPostLinSol[MAX_MG_LEVELS+1]; + /*! \brief FinestMesh observed on the previous call; 0 also serves as the sentinel forcing a * reset on the first call, since a FULL cycle starts at FinestMesh == nMGLevels > 0. */ unsigned short mg_ramp_last_FinestMesh = 0; @@ -368,6 +431,27 @@ class CMultiGridIntegration final : public CIntegration { enum class MGStartupPromote { NONE, BUDGET, CONVERGENCE, STAGNATION }; MGStartupPromote mg_startup_promote_reason = MGStartupPromote::NONE; + /*! \brief Limited least-squares gradient of the correction, indexed by coarse level. + * Allocated on first use, only when MG_LINEAR_PROLONGATION is on. */ + vector prolongGradient; + vector> correctionWeight; /*!< \brief Per level, weight of the correction near wall ends. */ + unsigned long correctionWeightVersion = std::numeric_limits::max(); /*!< \brief Wall-end flag version the weights belong to. */ + CSysVector correctionHops; /*!< \brief Coarse CVs from the nearest wall end, with halos. */ + + /*! + * \brief Weight each level's prolongated correction from zero where a wall ends to one a few coarse CVs away. + * Must be called by all threads. + * \param[in] geometry - Geometry of all levels of this zone and instance. + * \param[in] flowNodes - Flow variables of the finest grid, which flag the wall ends. + * \param[in] config - Definition of the particular problem. + */ + void ComputeCorrectionWeights(CGeometry** geometry, const CEulerVariable* flowNodes, const CConfig* config); + + /*! \brief Coarse cells per level whose gradient fit is too ill-conditioned and keep the constant + * operator, and whether that level has been reported. */ + unsigned long prolongIllConditioned[MAX_MG_LEVELS + 1] = {}; + bool prolongReported[MAX_MG_LEVELS + 1] = {}; + vector mg_startup_conv_start; /*!< \brief Field values when the active level became active. */ vector mg_startup_conv_prev; /*!< \brief Field values on the previous iteration. */ unsigned long mg_startup_stall_count = 0; /*!< \brief Consecutive iterations without useful reduction. */ diff --git a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp index 562f15e8eb74..106923a87242 100644 --- a/SU2_CFD/include/numerics/flow/flow_diffusion.hpp +++ b/SU2_CFD/include/numerics/flow/flow_diffusion.hpp @@ -164,6 +164,18 @@ class CAvgGrad_Base : public CNumerics { su2double val_dist_ij_2, const unsigned short val_nPrimVar); + /*! + * \brief Distance for the Jacobian. With the corrected gradient it is |d|^2/|d.n|, which matches the normal + * derivative of the corrected gradient, bounded by 10|d| for edges nearly tangent to the face. + */ + su2double JacobianDistance(su2double dist_ij_2, const su2double* edge_vector, const su2double* unit_normal) const { + const su2double dist_ij = sqrt(dist_ij_2); + if (!correct_gradient) return dist_ij; + su2double proj = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) proj += edge_vector[iDim] * unit_normal[iDim]; + return dist_ij_2 / fmax(fabs(proj), 0.1 * dist_ij); + } + public: /*! diff --git a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp index 9908424c9284..288e6896ec51 100644 --- a/SU2_CFD/include/numerics_simd/flow/convection/common.hpp +++ b/SU2_CFD/include/numerics_simd/flow/convection/common.hpp @@ -121,9 +121,16 @@ FORCEINLINE CPair reconstructPrimitives(const Int& iEdge, fmax(solution.OutlierMitigation(iPoint[k]), solution.OutlierMitigation(jPoint[k])) / VariableType::MAX_OUTLIER_MITIGATION); } + /*--- Edges of flagged points drop to first order without the extra dissipation of a + * non-physical edge. ---*/ + Double firstOrder = nonPhysical; + for (size_t k = 0; k < Double::Size; ++k) { + firstOrder[k] = fmax(firstOrder[k], fmax(solution.FirstOrderReconstruction(iPoint[k]), + solution.FirstOrderReconstruction(jPoint[k]))); + } for (size_t iVar = 0; iVar < ReconVarType::nVar; ++iVar) { - V.i.all(iVar) = nonPhysical * V1st.i.all(iVar) + (1-nonPhysical) * V.i.all(iVar); - V.j.all(iVar) = nonPhysical * V1st.j.all(iVar) + (1-nonPhysical) * V.j.all(iVar); + V.i.all(iVar) = firstOrder * V1st.i.all(iVar) + (1-firstOrder) * V.i.all(iVar); + V.j.all(iVar) = firstOrder * V1st.j.all(iVar) + (1-firstOrder) * V.j.all(iVar); } } else { nonPhysical = 0; diff --git a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp index 2b6c46550e1e..9c0c637df7a2 100644 --- a/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp +++ b/SU2_CFD/include/numerics_simd/flow/diffusion/viscous_fluxes.hpp @@ -76,7 +76,6 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { const su2double gamma; const su2double gasConst; const su2double prandtlTurb; - const bool correct; const bool useSA_QCR; const bool wallFun; const bool uq; @@ -92,12 +91,11 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { * \brief Constructor, initialize constants and booleans. */ template - CCompressibleViscousFluxBase(const CConfig& config, int iMesh, + CCompressibleViscousFluxBase(const CConfig& config, int, const CVariable* turbVars_, Ts&...) : gamma(config.GetGamma()), gasConst(config.GetGas_ConstantND()), prandtlTurb(config.GetPrandtl_Turb()), - correct(iMesh == MESH_0), useSA_QCR(config.GetSAParsedOptions().qcr2000), wallFun(config.GetWall_Functions()), uq(config.GetSSTParsedOptions().uq), @@ -144,10 +142,10 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { Double mask = dist2_ij < EPS*EPS; dist2_ij += mask / (EPS*EPS); - /*--- Compute the corrected mean gradient. ---*/ + /*--- Compute the corrected mean gradient on all levels. ---*/ auto avgGrad = averageGradient(iPoint, jPoint, gradient); - if(correct) correctGradient(V, vector_ij, dist2_ij, avgGrad); + correctGradient(V, vector_ij, dist2_ij, avgGrad); /*--- Stress and heat flux tensors. ---*/ @@ -181,7 +179,10 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD { /*--- Flux Jacobians. ---*/ - Double dist_ij = sqrt(dist2_ij); + /*--- Effective distance |d|^2/|d.n| matches the normal derivative of the corrected gradient. ---*/ + + const Double projDist = abs(dot(vector_ij, unitNormal)); + const Double dist_ij = dist2_ij / fmax(projDist, 0.1 * sqrt(dist2_ij)); auto dtau = stressTensorJacobian(avgV, unitNormal, dist_ij); /*--- Energy flux Jacobian. ---*/ diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 869eac4d800c..6f50ffb3d02b 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -394,6 +394,13 @@ class CEulerSolver : public CFVMFlowSolverBase::ImplicitEuler_Iteration(CGeometry *geometry, CSol } END_SU2_OMP_FOR - auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config, + config->GetMG_LinSolIter(geometry->GetMGLevel())); BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { SetIterLinSolver(iter); diff --git a/SU2_CFD/include/solvers/CScalarSolver.inl b/SU2_CFD/include/solvers/CScalarSolver.inl index 041730ba8029..1694f57d4dab 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.inl +++ b/SU2_CFD/include/solvers/CScalarSolver.inl @@ -606,7 +606,8 @@ void CScalarSolver::ImplicitEuler_Iteration(CGeometry* geometry, C } END_SU2_OMP_FOR - auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config); + auto iter = System.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config, + config->GetMG_LinSolIter(geometry->GetMGLevel())); BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { SetIterLinSolver(iter); diff --git a/SU2_CFD/include/solvers/CSolver.hpp b/SU2_CFD/include/solvers/CSolver.hpp index 9446db1e7351..fe9436fb607f 100644 --- a/SU2_CFD/include/solvers/CSolver.hpp +++ b/SU2_CFD/include/solvers/CSolver.hpp @@ -665,6 +665,13 @@ class CSolver { */ inline virtual void SetPrimitive_Limiter(CGeometry *geometry, const CConfig *config) { } + /*! + * \brief Flag the points reconstructed to first order at no-slip wall ends and sharp wall edges. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] config - Definition of the particular problem. + */ + inline virtual void SetWallEndFlags(CGeometry *geometry, const CConfig *config) { } + /*! * \brief Copy PRIMITIVE sensor values from primitive variable array into Sensor_Adapt. * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/include/variables/CAdjEulerVariable.hpp b/SU2_CFD/include/variables/CAdjEulerVariable.hpp index 7d6dde9a9756..1959f416d36a 100644 --- a/SU2_CFD/include/variables/CAdjEulerVariable.hpp +++ b/SU2_CFD/include/variables/CAdjEulerVariable.hpp @@ -102,6 +102,11 @@ class CAdjEulerVariable : public CVariable { Solution_Old(iPoint,iDim+1) = val_velocity[iDim]*Solution(iPoint,0); } + /*! + * \brief Index of the adjoint momentum in the solution vector. + */ + inline short GetVelocityIndex() const final { return 1; } + /*! * \brief Set the momentum part of the truncation error to zero. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CEulerVariable.hpp b/SU2_CFD/include/variables/CEulerVariable.hpp index 72bb20ffe9ea..e64971953db3 100644 --- a/SU2_CFD/include/variables/CEulerVariable.hpp +++ b/SU2_CFD/include/variables/CEulerVariable.hpp @@ -314,6 +314,11 @@ class CEulerVariable : public CFlowVariable { Solution_Old(iPoint,iDim+1) = val_velocity[iDim]*Solution(iPoint,0); } + /*! + * \brief Index of the momentum in the conservative solution vector. + */ + inline short GetVelocityIndex() const final { return 1; } + /*! * \brief Set the momentum part of the truncation error to zero. * \param[in] iPoint - Point index. @@ -385,4 +390,26 @@ class CEulerVariable : public CFlowVariable { */ su2vector OutlierMitigation; + /*! + * \brief Points whose edges are reconstructed to first order (1), others use MUSCL (0). + */ + su2vector FirstOrderReconstruction; + + /*! + * \brief Points, and their neighbours, where the multigrid correction is not prolongated (1), others (0). + */ + su2vector SkipMGCorrection; + + /*! + * \brief Incremented each time the two flags above are recomputed. + */ + unsigned long WallEndFlagsVersion = 0; + + inline uint8_t GetFirstOrderReconstruction(unsigned long iPoint) const final { + return FirstOrderReconstruction(iPoint); + } + inline void SetFirstOrderReconstruction(unsigned long iPoint, uint8_t val) final { + FirstOrderReconstruction(iPoint) = val; + } + }; diff --git a/SU2_CFD/include/variables/CIncEulerVariable.hpp b/SU2_CFD/include/variables/CIncEulerVariable.hpp index 7935ee1cbfe5..d95ca0f3c48e 100644 --- a/SU2_CFD/include/variables/CIncEulerVariable.hpp +++ b/SU2_CFD/include/variables/CIncEulerVariable.hpp @@ -213,6 +213,11 @@ class CIncEulerVariable : public CFlowVariable { Solution_Old(iPoint,iDim+1) = val_velocity[iDim]; } + /*! + * \brief Index of the velocity in the solution vector. + */ + inline short GetVelocityIndex() const final { return 1; } + /*! * \brief Set the momentum part of the truncation error to zero. * \param[in] iPoint - Point index. diff --git a/SU2_CFD/include/variables/CNEMOEulerVariable.hpp b/SU2_CFD/include/variables/CNEMOEulerVariable.hpp index 2cc2923aeabb..6a023296b4ba 100644 --- a/SU2_CFD/include/variables/CNEMOEulerVariable.hpp +++ b/SU2_CFD/include/variables/CNEMOEulerVariable.hpp @@ -298,6 +298,12 @@ class CNEMOEulerVariable : public CFlowVariable { } } + /*! + * \brief Index of the momentum in the conservative solution vector, which the primitive + * index Velocity() does not give. + */ + inline short GetVelocityIndex() const final { return static_cast(nSpecies); } + /*! * \brief A virtual member. * \return Value of the vibrational-electronic temperature. diff --git a/SU2_CFD/include/variables/CVariable.hpp b/SU2_CFD/include/variables/CVariable.hpp index 34893634e583..27aaf6ab554d 100644 --- a/SU2_CFD/include/variables/CVariable.hpp +++ b/SU2_CFD/include/variables/CVariable.hpp @@ -970,6 +970,12 @@ class CVariable { * \return Value of the pressure sensor. */ inline su2double GetSensor(unsigned long iPoint) const { return Sensor(iPoint); } + + /*! + * \brief First-order reconstruction flag of a point (1) or MUSCL (0). + */ + inline virtual uint8_t GetFirstOrderReconstruction(unsigned long iPoint) const { return 0; } + inline virtual void SetFirstOrderReconstruction(unsigned long iPoint, uint8_t val) {} inline const VectorType& GetSensor() const { return Sensor; } /*! @@ -1635,6 +1641,12 @@ class CVariable { */ inline virtual void SetVelocity_Old(unsigned long iPoint, const su2double *val_velocity) {} + /*! + * \brief Index of the first velocity or momentum component in the solution vector. + * \return The index, or -1 when the solution carries no velocity. + */ + inline virtual short GetVelocityIndex() const { return -1; } + /*! * \brief A virtual member. * \param[in] laminarViscosity diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index fb39f5dd7805..b270f7a5eacb 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -822,6 +822,54 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { return range; }; + /*--- The face normals of a closed control volume sum to zero. Reports the largest sum + * relative to the sum of the face areas, and how many CVs exceed a small tolerance. ---*/ + auto closureReport = [&](const CGeometry* grid, unsigned short iLevel) { + const auto nDomain = grid->GetnPointDomain(); + const auto nDim = grid->GetnDim(); + vector> boundary(nDomain, {0.0, 0.0, 0.0}); + for (auto iMarker = 0u; iMarker < grid->GetnMarker(); iMarker++) { + if (config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) continue; + for (auto iVertex = 0ul; iVertex < grid->GetnVertex(iMarker); iVertex++) { + const auto iPoint = grid->vertex[iMarker][iVertex]->GetNode(); + if (iPoint >= nDomain) continue; + for (auto iDim = 0u; iDim < nDim; iDim++) + boundary[iPoint][iDim] -= SU2_TYPE::GetValue(grid->vertex[iMarker][iVertex]->GetNormal(iDim)); + } + } + + passivedouble worst = 0.0; + unsigned long nBad = 0, nBadGlobal = 0; + for (auto iPoint = 0ul; iPoint < nDomain; iPoint++) { + std::array sum = boundary[iPoint]; + passivedouble area = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) area += fabs(sum[iDim]); + for (auto iNeigh = 0u; iNeigh < grid->nodes->GetnPoint(iPoint); iNeigh++) { + const auto iEdge = grid->nodes->GetEdge(iPoint, iNeigh); + const passivedouble sign = (grid->edges->GetNode(iEdge, 0) == iPoint) ? 1.0 : -1.0; + passivedouble norm2 = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) { + const passivedouble n = SU2_TYPE::GetValue(grid->edges->GetNormal(iEdge)[iDim]); + sum[iDim] += sign * n; + norm2 += n * n; + } + area += sqrt(norm2); + } + passivedouble defect = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) defect += sum[iDim] * sum[iDim]; + defect = sqrt(defect) / max(area, std::numeric_limits::min()); + if (defect > 1e-6) nBad++; + worst = std::max(worst, defect); + } + passivedouble worstGlobal = 0.0; + CPassiveMPI::Allreduce(&worst, &worstGlobal, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(&nBad, &nBadGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + if (rank == MASTER_NODE) { + cout << " MG level " << iLevel << " CV closure: " << nBadGlobal << " CVs with a face normal sum above 1e-6 of the " + << "face area, worst " << worstGlobal << "\n"; + } + }; + /*--- Agglomeration should not spread the CV volumes far wider than the fine grid already does. * An absolute limit cannot tell a coarsened mesh from a badly stretched input one. ---*/ constexpr passivedouble VOL_RATIO_GROWTH_WARN = 10.0; @@ -880,11 +928,9 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { geometry[iMGlevel]->SetBoundControlVolume(geometry[iMGlevel-1], config, ALLOCATE); - geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); - - /*--- Find closest, most normal, neighbor to a surface point ---*/ + if (config->GetMGOptions().MG_Smooth_Output) closureReport(geometry[iMGlevel], iMGlevel); - geometry[iMGlevel]->FindNormal_Neighbor(config); + geometry[iMGlevel]->SetCoord(geometry[iMGlevel-1]); /*--- Store our multigrid index. ---*/ @@ -935,6 +981,18 @@ void CDriver::InitializeGeometryFVM(CConfig *config, CGeometry **&geometry) { for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) { + /*--- SetCoord centred a halo agglomerate on the partial child list this rank holds. Take + the owner's coordinate, otherwise coarse stencils depend on the partitioning. ---*/ + + if (iMGlevel > MESH_0) { + geometry[iMGlevel]->InitiateComms(geometry[iMGlevel], config, MPI_QUANTITIES::COORDINATES); + geometry[iMGlevel]->CompleteComms(geometry[iMGlevel], config, MPI_QUANTITIES::COORDINATES); + + /*--- Find closest, most normal, neighbor to a surface point ---*/ + + geometry[iMGlevel]->FindNormal_Neighbor(config); + } + /*--- Compute the max length. ---*/ if (!fea) { @@ -1810,7 +1868,7 @@ void CDriver::InitializeNumerics(CConfig *config, CGeometry **geometry, CSolver /*--- Compressible flow Ideal gas ---*/ numerics[MESH_0][FLOW_SOL][visc_term] = new CAvgGrad_Flow(nDim, nVar_Flow, true, config); for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) - numerics[iMGlevel][FLOW_SOL][visc_term] = new CAvgGrad_Flow(nDim, nVar_Flow, false, config); + numerics[iMGlevel][FLOW_SOL][visc_term] = new CAvgGrad_Flow(nDim, nVar_Flow, true, config); /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) @@ -1821,7 +1879,7 @@ void CDriver::InitializeNumerics(CConfig *config, CGeometry **geometry, CSolver /*--- Compressible flow Real gas ---*/ numerics[MESH_0][FLOW_SOL][visc_term] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, true, config); for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) - numerics[iMGlevel][FLOW_SOL][visc_term] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, false, config); + numerics[iMGlevel][FLOW_SOL][visc_term] = new CGeneralAvgGrad_Flow(nDim, nVar_Flow, true, config); /*--- Definition of the boundary condition method ---*/ for (iMGlevel = 0; iMGlevel <= config->GetnMGLevels(); iMGlevel++) @@ -1832,6 +1890,8 @@ void CDriver::InitializeNumerics(CConfig *config, CGeometry **geometry, CSolver if (incompressible) { /*--- Incompressible flow, use preconditioning method ---*/ numerics[MESH_0][FLOW_SOL][visc_term] = new CAvgGradInc_Flow(nDim, nVar_Flow, true, config); + + /*--- Coarse levels keep the averaged gradient, the incompressible Jacobian has no effective distance. ---*/ for (iMGlevel = 1; iMGlevel <= config->GetnMGLevels(); iMGlevel++) numerics[iMGlevel][FLOW_SOL][visc_term] = new CAvgGradInc_Flow(nDim, nVar_Flow, false, config); diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp index 89d3d95ea596..4848b12ca4b6 100644 --- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp +++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp @@ -28,7 +28,11 @@ #include "../../include/integration/CMultiGridIntegration.hpp" #include "../../../Common/include/parallelization/omp_structure.hpp" #include "../../../Common/include/toolboxes/printing_toolbox.hpp" +#include "../../../Common/include/toolboxes/geometry_toolbox.hpp" #include +#include +#include +#include "../../include/variables/CEulerVariable.hpp" namespace { @@ -72,7 +76,9 @@ void CMultiGridIntegration::adaptDampingFactors(CConfig* config, passivedouble c applyGlobalTrend(config->GetDamp_Correc_Prolong(), crossCycleRatio)); } -CMultiGridIntegration::CMultiGridIntegration() : CIntegration() { } +CMultiGridIntegration::CMultiGridIntegration() : CIntegration() { + prolongGradient.resize(MAX_MG_LEVELS + 1); +} void CMultiGridIntegration::MonitorFullMG_Startup(const vector >& convFields, const CConfig *config) { @@ -101,14 +107,15 @@ void CMultiGridIntegration::MonitorFullMG_Startup(const vector 0.0 && !mg_startup_conv_prev.empty()) { + const passivedouble band = fabs(log10(stall_tol)); bool stalled = true; for (auto iField = 0ul; iField < nFields; iField++) - stalled = stalled && (convFields[iField].second - mg_startup_conv_prev[iField] >= log10(stall_tol)); + stalled = stalled && (fabs(convFields[iField].second - mg_startup_conv_prev[iField]) <= band); if (stalled) mg_startup_stall_count++; @@ -151,12 +158,13 @@ void CMultiGridIntegration::SetCoarseGridCFL(CGeometry ****geometry, CSolver *** mg_ramp_mesh0_active = FullMG_Mesh0Ramping(config[iZone], FinestMesh, FullMG); - /*--- Coarse targets are derived from the level-0 CFL via MG_CFL_SCALING. ---*/ + /*--- The active level takes the level-0 CFL, the levels below it are scaled via MG_CFL_SCALING. ---*/ passivedouble cfl_base = mesh0_ramp_window ? passivedouble{0.0} : SU2_TYPE::GetValue(sol_f->GetAvg_CFL_Local()); if (cfl_base < EPS) cfl_base = SU2_TYPE::GetValue(config[iZone]->GetCFL(MESH_0)); const auto& cflScaling = config[iZone]->GetMGOptions().MG_CflScaling; + const unsigned short activeLevel = FullMG ? FinestMesh : MESH_0; passivedouble CFL_target[MAX_MG_LEVELS+1]; passivedouble CFL_scale[MAX_MG_LEVELS+1]; @@ -169,7 +177,7 @@ void CMultiGridIntegration::SetCoarseGridCFL(CGeometry ****geometry, CSolver *** const passivedouble scale = max(passivedouble{1e-6}, min(passivedouble{1.0}, SU2_TYPE::GetValue(cflScaling[iScale]))); CFL_scale[lvl] = scale; - CFL_target[lvl] = CFL_target[lvl-1] * scale; + CFL_target[lvl] = (lvl <= activeLevel) ? cfl_base : CFL_target[lvl-1] * scale; } /*--- Ramp from the CFL the level below handed over at. The coarsest level has none and starts @@ -324,6 +332,10 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, if (config[iZone]->GetInnerIter() < mg_ramp_level_start_iter) mg_ramp_level_start_iter = config[iZone]->GetInnerIter(); + + for (unsigned short i = 0; i <= nMGLevels; ++i) + mg_work_weight[i] = passivedouble(geometry[iZone][iInst][i]->GetGlobal_nPointDomain()) / + passivedouble(geometry[iZone][iInst][MESH_0]->GetGlobal_nPointDomain()); } END_SU2_OMP_SAFE_GLOBAL_ACCESS @@ -343,7 +355,7 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, solver_container[iZone][iInst][FinestMesh][Solver_Position], geometry[iZone][iInst][FinestMesh-1], geometry[iZone][iInst][FinestMesh], - config[iZone]); + config[iZone], FinestMesh); /*--- The scalar equations only restrict downward, so hand the new level their solution too, * otherwise they restart from their initial condition at every promotion. ---*/ @@ -357,7 +369,7 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, SetProlongated_ScalarSolution(scalar_fine, scalar_coarse, geometry[iZone][iInst][FinestMesh-1], geometry[iZone][iInst][FinestMesh], - config[iZone], Scalar_Position == TURB_SOL); + config[iZone], Scalar_Position == TURB_SOL, FinestMesh); } /*--- Report the promotion before the startup state is reset below. ---*/ @@ -411,6 +423,7 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, /*--- The EMA is measured on a different grid after a promotion. ---*/ mg_fine_rms_ema = 0.0; + mg_prev_cycle_defect = 0.0; config[iZone]->SetDamp_Res_Restric(mg_damp_restric_initial); config[iZone]->SetDamp_Correc_Prolong(mg_damp_prolong_initial); @@ -437,7 +450,7 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, /*--- Perform the Full Approximation Scheme multigrid ---*/ MultiGrid_Cycle(geometry, solver_container, numerics_container, config, - FinestMesh, RecursiveParam, RunTime_EqSystem, iZone, iInst); + FinestMesh, RecursiveParam, RunTime_EqSystem, iZone, iInst, false); if (!fmg_warmup && !fmg_mesh0_ramp) SetCoarseGridCFL(geometry, solver_container, config, RunTime_EqSystem, iZone, iInst, FinestMesh, FullMG, @@ -446,11 +459,21 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, /*--- Coarse-level residuals are per-rank partial sums; reduce once so the promotion criterion * agrees on every rank. The smoothing early exit already reduces when it is on. ---*/ - if (fmg_warmup && !config[iZone]->GetMGOptions().MG_Smooth_EarlyExit) { + if (fmg_warmup && !config[iZone]->GetMGOptions().MG_Smooth_EarlyExit && + !config[iZone]->GetMGOptions().MG_Smooth_Output) { solver_container[iZone][iInst][FinestMesh][Solver_Position]->SetResidual_RMS( geometry[iZone][iInst][FinestMesh], config[iZone], true); } + /*--- The friction forces and the scalar solvers on the active startup level need its gradients. ---*/ + + if (fmg_warmup) { + solver_container[iZone][iInst][FinestMesh][Solver_Position]->Preprocessing(geometry[iZone][iInst][FinestMesh], + solver_container[iZone][iInst][FinestMesh], + config[iZone], FinestMesh, NO_RK_ITER, + RunTime_EqSystem, true); + } + /*--- Computes primitive variables and gradients in the finest mesh (useful for the next solver (turbulence) and output ---*/ solver_container[iZone][iInst][MESH_0][Solver_Position]->Preprocessing(geometry[iZone][iInst][MESH_0], @@ -537,6 +560,26 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, table << "-"; /*--- Corr.-smooth: defined on levels 0..nMGLevels-1; coarsest has none. ---*/ + /*--- Linear solver iterations and final relative residual of each smoothing step. ---*/ + auto linRows = [&](const char* name, const std::vector* info, unsigned short nLev) { + std::vector its(nMGLevels + 1, "-"), res(nMGLevels + 1, "-"); + for (unsigned short i = 0; i < nLev; ++i) { + std::ostringstream si, sr; + sr << std::scientific << std::setprecision(1); + for (std::size_t k = 0; k < info[i].size(); ++k) { + si << (k ? "," : "") << info[i][k].iters; + sr << (k ? "," : "") << info[i][k].res; + } + if (!info[i].empty()) { its[i] = si.str(); res[i] = sr.str(); } + } + table << std::string(name) + " its"; + for (const auto& str : its) table << str; + table << std::string(name) + " res"; + for (const auto& str : res) table << str; + }; + linRows("Pre-lin", lastPreLinSol, nMGLevels + 1); + linRows("Post-lin", lastPostLinSol, nMGLevels); + table << "Corr-smooth"; for (unsigned short i = 0; i < nMGLevels; ++i) table << cellStr(lastCorrecSmoothIters[i], mgOptsZone.MG_CorrecSmooth[i], @@ -561,8 +604,18 @@ void CMultiGridIntegration::MultiGrid_Iteration(CGeometry ****geometry, cout << std::fixed << std::setprecision(4) << "Damping [restrict | prolong] : " << config[iZone]->GetDamp_Res_Restric() << " | " << config[iZone]->GetDamp_Correc_Prolong() - << " cross-cycle: " << std::setprecision(3) << last_crossCycleRatio << "\n" - << std::defaultfloat << std::setprecision(6); + << " cross-cycle: " << std::setprecision(3) << last_crossCycleRatio << "\n"; + + /*--- Defect ratios of the finest level: over its pre-smoothing, and from there to the start of + * this cycle, which spans the coarse-grid correction and the scalar solvers. ---*/ + if (FinestMesh < nMGLevels) { + const passivedouble d0 = lastPreSmoothRMS[FinestMesh][0], d1 = lastPreSmoothRMS[FinestMesh][1]; + cout << "Gain [smoothing | correction] : " << ((d0 > 0.0) ? d1 / d0 : 0.0) << " | " + << ((mg_prev_cycle_defect > 0.0) ? d0 / mg_prev_cycle_defect : 0.0); + mg_prev_cycle_defect = d1; + } + cout << " work [residual | linear] : " << std::setprecision(1) << mg_work_residual << " | " << mg_work_linear; + cout << "\n" << std::defaultfloat << std::setprecision(6); } END_SU2_OMP_SAFE_GLOBAL_ACCESS } @@ -580,13 +633,15 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, unsigned short RecursiveParam, unsigned short RunTime_EqSystem, unsigned short iZone, - unsigned short iInst) { + unsigned short iInst, + bool residualReady) { SU2_ZONE_SCOPED CConfig* config = config_container[iZone]; const unsigned short Solver_Position = config->GetContainerPosition(RunTime_EqSystem); const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const bool classical_rk4 = (config->GetKind_TimeIntScheme() == CLASSICAL_RK4_EXPLICIT); /*--- Shorter names to refer to fine grid entities. ---*/ @@ -599,14 +654,21 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, unsigned short iRKLimit = config->GetnRKStep(); + /*--- Wall end weights for every level, once the hierarchy exists. ---*/ + if (iMesh == MESH_0) { + const auto* flowNodes = dynamic_cast(solver_container_fine[FLOW_SOL]->GetNodes()); + const unsigned long version = flowNodes ? flowNodes->WallEndFlagsVersion : 0; + if (version != correctionWeightVersion) ComputeCorrectionWeights(geometry[iZone][iInst], flowNodes, config); + } + /*--- Do a presmoothing on the grid iMesh to be restricted to the grid iMesh+1 ---*/ PreSmoothing(RunTime_EqSystem, geometry, solver_container, config_container, solver_fine, numerics_fine, - geometry_fine, solver_container_fine, config, iMesh, iZone, iRKLimit); + geometry_fine, solver_container_fine, config, iMesh, iZone, iRKLimit, residualReady); /*--- Compute Forcing Term $P_(k+1) = I^(k+1)_k(P_k+F_k(u_k))-F_(k+1)(I^(k+1)_k u_k)$ and update solution for multigrid ---*/ - if ( iMesh < config->GetnMGLevels() ) { + if (iMesh < config->GetnMGLevels()) { /*--- Shorter names to refer to coarse grid entities. ---*/ @@ -615,7 +677,7 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, CSolver* solver_coarse = solver_container_coarse[Solver_Position]; CNumerics** numerics_coarse = numerics_container[iZone][iInst][iMesh+1][Solver_Position]; - /*--- Temporarily disable implicit integration, for what follows we do not need the Jacobian. ---*/ + /*--- Temporarily disable implicit integration, the fine residual needs no Jacobian. ---*/ if (implicit) { SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetKind_TimeIntScheme(EULER_EXPLICIT);) @@ -627,29 +689,49 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, Space_Integration(geometry_fine, solver_container_fine, numerics_fine, config, iMesh, NO_RK_ITER, RunTime_EqSystem); - /*--- LinSysRes = R(u_N) here, before tau is added by SetResidual_Term. ---*/ - BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { - lastPreSmoothRMS[iMesh][1] = ComputeLinSysResRMS(solver_fine); + SetResidual_Term(geometry_fine, solver_fine); + + const auto& mgOpts = config->GetMGOptions(); + + /*--- Defect left by the pre-smoothing, forcing term included. ---*/ + if (mgOpts.MG_Smooth_Output) { + const su2double defect = sqrt(solver_fine->LinSysRes.squaredNorm() / geometry_fine->GetGlobal_nPointDomain()); + SU2_OMP_SAFE_GLOBAL_ACCESS(lastPreSmoothRMS[iMesh][1] = SU2_TYPE::GetValue(defect);) } - END_SU2_OMP_SAFE_GLOBAL_ACCESS - SetResidual_Term(geometry_fine, solver_fine); + /*--- The coarse residual is also the first coarse pre-smoothing step, so it gets its Jacobian. ---*/ + const bool coarseReady = (RunTime_EqSystem == RUNTIME_FLOW_SYS) && (mgOpts.MG_PreSmooth[iMesh+1] > 0); + + if (implicit && coarseReady) { + SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetKind_TimeIntScheme(EULER_IMPLICIT);) + } - /*--- Compute $r_(k+1) = F_(k+1)(I^(k+1)_k u_k)$ ---*/ + /*--- Compute $r_(k+1) = F_(k+1)(I^(k+1)_k u_k)$, whose boundary conditions also act on the restricted defect. ---*/ SetRestricted_Solution(RunTime_EqSystem, solver_fine, solver_coarse, geometry_fine, geometry_coarse, config); + SetRestricted_Residual(solver_fine, solver_coarse, geometry_coarse, config); + solver_coarse->Preprocessing(geometry_coarse, solver_container_coarse, config, iMesh+1, NO_RK_ITER, RunTime_EqSystem, false); + if (coarseReady) { + solver_coarse->Set_OldSolution(); + if (classical_rk4) solver_coarse->Set_NewSolution(); + solver_coarse->SetTime_Step(geometry_coarse, solver_container_coarse, config, iMesh+1, config->GetTimeIter()); + } + Space_Integration(geometry_coarse, solver_container_coarse, numerics_coarse, config, iMesh+1, NO_RK_ITER, RunTime_EqSystem); /*--- Compute $P_(k+1) = I^(k+1)_k(r_k) - r_(k+1) ---*/ - SetForcing_Term(solver_fine, solver_coarse, geometry_fine, geometry_coarse, config, iMesh+1); + SetForcing_Term(solver_coarse, geometry_coarse); + + /*--- The coarse evaluation is counted with the pre-smoothing step that reuses it. ---*/ + SU2_OMP_SAFE_GLOBAL_ACCESS(mg_work_residual += mg_work_weight[iMesh] + (coarseReady ? 0.0 : mg_work_weight[iMesh+1]);) /*--- Restore the time integration settings. ---*/ - if (implicit) { + if (implicit && !coarseReady) { SU2_OMP_SAFE_GLOBAL_ACCESS(config->SetKind_TimeIntScheme(EULER_IMPLICIT);) } @@ -664,18 +746,18 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry, nextRecurseParam = 0; MultiGrid_Cycle(geometry, solver_container, numerics_container, config_container, - iMesh+1, nextRecurseParam, RunTime_EqSystem, iZone, iInst); + iMesh+1, nextRecurseParam, RunTime_EqSystem, iZone, iInst, coarseReady && (imu == 0)); } /*--- Compute prolongated solution, and smooth the correction $u^(new)_k = u_k + Smooth(I^k_(k+1)(u_(k+1)-I^(k+1)_k u_k))$ ---*/ - GetProlongated_Correction(RunTime_EqSystem, solver_fine, solver_coarse, geometry_fine, geometry_coarse, config); + GetProlongated_Correction(RunTime_EqSystem, solver_fine, solver_coarse, geometry_fine, geometry_coarse, config, + iMesh+1); - const auto& mgOpts = config->GetMGOptions(); SmoothProlongated_Correction(RunTime_EqSystem, solver_fine, geometry_fine, mgOpts.MG_CorrecSmooth[iMesh], mgOpts.MG_Smooth_Coeff, config, iMesh); - SetProlongated_Correction(solver_fine, geometry_fine, config, iMesh); + SetProlongated_Correction(solver_fine, solver_container_fine[FLOW_SOL], geometry_fine, config, iMesh); /*--- Solution post-smoothing in the prolongated grid. ---*/ @@ -728,12 +810,14 @@ void CMultiGridIntegration::PreSmoothing(unsigned short RunTime_EqSystem, CConfig *config, unsigned short iMesh, unsigned short iZone, - unsigned short iRKLimit) { + unsigned short iRKLimit, + bool residualReady) { SU2_ZONE_SCOPED const auto& mgOpts = config->GetMGOptions(); const bool classical_rk4 = (config->GetKind_TimeIntScheme() == CLASSICAL_RK4_EXPLICIT); - const unsigned short nPreSmooth = mgOpts.MG_PreSmooth[iMesh]; + /*--- The coarsest level is smoothed at least once. ---*/ + const unsigned short nPreSmooth = max(mgOpts.MG_PreSmooth[iMesh], (iMesh == config->GetnMGLevels()) ? 1 : 0); const unsigned long timeIter = config->GetTimeIter(); const bool early_exit = mgOpts.MG_Smooth_EarlyExit && (nPreSmooth > 1); const bool need_per_step_rms = early_exit || mgOpts.MG_Smooth_Output; @@ -743,31 +827,42 @@ void CMultiGridIntegration::PreSmoothing(unsigned short RunTime_EqSystem, ? SU2_TYPE::GetValue(mgOpts.MG_Smooth_StagnationTol) : passivedouble(1.0); /*--- Reset the shared early-exit flag (master only). ---*/ - SU2_OMP_SAFE_GLOBAL_ACCESS(mg_early_exit_flag = false;) + SU2_OMP_SAFE_GLOBAL_ACCESS(mg_early_exit_flag = false; lastPreLinSol[iMesh].clear();) for (unsigned short iPreSmooth = 0; iPreSmooth < nPreSmooth; iPreSmooth++) { /*--- Time and space integration ---*/ for (unsigned short iRKStep = 0; iRKStep < iRKLimit; iRKStep++) { - /*--- Send-Receive boundary conditions, and preprocessing ---*/ - solver_fine->Preprocessing(geometry_fine, solver_container_fine, config, iMesh, iRKStep, RunTime_EqSystem, false); + if (!residualReady || (iPreSmooth > 0) || (iRKStep > 0)) { - if (iRKStep == 0) { + /*--- Send-Receive boundary conditions, and preprocessing ---*/ + solver_fine->Preprocessing(geometry_fine, solver_container_fine, config, iMesh, iRKStep, RunTime_EqSystem, false); - /*--- Set the old solution ---*/ - solver_fine->Set_OldSolution(); + if (iRKStep == 0) { - if (classical_rk4) solver_fine->Set_NewSolution(); - solver_fine->SetTime_Step(geometry_fine, solver_container_fine, config, iMesh, timeIter); - Adjoint_Setup(geometry, solver_container, config_container, RunTime_EqSystem, timeIter, iZone); - } + /*--- Set the old solution ---*/ + solver_fine->Set_OldSolution(); - /*--- Space integration ---*/ - Space_Integration(geometry_fine, solver_container_fine, numerics_fine, config, iMesh, iRKStep, RunTime_EqSystem); + if (classical_rk4) solver_fine->Set_NewSolution(); + solver_fine->SetTime_Step(geometry_fine, solver_container_fine, config, iMesh, timeIter); + Adjoint_Setup(geometry, solver_container, config_container, RunTime_EqSystem, timeIter, iZone); + } + + /*--- Space integration ---*/ + Space_Integration(geometry_fine, solver_container_fine, numerics_fine, config, iMesh, iRKStep, RunTime_EqSystem); + } /*--- Time integration, update solution using the old solution plus the solution increment ---*/ Time_Integration(geometry_fine, solver_container_fine, config, iRKStep, RunTime_EqSystem); + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + if (mgOpts.MG_Smooth_Output) + lastPreLinSol[iMesh].push_back({solver_fine->GetIterLinSolver(), + SU2_TYPE::GetValue(solver_fine->GetResLinSolver())}); + AddWork(config, iMesh, solver_fine->GetIterLinSolver()); + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + /*--- At iRKStep==0 LinSysRes = R(u_k). ---*/ if (iRKStep == 0 && need_initial_rms) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { @@ -819,7 +914,7 @@ void CMultiGridIntegration::PostSmoothing(unsigned short RunTime_EqSystem, ? SU2_TYPE::GetValue(mgOpts.MG_Smooth_StagnationTol) : passivedouble(1.0); /*--- Reset the shared early-exit flag (master only). ---*/ - SU2_OMP_SAFE_GLOBAL_ACCESS(mg_early_exit_flag = false;) + SU2_OMP_SAFE_GLOBAL_ACCESS(mg_early_exit_flag = false; lastPostLinSol[iMesh].clear();) /*--- Do a postsmoothing on the grid iMesh after prolongation from the grid iMesh+1 ---*/ for (unsigned short iPostSmooth = 0; iPostSmooth < nPostSmooth; iPostSmooth++) { @@ -841,6 +936,14 @@ void CMultiGridIntegration::PostSmoothing(unsigned short RunTime_EqSystem, /*--- Time integration, update solution using the old solution plus the solution increment ---*/ Time_Integration(geometry_fine, solver_container_fine, config, iRKStep, RunTime_EqSystem); + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + if (mgOpts.MG_Smooth_Output) + lastPostLinSol[iMesh].push_back({solver_fine->GetIterLinSolver(), + SU2_TYPE::GetValue(solver_fine->GetResLinSolver())}); + AddWork(config, iMesh, solver_fine->GetIterLinSolver()); + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + /*--- At iRKStep==0 LinSysRes = R(u_k) ---*/ if (iRKStep == 0 && need_per_step_rms) { BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { @@ -873,7 +976,8 @@ void CMultiGridIntegration::PostSmoothing(unsigned short RunTime_EqSystem, void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, - CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config) { + CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config, + unsigned short iMesh) { SU2_ZONE_SCOPED const unsigned short nVar = sol_coarse->GetnVar(); @@ -941,17 +1045,327 @@ void CMultiGridIntegration::GetProlongated_Correction(unsigned short RunTime_EqS /*--- Interpolate the coarse-grid correction onto the fine * grid and store in LinSysRes. ---*/ - /*--- Halos too: the correction smoother reads them before its first exchange. ---*/ - SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPoint(), omp_get_num_threads())) - for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPoint(); Point_Coarse++) { + if (!config->GetMGOptions().MG_Linear_Prolongation) { + + /*--- Halos too: the correction smoother reads them before its first exchange. ---*/ + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPoint(), omp_get_num_threads())) + for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPoint(); Point_Coarse++) { + const auto* Correction = sol_coarse->GetNodes()->GetSolution_Old(Point_Coarse); + for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { + const auto Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren); + sol_fine->LinSysRes.SetBlock(Point_Fine, Correction); + } + } + END_SU2_OMP_FOR + + return; + } + + /*--- The coarse coordinate is the volume-weighted centroid of the children, so the + * reconstruction below averages back to the coarse correction exactly. ---*/ + + ComputeProlongationGradient(sol_coarse, geo_coarse, geo_fine, config, iMesh, false); + + const unsigned short nDim = geo_coarse->GetnDim(); + const auto& gradient = prolongGradient[iMesh]; + + /*--- A halo agglomerate holds a partial child list, so only owners write, and the + * exchange below fills the fine halos the correction smoother reads. ---*/ + + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) + for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { + const auto* Correction = sol_coarse->GetNodes()->GetSolution_Old(Point_Coarse); + const auto* Coord_Coarse = geo_coarse->nodes->GetCoord(Point_Coarse); + for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { const auto Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren); - sol_fine->LinSysRes.SetBlock(Point_Fine, Correction); + + su2double Distance[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, geo_fine->nodes->GetCoord(Point_Fine), Coord_Coarse, Distance); + + su2double Solution[MAXNVAR] = {0.0}; + for (auto iVar = 0u; iVar < nVar; iVar++) { + Solution[iVar] = Correction[iVar]; + for (auto iDim = 0u; iDim < nDim; iDim++) + Solution[iVar] += gradient(Point_Coarse, iVar, iDim) * Distance[iDim]; + } + sol_fine->LinSysRes.SetBlock(Point_Fine, Solution); } } END_SU2_OMP_FOR + SU2_OMP_BARRIER + CSysMatrixComms::Initiate(sol_fine->LinSysRes, geo_fine, config); + CSysMatrixComms::Complete(sol_fine->LinSysRes, geo_fine, config); + +} + +/*--- Largest condition number of the stencil directions for which the prolongation gradient is fitted. ---*/ +static constexpr passivedouble PROLONG_MAX_CONDITION = 1e3; + +/*--- Stencil aspect ratio up to which the fitted gradient is used in full, and from which the cell + * keeps the constant operator. In between the gradient fades out with the logarithm of the ratio. ---*/ +static constexpr passivedouble PROLONG_FULL_ASPECT = 10.0; +static constexpr passivedouble PROLONG_MAX_ASPECT = 100.0; + +namespace { +/*--- Condition number of a symmetric 2x2 or 3x3 matrix, infinite if it is not positive definite. ---*/ +passivedouble FitConditionNumber(unsigned short nDim, const su2double A[3][3]) { + constexpr passivedouble big = 1e300; + passivedouble lmin, lmax; + if (nDim == 2) { + const passivedouble a = SU2_TYPE::GetValue(A[0][0]), b = SU2_TYPE::GetValue(A[0][1]), d = SU2_TYPE::GetValue(A[1][1]); + const passivedouble mean = 0.5 * (a + d), radius = sqrt(0.25 * (a - d) * (a - d) + b * b); + lmin = mean - radius; + lmax = mean + radius; + } else { + passivedouble M[3][3]; + for (auto i = 0u; i < 3; ++i) + for (auto j = 0u; j < 3; ++j) M[i][j] = SU2_TYPE::GetValue(A[i][j]); + const passivedouble q = (M[0][0] + M[1][1] + M[2][2]) / 3.0; + const passivedouble p1 = M[0][1] * M[0][1] + M[0][2] * M[0][2] + M[1][2] * M[1][2]; + const passivedouble p2 = pow(M[0][0] - q, 2) + pow(M[1][1] - q, 2) + pow(M[2][2] - q, 2) + 2.0 * p1; + const passivedouble p = sqrt(p2 / 6.0); + if (p <= 0.0) return (q > 0.0) ? 1.0 : big; + passivedouble B[3][3]; + for (auto i = 0u; i < 3; ++i) + for (auto j = 0u; j < 3; ++j) B[i][j] = (M[i][j] - ((i == j) ? q : 0.0)) / p; + const passivedouble detB = B[0][0] * (B[1][1] * B[2][2] - B[1][2] * B[2][1]) - + B[0][1] * (B[1][0] * B[2][2] - B[1][2] * B[2][0]) + + B[0][2] * (B[1][0] * B[2][1] - B[1][1] * B[2][0]); + const passivedouble phi = acos(max(-1.0, min(1.0, 0.5 * detB))) / 3.0; + lmax = q + 2.0 * p * cos(phi); + lmin = q + 2.0 * p * cos(phi + 2.0 * M_PI / 3.0); + } + return (lmin > 0.0) ? lmax / lmin : big; +} + +/*--- Inverse of a symmetric positive definite matrix by Cholesky factorization, which stays accurate + * for the strong anisotropy of a boundary layer stencil. False if a pivot vanishes. ---*/ +bool CholeskyInverse(unsigned short n, const su2double A[3][3], su2double inv[3][3]) { + su2double L[3][3] = {{0.0}}; + for (auto i = 0u; i < n; ++i) { + for (auto j = 0u; j <= i; ++j) { + su2double sum = A[i][j]; + for (auto k = 0u; k < j; ++k) sum -= L[i][k] * L[j][k]; + if (i == j) { + if (sum <= 1e-14 * A[i][i]) return false; + L[i][i] = sqrt(sum); + } else { + L[i][j] = sum / L[j][j]; + } + } + } + for (auto c = 0u; c < n; ++c) { + su2double y[3] = {0.0}, x[3] = {0.0}; + for (auto i = 0u; i < n; ++i) { + su2double sum = (i == c) ? 1.0 : 0.0; + for (auto k = 0u; k < i; ++k) sum -= L[i][k] * y[k]; + y[i] = sum / L[i][i]; + } + for (int i = n - 1; i >= 0; --i) { + su2double sum = y[i]; + for (auto k = i + 1u; k < n; ++k) sum -= L[k][i] * x[k]; + x[i] = sum / L[i][i]; + } + for (auto i = 0u; i < n; ++i) inv[i][c] = x[i]; + } + return true; +} +} // namespace + +void CMultiGridIntegration::ComputeProlongationGradient(CSolver *sol_coarse, CGeometry *geo_coarse, + CGeometry *geo_fine, const CConfig *config, + unsigned short iMesh, bool useSolution) { + SU2_ZONE_SCOPED + + const unsigned short nVar = sol_coarse->GetnVar(); + const unsigned short nDim = geo_coarse->GetnDim(); + const auto nPointDomain = geo_coarse->GetnPointDomain(); + auto* nodes = sol_coarse->GetNodes(); + auto Field = [&](unsigned long iPoint) { + return useSolution ? nodes->GetSolution(iPoint) : nodes->GetSolution_Old(iPoint); + }; + + /*--- The coarse grid does not change, so each level is reported once. ---*/ + auto reportIllConditioned = [&]() { + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS + { + if (!prolongReported[iMesh]) { + prolongReported[iMesh] = true; + unsigned long local[2] = {prolongIllConditioned[iMesh], nPointDomain}, global[2] = {0, 0}; + SU2_MPI::Allreduce(local, global, 2, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + if ((global[0] > 0) && (SU2_MPI::GetRank() == MASTER_NODE)) + cout << "MG level " << iMesh << ": linear prolongation keeps the constant operator in " << global[0] + << " of " << global[1] << " coarse cells (stencil direction condition number above " + << PROLONG_MAX_CONDITION << " or aspect ratio above " << PROLONG_MAX_ASPECT << ")." << endl; + } + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + }; + + /*--- All threads of this rank take this branch together; the sizing test below needs a sized container. ---*/ + if (nPointDomain == 0) { + reportIllConditioned(); + return; + } + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS + { prolongIllConditioned[iMesh] = 0; } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS + { + auto& grad = prolongGradient[iMesh]; + if ((grad.length() != nPointDomain) || (grad.rows() != nVar) || (grad.cols() != nDim)) + grad.resize(nPointDomain, nVar, nDim, 0.0); + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + + auto& gradient = prolongGradient[iMesh]; + + /*--- Inverse-distance-squared weights give every neighbour's directional difference the same + * weight, so the fit does not depend on how far apart the neighbours are. ---*/ + + SU2_OMP_FOR_STAT(roundUpDiv(nPointDomain, omp_get_num_threads())) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + + for (auto iVar = 0u; iVar < nVar; iVar++) + for (auto iDim = 0u; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) = 0.0; + + const auto* Coord_i = geo_coarse->nodes->GetCoord(iPoint); + const auto* Correction_i = Field(iPoint); + + /*--- The extent matrix measures the stencil's stretching, the fit matrix is the weighted normal matrix. ---*/ + su2double extentMat[MAXNDIM][MAXNDIM] = {{0.0}}, fitMat[MAXNDIM][MAXNDIM] = {{0.0}}; + su2double rhs[MAXNVAR][MAXNDIM] = {{0.0}}; + + for (auto jPoint : geo_coarse->nodes->GetPoints(iPoint)) { + + su2double Distance[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, geo_coarse->nodes->GetCoord(jPoint), Coord_i, Distance); + const su2double dist2 = GeometryToolbox::SquaredNorm(nDim, Distance); + if (dist2 <= 0.0) continue; + + for (auto iDim = 0u; iDim < nDim; iDim++) + for (auto jDim = 0u; jDim < nDim; jDim++) { + extentMat[iDim][jDim] += Distance[iDim]*Distance[jDim]; + fitMat[iDim][jDim] += Distance[iDim]*Distance[jDim]/dist2; + } + + const auto* Correction_j = Field(jPoint); + + for (auto iVar = 0u; iVar < nVar; iVar++) { + const su2double delta = Correction_j[iVar] - Correction_i[iVar]; + for (auto iDim = 0u; iDim < nDim; iDim++) rhs[iVar][iDim] += Distance[iDim]*delta/dist2; + } + } + + /*--- Neighbours that do not span every direction leave a slope undefined. A stencil much longer in + * one direction than another, from cell stretching, weakens the gradient or removes it. In both + * cases the cell falls back to the constant operator. ---*/ + su2double fitInv[MAXNDIM][MAXNDIM] = {{0.0}}; + const passivedouble aspect = sqrt(FitConditionNumber(nDim, extentMat)); + const passivedouble weight = + (aspect <= PROLONG_FULL_ASPECT) + ? 1.0 + : max(0.0, log(PROLONG_MAX_ASPECT / aspect) / log(PROLONG_MAX_ASPECT / PROLONG_FULL_ASPECT)); + if ((FitConditionNumber(nDim, fitMat) > PROLONG_MAX_CONDITION) || (weight <= 0.0) || + !CholeskyInverse(nDim, fitMat, fitInv)) { + SU2_OMP_ATOMIC + prolongIllConditioned[iMesh]++; + continue; + } + + for (auto iVar = 0u; iVar < nVar; iVar++) + for (auto iDim = 0u; iDim < nDim; iDim++) { + su2double value = 0.0; + for (auto jDim = 0u; jDim < nDim; jDim++) value += fitInv[iDim][jDim]*rhs[iVar][jDim]; + gradient(iPoint, iVar, iDim) = weight * value; + } + } + END_SU2_OMP_FOR + + /*--- The children of a wall agglomerate are all wall nodes, so their velocity correction is + * the constrained one the caller already imposed and only its gradient has to go. The + * remaining variables carry no wall condition and reconstruct along the surface. ---*/ + + const short iVel = nodes->GetVelocityIndex(); + + if (iVel >= 0) { + for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { + + const auto kindBC = config->GetMarker_All_KindBC(iMarker); + if (!config->GetViscous_Wall(iMarker) && (kindBC != EULER_WALL) && (kindBC != SYMMETRY_PLANE)) continue; + + SU2_OMP_FOR_STAT(32) + for (auto iVertex = 0ul; iVertex < geo_coarse->nVertex[iMarker]; iVertex++) { + const auto iPoint = geo_coarse->vertex[iMarker][iVertex]->GetNode(); + if (iPoint >= nPointDomain) continue; + for (auto iVar = iVel; iVar < min(iVel + nDim, nVar); iVar++) + for (auto iDim = 0u; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) = 0.0; + } + END_SU2_OMP_FOR + } + } + + /*--- Barth-Jespersen limiter over the children. One factor per variable scales the whole + * gradient, which is what keeps the children averaging back to the coarse value. ---*/ + + SU2_OMP_FOR_STAT(roundUpDiv(nPointDomain, omp_get_num_threads())) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + + const auto* Coord_i = geo_coarse->nodes->GetCoord(iPoint); + const auto* Correction_i = Field(iPoint); + + su2double Correction_Min[MAXNVAR], Correction_Max[MAXNVAR]; + for (auto iVar = 0u; iVar < nVar; iVar++) { + Correction_Min[iVar] = Correction_i[iVar]; + Correction_Max[iVar] = Correction_i[iVar]; + } + + for (auto jPoint : geo_coarse->nodes->GetPoints(iPoint)) { + const auto* Correction_j = Field(jPoint); + for (auto iVar = 0u; iVar < nVar; iVar++) { + Correction_Min[iVar] = min(Correction_Min[iVar], Correction_j[iVar]); + Correction_Max[iVar] = max(Correction_Max[iVar], Correction_j[iVar]); + } + } + + su2double limiter[MAXNVAR]; + for (auto iVar = 0u; iVar < nVar; iVar++) limiter[iVar] = 1.0; + + for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(iPoint); iChildren++) { + + const auto Point_Fine = geo_coarse->nodes->GetChildren_CV(iPoint, iChildren); + + su2double Distance[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, geo_fine->nodes->GetCoord(Point_Fine), Coord_i, Distance); + + for (auto iVar = 0u; iVar < nVar; iVar++) { + + su2double delta = 0.0; + for (auto iDim = 0u; iDim < nDim; iDim++) delta += gradient(iPoint, iVar, iDim)*Distance[iDim]; + + /*--- Scaled with the correction so the cut-off tracks its magnitude. ---*/ + const su2double tol = EPS*max(fabs(Correction_Max[iVar]), fabs(Correction_Min[iVar])) + EPS*EPS; + + if (delta > tol) + limiter[iVar] = min(limiter[iVar], (Correction_Max[iVar] - Correction_i[iVar])/delta); + else if (delta < -tol) + limiter[iVar] = min(limiter[iVar], (Correction_Min[iVar] - Correction_i[iVar])/delta); + } + } + + for (auto iVar = 0u; iVar < nVar; iVar++) { + const su2double factor = max(su2double(0.0), min(su2double(1.0), limiter[iVar])); + for (auto iDim = 0u; iDim < nDim; iDim++) gradient(iPoint, iVar, iDim) *= factor; + } + } + END_SU2_OMP_FOR + + reportIllConditioned(); } void CMultiGridIntegration::SmoothProlongated_Correction(unsigned short RunTime_EqSystem, CSolver *solver, CGeometry *geometry, @@ -964,6 +1378,11 @@ void CMultiGridIntegration::SmoothProlongated_Correction(unsigned short RunTime_ const unsigned short nVar = solver->GetnVar(); + if (config->GetMGOptions().MG_Smooth_Output) { + const su2double res = sqrt(solver->LinSysRes.squaredNorm() / (nVar * geometry->GetGlobal_nPointDomain())); + SU2_OMP_SAFE_GLOBAL_ACCESS(lastCorrecSmoothRMS[iMesh][0] = SU2_TYPE::GetValue(res);) + } + SU2_OMP_FOR_STAT(roundUpDiv(geometry->GetnPoint(), omp_get_num_threads())) for (auto iPoint = 0ul; iPoint < geometry->GetnPoint(); iPoint++) { const auto* Residual_Old = solver->LinSysRes.GetBlock(iPoint); @@ -1041,7 +1460,79 @@ void CMultiGridIntegration::SmoothProlongated_Correction(unsigned short RunTime_ } } -void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeometry *geo_fine, +void CMultiGridIntegration::ComputeCorrectionWeights(CGeometry** geometry, const CEulerVariable* flowNodes, + const CConfig* config) { + /*--- Coarse CVs over which the correction fades in from a wall end. ---*/ + constexpr unsigned long nBlend = 4; + const auto nLevels = config->GetnMGLevels(); + + const unsigned long version = flowNodes ? flowNodes->WallEndFlagsVersion : 0; + + if (!flowNodes || !config->GetMUSCL_FirstOrderWallEnds()) { + SU2_OMP_SAFE_GLOBAL_ACCESS(correctionWeightVersion = version;) + return; + } + + /*--- Points of each level holding a wall end, passed down from the finest grid. ---*/ + vector wallEnd; + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + correctionWeight.assign(nLevels, {}); + wallEnd.assign(geometry[MESH_0]->GetnPoint(), 0); + for (auto iPoint = 0ul; iPoint < geometry[MESH_0]->GetnPointDomain(); iPoint++) + wallEnd[iPoint] = flowNodes->SkipMGCorrection(iPoint); + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + + auto hopsOf = [&](unsigned long iPoint) { return static_cast(SU2_TYPE::Int(correctionHops(iPoint, 0))); }; + + /*--- The distance grows one layer per pass on every rank, and each pass hands the halos their + * owner's value, so a front crosses partition interfaces as if there were none. ---*/ + + for (unsigned short iMesh = 0; iMesh < nLevels; iMesh++) { + auto* coarse = geometry[iMesh + 1]; + const auto nDomain = coarse->GetnPointDomain(); + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + correctionHops.Initialize(coarse->GetnPoint(), nDomain, 1, su2double(nBlend)); + for (auto iCoarse = 0ul; iCoarse < nDomain; iCoarse++) + for (auto iChild = 0u; iChild < coarse->nodes->GetnChildren_CV(iCoarse); iChild++) + if (wallEnd[coarse->nodes->GetChildren_CV(iCoarse, iChild)]) correctionHops(iCoarse, 0) = 0.0; + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + + for (unsigned long d = 0; d < nBlend; d++) { + if (d > 0) { + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + for (auto iCoarse = 0ul; iCoarse < nDomain; iCoarse++) { + if (hopsOf(iCoarse) < d) continue; + for (auto jCoarse : coarse->nodes->GetPoints(iCoarse)) + if (hopsOf(jCoarse) + 1 == d) correctionHops(iCoarse, 0) = d; + } + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + } + CSysMatrixComms::Initiate(correctionHops, coarse, config); + CSysMatrixComms::Complete(correctionHops, coarse, config); + } + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + auto& weight = correctionWeight[iMesh]; + weight.assign(geometry[iMesh]->GetnPoint(), 1.0); + for (auto iCoarse = 0ul; iCoarse < nDomain; iCoarse++) { + const auto w = SU2_TYPE::GetValue(correctionHops(iCoarse, 0)) / nBlend; + for (auto iChild = 0u; iChild < coarse->nodes->GetnChildren_CV(iCoarse); iChild++) + weight[coarse->nodes->GetChildren_CV(iCoarse, iChild)] = w; + } + wallEnd.assign(coarse->GetnPoint(), 0); + for (auto iCoarse = 0ul; iCoarse < coarse->GetnPoint(); iCoarse++) wallEnd[iCoarse] = (hopsOf(iCoarse) == 0); + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + } + + SU2_OMP_SAFE_GLOBAL_ACCESS(correctionWeightVersion = version;) +} + +void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CSolver *sol_flow, CGeometry *geo_fine, CConfig *config, unsigned short iMesh) { SU2_ZONE_SCOPED @@ -1049,20 +1540,23 @@ void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeomet /*--- Use the adaptive damping factor uniformly across all prolongation levels. ---*/ const su2double factor = config->GetDamp_Correc_Prolong(); + const auto* flowNodes = sol_flow ? dynamic_cast(sol_flow->GetNodes()) : nullptr; + const bool skipHere = flowNodes && (sol_fine == sol_flow); SU2_OMP_FOR_STAT(roundUpDiv(geo_fine->GetnPointDomain(), omp_get_num_threads())) for (auto Point_Fine = 0ul; Point_Fine < geo_fine->GetnPointDomain(); Point_Fine++) { + if (skipHere && flowNodes->SkipMGCorrection(Point_Fine)) continue; auto* Residual_Fine = sol_fine->LinSysRes.GetBlock(Point_Fine); auto* Solution_Fine = sol_fine->GetNodes()->GetSolution(Point_Fine); - for (auto iVar = 0u; iVar < nVar; iVar++) { - /*--- Prevent a fine grid divergence due to a coarse grid divergence ---*/ - if (Residual_Fine[iVar] != Residual_Fine[iVar]) - Residual_Fine[iVar] = 0.0; - su2double correction = factor * Residual_Fine[iVar]; + /*--- Prevent a fine grid divergence due to a coarse grid divergence ---*/ + for (auto iVar = 0u; iVar < nVar; iVar++) + if (std::isnan(SU2_TYPE::GetValue(Residual_Fine[iVar]))) Residual_Fine[iVar] = 0.0; - Solution_Fine[iVar] += correction; - } + su2double relax = factor; + if ((iMesh < correctionWeight.size()) && !correctionWeight[iMesh].empty()) relax *= correctionWeight[iMesh][Point_Fine]; + + for (auto iVar = 0u; iVar < nVar; iVar++) Solution_Fine[iVar] += relax * Residual_Fine[iVar]; } END_SU2_OMP_FOR @@ -1073,24 +1567,55 @@ void CMultiGridIntegration::SetProlongated_Correction(CSolver *sol_fine, CGeomet } -void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, - CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config) { +void CMultiGridIntegration::InterpolateSolutionToChildren(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, + CGeometry *geo_coarse, CConfig *config, + unsigned short iMesh) { SU2_ZONE_SCOPED - const unsigned short Solver_Position = config->GetContainerPosition(RunTime_EqSystem); - const bool grid_movement = config->GetGrid_Movement(); + const unsigned short nVar = sol_coarse->GetnVar(); + const unsigned short nDim = geo_coarse->GetnDim(); + const bool linear = config->GetMGOptions().MG_Linear_Prolongation; - /*--- Constant injection: every fine child of a coarse CV takes its parent's value. ---*/ + if (linear) ComputeProlongationGradient(sol_coarse, geo_coarse, geo_fine, config, iMesh, true); SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { const auto* Solution_Coarse = sol_coarse->GetNodes()->GetSolution(Point_Coarse); + const auto* Coord_Coarse = geo_coarse->nodes->GetCoord(Point_Coarse); + for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { const auto Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren); - sol_fine->GetNodes()->SetSolution(Point_Fine, Solution_Coarse); + + if (!linear) { + sol_fine->GetNodes()->SetSolution(Point_Fine, Solution_Coarse); + continue; + } + + su2double Distance[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, geo_fine->nodes->GetCoord(Point_Fine), Coord_Coarse, Distance); + + for (auto iVar = 0u; iVar < nVar; iVar++) { + su2double value = Solution_Coarse[iVar]; + for (auto iDim = 0u; iDim < nDim; iDim++) + value += prolongGradient[iMesh](Point_Coarse, iVar, iDim) * Distance[iDim]; + sol_fine->GetNodes()->SetSolution(Point_Fine, iVar, value); + } } } END_SU2_OMP_FOR +} + +void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSystem, CSolver *sol_fine, CSolver *sol_coarse, + CGeometry *geo_fine, CGeometry *geo_coarse, CConfig *config, + unsigned short iMesh) { + SU2_ZONE_SCOPED + + const unsigned short Solver_Position = config->GetContainerPosition(RunTime_EqSystem); + const bool grid_movement = config->GetGrid_Movement(); + + /*--- Constant injection, or the limited linear reconstruction when MG_Linear_Prolongation is set. ---*/ + + InterpolateSolutionToChildren(sol_fine, sol_coarse, geo_fine, geo_coarse, config, iMesh); /*--- The injected values do not satisfy the fine-grid wall conditions on their own. ---*/ @@ -1140,26 +1665,28 @@ void CMultiGridIntegration::SetProlongated_Solution(unsigned short RunTime_EqSys void CMultiGridIntegration::SetProlongated_ScalarSolution(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, CGeometry *geo_coarse, - CConfig *config, bool eddy_viscosity) { + CConfig *config, bool eddy_viscosity, + unsigned short iMesh) { SU2_ZONE_SCOPED - /*--- Constant injection: every fine child of a coarse CV takes its parent's value. ---*/ + /*--- Constant injection, or the limited linear reconstruction when MG_Linear_Prolongation is set. ---*/ - SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) - for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { + InterpolateSolutionToChildren(sol_fine, sol_coarse, geo_fine, geo_coarse, config, iMesh); - const auto* Solution_Coarse = sol_coarse->GetNodes()->GetSolution(Point_Coarse); - const su2double muT_Coarse = eddy_viscosity ? sol_coarse->GetNodes()->GetmuT(Point_Coarse) : su2double(0.0); + /*--- The eddy viscosity is injected as a constant. ---*/ - for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) { - const auto Point_Fine = geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren); - sol_fine->GetNodes()->SetSolution(Point_Fine, Solution_Coarse); - if (eddy_viscosity) sol_fine->GetNodes()->SetmuT(Point_Fine, muT_Coarse); + if (eddy_viscosity) { + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) + for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { + const su2double muT_Coarse = sol_coarse->GetNodes()->GetmuT(Point_Coarse); + for (auto iChildren = 0u; iChildren < geo_coarse->nodes->GetnChildren_CV(Point_Coarse); iChildren++) + sol_fine->GetNodes()->SetmuT(geo_coarse->nodes->GetChildren_CV(Point_Coarse, iChildren), muT_Coarse); } + END_SU2_OMP_FOR } - END_SU2_OMP_FOR - /*--- The eddy viscosity is zero on a no-slip wall, the injected value is not. ---*/ + /*--- On a no-slip wall the eddy viscosity is zero, and the turbulence variables take the value + * of their wall parent, which holds the wall condition instead of an extrapolation. ---*/ if (eddy_viscosity) { for (auto iMarker = 0u; iMarker < config->GetnMarker_All(); iMarker++) { @@ -1168,6 +1695,8 @@ void CMultiGridIntegration::SetProlongated_ScalarSolution(CSolver *sol_fine, CSo SU2_OMP_FOR_STAT(32) for (auto iVertex = 0ul; iVertex < geo_fine->nVertex[iMarker]; iVertex++) { const auto Point_Fine = geo_fine->vertex[iMarker][iVertex]->GetNode(); + const auto Point_Coarse = geo_fine->nodes->GetParent_CV(Point_Fine); + sol_fine->GetNodes()->SetSolution(Point_Fine, sol_coarse->GetNodes()->GetSolution(Point_Coarse)); sol_fine->GetNodes()->SetmuT(Point_Fine, 0.0); } END_SU2_OMP_FOR @@ -1182,8 +1711,8 @@ void CMultiGridIntegration::SetProlongated_ScalarSolution(CSolver *sol_fine, CSo } -void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_fine, - CGeometry *geo_coarse, CConfig *config, unsigned short iMesh) { +void CMultiGridIntegration::SetRestricted_Residual(CSolver *sol_fine, CSolver *sol_coarse, CGeometry *geo_coarse, + CConfig *config) { SU2_ZONE_SCOPED const unsigned short nVar = sol_coarse->GetnVar(); @@ -1221,6 +1750,11 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar } } +} + +void CMultiGridIntegration::SetForcing_Term(CSolver *sol_coarse, CGeometry *geo_coarse) { + SU2_ZONE_SCOPED + SU2_OMP_FOR_STAT(roundUpDiv(geo_coarse->GetnPointDomain(), omp_get_num_threads())) for (auto Point_Coarse = 0ul; Point_Coarse < geo_coarse->GetnPointDomain(); Point_Coarse++) { sol_coarse->GetNodes()->SubtractRes_TruncError(Point_Coarse, sol_coarse->LinSysRes.GetBlock(Point_Coarse)); diff --git a/SU2_CFD/src/integration/CSingleGridIntegration.cpp b/SU2_CFD/src/integration/CSingleGridIntegration.cpp index 5862672185f2..8eab206889ba 100644 --- a/SU2_CFD/src/integration/CSingleGridIntegration.cpp +++ b/SU2_CFD/src/integration/CSingleGridIntegration.cpp @@ -87,6 +87,14 @@ void CSingleGridIntegration::SingleGrid_Iteration(CGeometry ****geometry, CSolve Time_Integration(geometry_fine, solvers_fine, config[iZone], NO_RK_ITER, RunTime_EqSystem); + /*--- Coarse-level residuals are per-rank sums of squares unless reduced, which the smoothing + * early exit already does. ---*/ + + if ((FinestMesh != MESH_0) && !config[iZone]->GetMGOptions().MG_Smooth_EarlyExit && + !config[iZone]->GetMGOptions().MG_Smooth_Output) { + solvers_fine[Solver_Position]->SetResidual_RMS(geometry_fine, config[iZone], true); + } + /*--- Postprocessing ---*/ solvers_fine[Solver_Position]->Postprocessing(geometry_fine, solvers_fine, config[iZone], FinestMesh); diff --git a/SU2_CFD/src/iteration/CFluidIteration.cpp b/SU2_CFD/src/iteration/CFluidIteration.cpp index 294dd5cac444..283f0174d57e 100644 --- a/SU2_CFD/src/iteration/CFluidIteration.cpp +++ b/SU2_CFD/src/iteration/CFluidIteration.cpp @@ -133,8 +133,9 @@ void CFluidIteration::CommonAuxiliarySolvers(CIntegration**** integration, CGeom /*--- Solve the turbulence model ---*/ config[val_iZone]->SetGlobalParam(main_solver, RUNTIME_TURB_SYS); - integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, - RUNTIME_TURB_SYS, val_iZone, val_iInst); + for (auto iSub = 0u; iSub < config[val_iZone]->GetTurb_SubIter(); iSub++) + integration[val_iZone][val_iInst][TURB_SOL]->SingleGrid_Iteration(geometry, solver, numerics, config, + RUNTIME_TURB_SYS, val_iZone, val_iInst); } if (config[val_iZone]->GetKind_Species_Model() != SPECIES_MODEL::NONE) { diff --git a/SU2_CFD/src/iteration/CIteration.cpp b/SU2_CFD/src/iteration/CIteration.cpp index f4c4cec104f1..ae52f81a4ae8 100644 --- a/SU2_CFD/src/iteration/CIteration.cpp +++ b/SU2_CFD/src/iteration/CIteration.cpp @@ -203,6 +203,8 @@ void CIteration::SetMesh_Deformation(CGeometry** geometry, CSolver** solver, CNu solver[MESH_SOL]->DeformMesh(geometry, numerics[MESH_SOL], config); + if (solver[FLOW_SOL] != nullptr) solver[FLOW_SOL]->SetWallEndFlags(geometry[MESH_0], config); + /*--- Continue recording. ---*/ AD::EndPassive(wasActive); } diff --git a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp index d4c3dd226944..caf4ba2ff08e 100644 --- a/SU2_CFD/src/numerics/flow/flow_diffusion.cpp +++ b/SU2_CFD/src/numerics/flow/flow_diffusion.cpp @@ -501,7 +501,7 @@ CNumerics::ResidualType<> CAvgGrad_Flow::ComputeResidual(const CConfig* config) } } } else { - const su2double dist_ij = sqrt(dist_ij_2); + const su2double dist_ij = JacobianDistance(dist_ij_2, Edge_Vector, UnitNormal); SetTauJacobian(Mean_PrimVar, Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, dist_ij, UnitNormal); SetHeatFluxJacobian(Mean_PrimVar, Mean_Cp, Mean_Thermal_Conductivity, Mean_Eddy_Viscosity, dist_ij, UnitNormal); @@ -1019,7 +1019,7 @@ CNumerics::ResidualType<> CGeneralAvgGrad_Flow::ComputeResidual(const CConfig* c } } } else { - const su2double dist_ij = sqrt(dist_ij_2); + const su2double dist_ij = JacobianDistance(dist_ij_2, Edge_Vector, UnitNormal); SetTauJacobian(Mean_PrimVar, Mean_Laminar_Viscosity, Mean_Eddy_Viscosity, dist_ij, UnitNormal); diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index d4abbe3721a3..e909ed5ca35c 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -326,6 +326,16 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, nodes->NonPhysicalEdgeCounter.resize(geometry->GetnEdge()) = 0; } + if ((iMesh == MESH_0) && config->GetMUSCL_Flow() && config->GetMUSCL_FirstOrderWallEnds()) { + SetWallEndFlags(geometry, config); + + unsigned long nFlagged = 0, nFlaggedGlobal = 0; + for (iPoint = 0; iPoint < nPointDomain; iPoint++) nFlagged += nodes->FirstOrderReconstruction(iPoint); + SU2_MPI::Allreduce(&nFlagged, &nFlaggedGlobal, 1, MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm()); + if (rank == MASTER_NODE) + cout << "First-order reconstruction at " << nFlaggedGlobal << " points where a no-slip wall ends or has a sharp edge." << endl; + } + /*--- Check that the initial solution is physical, report any non-physical nodes ---*/ counter_local = 0; @@ -389,6 +399,101 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, SU2_MPI::Error("Oops! The CEulerSolver static array sizes are not large enough.",CURRENT_FUNCTION); } +void CEulerSolver::SetWallEndFlags(CGeometry* geometry, const CConfig* config) { + if (!config->GetMUSCL_Flow() || !config->GetMUSCL_FirstOrderWallEnds()) return; + + /*--- The gradient is singular where a no-slip wall meets another kind of boundary. Unlimited + * reconstruction across it gives a defect the first-order multigrid levels cannot correct. ---*/ + + BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { + /*--- Only where the other boundary continues the wall surface does the condition jump along a + * smooth surface. Where they meet at an angle, as at a wing root on a symmetry plane, the + * flow is smooth. Halfway between parallel and perpendicular separates the two. ---*/ + const su2double minAlignment = sqrt(0.5); + + auto unitNormal = [&](unsigned short iMarker, long iVertex, su2double* normal) { + geometry->vertex[iMarker][iVertex]->GetNormal(normal); + const su2double area = GeometryToolbox::Norm(nDim, normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) normal[iDim] /= max(area, EPS); + }; + + /*--- A sharp edge of the wall itself, such as a trailing edge, is singular as well. Its vertex + * normal is much shorter than the area of the faces around it, cos(half the angle between + * their normals); the same halfway threshold applies. ---*/ + vector wallArea(nPoint, 0.0); + for (unsigned short iWall = 0; iWall < config->GetnMarker_All(); iWall++) { + if (!config->GetViscous_Wall(iWall)) continue; + for (unsigned long iElem = 0; iElem < geometry->GetnElem_Bound(iWall); iElem++) { + const auto* elem = geometry->bound[iWall][iElem]; + const auto nNodes = elem->GetnNodes(); + su2double area = 0.0; + if (nDim == 2) { + su2double edge[MAXNDIM] = {0.0}; + GeometryToolbox::Distance(nDim, geometry->nodes->GetCoord(elem->GetNode(1)), + geometry->nodes->GetCoord(elem->GetNode(0)), edge); + area = GeometryToolbox::Norm(nDim, edge); + } else { + for (unsigned short iNode = 1; iNode + 1 < nNodes; iNode++) { + su2double a[3] = {0.0}, b[3] = {0.0}, c[3] = {0.0}; + GeometryToolbox::Distance(3, geometry->nodes->GetCoord(elem->GetNode(iNode)), + geometry->nodes->GetCoord(elem->GetNode(0)), a); + GeometryToolbox::Distance(3, geometry->nodes->GetCoord(elem->GetNode(iNode + 1)), + geometry->nodes->GetCoord(elem->GetNode(0)), b); + GeometryToolbox::CrossProduct(a, b, c); + area += 0.5 * GeometryToolbox::Norm(3, c); + } + } + for (unsigned short iNode = 0; iNode < nNodes; iNode++) wallArea[elem->GetNode(iNode)] += area / nNodes; + } + } + const su2double minFlatness = cos(PI_NUMBER / 8); + + for (auto iPoint = 0ul; iPoint < nPoint; iPoint++) { + bool wallEnds = false; + for (unsigned short iWall = 0; iWall < config->GetnMarker_All(); iWall++) { + const auto wallVertex = geometry->nodes->GetVertex(iPoint, iWall); + if (!config->GetViscous_Wall(iWall) || (wallVertex < 0)) continue; + + const su2double vertexArea = GeometryToolbox::Norm(nDim, geometry->vertex[iWall][wallVertex]->GetNormal()); + if (vertexArea < minFlatness * wallArea[iPoint]) wallEnds = true; + + su2double wallNormal[MAXNDIM] = {0.0}; + unitNormal(iWall, wallVertex, wallNormal); + + for (unsigned short jMarker = 0; jMarker < config->GetnMarker_All(); jMarker++) { + const auto kindBC = config->GetMarker_All_KindBC(jMarker); + if (config->GetViscous_Wall(jMarker) || (kindBC == SEND_RECEIVE) || (kindBC == PERIODIC_BOUNDARY) || + (kindBC == INTERNAL_BOUNDARY) || (kindBC == NEARFIELD_BOUNDARY) || (kindBC == FLUID_INTERFACE)) continue; + const auto iVertex = geometry->nodes->GetVertex(iPoint, jMarker); + if (iVertex < 0) continue; + su2double normal[MAXNDIM] = {0.0}; + unitNormal(jMarker, iVertex, normal); + if (fabs(GeometryToolbox::DotProduct(nDim, wallNormal, normal)) > minAlignment) wallEnds = true; + } + } + nodes->FirstOrderReconstruction(iPoint) = wallEnds; + } + } + END_SU2_OMP_SAFE_GLOBAL_ACCESS + + /*--- A halo may lack one of the markers its owner has, so it takes the owner's flag. ---*/ + InitiateComms(geometry, config, MPI_QUANTITIES::FIRST_ORDER_RECONSTRUCTION); + CompleteComms(geometry, config, MPI_QUANTITIES::FIRST_ORDER_RECONSTRUCTION); + + /*--- The coarse grid cannot represent the singular flow there, its correction is not prolongated to + * those points and their neighbours. ---*/ + SU2_OMP_FOR_STAT(omp_chunk_size) + for (auto iPoint = 0ul; iPoint < nPointDomain; iPoint++) { + bool skip = nodes->FirstOrderReconstruction(iPoint); + for (auto iNeigh = 0u; !skip && (iNeigh < geometry->nodes->GetnPoint(iPoint)); iNeigh++) + skip = nodes->FirstOrderReconstruction(geometry->nodes->GetPoint(iPoint, iNeigh)); + nodes->SkipMGCorrection(iPoint) = skip; + } + END_SU2_OMP_FOR + + SU2_OMP_SAFE_GLOBAL_ACCESS(++nodes->WallEndFlagsVersion;) +} + CEulerSolver::~CEulerSolver() { for(auto& model : FluidModel) delete model; } @@ -1887,7 +1992,7 @@ void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_contain /*--- Set them with or without high order reconstruction using MUSCL strategy. ---*/ - if (!muscl) { + if (!muscl || nodes->FirstOrderReconstruction(iPoint) || nodes->FirstOrderReconstruction(jPoint)) { numerics->SetPrimitive(V_i, V_j); numerics->SetSecondary(S_i, S_j); diff --git a/SU2_CFD/src/solvers/CNSSolver.cpp b/SU2_CFD/src/solvers/CNSSolver.cpp index f7fa0f6af908..ef3dcc33efb3 100644 --- a/SU2_CFD/src/solvers/CNSSolver.cpp +++ b/SU2_CFD/src/solvers/CNSSolver.cpp @@ -99,9 +99,18 @@ void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, C } } - /*--- Compute gradient of the primitive variables ---*/ - - if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { + /*--- Compute gradient of the primitive variables. Coarse levels take the viscous flux from the edge + * difference only, as their Jacobian does, except for the output call that feeds the turbulence + * model on the active level of the full-multigrid startup. ---*/ + + if ((iMesh != MESH_0) && !Output) { + SU2_OMP_FOR_STAT(omp_chunk_size) + for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++) + for (unsigned short iVar = 0; iVar < nPrimVarGrad; iVar++) + for (unsigned short iDim = 0; iDim < nDim; iDim++) nodes->GetGradient_Primitive()(iPoint, iVar, iDim) = 0.0; + END_SU2_OMP_FOR + } + else if (config->GetKind_Gradient_Method() == GREEN_GAUSS) { SetPrimitive_Gradient_GG(geometry, config); } else if (config->GetKind_Gradient_Method() == WEIGHTED_LEAST_SQUARES) { diff --git a/SU2_CFD/src/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp index bb9cf9bfe076..a6eac78943e1 100644 --- a/SU2_CFD/src/solvers/CSolver.cpp +++ b/SU2_CFD/src/solvers/CSolver.cpp @@ -1597,6 +1597,7 @@ void CSolver::GetCommCountAndType(const CConfig* config, break; case MPI_QUANTITIES::MAX_EIGENVALUE: case MPI_QUANTITIES::SENSOR: + case MPI_QUANTITIES::FIRST_ORDER_RECONSTRUCTION: COUNT_PER_POINT = 1; MPI_TYPE = COMM_TYPE::DOUBLE; break; @@ -1802,6 +1803,9 @@ void CSolver::InitiateComms(CGeometry *geometry, case MPI_QUANTITIES::SENSOR: bufDSend[buf_offset] = base_nodes->GetSensor(iPoint); break; + case MPI_QUANTITIES::FIRST_ORDER_RECONSTRUCTION: + bufDSend[buf_offset] = base_nodes->GetFirstOrderReconstruction(iPoint); + break; case MPI_QUANTITIES::SENSOR_ADAPT: for (iVar = 0; iVar < GetnAdaptiveMetricSensor(); iVar++) bufDSend[buf_offset+iVar] = base_nodes->GetSensor_Adapt(iPoint, iVar); @@ -1981,6 +1985,9 @@ void CSolver::CompleteComms(CGeometry *geometry, case MPI_QUANTITIES::SENSOR: base_nodes->SetSensor(iPoint,bufDRecv[buf_offset]); break; + case MPI_QUANTITIES::FIRST_ORDER_RECONSTRUCTION: + base_nodes->SetFirstOrderReconstruction(iPoint, SU2_TYPE::GetValue(bufDRecv[buf_offset]) > 0.5); + break; case MPI_QUANTITIES::SENSOR_ADAPT: for (iVar = 0; iVar < GetnAdaptiveMetricSensor(); iVar++) base_nodes->SetSensor_Adapt(iPoint, iVar, bufDRecv[buf_offset+iVar]); @@ -2100,7 +2107,7 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry, if (iMesh == MESH_0) { MGFactor[iMesh] = 1.0; } else { - const su2double CFLRatio = config->GetCFL(iMesh)/config->GetCFL(iMesh-1); + const su2double CFLRatio = max(su2double(1e-6), min(su2double(1.0), config->GetMGOptions().MG_CflScaling[iMesh-1])); MGFactor[iMesh] = MGFactor[iMesh-1]*CFLRatio; } @@ -2247,12 +2254,12 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry, CFLFactor = CFLFactorIncrease; } - /* Check if we are hitting the min or max and adjust. */ + /* Check if we are hitting the min or max and adjust, the limits scale with the level. */ - if (CFL*CFLFactor <= CFLMin) { + if (CFL*CFLFactor <= CFLMin*MGFactor[iMesh]) { CFL = CFLMin; CFLFactor = MGFactor[iMesh]; - } else if (CFL*CFLFactor >= CFLMax) { + } else if (CFL*CFLFactor >= CFLMax*MGFactor[iMesh]) { CFL = CFLMax; CFLFactor = MGFactor[iMesh]; } @@ -2312,9 +2319,10 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry, void CSolver::SetResidual_RMS(const CGeometry *geometry, const CConfig *config, bool force) { SU2_ZONE_SCOPED - /*--- On coarse levels the reduction is skipped for performance, unless MG_Smooth_EarlyExit - * needs it or the caller asks for it. ---*/ - if (!force && geometry->GetMGLevel() != MESH_0 && !config->GetMGOptions().MG_Smooth_EarlyExit) return; + /*--- On coarse levels the reduction is skipped for performance, unless MG_Smooth_EarlyExit or + * MG_Smooth_Output needs it, or the caller asks for it. ---*/ + if (!force && geometry->GetMGLevel() != MESH_0 && !config->GetMGOptions().MG_Smooth_EarlyExit && + !config->GetMGOptions().MG_Smooth_Output) return; BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { diff --git a/SU2_CFD/src/variables/CEulerVariable.cpp b/SU2_CFD/src/variables/CEulerVariable.cpp index b78fe46b439e..fcab3569d891 100644 --- a/SU2_CFD/src/variables/CEulerVariable.cpp +++ b/SU2_CFD/src/variables/CEulerVariable.cpp @@ -113,6 +113,8 @@ CEulerVariable::CEulerVariable(su2double density, const su2double *velocity, su2 } OutlierMitigation.resize(nPoint) = 0; + FirstOrderReconstruction.resize(nPoint) = 0; + SkipMGCorrection.resize(nPoint) = 0; } bool CEulerVariable::SetPrimVar(unsigned long iPoint, CFluidModel *FluidModel) { diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref index 2ddfaff9e588..7a4e8fc71040 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_cd_disc.dat.ref @@ -1,39 +1,39 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , -10743.0 , 0.001 - 1 , -12209.1 , 0.001 - 2 , -8820.43 , 0.001 - 3 , -4499.31 , 0.001 - 4 , -666.822 , 0.001 - 5 , 2295.31 , 0.001 - 6 , 4462.58 , 0.001 - 7 , 6094.72 , 0.001 - 8 , 7507.39 , 0.001 - 9 , 9016.3 , 0.001 - 10 , 10913.7 , 0.001 - 11 , 13452.7 , 0.001 - 12 , 16817.9 , 0.001 - 13 , 21036.1 , 0.001 - 14 , 25683.2 , 0.001 - 15 , 28962.7 , 0.001 - 16 , 24836.8 , 0.001 - 17 , -5455.66 , 0.001 - 18 , -105581.0 , 0.001 - 19 , -22082.4 , 0.001 - 20 , -19868.6 , 0.001 - 21 , -12630.5 , 0.001 - 22 , -6543.52 , 0.001 - 23 , -3097.77 , 0.001 - 24 , -2154.9 , 0.001 - 25 , -2997.33 , 0.001 - 26 , -4816.41 , 0.001 - 27 , -6961.91 , 0.001 - 28 , -9055.96 , 0.001 - 29 , -11020.7 , 0.001 - 30 , -13053.2 , 0.001 - 31 , -15554.9 , 0.001 - 32 , -18942.9 , 0.001 - 33 , -23075.0 , 0.001 - 34 , -25752.7 , 0.001 - 35 , -19717.7 , 0.001 - 36 , 11830.8 , 0.001 - 37 , 90755.6 , 0.001 + 0 , -9202.31 , 0.001 + 1 , -11788.8 , 0.001 + 2 , -8721.38 , 0.001 + 3 , -4114.08 , 0.001 + 4 , 305.267 , 0.001 + 5 , 3932.86 , 0.001 + 6 , 6717.6 , 0.001 + 7 , 8859.85 , 0.001 + 8 , 10646.5 , 0.001 + 9 , 12358.0 , 0.001 + 10 , 14207.2 , 0.001 + 11 , 16281.9 , 0.001 + 12 , 18462.1 , 0.001 + 13 , 20259.5 , 0.001 + 14 , 20447.0 , 0.001 + 15 , 16181.3 , 0.001 + 16 , 1015.71 , 0.001 + 17 , -38629.0 , 0.001 + 18 , -118966.0 , 0.001 + 19 , -22745.8 , 0.001 + 20 , -22327.9 , 0.001 + 21 , -15522.2 , 0.001 + 22 , -9357.91 , 0.001 + 23 , -5783.47 , 0.001 + 24 , -4829.0 , 0.001 + 25 , -5777.33 , 0.001 + 26 , -7736.69 , 0.001 + 27 , -9940.95 , 0.001 + 28 , -11887.3 , 0.001 + 29 , -13366.9 , 0.001 + 30 , -14427.0 , 0.001 + 31 , -15274.5 , 0.001 + 32 , -16043.2 , 0.001 + 33 , -16168.7 , 0.001 + 34 , -12980.4 , 0.001 + 35 , 252.815 , 0.001 + 36 , 34024.4 , 0.001 + 37 , 88513.5 , 0.001 diff --git a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref index 34f9fdc4b499..e6dcad499894 100644 --- a/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/cont_adj_euler/naca0012/of_grad_directdiff.dat.ref @@ -1,4 +1,4 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , -0.4822702617 , -33.47975893 , -0.4005061436 , -3.752457446 , 0.0 , -3.742827467 , 0.0 , 0.0 , 0.4901663445 , 0.0 - 1 , 0.4046369694 , -39.8358634 , 0.4806656813 , -3.479932458 , 0.0 , -3.489589995 , 0.0 , 0.0 , 0.2099434069 , 0.0 - 2 , 0.8857650012 , -37.46457348 , 0.9462916401 , -2.764234008 , 0.0 , -2.784219439 , 0.0 , 0.0 , -0.1102654457 , 0.0 + 0 , 0.2238017616 , -26.45441896 , 0.26355388 , -1.8193724 , 0.0 , -1.824688836 , 0.0 , 0.0 , 0.4757354463 , 0.0 + 1 , 0.4941215347 , -41.68837227 , 0.5532618619 , -2.704972581 , 0.0 , -2.716398215 , 0.0 , 0.0 , 0.236646489 , 0.0 + 2 , 0.7580150128 , -47.55455329 , 0.8206631815 , -2.862855937 , 0.0 , -2.880077328 , 0.0 , 0.0 , -0.06710325381 , 0.0 diff --git a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref index 916efa61b3cd..81fa5e5cfe00 100644 --- a/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref +++ b/TestCases/cont_adj_euler/wedge/of_grad_combo.dat.ref @@ -1,5 +1,5 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.00702689 , 0.0001 - 1 , 0.00485994 , 0.0001 - 2 , 0.0024459 , 0.0001 - 3 , 0.000872721 , 0.0001 + 0 , 0.00699944 , 0.0001 + 1 , 0.00484765 , 0.0001 + 2 , 0.00244252 , 0.0001 + 3 , 0.000872197 , 0.0001 diff --git a/TestCases/hybrid_regression.py b/TestCases/hybrid_regression.py index a03850328cb9..a00d728de90d 100644 --- a/TestCases/hybrid_regression.py +++ b/TestCases/hybrid_regression.py @@ -64,7 +64,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [3.601531, 0.116605, 0.168986, 1.000000] + channel.test_vals = [3.301777, 0.125985, 0.098809, 1.000000] test_list.append(channel) # NACA0012 @@ -72,7 +72,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.029205, -3.521852, 0.272095, 0.009425] + naca0012.test_vals = [-4.562256, -3.990260, 0.297063, 0.025787] test_list.append(naca0012) # Supersonic wedge @@ -80,7 +80,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-4.160450, 1.566828, -0.249526, 0.043953] + wedge.test_vals = [-3.891138, 1.834563, -0.249527, 0.043953] test_list.append(wedge) # ONERA M6 Wing @@ -88,7 +88,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [0.277060, 0.006086] + oneram6.test_vals = [0.272909, 0.004969] test_list.append(oneram6) # Fixed CL NACA0012 @@ -96,7 +96,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.935633, 1.578848, 0.300929, 0.019471] + fixedCL_naca0012.test_vals = [-3.929600, 1.584693, 0.300944, 0.019472] test_list.append(fixedCL_naca0012) # HYPERSONIC FLOW PAST BLUNT BODY @@ -116,7 +116,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-8.265204, -2.790380, 0.001084, 0.036280, 2.361500, -2.325300, 0.000000, 0.000000] + flatplate.test_vals = [-8.085820, -2.610594, 0.001084, 0.036283, 2.361500, -2.325300, 0.000000, 0.000000] test_list.append(flatplate) # Laminar cylinder (steady) @@ -124,7 +124,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-8.638753, -3.154563, 0.005584, 1.614194, 0.000000] + cylinder.test_vals = [-8.641890, -3.152957, -0.011298, 1.610989, 0.000000] test_list.append(cylinder) # Laminar cylinder (low Mach correction) @@ -132,7 +132,7 @@ def main(): cylinder_lowmach.cfg_dir = "navierstokes/cylinder" cylinder_lowmach.cfg_file = "cylinder_lowmach.cfg" cylinder_lowmach.test_iter = 25 - cylinder_lowmach.test_vals = [-8.730784, -3.268719, 0.318044, 1.770346, 0.000000] + cylinder_lowmach.test_vals = [-8.506547, -3.044088, 0.325412, 1.711231, 0.000000] cylinder_lowmach.test_vals_aarch64 = [-6.830996, -1.368850, -0.143956, 73.963354, 0] test_list.append(cylinder_lowmach) @@ -149,7 +149,7 @@ def main(): poiseuille_profile.cfg_dir = "navierstokes/poiseuille" poiseuille_profile.cfg_file = "profile_poiseuille.cfg" poiseuille_profile.test_iter = 10 - poiseuille_profile.test_vals = [-12.004086, -7.637842, -0.000000, 2.089953] + poiseuille_profile.test_vals = [-12.010692, -7.646931, -0.000000, 2.089953] poiseuille_profile.test_vals_aarch64 = [-12.004276, -7.636719, -0.000000, 2.089953] test_list.append(poiseuille_profile) @@ -178,7 +178,7 @@ def main(): rae2822_sa.cfg_dir = "rans/rae2822" rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg" rae2822_sa.test_iter = 20 - rae2822_sa.test_vals = [-2.935392, -5.307268, 0.801692, 0.019604, 1000.000000] + rae2822_sa.test_vals = [-2.967114, -5.289892, 0.808282, 0.020009, 1000.000000] test_list.append(rae2822_sa) # RAE2822 SST @@ -186,7 +186,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.468398, 5.899572, 0.675268, 0.026224, 100.000000] + rae2822_sst.test_vals = [-1.368201, 5.882410, 0.556244, 0.014039, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST_SUST @@ -194,7 +194,7 @@ def main(): rae2822_sst_sust.cfg_dir = "rans/rae2822" rae2822_sst_sust.cfg_file = "turb_SST_SUST_RAE2822.cfg" rae2822_sst_sust.test_iter = 20 - rae2822_sst_sust.test_vals = [-2.465508, 5.845328, 0.497041, 0.041058] + rae2822_sst_sust.test_vals = [-2.495527, 5.824730, 0.686939, 0.019530] test_list.append(rae2822_sst_sust) # Flat plate @@ -202,7 +202,7 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-0.187373, 0.003723, 10.000000, -1.444515] + turb_flatplate.test_vals = [-0.165661, 0.004184, 10.000000, -2.554025] test_list.append(turb_flatplate) # ONERA M6 Wing @@ -218,7 +218,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.038092, -16.332088, 1.080346, 0.018385, 20.000000, -2.873167, 0.000000, -14.250270, 0.000000] + turb_naca0012_sa.test_vals = [-12.038050, -16.332089, 1.080346, 0.018385, 20.000000, -2.873679, 0.000000, -14.250270, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.038091, -16.332090, 1.080346, 0.018385, 20.000000, -2.873236, 0.000000, -14.250271, 0.000000] test_list.append(turb_naca0012_sa) @@ -273,7 +273,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.066104, 0.510545, -1.715019, 2.920832, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.066093, 0.510552, -1.715310, 2.920425, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.140441, -9.154674, -10.886121, -5.806594, 0.000000] test_list.append(axi_rans_air_nozzle_restart) @@ -287,7 +287,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 20 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-3.690079, -5.056964, 0.830560, -0.008732, 0.078127] + turb_naca0012_sst_restart_mg.test_vals = [-3.734651, -5.056972, 0.830549, -0.008629, 0.077930] test_list.append(turb_naca0012_sst_restart_mg) ############################# @@ -368,7 +368,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.668256, -5.851153, 0.531532, 0.008487] + inc_euler_naca0012.test_vals = [-6.729257, -5.879573, 0.531546, 0.008484] test_list.append(inc_euler_naca0012) # NACA0012 Hydrofoil, pressure-based. Exercises the OpenMP path of the Poisson @@ -411,7 +411,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.121917, -5.432144, 0.000056, 0.125551] + inc_nozzle.test_vals = [-6.202097, -5.483459, -0.005853, 0.125978] test_list.append(inc_nozzle) ############################# @@ -423,7 +423,7 @@ def main(): inc_lam_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_lam_cylinder.cfg_file = "incomp_cylinder.cfg" inc_lam_cylinder.test_iter = 10 - inc_lam_cylinder.test_vals = [-4.814160, -5.008238, 0.001269, 3.114987] + inc_lam_cylinder.test_vals = [-4.835169, -4.799421, 0.005368, 3.098376] test_list.append(inc_lam_cylinder) # Buoyancy-driven cavity @@ -488,7 +488,7 @@ def main(): cavity.cfg_dir = "moving_wall/cavity" cavity.cfg_file = "lam_cavity.cfg" cavity.test_iter = 25 - cavity.test_vals = [-7.887109, -2.429088, 0.013598, 0.005372] + cavity.test_vals = [-7.783818, -2.318498, 0.276732, 0.248344] test_list.append(cavity) # Spinning cylinder @@ -496,7 +496,7 @@ def main(): spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder" spinning_cylinder.cfg_file = "spinning_cylinder.cfg" spinning_cylinder.test_iter = 25 - spinning_cylinder.test_vals = [-7.614070, -2.155206, 1.804022, 1.893004] + spinning_cylinder.test_vals = [-7.535740, -2.098156, 2.688174, 2.265403] spinning_cylinder.test_vals_aarch64 = [-8.008023, -2.611064, 1.497308, 1.487483] test_list.append(spinning_cylinder) @@ -518,7 +518,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481833, -0.012152, -0.004132] + sine_gust.test_vals = [-1.977498, 3.481833, -0.012127, -0.003839] sine_gust.unsteady = True test_list.append(sine_gust) @@ -547,7 +547,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [-1.876631, 4.021082, 0.082347, 0.026939, -0.001638, -0.000130, -1.043994] + aeroelastic.test_vals = [-1.876624, 4.021086, 0.082030, 0.027159, -0.001637, -0.000130, -1.044015] aeroelastic.unsteady = True aeroelastic.enabled_on_cpu_arch = ["x86_64"] # Requires AVX-capable architecture test_list.append(aeroelastic) @@ -590,7 +590,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.666017, -3.794928, -3.717606, -3.149231] + unst_deforming_naca0012.test_vals = [-3.665168, -3.793753, -3.716692, -3.148343] unst_deforming_naca0012.unsteady = True unst_deforming_naca0012.enabled_with_tsan = False test_list.append(unst_deforming_naca0012) @@ -604,7 +604,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 25 - edge_VW.test_vals = [-11.723639, -5.537067, -0.000009, 0.000000] + edge_VW.test_vals = [-11.771824, -5.584805, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -612,7 +612,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 20 - edge_PPR.test_vals = [-10.993286, -4.827527, -0.000034, 0.000000] + edge_PPR.test_vals = [-8.242353, -2.087373, -0.000034, 0.000000] edge_PPR.test_vals_aarch64 = [ -7.139211, -0.980821, -0.000034, 0.000000] test_list.append(edge_PPR) @@ -625,7 +625,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-0.151372, -0.171658, -8.195257, -2.499027, -7.362886, -1.883842, 73291.000000, 73291.000000, 0.020062, 82.380000] + Jones_tc_restart.test_vals = [-0.151371, -0.171559, -8.195256, -2.499027, -7.362867, -1.884111, 73291.000000, 73291.000000, 0.020062, 82.380000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -734,7 +734,7 @@ def main(): bars_SST_2D.cfg_dir = "sliding_interface/bars_SST_2D" bars_SST_2D.cfg_file = "bars.cfg" bars_SST_2D.test_iter = 13 - bars_SST_2D.test_vals = [13.000000, -0.462562, -1.525524] + bars_SST_2D.test_vals = [13.000000, -0.392184, -1.444896] bars_SST_2D.multizone = True test_list.append(bars_SST_2D) @@ -796,7 +796,7 @@ def main(): fsi_cht_restart.cfg_dir = "fea_fsi/stat_fsi" fsi_cht_restart.cfg_file = "config_restart.cfg" fsi_cht_restart.test_iter = 0 - fsi_cht_restart.test_vals = [5.000000, 0.006352, -1.960362, -9.327033, -9.627371, -9.319273, 608.380000, -0.012974, 0.000000, 20.000000] + fsi_cht_restart.test_vals = [5.000000, 0.006352, -1.960362, -9.326975, -9.618699, -9.319644, 608.380000, -0.012974, 0.000000, 20.000000] fsi_cht_restart.multizone = True test_list.append(fsi_cht_restart) diff --git a/TestCases/hybrid_regression_AD.py b/TestCases/hybrid_regression_AD.py index 8860042f7303..e02fcf9ee61e 100644 --- a/TestCases/hybrid_regression_AD.py +++ b/TestCases/hybrid_regression_AD.py @@ -79,7 +79,7 @@ def main(): discadj_rans_naca0012_sa.cfg_dir = "disc_adj_rans/naca0012" discadj_rans_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" discadj_rans_naca0012_sa.test_iter = 10 - discadj_rans_naca0012_sa.test_vals = [-2.987158, 0.533077, 0.000004, -0.000000, 5.000000, -2.939652, 5.000000, -5.503576] + discadj_rans_naca0012_sa.test_vals = [-2.987158, 0.533077, 0.000004, -0.000000, 5.000000, -2.939652, 5.000000, -5.493665] test_list.append(discadj_rans_naca0012_sa) # Adjoint turbulent NACA0012 SST @@ -100,7 +100,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -3.134641, -2.294877, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -3.217505, -2.513785, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -188,7 +188,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.128086, -1.582652, -0.006613, 0.000011] + discadj_pitchingNACA0012.test_vals = [-1.144664, -1.593160, -0.006641, 0.000010] discadj_pitchingNACA0012.tol = 0.01 discadj_pitchingNACA0012.unsteady = True discadj_pitchingNACA0012.enabled_with_tsan = False diff --git a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref index 23ceb1a6b5b3..9e1774be81bf 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_cd.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "GRADIENT" , "FINDIFF_STEP" - 0 , 0.0441842 , 0.001 - 1 , -0.0851416 , 0.001 + 0 , 0.0427831 , 0.001 + 1 , -0.0829177 , 0.001 diff --git a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref index c8cdfc2be3b8..ab6b6dcbbab7 100644 --- a/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref +++ b/TestCases/multiple_ffd/naca0012/of_grad_directdiff.dat.ref @@ -1,3 +1,3 @@ VARIABLES="VARIABLE" , "DRAG" , "EFFICIENCY" , "FORCE_X" , "FORCE_Y" , "FORCE_Z" , "LIFT" , "MOMENT_X" , "MOMENT_Y" , "MOMENT_Z" , "SIDEFORCE" - 0 , 0.04764995291 , -0.4785284359 , 0.04801017457 , -0.01598892384 , 0.0 , -0.01703245534 , 0.0 , 0.0 , 0.02996605706 , 0.0 - 1 , -0.09288671545 , 0.3493425426 , -0.09225244369 , -0.03008154029 , 0.0 , -0.02806190524 , 0.0 , 0.0 , 0.06566823485 , 0.0 + 0 , 0.04664738027 , -0.5056424841 , 0.04695620131 , -0.01364420371 , 0.0 , -0.01466530089 , 0.0 , 0.0 , 0.02845302842 , 0.0 + 1 , -0.09019985946 , 0.4771773726 , -0.08972714712 , -0.02264806689 , 0.0 , -0.02068528987 , 0.0 , 0.0 , 0.06196955454 , 0.0 diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index e5fd6ed2db9f..39deaff4533c 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -47,7 +47,7 @@ def main(): cfd_cantera_dc_ch4.cfg_dir = "combustion/1step_methane_air" cfd_cantera_dc_ch4.cfg_file = "2d_slit_burner_fluid.cfg" cfd_cantera_dc_ch4.test_iter = 10 - cfd_cantera_dc_ch4.test_vals = [-12.897453, -15.198159, -12.810575, 10.000000, -1.881353, 1000.000000] + cfd_cantera_dc_ch4.test_vals = [-12.897452, -15.193280, -12.810575, 10.000000, -1.863535, 1000.000000] cfd_cantera_dc_ch4.new_output = True test_list.append(cfd_cantera_dc_ch4) @@ -56,7 +56,7 @@ def main(): cfd_cantera_dc_h2.cfg_dir = "combustion/h2o2_hydrogen_air" cfd_cantera_dc_h2.cfg_file = "2d_slit_burner_h2.cfg" cfd_cantera_dc_h2.test_iter = 10 - cfd_cantera_dc_h2.test_vals = [-15.993819, -17.134091, -32.000000, 5.000000, -2.029177, 100.000000] + cfd_cantera_dc_h2.test_vals = [-15.994240, -17.134241, -32.000000, 5.000000, -2.027407, 100.000000] cfd_cantera_dc_h2.new_output = True test_list.append(cfd_cantera_dc_h2) @@ -261,7 +261,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 20 - channel.test_vals = [3.612169, 0.104888, 0.172110, 1.000000] + channel.test_vals = [3.310505, 0.108396, 0.101621, 1.000000] test_list.append(channel) # NACA0012, native SU2 binary mesh format (.su2b) @@ -289,7 +289,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe_su2bin.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.024996, -3.520626, 0.275033, 0.009889] + naca0012.test_vals = [-4.543171, -3.970680, 0.298990, 0.025841] test_list.append(naca0012) # Supersonic wedge @@ -297,7 +297,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-4.017584, 1.709444, -0.249527, 0.043953] + wedge.test_vals = [-3.504018, 2.221139, -0.249525, 0.043953] test_list.append(wedge) # ONERA M6 Wing @@ -305,7 +305,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-4.761651, -4.155183, 0.277045, 0.006558] + oneram6.test_vals = [-4.733075, -4.126797, 0.275641, 0.006035] oneram6.timeout = 3200 test_list.append(oneram6) @@ -314,7 +314,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.879989, 1.634337, 0.300975, 0.019477] + fixedCL_naca0012.test_vals = [-3.872450, 1.641863, 0.300984, 0.019478] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -323,7 +323,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.316438, 4.156970, 0.002707, 0.114493] + polar_naca0012.test_vals = [-1.254512, 4.195237, -0.000938, 0.083329] polar_naca0012.test_vals_aarch64 = [-1.083394, 4.386134, 0.001588, 0.033513] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-i 11") # flaky test on arm64 @@ -389,7 +389,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 100 - flatplate.test_vals = [-8.165135, -2.690978, 0.001084, 0.036277, 2.361500, -2.325300, 0.000000, 0.000000] + flatplate.test_vals = [-8.274423, -2.799366, 0.001084, 0.036279, 2.361500, -2.325300, 0.000000, 0.000000] test_list.append(flatplate) # Laminar flat plate with the WALL_DISTANCE limiter @@ -397,7 +397,7 @@ def main(): flatplate_wall_limiter.cfg_dir = "navierstokes/flatplate" flatplate_wall_limiter.cfg_file = "lam_flatplate_wall_limiter.cfg" flatplate_wall_limiter.test_iter = 20 - flatplate_wall_limiter.test_vals = [-5.373432, 0.105283, 0.001249, 0.027725, 2.361600, -2.333900, 0.000000, 0.000000] + flatplate_wall_limiter.test_vals = [-5.409896, 0.067894, 0.001183, 0.030453, 2.361700, -2.331200, 0.000000, 0.000000] test_list.append(flatplate_wall_limiter) # Supersonic laminar flat plate @@ -430,7 +430,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-8.557718, -3.072847, -0.018912, 1.610317, 0.000000] + cylinder.test_vals = [-8.587179, -3.100759, -0.015616, 1.610256, 0.000000] test_list.append(cylinder) # Laminar cylinder (low Mach correction) @@ -438,7 +438,7 @@ def main(): cylinder_lowmach.cfg_dir = "navierstokes/cylinder" cylinder_lowmach.cfg_file = "cylinder_lowmach.cfg" cylinder_lowmach.test_iter = 25 - cylinder_lowmach.test_vals = [-8.737675, -3.275569, 0.050297, 1.839111, 0.000000] + cylinder_lowmach.test_vals = [-8.538168, -3.075812, 0.118777, 1.723308, 0.000000] test_list.append(cylinder_lowmach) @@ -447,7 +447,7 @@ def main(): lam_naca0012_linelet.cfg_dir = "navierstokes/naca0012" lam_naca0012_linelet.cfg_file = "lam_NACA0012_LINELET.cfg" lam_naca0012_linelet.test_iter = 20 - lam_naca0012_linelet.test_vals = [-5.335764, -2.936176, -2.943918, 0.102456] + lam_naca0012_linelet.test_vals = [-5.384409, -2.896930, -2.972064, 0.147427] lam_naca0012_linelet.command = TestCase.Command("mpirun --oversubscribe -n 4", "SU2_CFD") test_list.append(lam_naca0012_linelet) @@ -465,7 +465,7 @@ def main(): poiseuille_profile.cfg_dir = "navierstokes/poiseuille" poiseuille_profile.cfg_file = "profile_poiseuille.cfg" poiseuille_profile.test_iter = 10 - poiseuille_profile.test_vals = [-12.003186, -7.623957, -0.000000, 2.089953] + poiseuille_profile.test_vals = [-12.010526, -7.639846, -0.000000, 2.089953] poiseuille_profile.test_vals_aarch64 = [-12.007498, -7.226926, -0.000000, 2.089953] poiseuille_profile.tol = [0.001, 0.001, 1e-5, 1e-5, 1e-5] test_list.append(poiseuille_profile) @@ -491,7 +491,7 @@ def main(): periodic2d_multigrid.cfg_dir = "navierstokes/periodic2D" periodic2d_multigrid.cfg_file = "multigrid.cfg" periodic2d_multigrid.test_iter = 300 - periodic2d_multigrid.test_vals = [-4.422778, -1.615251, -1.453736, 1.047350, -1.410225, -2060.600000] + periodic2d_multigrid.test_vals = [-5.338176, -2.795308, -2.414528, 0.120556, -1.314701, -2813.300000] test_list.append(periodic2d_multigrid) # 2D rotational periodic sector with limiter @@ -507,7 +507,7 @@ def main(): periodic3d_axis.cfg_dir = "navierstokes/periodic3D_axis" periodic3d_axis.cfg_file = "config.cfg" periodic3d_axis.test_iter = 100 - periodic3d_axis.test_vals = [-3.271569, -0.284345, 2.163829, -7.848400, -7.848400] + periodic3d_axis.test_vals = [-3.271759, -0.284720, 2.163574, -7.847600, -7.847600] test_list.append(periodic3d_axis) ########################## @@ -519,7 +519,7 @@ def main(): rae2822_sa.cfg_dir = "rans/rae2822" rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg" rae2822_sa.test_iter = 20 - rae2822_sa.test_vals = [-3.047650, -5.306106, 0.788758, 0.019614, 1000.000000] + rae2822_sa.test_vals = [-3.043815, -5.310800, 0.781348, 0.019486, 1000.000000] test_list.append(rae2822_sa) # RAE2822 SST @@ -527,7 +527,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.490389, 5.887511, 0.612423, 0.020606, 100.000000] + rae2822_sst.test_vals = [-1.343054, 5.889156, 0.654021, 0.018707, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST with JST matrix dissipation (rho*k Laplacian and its MPI exchange) @@ -535,7 +535,7 @@ def main(): rae2822_sst_jst_mat.cfg_dir = "rans/rae2822" rae2822_sst_jst_mat.cfg_file = "turb_SST_JST_MAT_RAE2822.cfg" rae2822_sst_jst_mat.test_iter = 20 - rae2822_sst_jst_mat.test_vals = [-1.629500, 5.867810, 0.701293, 0.065872, 100.000000] + rae2822_sst_jst_mat.test_vals = [-1.474492, 5.881394, 0.675039, 0.062869, 100.000000] test_list.append(rae2822_sst_jst_mat) # RAE2822 SST_SUST @@ -543,7 +543,7 @@ def main(): rae2822_sst_sust.cfg_dir = "rans/rae2822" rae2822_sst_sust.cfg_file = "turb_SST_SUST_RAE2822.cfg" rae2822_sst_sust.test_iter = 20 - rae2822_sst_sust.test_vals = [-2.464689, 5.852511, 0.496635, 0.041128] + rae2822_sst_sust.test_vals = [-2.489350, 5.830917, 0.681764, 0.017909] test_list.append(rae2822_sst_sust) # Flat plate @@ -551,15 +551,31 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-0.187388, 0.003749, 10.000000, -1.406182] + turb_flatplate.test_vals = [-0.187618, 0.004042, 10.000000, -0.781225] test_list.append(turb_flatplate) + # FLAT PLATE, LINEAR MULTIGRID PROLONGATION, FIRST ORDER AT THE WALL END, ANISOTROPIC PARTITIONING + turb_flatplate_mg_linear = TestCase('turb_flatplate_mg_linear') + turb_flatplate_mg_linear.cfg_dir = "rans/flatplate" + turb_flatplate_mg_linear.cfg_file = "turb_SA_flatplate_mg_linear.cfg" + turb_flatplate_mg_linear.test_iter = 20 + turb_flatplate_mg_linear.test_vals = [-5.090006, -6.110316, -0.187162, 0.002996, 10.000000, -2.051853] + test_list.append(turb_flatplate_mg_linear) + + # FLAT PLATE, SST, FULL MULTIGRID STARTUP, TURBULENCE SUB-ITERATIONS + turb_flatplate_sst_fullmg = TestCase('turb_flatplate_sst_fullmg') + turb_flatplate_sst_fullmg.cfg_dir = "rans/flatplate" + turb_flatplate_sst_fullmg.cfg_file = "turb_SST_flatplate_fullmg.cfg" + turb_flatplate_sst_fullmg.test_iter = 20 + turb_flatplate_sst_fullmg.test_vals = [-5.466644, -2.316828, 7.155791, -0.187269, 0.001171] + test_list.append(turb_flatplate_sst_fullmg) + # Flat plate (compressible) with species inlet turb_flatplate_species = TestCase('turb_flatplate_species') turb_flatplate_species.cfg_dir = "rans/flatplate" turb_flatplate_species.cfg_file = "turb_SA_flatplate_species.cfg" turb_flatplate_species.test_iter = 20 - turb_flatplate_species.test_vals = [-5.359043, -1.881674, -3.075839, 0.124416, -3.602253, 2.000000, -1.239286, 1.000000, -1.158672, 3.000000, -0.849003, 0.999876, 0.999876] + turb_flatplate_species.test_vals = [-1.485399, 0.863236, 0.484692, 3.386697, -2.465371, 2.000000, -1.057746, 3.000000, -0.071163, 3.000000, -0.771473, 0.999411, 0.999411] test_list.append(turb_flatplate_species) # Flat plate SST compressibility correction Wilcox @@ -635,7 +651,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.037539, -16.376949, 1.080346, 0.018385, 20.000000, -1.564082, 20.000000, -4.180930, 0.000000] + turb_naca0012_sa.test_vals = [-12.037544, -16.376949, 1.080346, 0.018385, 20.000000, -1.564067, 20.000000, -4.180949, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.037489, -16.376949, 1.080346, 0.018385, 20.000000, -1.564143, 20.000000, -4.180945, 0.000000] turb_naca0012_sa.timeout = 3200 test_list.append(turb_naca0012_sa) @@ -759,7 +775,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.126496, 0.450311, -1.628542, 2.883478, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.126504, 0.450297, -1.628749, 2.883154, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.143310, -9.163287, -10.858232, -5.787715, 0.000000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -769,7 +785,7 @@ def main(): axi_rans_air_nozzle_density_velocity.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_density_velocity.cfg_file = "air_nozzle_density_velocity.cfg" axi_rans_air_nozzle_density_velocity.test_iter = 10 - axi_rans_air_nozzle_density_velocity.test_vals = [702.550000, -1.879323, 4.022709, 0.513957, 4.415534] + axi_rans_air_nozzle_density_velocity.test_vals = [702.550000, -1.879323, 4.022709, 0.513969, 4.415605] test_list.append(axi_rans_air_nozzle_density_velocity) ################################# @@ -782,7 +798,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 20 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-3.692691, -5.056997, 0.830506, -0.008795, 0.078083] + turb_naca0012_sst_restart_mg.test_vals = [-3.735895, -5.056994, 0.830513, -0.008825, 0.077879] turb_naca0012_sst_restart_mg.timeout = 3200 turb_naca0012_sst_restart_mg.tol = 0.000001 test_list.append(turb_naca0012_sst_restart_mg) @@ -796,7 +812,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.920909, -6.189139, 0.531865, 0.008472] + inc_euler_naca0012.test_vals = [-6.911473, -6.188337, 0.531897, 0.008470] test_list.append(inc_euler_naca0012) # NACA0012 Hydrofoil @@ -820,7 +836,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.357399, -5.618580, 0.004548, 0.126243] + inc_nozzle.test_vals = [-6.355762, -5.617268, 0.004751, 0.126111] test_list.append(inc_nozzle) # Laminar wall mounted cylinder, Euler walls, cylinder wall diagonally split @@ -840,7 +856,7 @@ def main(): inc_lam_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_lam_cylinder.cfg_file = "incomp_cylinder.cfg" inc_lam_cylinder.test_iter = 10 - inc_lam_cylinder.test_vals = [-4.816099, -5.029676, -0.000155, 3.113777] + inc_lam_cylinder.test_vals = [-4.843553, -4.882219, -0.000244, 3.093746] test_list.append(inc_lam_cylinder) # Laminar cylinder, pressure-based @@ -876,7 +892,7 @@ def main(): inc_lam_sphere.cfg_dir = "incomp_navierstokes/sphere" inc_lam_sphere.cfg_file = "sphere.cfg" inc_lam_sphere.test_iter = 5 - inc_lam_sphere.test_vals = [-7.599894, -8.023038, -8.135420, -8.783151, 0.121003, 25.782689, -1.574889] + inc_lam_sphere.test_vals = [-7.598353, -7.960253, -8.024160, -8.631574, 0.121002, 25.782692, -1.529291] test_list.append(inc_lam_sphere) # Laminar sphere, Re=1, pressure-based. Only 3D pressure-based case in the regression suite. @@ -1072,7 +1088,7 @@ def main(): turbmod_sa_bsl_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_bsl_rae2822.cfg_file = "turb_SA_BSL_RAE2822.cfg" turbmod_sa_bsl_rae2822.test_iter = 20 - turbmod_sa_bsl_rae2822.test_vals = [-3.069286, -0.415479, -0.840170, -5.124469, 0.788558, 0.018057] + turbmod_sa_bsl_rae2822.test_vals = [-3.105645, -0.400790, -0.806193, -5.131064, 0.778006, 0.017764] test_list.append(turbmod_sa_bsl_rae2822) # SA Negative @@ -1080,7 +1096,7 @@ def main(): turbmod_sa_neg_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_neg_rae2822.cfg_file = "turb_SA_NEG_RAE2822.cfg" turbmod_sa_neg_rae2822.test_iter = 10 - turbmod_sa_neg_rae2822.test_vals = [1.262984, 1.057729, -2.485714, 1.347422, 0.499608, 0.000000] + turbmod_sa_neg_rae2822.test_vals = [1.264766, 1.058838, -2.479388, 1.304799, 0.473631, 0.000000] turbmod_sa_neg_rae2822.test_vals_aarch64 = [-1.345593, 1.448310, 1.208721, -0.846597, 1.248410, 0.489117, 0.000000] test_list.append(turbmod_sa_neg_rae2822) @@ -1089,7 +1105,7 @@ def main(): turbmod_sa_comp_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_comp_rae2822.cfg_file = "turb_SA_COMP_RAE2822.cfg" turbmod_sa_comp_rae2822.test_iter = 20 - turbmod_sa_comp_rae2822.test_vals = [-3.070530, -0.414501, -0.840492, -5.165673, 0.789069, 0.018035] + turbmod_sa_comp_rae2822.test_vals = [-3.106858, -0.399605, -0.806484, -5.157237, 0.778645, 0.017740] test_list.append(turbmod_sa_comp_rae2822) # SA Edwards @@ -1097,7 +1113,7 @@ def main(): turbmod_sa_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_edw_rae2822.cfg_file = "turb_SA_EDW_RAE2822.cfg" turbmod_sa_edw_rae2822.test_iter = 20 - turbmod_sa_edw_rae2822.test_vals = [-3.075819, -0.411618, -0.840928, -5.208532, 0.791884, 0.017788] + turbmod_sa_edw_rae2822.test_vals = [-3.144932, -0.366912, -0.805511, -4.183794, 0.795186, 0.017522] test_list.append(turbmod_sa_edw_rae2822) # SA Compressibility and Edwards @@ -1105,7 +1121,7 @@ def main(): turbmod_sa_comp_edw_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_comp_edw_rae2822.cfg_file = "turb_SA_COMP_EDW_RAE2822.cfg" turbmod_sa_comp_edw_rae2822.test_iter = 20 - turbmod_sa_comp_edw_rae2822.test_vals = [-3.078301, -0.343983, -0.817017, -5.287226, 0.809098, 0.019728] + turbmod_sa_comp_edw_rae2822.test_vals = [-3.093383, -0.351747, -0.799857, -5.289339, 0.798732, 0.019370] test_list.append(turbmod_sa_comp_edw_rae2822) # SA QCR @@ -1113,7 +1129,7 @@ def main(): turbmod_sa_qcr_rae2822.cfg_dir = "turbulence_models/sa/rae2822" turbmod_sa_qcr_rae2822.cfg_file = "turb_SA_QCR_RAE2822.cfg" turbmod_sa_qcr_rae2822.test_iter = 20 - turbmod_sa_qcr_rae2822.test_vals = [-3.028738, -0.415867, -0.799201, -5.082143, 0.761283, 0.016850] + turbmod_sa_qcr_rae2822.test_vals = [-3.079434, -0.441259, -0.827352, -5.125950, 0.779105, 0.017356] test_list.append(turbmod_sa_qcr_rae2822) ############################ @@ -1137,7 +1153,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.547544, -15.069350, -0.726250, 0.020280] + contadj_naca0012.test_vals = [-9.528612, -15.088426, -0.726250, 0.020280] contadj_naca0012.test_vals_aarch64 = [-9.662546, -14.998818, -0.726250, 0.020280] test_list.append(contadj_naca0012) @@ -1146,7 +1162,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-12.085026, -12.651321, -1.086100, 0.007556] + contadj_oneram6.test_vals = [-12.029055, -12.586778, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint @@ -1162,7 +1178,7 @@ def main(): contadj_fixed_CL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixed_CL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixed_CL_naca0012.test_iter = 100 - contadj_fixed_CL_naca0012.test_vals = [1.408757, -4.010761, 0.005926, 0.004032] + contadj_fixed_CL_naca0012.test_vals = [1.374556, -4.049652, 0.003974, 0.003553] test_list.append(contadj_fixed_CL_naca0012) ################################### @@ -1174,7 +1190,7 @@ def main(): contadj_ns_cylinder.cfg_dir = "cont_adj_navierstokes/cylinder" contadj_ns_cylinder.cfg_file = "lam_cylinder.cfg" contadj_ns_cylinder.test_iter = 20 - contadj_ns_cylinder.test_vals = [-3.626865, -9.079504, 2.056700, -0.000000] + contadj_ns_cylinder.test_vals = [-3.636183, -9.092363, 2.056700, -0.000000] test_list.append(contadj_ns_cylinder) # Adjoint laminar naca0012 subsonic @@ -1218,7 +1234,7 @@ def main(): contadj_rans_rae2822.cfg_dir = "cont_adj_rans/rae2822" contadj_rans_rae2822.cfg_file = "turb_SA_RAE2822.cfg" contadj_rans_rae2822.test_iter = 20 - contadj_rans_rae2822.test_vals = [-5.399270, -10.904277, -0.212470, 0.005448] + contadj_rans_rae2822.test_vals = [-5.400257, -10.905220, -0.212470, 0.005448] test_list.append(contadj_rans_rae2822) ############################# @@ -1298,7 +1314,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-0.028751, 0.058727, 2.000000, -1.147537] + rot_naca0012.test_vals = [-0.039175, 0.046362, 2.000000, -1.174911] test_list.append(rot_naca0012) # Lid-driven cavity @@ -1306,7 +1322,7 @@ def main(): cavity.cfg_dir = "moving_wall/cavity" cavity.cfg_file = "lam_cavity.cfg" cavity.test_iter = 25 - cavity.test_vals = [-7.770113, -2.308185, 0.011072, 0.008947] + cavity.test_vals = [-8.192883, -2.726835, 0.009911, 0.008952] test_list.append(cavity) # Spinning cylinder @@ -1314,7 +1330,7 @@ def main(): spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder" spinning_cylinder.cfg_file = "spinning_cylinder.cfg" spinning_cylinder.test_iter = 25 - spinning_cylinder.test_vals = [-7.471322, -2.007082, 2.183565, 1.847848] + spinning_cylinder.test_vals = [-7.502134, -2.046784, 3.034409, 2.100243] test_list.append(spinning_cylinder) ###################################### @@ -1348,7 +1364,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481833, -0.013388, -0.003910] + sine_gust.test_vals = [-1.977498, 3.481833, -0.013083, -0.003728] sine_gust.unsteady = True test_list.append(sine_gust) @@ -1362,10 +1378,10 @@ def main(): test_list.append(ddes_flatplate) # Hybrid RANS/LES models on the ONERA M6 wing, restarting from a RANS solution - ddes_oneram6_vals = {"sst_ddes": [-2.221793, -0.757244, 2.506727, 0.261418, 0.022680], - "sst_iddes": [-2.226164, 3.063400, 2.594574, 0.261433, 0.022683], - "sst_siddes": [-2.226164, 3.063400, 2.594625, 0.261418, 0.022680], - "sst_eddes": [-2.221792, 0.258725, 2.506711, 0.261418, 0.022680], + ddes_oneram6_vals = {"sst_ddes": [-2.221793, -0.757239, 2.506710, 0.261418, 0.022680], + "sst_iddes": [-2.226164, 3.063400, 2.594562, 0.261433, 0.022683], + "sst_siddes": [-2.226164, 3.063400, 2.594613, 0.261418, 0.022680], + "sst_eddes": [-2.221792, 0.258724, 2.506694, 0.261418, 0.022680], "sa_eddes": [-3.510007, -3.683557, 0.266420, 0.023471]} for model, vals in ddes_oneram6_vals.items(): ddes_oneram6 = TestCase('ddes_oneram6_' + model) @@ -1414,7 +1430,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-4.478306, 1.723006, -0.000009, 0.000000] + edge_VW.test_vals = [-6.286838, -0.156423, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -1422,7 +1438,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 20 - edge_PPR.test_vals = [-8.395110, -2.236894, -0.000034, 0.000000] + edge_PPR.test_vals = [-6.099027, 0.029631, -0.000034, 0.000000] test_list.append(edge_PPR) # Rarefaction Q1D nozzle, include CoolProp fluid model @@ -1448,7 +1464,7 @@ def main(): datadriven_fluidModel.cfg_dir = "nicf/datadriven" datadriven_fluidModel.cfg_file = "datadriven_nozzle.cfg" datadriven_fluidModel.test_iter = 50 - datadriven_fluidModel.test_vals = [-5.772083, -2.793971, -3.757967, -0.619363, -1.476238, 1.691659] + datadriven_fluidModel.test_vals = [-5.769678, -2.799426, -3.747972, -0.609775, -1.488443, 1.616657] test_list.append(datadriven_fluidModel) ###################################### @@ -1461,7 +1477,7 @@ def main(): Aachen_3D_restart.cfg_file = "aachen_3D_MP_restart.cfg" Aachen_3D_restart.test_iter = 5 Aachen_3D_restart.tol = 0.00001 - Aachen_3D_restart.test_vals = [-7.688564, -8.466956, -6.035917, -6.426466, -5.820124, -4.598187, -5.531056, -5.302112, -3.820712, -5.241768, -5.750040, -3.629381, -2.213582, -2.858817, -0.578239] + Aachen_3D_restart.test_vals = [-7.689216, -8.447703, -6.049105, -6.408333, -5.833790, -4.582537, -5.531371, -5.312054, -3.829167, -5.243427, -5.787652, -3.644207, -2.211820, -2.864063, -0.585675] test_list.append(Aachen_3D_restart) # Jones APU Turbocharger restart @@ -1469,7 +1485,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-0.151378, -0.171653, -8.195262, -2.499033, -7.362884, -1.883837, 73291.000000, 73291.000000, 0.020062, 82.380000] + Jones_tc_restart.test_vals = [-0.151377, -0.171554, -8.195262, -2.499033, -7.362866, -1.884107, 73291.000000, 73291.000000, 0.020062, 82.380000] # The second BGS residual is near the numerical floor and varies between builds. Jones_tc_restart.tol = [1e-5, 5e-4] + [1e-5] * 8 test_list.append(Jones_tc_restart) @@ -1487,7 +1503,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-4.361988, -2.478653, -2.080473, 1.732234, -1.467441, 3.229155, -471620.000000, 94.838000, -0.064875] + transonic_stator_restart.test_vals = [-4.361997, -2.478636, -2.080514, 1.732226, -1.467385, 3.229118, -471620.000000, 94.838000, -0.064873] transonic_stator_restart.test_vals_aarch64 = [-4.437809, -2.553049, -2.164729, 1.657542, -1.356823, 3.178788, -471620.000000, 94.842000, -0.040365] test_list.append(transonic_stator_restart) @@ -1579,7 +1595,7 @@ def main(): bars_SST_2D.cfg_dir = "sliding_interface/bars_SST_2D" bars_SST_2D.cfg_file = "bars.cfg" bars_SST_2D.test_iter = 13 - bars_SST_2D.test_vals = [13.000000, -0.464379, -1.525511] + bars_SST_2D.test_vals = [13.000000, -0.396148, -1.444774] bars_SST_2D.multizone = True test_list.append(bars_SST_2D) @@ -1779,7 +1795,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 80 - pywrapper_naca0012.test_vals = [-5.701280, -5.186480, 0.334856, 0.023342] + pywrapper_naca0012.test_vals = [-4.842904, -4.165053, 0.335809, 0.023275] pywrapper_naca0012.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") test_list.append(pywrapper_naca0012) @@ -1809,7 +1825,7 @@ def main(): pywrapper_aeroelastic.cfg_dir = "aeroelastic" pywrapper_aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" pywrapper_aeroelastic.test_iter = 2 - pywrapper_aeroelastic.test_vals = [-1.876625, 4.021087, 0.083271, 0.026787, -0.001638, -0.000130, -0.973891] + pywrapper_aeroelastic.test_vals = [-1.876622, 4.021100, 0.084667, 0.026652, -0.001636, -0.000131, -0.973885] pywrapper_aeroelastic.command = TestCase.Command("mpirun -np 2", "SU2_CFD.py", "--parallel -f") pywrapper_aeroelastic.unsteady = True test_list.append(pywrapper_aeroelastic) @@ -1850,7 +1866,7 @@ def main(): pywrapper_unsteadyCHT.cfg_dir = "py_wrapper/flatPlate_unsteady_CHT" pywrapper_unsteadyCHT.cfg_file = "unsteady_CHT_FlatPlate_Conf.cfg" pywrapper_unsteadyCHT.test_iter = 5 - pywrapper_unsteadyCHT.test_vals = [-1.614169, 2.260208, -0.008127, 0.201931] + pywrapper_unsteadyCHT.test_vals = [-1.614168, 2.260661, 0.000880, 0.102124] pywrapper_unsteadyCHT.command = TestCase.Command("mpirun -np 2", "python", "launch_unsteady_CHT_FlatPlate.py --parallel -f") pywrapper_unsteadyCHT.unsteady = True test_list.append(pywrapper_unsteadyCHT) diff --git a/TestCases/parallel_regression_AD.py b/TestCases/parallel_regression_AD.py index b9bf3f91468e..c9e4ae826201 100644 --- a/TestCases/parallel_regression_AD.py +++ b/TestCases/parallel_regression_AD.py @@ -104,7 +104,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -3.126844, -2.284292, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -3.219759, -2.515120, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -158,7 +158,7 @@ def main(): discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle" discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_restart.cfg" discadj_axisymmetric_rans_nozzle.test_iter = 10 - discadj_axisymmetric_rans_nozzle.test_vals = [9.738539, 5.135055, 7.100324, 2.487206] + discadj_axisymmetric_rans_nozzle.test_vals = [9.737649, 5.134194, 7.099939, 2.486935] discadj_axisymmetric_rans_nozzle.no_restart = True test_list.append(discadj_axisymmetric_rans_nozzle) @@ -171,7 +171,7 @@ def main(): discadj_cylinder.cfg_dir = "disc_adj_rans/cylinder" discadj_cylinder.cfg_file = "cylinder.cfg" discadj_cylinder.test_iter = 9 - discadj_cylinder.test_vals = [1.639372, -2.834293, -0.009538, 0.000020] + discadj_cylinder.test_vals = [1.639367, -2.834313, -0.009538, 0.000020] discadj_cylinder.unsteady = True test_list.append(discadj_cylinder) @@ -184,7 +184,7 @@ def main(): discadj_cylinder.cfg_dir = "disc_adj_rans/cylinder" discadj_cylinder.cfg_file = "cylinder_Windowing_AD.cfg" discadj_cylinder.test_iter = 9 - discadj_cylinder.test_vals = [2.183361] + discadj_cylinder.test_vals = [2.183345] discadj_cylinder.unsteady = True test_list.append(discadj_cylinder) @@ -212,7 +212,7 @@ def main(): discadj_DT_1ST_cylinder.cfg_dir = "disc_adj_rans/cylinder_DT_1ST" discadj_DT_1ST_cylinder.cfg_file = "cylinder.cfg" discadj_DT_1ST_cylinder.test_iter = 9 - discadj_DT_1ST_cylinder.test_vals = [1.196414, -3.339029, -0.006212, 0.000020] + discadj_DT_1ST_cylinder.test_vals = [1.196412, -3.339040, -0.006212, 0.000020] discadj_DT_1ST_cylinder.unsteady = True test_list.append(discadj_DT_1ST_cylinder) @@ -225,7 +225,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.115587, -1.573317, -0.006474, 0.000010] + discadj_pitchingNACA0012.test_vals = [-1.141444, -1.588616, -0.006492, 0.000009] discadj_pitchingNACA0012.tol = 0.01 discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -259,7 +259,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.555093, -10.335187, -10.357771, -13.629182] + discadj_trans_stator.test_vals = [79.000000, -7.553958, -10.332913, -10.356693, -13.628002] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.555647, -10.335486, -10.356919, -13.629543] test_list.append(discadj_trans_stator) @@ -268,7 +268,7 @@ def main(): discadj_axial_stage.cfg_dir = "disc_adj_turbomachinery/axial_stage_2D" discadj_axial_stage.cfg_file = "Axial_stage2D.cfg" discadj_axial_stage.test_iter = 79 - discadj_axial_stage.test_vals = [79.000000, -6.500066, -6.635655] + discadj_axial_stage.test_vals = [79.000000, -6.500058, -6.635717] discadj_axial_stage.test_vals_aarch64 = [79.000000, -6.606356, -7.139726] test_list.append(discadj_axial_stage) @@ -315,7 +315,7 @@ def main(): discadj_fsi.cfg_dir = "disc_adj_fsi" discadj_fsi.cfg_file = "config.cfg" discadj_fsi.test_iter = 9 - discadj_fsi.test_vals = [-3.166421, -4.160938, 0.000439, -1.061900] + discadj_fsi.test_vals = [-3.166795, -4.161507, 0.000439, -1.061900] test_list.append(discadj_fsi) # Multi physics framework @@ -478,6 +478,7 @@ def main(): unsteady_naca0012.timeout = 1600 unsteady_naca0012.reference_file = "of_grad_cd.csv.ref" unsteady_naca0012.test_file = "of_grad_cd.csv" + unsteady_naca0012.tol_file_percent = 0.001 unsteady_naca0012.unsteady = True pass_list.append(unsteady_naca0012.run_filediff()) test_list.append(unsteady_naca0012) @@ -495,6 +496,7 @@ def main(): unsteady_naca0012.timeout = 1600 unsteady_naca0012.reference_file = "of_grad_cd.csv.ref" unsteady_naca0012.test_file = "of_grad_cd.csv" + unsteady_naca0012.tol_file_percent = 0.001 unsteady_naca0012.unsteady = True pass_list.append(unsteady_naca0012.run_filediff()) test_list.append(unsteady_naca0012) diff --git a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref index 999eb13891e2..e487bb2c00d0 100644 --- a/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref +++ b/TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0.csv.ref @@ -1,200 +1,200 @@ -199, -1.20, -0.00, 0.00 -0, -2.92, 20.11, 0.00 -1, -4.10, 28.24, 0.00 -2, -5.16, 35.61, 0.00 -3, -6.07, 41.96, 0.00 -4, -6.84, 47.48, 0.00 -5, -7.47, 51.99, 0.00 -6, -7.99, 55.84, 0.00 -7, -8.38, 58.85, 0.00 -8, -8.65, 61.11, 0.00 -9, -8.81, 62.62, 0.00 -10, -8.87, 63.45, 0.00 -11, -8.84, 63.65, 0.00 -12, -8.70, 63.17, 0.00 -13, -8.48, 62.07, 0.00 -14, -8.17, 60.33, 0.00 -15, -7.79, 58.00, 0.00 -16, -7.33, 55.14, 0.00 -17, -6.80, 51.70, 0.00 -18, -6.21, 47.72, 0.00 -19, -5.57, 43.25, 0.00 -20, -4.87, 38.31, 0.00 -21, -4.14, 32.93, 0.00 -22, -3.38, 27.21, 0.00 -23, -2.58, 21.06, 0.00 -24, -1.77, 14.67, 0.00 -25, -0.94, 7.90, 0.00 -26, -0.11, 0.90, 0.00 -27, 0.75, -6.47, 0.00 -28, 1.59, -13.99, 0.00 -29, 2.44, -21.72, 0.00 -30, 3.25, -29.47, 0.00 -31, 4.05, -37.38, 0.00 -32, 4.84, -45.40, 0.00 -33, 5.60, -53.55, 0.00 -34, 6.36, -61.97, 0.00 -35, 7.10, -70.62, 0.00 -36, 7.89, -80.20, 0.00 -37, 8.71, -90.57, 0.00 -38, 9.61, -102.26, 0.00 -39, 10.53, -114.86, 0.00 -40, 11.24, -125.87, 0.00 -41, 11.76, -135.57, 0.00 -42, 12.03, -142.86, 0.00 -43, 12.24, -150.07, 0.00 -44, 12.24, -155.39, 0.00 -45, 11.86, -156.46, 0.00 -46, 11.10, -152.43, 0.00 -47, 10.29, -147.82, 0.00 -48, 10.60, -159.90, 0.00 -49, 11.68, -185.89, 0.00 -50, 9.66, -163.27, 0.00 -51, 3.18, -57.51, 0.00 -52, -1.13, 21.95, 0.00 -53, 13.09, -277.45, 0.00 -54, 23.52, -549.90, 0.00 -55, 22.09, -578.95, 0.00 -56, 18.87, -566.71, 0.00 -57, 15.68, -555.98, 0.00 -58, 12.53, -547.86, 0.00 -59, 9.31, -538.89, 0.00 -60, 6.02, -528.41, 0.00 -61, 2.70, -516.97, 0.00 -62, -0.62, -504.20, 0.00 -63, -3.93, -490.25, 0.00 -64, -7.20, -475.69, 0.00 -65, -10.40, -460.25, 0.00 -66, -13.51, -443.76, 0.00 -67, -16.50, -426.61, 0.00 -68, -19.34, -408.66, 0.00 -69, -22.02, -390.17, 0.00 -70, -24.51, -371.23, 0.00 -71, -26.79, -351.77, 0.00 -72, -28.82, -331.86, 0.00 -73, -30.56, -311.45, 0.00 -74, -32.02, -290.76, 0.00 -75, -33.17, -269.89, 0.00 -76, -33.93, -248.58, 0.00 -77, -34.32, -227.14, 0.00 -78, -34.31, -205.74, 0.00 -79, -33.84, -184.21, 0.00 -80, -32.90, -162.78, 0.00 -81, -31.43, -141.41, 0.00 -82, -29.36, -120.14, 0.00 -83, -26.66, -99.11, 0.00 -84, -23.23, -78.36, 0.00 -85, -19.00, -57.99, 0.00 -86, -13.83, -38.07, 0.00 -87, -7.58, -18.73, 0.00 -88, -0.08, -0.17, 0.00 -89, 8.88, 17.37, 0.00 -90, 19.52, 33.49, 0.00 -91, 32.13, 47.77, 0.00 -92, 46.90, 59.39, 0.00 -93, 64.03, 67.52, 0.00 -94, 83.40, 70.85, 0.00 -95, 103.85, 67.64, 0.00 -96, 123.55, 56.63, 0.00 -97, 140.19, 37.94, 0.00 -98, 109.36, 14.67, 0.00 -99, 71.65, -0.00, 0.00 -100, 107.04, -14.36, 0.00 -101, 132.32, -35.81, 0.00 -102, 110.90, -50.83, 0.00 -103, 87.80, -57.19, 0.00 -104, 65.17, -55.36, 0.00 -105, 44.58, -47.01, 0.00 -106, 26.89, -34.05, 0.00 -107, 12.05, -17.91, 0.00 -108, -0.31, 0.53, 0.00 -109, -10.50, 20.54, 0.00 -110, -18.88, 41.66, 0.00 -111, -25.69, 63.51, 0.00 -112, -31.22, 85.95, 0.00 -113, -35.63, 108.76, 0.00 -114, -39.11, 131.90, 0.00 -115, -41.77, 155.28, 0.00 -116, -43.70, 178.80, 0.00 -117, -45.01, 202.51, 0.00 -118, -45.73, 226.24, 0.00 -119, -45.92, 249.93, 0.00 -120, -45.64, 273.69, 0.00 -121, -44.91, 297.20, 0.00 -122, -43.78, 320.72, 0.00 -123, -42.28, 344.01, 0.00 -124, -40.39, 366.73, 0.00 -125, -38.21, 389.37, 0.00 -126, -35.77, 411.98, 0.00 -127, -33.06, 434.11, 0.00 -128, -30.09, 455.66, 0.00 -129, -26.90, 476.54, 0.00 -130, -23.52, 496.93, 0.00 -131, -19.99, 516.80, 0.00 -132, -16.32, 535.94, 0.00 -133, -12.53, 554.54, 0.00 -134, -8.66, 572.15, 0.00 -135, -4.72, 588.94, 0.00 -136, -0.75, 605.28, 0.00 -137, 3.25, 620.52, 0.00 -138, 7.23, 634.61, 0.00 -139, 11.19, 648.16, 0.00 -140, 15.11, 660.74, 0.00 -141, 18.95, 671.89, 0.00 -142, 22.72, 682.27, 0.00 -143, 26.39, 691.85, 0.00 -144, 29.95, 700.18, 0.00 -145, 33.36, 707.21, 0.00 -146, 36.65, 713.40, 0.00 -147, 39.79, 718.51, 0.00 -148, 42.75, 722.25, 0.00 -149, 45.54, 724.84, 0.00 -150, 48.02, 724.24, 0.00 -151, 51.10, 733.90, 0.00 -152, 54.32, 746.21, 0.00 -153, 22.28, 293.80, 0.00 -154, -1.65, -20.95, 0.00 -155, 2.74, 33.57, 0.00 -156, 4.21, 49.97, 0.00 -157, 4.36, 50.23, 0.00 -158, 4.78, 53.56, 0.00 -159, 4.98, 54.36, 0.00 -160, 5.00, 53.19, 0.00 -161, 4.89, 50.85, 0.00 -162, 4.69, 47.62, 0.00 -163, 4.39, 43.67, 0.00 -164, 4.00, 39.02, 0.00 -165, 3.53, 33.75, 0.00 -166, 3.00, 28.14, 0.00 -167, 2.40, 22.09, 0.00 -168, 1.76, 15.92, 0.00 -169, 1.06, 9.46, 0.00 -170, 0.35, 3.03, 0.00 -171, -0.41, -3.52, 0.00 -172, -1.16, -9.89, 0.00 -173, -1.93, -16.22, 0.00 -174, -2.69, -22.27, 0.00 -175, -3.45, -28.15, 0.00 -176, -4.19, -33.74, 0.00 -177, -4.90, -39.00, 0.00 -178, -5.58, -43.85, 0.00 -179, -6.22, -48.33, 0.00 -180, -6.81, -52.34, 0.00 -181, -7.35, -55.89, 0.00 -182, -7.84, -58.94, 0.00 -183, -8.25, -61.43, 0.00 -184, -8.59, -63.43, 0.00 -185, -8.86, -64.81, 0.00 -186, -9.04, -65.58, 0.00 -187, -9.12, -65.71, 0.00 -188, -9.11, -65.16, 0.00 -189, -9.01, -63.99, 0.00 -190, -8.80, -62.16, 0.00 -191, -8.48, -59.60, 0.00 -192, -8.05, -56.31, 0.00 -193, -7.50, -52.22, 0.00 -194, -6.84, -47.48, 0.00 -195, -6.04, -41.77, 0.00 -196, -5.11, -35.28, 0.00 -197, -4.03, -27.80, 0.00 -198, -2.84, -19.56, 0.00 +199, -1.21, -0.00, 0.00 +0, -2.95, 20.31, 0.00 +1, -4.14, 28.56, 0.00 +2, -5.23, 36.07, 0.00 +3, -6.15, 42.56, 0.00 +4, -6.95, 48.22, 0.00 +5, -7.60, 52.88, 0.00 +6, -8.14, 56.88, 0.00 +7, -8.55, 60.05, 0.00 +8, -8.85, 62.47, 0.00 +9, -9.03, 64.15, 0.00 +10, -9.11, 65.17, 0.00 +11, -9.10, 65.57, 0.00 +12, -9.00, 65.29, 0.00 +13, -8.80, 64.41, 0.00 +14, -8.52, 62.91, 0.00 +15, -8.16, 60.82, 0.00 +16, -7.74, 58.26, 0.00 +17, -7.26, 55.15, 0.00 +18, -6.71, 51.55, 0.00 +19, -6.11, 47.48, 0.00 +20, -5.46, 42.92, 0.00 +21, -4.77, 37.96, 0.00 +22, -4.04, 32.56, 0.00 +23, -3.28, 26.75, 0.00 +24, -2.49, 20.59, 0.00 +25, -1.68, 14.05, 0.00 +26, -0.84, 7.16, 0.00 +27, 0.01, -0.05, 0.00 +28, 0.86, -7.58, 0.00 +29, 1.73, -15.40, 0.00 +30, 2.59, -23.50, 0.00 +31, 3.45, -31.85, 0.00 +32, 4.31, -40.48, 0.00 +33, 5.16, -49.33, 0.00 +34, 5.99, -58.37, 0.00 +35, 6.80, -67.63, 0.00 +36, 7.58, -77.07, 0.00 +37, 8.33, -86.61, 0.00 +38, 9.05, -96.30, 0.00 +39, 9.72, -106.03, 0.00 +40, 10.33, -115.73, 0.00 +41, 10.88, -125.33, 0.00 +42, 11.35, -134.83, 0.00 +43, 11.74, -144.02, 0.00 +44, 12.03, -152.80, 0.00 +45, 12.19, -160.80, 0.00 +46, 12.22, -167.88, 0.00 +47, 12.05, -173.14, 0.00 +48, 11.69, -176.34, 0.00 +49, 11.20, -178.21, 0.00 +50, 10.24, -172.94, 0.00 +51, 7.58, -136.87, 0.00 +52, 6.77, -131.80, 0.00 +53, 19.38, -410.91, 0.00 +54, 25.71, -601.18, 0.00 +55, 21.94, -575.27, 0.00 +56, 18.60, -558.71, 0.00 +57, 15.62, -553.59, 0.00 +58, 12.49, -546.26, 0.00 +59, 9.27, -536.95, 0.00 +60, 6.00, -526.55, 0.00 +61, 2.70, -515.32, 0.00 +62, -0.62, -502.79, 0.00 +63, -3.92, -489.02, 0.00 +64, -7.18, -474.61, 0.00 +65, -10.38, -459.26, 0.00 +66, -13.48, -442.84, 0.00 +67, -16.47, -425.74, 0.00 +68, -19.30, -407.83, 0.00 +69, -21.98, -389.37, 0.00 +70, -24.46, -370.46, 0.00 +71, -26.73, -351.02, 0.00 +72, -28.75, -331.13, 0.00 +73, -30.49, -310.72, 0.00 +74, -31.94, -290.04, 0.00 +75, -33.08, -269.18, 0.00 +76, -33.84, -247.89, 0.00 +77, -34.22, -226.47, 0.00 +78, -34.21, -205.11, 0.00 +79, -33.73, -183.59, 0.00 +80, -32.78, -162.18, 0.00 +81, -31.30, -140.83, 0.00 +82, -29.23, -119.59, 0.00 +83, -26.52, -98.59, 0.00 +84, -23.09, -77.87, 0.00 +85, -18.85, -57.53, 0.00 +86, -13.67, -37.65, 0.00 +87, -7.42, -18.34, 0.00 +88, 0.09, 0.19, 0.00 +89, 9.05, 17.69, 0.00 +90, 19.68, 33.77, 0.00 +91, 32.29, 48.01, 0.00 +92, 47.05, 59.58, 0.00 +93, 64.16, 67.65, 0.00 +94, 83.50, 70.93, 0.00 +95, 103.90, 67.68, 0.00 +96, 123.54, 56.62, 0.00 +97, 140.08, 37.91, 0.00 +98, 109.21, 14.66, 0.00 +99, 71.53, -0.00, 0.00 +100, 106.82, -14.33, 0.00 +101, 131.96, -35.72, 0.00 +102, 110.47, -50.63, 0.00 +103, 87.33, -56.88, 0.00 +104, 64.68, -54.95, 0.00 +105, 44.09, -46.49, 0.00 +106, 26.40, -33.44, 0.00 +107, 11.57, -17.20, 0.00 +108, -0.77, 1.32, 0.00 +109, -10.94, 21.41, 0.00 +110, -19.30, 42.60, 0.00 +111, -26.09, 64.50, 0.00 +112, -31.60, 87.00, 0.00 +113, -35.99, 109.87, 0.00 +114, -39.45, 133.06, 0.00 +115, -42.09, 156.48, 0.00 +116, -44.01, 180.06, 0.00 +117, -45.30, 203.81, 0.00 +118, -46.00, 227.59, 0.00 +119, -46.18, 251.33, 0.00 +120, -45.89, 275.15, 0.00 +121, -45.13, 298.70, 0.00 +122, -43.99, 322.26, 0.00 +123, -42.47, 345.60, 0.00 +124, -40.57, 368.36, 0.00 +125, -38.38, 391.04, 0.00 +126, -35.92, 413.69, 0.00 +127, -33.19, 435.86, 0.00 +128, -30.21, 457.44, 0.00 +129, -27.00, 478.36, 0.00 +130, -23.61, 498.79, 0.00 +131, -20.06, 518.70, 0.00 +132, -16.38, 537.89, 0.00 +133, -12.58, 556.52, 0.00 +134, -8.69, 574.17, 0.00 +135, -4.74, 591.00, 0.00 +136, -0.75, 607.39, 0.00 +137, 3.26, 622.66, 0.00 +138, 7.26, 636.80, 0.00 +139, 11.23, 650.40, 0.00 +140, 15.16, 663.02, 0.00 +141, 19.02, 674.22, 0.00 +142, 22.80, 684.65, 0.00 +143, 26.48, 694.28, 0.00 +144, 30.05, 702.63, 0.00 +145, 33.48, 709.70, 0.00 +146, 36.78, 715.92, 0.00 +147, 39.93, 721.11, 0.00 +148, 42.92, 725.06, 0.00 +149, 45.75, 728.21, 0.00 +150, 48.35, 729.16, 0.00 +151, 50.54, 725.91, 0.00 +152, 54.65, 750.78, 0.00 +153, 51.39, 677.66, 0.00 +154, 6.89, 87.55, 0.00 +155, -0.23, -2.86, 0.00 +156, 3.37, 40.04, 0.00 +157, 3.82, 43.99, 0.00 +158, 4.05, 45.34, 0.00 +159, 4.27, 46.63, 0.00 +160, 4.30, 45.71, 0.00 +161, 4.17, 43.33, 0.00 +162, 3.92, 39.87, 0.00 +163, 3.58, 35.59, 0.00 +164, 3.15, 30.68, 0.00 +165, 2.65, 25.33, 0.00 +166, 2.09, 19.62, 0.00 +167, 1.48, 13.68, 0.00 +168, 0.84, 7.61, 0.00 +169, 0.17, 1.48, 0.00 +170, -0.53, -4.65, 0.00 +171, -1.24, -10.70, 0.00 +172, -1.95, -16.63, 0.00 +173, -2.67, -22.41, 0.00 +174, -3.38, -27.97, 0.00 +175, -4.08, -33.26, 0.00 +176, -4.76, -38.32, 0.00 +177, -5.41, -43.03, 0.00 +178, -6.03, -47.39, 0.00 +179, -6.62, -51.39, 0.00 +180, -7.16, -54.97, 0.00 +181, -7.65, -58.12, 0.00 +182, -8.08, -60.82, 0.00 +183, -8.46, -63.00, 0.00 +184, -8.77, -64.74, 0.00 +185, -9.01, -65.93, 0.00 +186, -9.17, -66.52, 0.00 +187, -9.24, -66.54, 0.00 +188, -9.21, -65.89, 0.00 +189, -9.10, -64.66, 0.00 +190, -8.89, -62.77, 0.00 +191, -8.57, -60.17, 0.00 +192, -8.13, -56.85, 0.00 +193, -7.57, -52.71, 0.00 +194, -6.91, -47.93, 0.00 +195, -6.10, -42.17, 0.00 +196, -5.16, -35.60, 0.00 +197, -4.07, -28.05, 0.00 +198, -2.86, -19.72, 0.00 diff --git a/TestCases/rans/flatplate/turb_SA_flatplate_mg_linear.cfg b/TestCases/rans/flatplate/turb_SA_flatplate_mg_linear.cfg new file mode 100644 index 000000000000..ae071786deb8 --- /dev/null +++ b/TestCases/rans/flatplate/turb_SA_flatplate_mg_linear.cfg @@ -0,0 +1,123 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Flat plate SA, linear multigrid prolongation % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2011.11.10 % +% File Version 8.6.0 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= RANS +KIND_TURB_MODEL= SA +MATH_PROBLEM= DIRECT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% +% +MACH_NUMBER= 0.2 +AOA= 0.0 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 300.0 +REYNOLDS_NUMBER= 5000000.0 +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 2.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( wall, 0.0 ) +MARKER_INLET= ( inlet, 302.4, 118309.784, 1.0, 0.0, 0.0 ) +MARKER_OUTLET= ( outlet, 115056.0, farfield, 115056.0 ) +MARKER_SYM= ( symmetry ) +MARKER_PLOTTING= ( wall ) +MARKER_MONITORING= ( wall ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1000.0 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +ITER= 1000 + +% ----------------------- SLOPE LIMITER DEFINITION ----------------------------% +% +VENKAT_LIMITER_COEFF= 0.1 +ADJ_SHARP_LIMITER_COEFF= 3.0 +REF_SHARP_EDGES= 3.0 +SENS_REMOVE_SHARP= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-3 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +MGLEVEL= 3 +MGCYCLE= V_CYCLE +MG_PRE_SMOOTH= ( 2, 2, 2, 2 ) +MG_POST_SMOOTH= ( 2, 2, 2, 2) +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +MG_DAMP_RESTRICTION= 0.75 +MG_DAMP_PROLONGATION= 0.75 +MG_IMPLICIT_LINES= YES +MG_LINEAR_PROLONGATION= YES + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +MUSCL_FIRST_ORDER_WALL_ENDS= YES +SLOPE_LIMITER_FLOW= NONE +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_RESIDUAL_MINVAL= -12 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= mesh_flatplate_turb_137x97.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out +SOLUTION_FILENAME= solution_flow +SOLUTION_ADJ_FILENAME= solution_adj +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow +RESTART_ADJ_FILENAME= restart_adj +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 1000 +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG, LINSOL_ITER,LINSOL_RESIDUAL) +% +% Weight the partitioning by cell anisotropy and keep wall-normal lines on one rank +PARMETIS_ANISOTROPY_WEIGHT= YES diff --git a/TestCases/rans/flatplate/turb_SST_flatplate_fullmg.cfg b/TestCases/rans/flatplate/turb_SST_flatplate_fullmg.cfg new file mode 100644 index 000000000000..e5bb085e9f0d --- /dev/null +++ b/TestCases/rans/flatplate/turb_SST_flatplate_fullmg.cfg @@ -0,0 +1,122 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Flat plate SST, full multigrid startup % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2011.11.10 % +% File Version 8.6.0 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% +% +SOLVER= RANS +KIND_TURB_MODEL= SST +MATH_PROBLEM= DIRECT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% +% +MACH_NUMBER= 0.2 +AOA= 0.0 +SIDESLIP_ANGLE= 0.0 +FREESTREAM_TEMPERATURE= 300.0 +REYNOLDS_NUMBER= 5000000.0 +REYNOLDS_LENGTH= 1.0 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 2.0 + +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +% +MARKER_HEATFLUX= ( wall, 0.0 ) +MARKER_INLET= ( inlet, 302.4, 118309.784, 1.0, 0.0, 0.0 ) +MARKER_OUTLET= ( outlet, 115056.0, farfield, 115056.0 ) +MARKER_SYM= ( symmetry ) +MARKER_PLOTTING= ( wall ) +MARKER_MONITORING= ( wall ) + +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% +NUM_METHOD_GRAD= GREEN_GAUSS +CFL_NUMBER= 1000.0 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 ) +RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 ) +ITER= 1000 + +% ----------------------- SLOPE LIMITER DEFINITION ----------------------------% +% +VENKAT_LIMITER_COEFF= 0.1 +ADJ_SHARP_LIMITER_COEFF= 3.0 +REF_SHARP_EDGES= 3.0 +SENS_REMOVE_SHARP= NO + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= LU_SGS +LINEAR_SOLVER_ERROR= 1E-3 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% +% +MGLEVEL= 3 +MGCYCLE= FULLMG_CYCLE +MG_STARTUP_ITER= 10 +MG_PRE_SMOOTH= ( 2, 2, 2, 2 ) +MG_POST_SMOOTH= ( 2, 2, 2, 2) +MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +MG_DAMP_RESTRICTION= 0.75 +MG_DAMP_PROLONGATION= 0.75 +MG_IMPLICIT_LINES= YES + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +SLOPE_LIMITER_FLOW= NONE +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +MUSCL_TURB= NO +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +TIME_DISCRE_TURB= EULER_IMPLICIT + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% +CONV_RESIDUAL_MINVAL= -12 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% +MESH_FILENAME= mesh_flatplate_turb_137x97.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out +SOLUTION_FILENAME= solution_flow +SOLUTION_ADJ_FILENAME= solution_adj +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow +RESTART_ADJ_FILENAME= restart_adj +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 1000 +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_TKE, RMS_DISSIPATION, LIFT, DRAG) +% +% Turbulence iterations per flow iteration +TURB_SUBITER= 2 diff --git a/TestCases/serial_regression.py b/TestCases/serial_regression.py index ed41021a7c9a..937172686873 100755 --- a/TestCases/serial_regression.py +++ b/TestCases/serial_regression.py @@ -95,7 +95,7 @@ def main(): channel.cfg_dir = "euler/channel" channel.cfg_file = "inv_channel_RK.cfg" channel.test_iter = 10 - channel.test_vals = [-1.906687, 3.625653, -0.011054, 0.205254, 1.000000] + channel.test_vals = [-2.139147, 3.402856, 0.145706, 0.157472, 1.000000] test_list.append(channel) # NACA0012 @@ -103,7 +103,7 @@ def main(): naca0012.cfg_dir = "euler/naca0012" naca0012.cfg_file = "inv_NACA0012_Roe.cfg" naca0012.test_iter = 20 - naca0012.test_vals = [-4.031446, -3.524530, 0.273056, 0.009703] + naca0012.test_vals = [-4.561230, -3.981698, 0.297778, 0.026136] test_list.append(naca0012) # NACA0012 - FMG test @@ -111,7 +111,7 @@ def main(): naca0012_FMG.cfg_dir = "euler/naca0012" naca0012_FMG.cfg_file = "inv_NACA0012.cfg" naca0012_FMG.test_iter = 20 - naca0012_FMG.test_vals = [-4.166393, -3.569881, 0.297999, 0.017053] + naca0012_FMG.test_vals = [-4.079993, -3.483233, 0.283691, 0.015265] test_list.append(naca0012_FMG) # Supersonic wedge @@ -119,7 +119,7 @@ def main(): wedge.cfg_dir = "euler/wedge" wedge.cfg_file = "inv_wedge_HLLC.cfg" wedge.test_iter = 20 - wedge.test_vals = [-4.350229, 1.379632, -0.249526, 0.043953] + wedge.test_vals = [-4.159759, 1.569071, -0.249526, 0.043953] test_list.append(wedge) # Supersonic biparabolic airfoil @@ -127,7 +127,7 @@ def main(): biparabolic.cfg_dir = "euler/biparabolic" biparabolic.cfg_file = "BIPARABOLIC.cfg" biparabolic.test_iter = 25 - biparabolic.test_vals = [-2.171577, 0.466003, 0.284966, 3.430832] + biparabolic.test_vals = [-2.188810, 0.428611, 0.270065, 3.418600] test_list.append(biparabolic) # ONERA M6 Wing @@ -135,7 +135,7 @@ def main(): oneram6.cfg_dir = "euler/oneram6" oneram6.cfg_file = "inv_ONERAM6.cfg" oneram6.test_iter = 10 - oneram6.test_vals = [-4.810596, -4.204431, 0.276777, 0.006518] + oneram6.test_vals = [-4.770858, -4.164782, 0.275761, 0.006022] oneram6.timeout = 9600 test_list.append(oneram6) @@ -144,7 +144,7 @@ def main(): fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" fixedCL_naca0012.cfg_file = "inv_NACA0012.cfg" fixedCL_naca0012.test_iter = 10 - fixedCL_naca0012.test_vals = [-3.872581, 1.641257, 0.301006, 0.019480] + fixedCL_naca0012.test_vals = [-3.875490, 1.638062, 0.301010, 0.019480] test_list.append(fixedCL_naca0012) # Polar sweep of the inviscid NACA0012 @@ -153,7 +153,7 @@ def main(): polar_naca0012.cfg_file = "inv_NACA0012.cfg" polar_naca0012.polar = True polar_naca0012.test_iter = 10 - polar_naca0012.test_vals = [-1.312269, 4.164334, -0.000071, 0.113101] + polar_naca0012.test_vals = [-1.250177, 4.201501, -0.001984, 0.081980] polar_naca0012.test_vals_aarch64 = [-1.063447, 4.401847, 0.000291, 0.031696] polar_naca0012.command = TestCase.Command(exec = "compute_polar.py", param = "-n 1 -i 11") # flaky test on arm64 @@ -173,7 +173,7 @@ def main(): inv_channel.cfg_dir = "euler/channel" inv_channel.cfg_file = "inv_channel.cfg" inv_channel.test_iter = 20 - inv_channel.test_vals = [-4.418376, -1.269655, -2.009395, 1.032228, 5.000000, -0.424585, 0.000080, -0.002653, 1000.000000] + inv_channel.test_vals = [-3.612713, -0.787561, -1.835495, 1.690293, 5.000000, -0.023068, -0.006001, -0.011194, 1000.000000] test_list.append(inv_channel) # CRM DPW4 wing-body, transonic @@ -181,7 +181,7 @@ def main(): inv_crm_jst.cfg_dir = "euler/CRM" inv_crm_jst.cfg_file = "inv_CRM_JST.cfg" inv_crm_jst.test_iter = 20 - inv_crm_jst.test_vals = [-2.057543, -1.908317, -1.902763, -1.770370, -1.455672] + inv_crm_jst.test_vals = [-2.054533, -1.906359, -1.899461, -1.760903, -1.452321] test_list.append(inv_crm_jst) ########################## @@ -200,7 +200,7 @@ def main(): flatplate.cfg_dir = "navierstokes/flatplate" flatplate.cfg_file = "lam_flatplate.cfg" flatplate.test_iter = 20 - flatplate.test_vals = [-5.623336, -0.144687, 0.001202, 0.028141, 2.361500, -2.333400, 0.000000, 0.000000] + flatplate.test_vals = [-5.694291, -0.217445, 0.001137, 0.030113, 2.361500, -2.331400, 0.000000, 0.000000] test_list.append(flatplate) # Laminar cylinder (steady) @@ -208,7 +208,7 @@ def main(): cylinder.cfg_dir = "navierstokes/cylinder" cylinder.cfg_file = "lam_cylinder.cfg" cylinder.test_iter = 25 - cylinder.test_vals = [-8.725171, -3.234867, -0.028017, 1.605526, 0.000000] + cylinder.test_vals = [-8.734576, -3.244748, -0.011923, 1.603493, 0.000000] test_list.append(cylinder) # Laminar cylinder (low Mach correction) @@ -216,7 +216,7 @@ def main(): cylinder_lowmach.cfg_dir = "navierstokes/cylinder" cylinder_lowmach.cfg_file = "cylinder_lowmach.cfg" cylinder_lowmach.test_iter = 25 - cylinder_lowmach.test_vals = [-8.698687, -3.236566, 0.401347, 1.754864, 0.000000] + cylinder_lowmach.test_vals = [-8.508810, -3.046383, 0.350691, 1.706690, 0.000000] test_list.append(cylinder_lowmach) # Laminar NACA0012 with linelet preconditioner (see #2877) @@ -224,7 +224,7 @@ def main(): lam_naca0012_linelet.cfg_dir = "navierstokes/naca0012" lam_naca0012_linelet.cfg_file = "lam_NACA0012_LINELET.cfg" lam_naca0012_linelet.test_iter = 20 - lam_naca0012_linelet.test_vals = [-5.345007, -2.936878, -2.943454, 0.096356] + lam_naca0012_linelet.test_vals = [-5.451332, -2.920406, -3.069535, 0.254095] test_list.append(lam_naca0012_linelet) # 2D Poiseuille flow (body force driven with periodic inlet / outlet) @@ -240,7 +240,7 @@ def main(): poiseuille_profile.cfg_dir = "navierstokes/poiseuille" poiseuille_profile.cfg_file = "profile_poiseuille.cfg" poiseuille_profile.test_iter = 10 - poiseuille_profile.test_vals = [-12.003109, -7.625653, -0.000000, 2.089953] + poiseuille_profile.test_vals = [-12.010777, -7.648201, -0.000000, 2.089953] poiseuille_profile.test_vals_aarch64 = [-12.009012, -7.262299, -0.000000, 2.089953] #last 4 columns test_list.append(poiseuille_profile) @@ -249,7 +249,7 @@ def main(): lam_naca0012.cfg_dir = "navierstokes/naca0012" lam_naca0012.cfg_file = "lam_NACA0012.cfg" lam_naca0012.test_iter = 20 - lam_naca0012.test_vals = [-5.476452, -3.192160, -3.250578, -0.070055] + lam_naca0012.test_vals = [-5.560757, -3.216919, -3.356493, -0.150846] test_list.append(lam_naca0012) ########################## @@ -268,7 +268,7 @@ def main(): rae2822_sa.cfg_dir = "rans/rae2822" rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg" rae2822_sa.test_iter = 20 - rae2822_sa.test_vals = [-3.113327, -5.315736, 0.778701, 0.019425, 1000.000000] + rae2822_sa.test_vals = [-3.033969, -5.292434, 0.780732, 0.019615, 1000.000000] test_list.append(rae2822_sa) # RAE2822 SST @@ -276,7 +276,7 @@ def main(): rae2822_sst.cfg_dir = "rans/rae2822" rae2822_sst.cfg_file = "turb_SST_RAE2822.cfg" rae2822_sst.test_iter = 20 - rae2822_sst.test_vals = [-1.855554, -1.481446, 5.882734, 0.596351, 0.018839, 100.000000] + rae2822_sst.test_vals = [-2.027466, -1.348503, 5.895325, 0.631054, 0.015689, 100.000000] test_list.append(rae2822_sst) # RAE2822 SST_SUST @@ -284,7 +284,7 @@ def main(): rae2822_sst_sust.cfg_dir = "rans/rae2822" rae2822_sst_sust.cfg_file = "turb_SST_SUST_RAE2822.cfg" rae2822_sst_sust.test_iter = 20 - rae2822_sst_sust.test_vals = [-2.464280, 5.853495, 0.490541, 0.042528] + rae2822_sst_sust.test_vals = [-2.487979, 5.831691, 0.681067, 0.017850] test_list.append(rae2822_sst_sust) # Flat plate @@ -292,9 +292,25 @@ def main(): turb_flatplate.cfg_dir = "rans/flatplate" turb_flatplate.cfg_file = "turb_SA_flatplate.cfg" turb_flatplate.test_iter = 20 - turb_flatplate.test_vals = [-5.286997, -6.483481, -0.187358, 0.003712, 10.000000, -2.181754] + turb_flatplate.test_vals = [-2.875833, -6.057824, -0.191856, 0.003148, 10.000000, -2.533595] test_list.append(turb_flatplate) + # FLAT PLATE, LINEAR MULTIGRID PROLONGATION, FIRST ORDER AT THE WALL END, ANISOTROPIC PARTITIONING + turb_flatplate_mg_linear = TestCase('turb_flatplate_mg_linear') + turb_flatplate_mg_linear.cfg_dir = "rans/flatplate" + turb_flatplate_mg_linear.cfg_file = "turb_SA_flatplate_mg_linear.cfg" + turb_flatplate_mg_linear.test_iter = 20 + turb_flatplate_mg_linear.test_vals = [-4.750399, -6.020779, -0.186911, 0.002849, 7.000000, -3.025969] + test_list.append(turb_flatplate_mg_linear) + + # FLAT PLATE, SST, FULL MULTIGRID STARTUP, TURBULENCE SUB-ITERATIONS + turb_flatplate_sst_fullmg = TestCase('turb_flatplate_sst_fullmg') + turb_flatplate_sst_fullmg.cfg_dir = "rans/flatplate" + turb_flatplate_sst_fullmg.cfg_file = "turb_SST_flatplate_fullmg.cfg" + turb_flatplate_sst_fullmg.test_iter = 20 + turb_flatplate_sst_fullmg.test_vals = [-5.615986, -2.397263, 6.169223, -0.187272, 0.001153] + test_list.append(turb_flatplate_sst_fullmg) + # FLAT PLATE, WALL FUNCTIONS, COMPRESSIBLE SST turb_wallfunction_flatplate_sst = TestCase('turb_sst_wallfunction_flatplate') turb_wallfunction_flatplate_sst.cfg_dir = "wallfunctions/flatplate/compressible_SST" @@ -333,7 +349,7 @@ def main(): turb_naca0012_sa.cfg_dir = "rans/naca0012" turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" turb_naca0012_sa.test_iter = 5 - turb_naca0012_sa.test_vals = [-12.037320, -16.384159, 1.080346, 0.018385, 20.000000, -3.457056, 20.000000, -4.641265, 0.000000] + turb_naca0012_sa.test_vals = [-12.037294, -16.384159, 1.080346, 0.018385, 20.000000, -3.456773, 20.000000, -4.641241, 0.000000] turb_naca0012_sa.test_vals_aarch64 = [-12.037297, -16.384158, 1.080346, 0.018385, 20.000000, -3.455886, 20.000000, -4.641247, 0.000000] turb_naca0012_sa.timeout = 3200 test_list.append(turb_naca0012_sa) @@ -403,7 +419,7 @@ def main(): turb_sst_flatplate.cfg_dir = "rans/flatplate" turb_sst_flatplate.cfg_file = "turb_SST_flatplate.cfg" turb_sst_flatplate.test_iter = 20 - turb_sst_flatplate.test_vals = [-5.355794, -2.389965, -2.978049, 0.128709, -2.673382, 5.640897] + turb_sst_flatplate.test_vals = [-5.237309, -2.258055, -2.652985, 0.248456, -1.445643, 6.813102] test_list.append(turb_sst_flatplate) # S809 wind turbine airfoil, SA @@ -423,7 +439,7 @@ def main(): axi_rans_air_nozzle_restart.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_restart.cfg_file = "air_nozzle_restart.cfg" axi_rans_air_nozzle_restart.test_iter = 10 - axi_rans_air_nozzle_restart.test_vals = [-5.118831, 0.457732, -1.640628, 2.890364, 0.000000] + axi_rans_air_nozzle_restart.test_vals = [-5.118839, 0.457719, -1.640848, 2.890044, 0.000000] axi_rans_air_nozzle_restart.test_vals_aarch64 = [-14.143715, -9.170705, -10.848554, -5.776746, 0.000000] axi_rans_air_nozzle_restart.tol = 0.0001 test_list.append(axi_rans_air_nozzle_restart) @@ -433,7 +449,7 @@ def main(): axi_rans_air_nozzle_density_velocity.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_density_velocity.cfg_file = "air_nozzle_density_velocity.cfg" axi_rans_air_nozzle_density_velocity.test_iter = 10 - axi_rans_air_nozzle_density_velocity.test_vals = [704.800000, -1.879849, 4.023872, 0.501073, 4.420427] + axi_rans_air_nozzle_density_velocity.test_vals = [704.800000, -1.879848, 4.023872, 0.501091, 4.420520] test_list.append(axi_rans_air_nozzle_density_velocity) # Axisymmetric air nozzle species @@ -441,7 +457,7 @@ def main(): axi_rans_air_nozzle_species.cfg_dir = "axisymmetric_rans/air_nozzle" axi_rans_air_nozzle_species.cfg_file = "air_nozzle_species.cfg" axi_rans_air_nozzle_species.test_iter = 10 - axi_rans_air_nozzle_species.test_vals = [-2.815444, 2.750418, -2.610818, 5.885227, -3.280961, 0.000000] + axi_rans_air_nozzle_species.test_vals = [-2.816390, 2.749474, -2.601965, 5.886404, -3.196843, 0.000000] axi_rans_air_nozzle_species.tol = 0.0001 test_list.append(axi_rans_air_nozzle_species) @@ -455,7 +471,7 @@ def main(): turb_naca0012_sst_restart_mg.cfg_file = "turb_NACA0012_sst_multigrid_restart.cfg" turb_naca0012_sst_restart_mg.test_iter = 50 turb_naca0012_sst_restart_mg.ntest_vals = 5 - turb_naca0012_sst_restart_mg.test_vals = [-3.651425, -5.081632, 0.810583, -0.009209, 0.078505] + turb_naca0012_sst_restart_mg.test_vals = [-3.543714, -5.081773, 0.810280, -0.008927, 0.077963] turb_naca0012_sst_restart_mg.timeout = 3200 turb_naca0012_sst_restart_mg.tol = 0.000001 test_list.append(turb_naca0012_sst_restart_mg) @@ -476,7 +492,7 @@ def main(): inc_euler_naca0012.cfg_dir = "incomp_euler/naca0012" inc_euler_naca0012.cfg_file = "incomp_NACA0012.cfg" inc_euler_naca0012.test_iter = 20 - inc_euler_naca0012.test_vals = [-6.814482, -6.001232, 0.531760, 0.008476] + inc_euler_naca0012.test_vals = [-6.911475, -6.089380, 0.531812, 0.008473] test_list.append(inc_euler_naca0012) # NACA0012 Hydrofoil, pressure-based @@ -492,7 +508,7 @@ def main(): inc_nozzle.cfg_dir = "incomp_euler/nozzle" inc_nozzle.cfg_file = "inv_nozzle.cfg" inc_nozzle.test_iter = 20 - inc_nozzle.test_vals = [-6.331969, -5.586818, -0.024387, 0.126306] + inc_nozzle.test_vals = [-6.335654, -5.591338, -0.026718, 0.126024] test_list.append(inc_nozzle) ############################# @@ -511,7 +527,7 @@ def main(): inc_lam_cylinder.cfg_dir = "incomp_navierstokes/cylinder" inc_lam_cylinder.cfg_file = "incomp_cylinder.cfg" inc_lam_cylinder.test_iter = 10 - inc_lam_cylinder.test_vals = [-4.809141, -5.026921, 0.000880, 3.118344] + inc_lam_cylinder.test_vals = [-4.838457, -4.926058, 0.002655, 3.096925] test_list.append(inc_lam_cylinder) # Laminar cylinder, pressure-based @@ -708,7 +724,7 @@ def main(): contadj_naca0012.cfg_dir = "cont_adj_euler/naca0012" contadj_naca0012.cfg_file = "inv_NACA0012.cfg" contadj_naca0012.test_iter = 5 - contadj_naca0012.test_vals = [-9.552105, -15.069398, -0.726250, 0.020280] + contadj_naca0012.test_vals = [-9.539906, -15.090660, -0.726250, 0.020280] contadj_naca0012.tol = 0.001 test_list.append(contadj_naca0012) @@ -717,7 +733,7 @@ def main(): contadj_oneram6.cfg_dir = "cont_adj_euler/oneram6" contadj_oneram6.cfg_file = "inv_ONERAM6.cfg" contadj_oneram6.test_iter = 10 - contadj_oneram6.test_vals = [-12.083324, -12.644564, -1.086100, 0.007556] + contadj_oneram6.test_vals = [-12.028740, -12.585768, -1.086100, 0.007556] test_list.append(contadj_oneram6) # Inviscid WEDGE: tests averaged outflow total pressure adjoint @@ -733,7 +749,7 @@ def main(): contadj_fixedCL_naca0012.cfg_dir = "fixed_cl/naca0012" contadj_fixedCL_naca0012.cfg_file = "inv_NACA0012_ContAdj.cfg" contadj_fixedCL_naca0012.test_iter = 100 - contadj_fixedCL_naca0012.test_vals = [1.408733, -4.007034, -0.024992, 0.004182] + contadj_fixedCL_naca0012.test_vals = [1.375003, -4.047516, -0.026472, 0.003657] test_list.append(contadj_fixedCL_naca0012) ################################### @@ -752,7 +768,7 @@ def main(): contadj_ns_cylinder.cfg_dir = "cont_adj_navierstokes/cylinder" contadj_ns_cylinder.cfg_file = "lam_cylinder.cfg" contadj_ns_cylinder.test_iter = 20 - contadj_ns_cylinder.test_vals = [-3.634026, -9.089553, 2.056700, -0.000000] + contadj_ns_cylinder.test_vals = [-3.633957, -9.089467, 2.056700, -0.000000] test_list.append(contadj_ns_cylinder) # Adjoint laminar naca0012 subsonic @@ -796,7 +812,7 @@ def main(): contadj_rans_rae2822.cfg_dir = "cont_adj_rans/rae2822" contadj_rans_rae2822.cfg_file = "turb_SA_RAE2822.cfg" contadj_rans_rae2822.test_iter = 20 - contadj_rans_rae2822.test_vals = [-5.399078, -10.904106, -0.212470, 0.005448] + contadj_rans_rae2822.test_vals = [-5.400074, -10.904964, -0.212470, 0.005448] test_list.append(contadj_rans_rae2822) ############################# @@ -874,7 +890,7 @@ def main(): rot_naca0012.cfg_dir = "rotating/naca0012" rot_naca0012.cfg_file = "rot_NACA0012.cfg" rot_naca0012.test_iter = 25 - rot_naca0012.test_vals = [-1.281731, 4.222906, -0.027650, 0.059278, 2.000000, -1.218436] + rot_naca0012.test_vals = [-1.325872, 4.186708, -0.042341, 0.046220, 2.000000, -1.241855] test_list.append(rot_naca0012) # Lid-driven cavity @@ -882,7 +898,7 @@ def main(): cavity.cfg_dir = "moving_wall/cavity" cavity.cfg_file = "lam_cavity.cfg" cavity.test_iter = 25 - cavity.test_vals = [-8.032742, -2.589249, 0.015257, 0.007688] + cavity.test_vals = [-8.105239, -2.649340, 0.011708, 0.007724] test_list.append(cavity) # Spinning cylinder @@ -890,7 +906,7 @@ def main(): spinning_cylinder.cfg_dir = "moving_wall/spinning_cylinder" spinning_cylinder.cfg_file = "spinning_cylinder.cfg" spinning_cylinder.test_iter = 25 - spinning_cylinder.test_vals = [-7.634797, -2.176937, 1.860210, 1.939647] + spinning_cylinder.test_vals = [-7.527383, -2.114675, 3.293096, 2.307068] test_list.append(spinning_cylinder) ###################################### @@ -911,7 +927,7 @@ def main(): sine_gust.cfg_dir = "gust" sine_gust.cfg_file = "inv_gust_NACA0012.cfg" sine_gust.test_iter = 5 - sine_gust.test_vals = [-1.977498, 3.481833, -0.012952, -0.003623] + sine_gust.test_vals = [-1.977498, 3.481833, -0.012664, -0.003415] sine_gust.unsteady = True test_list.append(sine_gust) @@ -920,7 +936,7 @@ def main(): aeroelastic.cfg_dir = "aeroelastic" aeroelastic.cfg_file = "aeroelastic_NACA64A010.cfg" aeroelastic.test_iter = 2 - aeroelastic.test_vals = [-1.876630, 4.021084, 0.082512, 0.026836, -0.001638, -0.000130, -1.102875] + aeroelastic.test_vals = [-1.876622, 4.021095, 0.082844, 0.026680, -0.001637, -0.000131, -1.102911] aeroelastic.unsteady = True test_list.append(aeroelastic) @@ -934,10 +950,10 @@ def main(): test_list.append(ddes_flatplate) # Hybrid RANS/LES models on the ONERA M6 wing, restarting from a RANS solution - ddes_oneram6_vals = {"sst_ddes": [-2.221793, -0.757241, 2.506746, 0.261418, 0.022680], - "sst_iddes": [-2.226164, 3.063400, 2.594586, 0.261433, 0.022683], - "sst_siddes": [-2.226164, 3.063400, 2.594638, 0.261418, 0.022680], - "sst_eddes": [-2.221792, 0.258724, 2.506730, 0.261418, 0.022680], + ddes_oneram6_vals = {"sst_ddes": [-2.221793, -0.757237, 2.506728, 0.261418, 0.022680], + "sst_iddes": [-2.226164, 3.063400, 2.594574, 0.261433, 0.022683], + "sst_siddes": [-2.226164, 3.063400, 2.594626, 0.261418, 0.022680], + "sst_eddes": [-2.221792, 0.258723, 2.506713, 0.261418, 0.022680], "sa_eddes": [-3.510006, -3.683557, 0.266420, 0.023471]} for model, vals in ddes_oneram6_vals.items(): ddes_oneram6 = TestCase('ddes_oneram6_' + model) @@ -961,7 +977,7 @@ def main(): unst_pitching_naca64a010_rans.cfg_dir = "unsteady/pitching_naca64a010_rans" unst_pitching_naca64a010_rans.cfg_file = "turb_NACA64A010.cfg" unst_pitching_naca64a010_rans.test_iter = 2 - unst_pitching_naca64a010_rans.test_vals = [-1.299045, -3.951325, 0.011217, 0.008239] + unst_pitching_naca64a010_rans.test_vals = [-1.299045, -3.951339, 0.010507, 0.008237] unst_pitching_naca64a010_rans.unsteady = True test_list.append(unst_pitching_naca64a010_rans) # unsteady pitching NACA64A010, Euler @@ -969,7 +985,7 @@ def main(): unst_pitching_naca64a010_euler.cfg_dir = "unsteady/pitching_naca64a010_euler" unst_pitching_naca64a010_euler.cfg_file = "pitching_NACA64A010.cfg" unst_pitching_naca64a010_euler.test_iter = 2 - unst_pitching_naca64a010_euler.test_vals = [-1.186839, 4.280671, -0.026418, 0.000937] + unst_pitching_naca64a010_euler.test_vals = [-1.186839, 4.280671, -0.026767, 0.000897] unst_pitching_naca64a010_euler.unsteady = True test_list.append(unst_pitching_naca64a010_euler) # unsteady plunging NACA0012, Laminar NS @@ -977,7 +993,7 @@ def main(): unst_plunging_naca0012.cfg_dir = "unsteady/plunging_naca0012" unst_plunging_naca0012.cfg_file = "plunging_NACA0012.cfg" unst_plunging_naca0012.test_iter = 2 - unst_plunging_naca0012.test_vals = [-4.083462, 1.366757, -3.455802, -0.097062] + unst_plunging_naca0012.test_vals = [-4.083462, 1.366757, -3.714516, -0.094441] unst_plunging_naca0012.unsteady = True test_list.append(unst_plunging_naca0012) @@ -986,7 +1002,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform.cfg" unst_deforming_naca0012.test_iter = 5 - unst_deforming_naca0012.test_vals = [-3.666074, -3.794974, -3.717659, -3.149285] + unst_deforming_naca0012.test_vals = [-3.665127, -3.793792, -3.716698, -3.148315] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -999,7 +1015,7 @@ def main(): ls89_sa.cfg_dir = "nicf/LS89" ls89_sa.cfg_file = "turb_SA_PR.cfg" ls89_sa.test_iter = 20 - ls89_sa.test_vals = [-5.041528, -13.379614, 0.179019, 0.420831] + ls89_sa.test_vals = [-5.234512, -13.598645, 0.191102, 0.404330] test_list.append(ls89_sa) # Rarefaction shock wave edge_VW @@ -1007,7 +1023,7 @@ def main(): edge_VW.cfg_dir = "nicf/edge" edge_VW.cfg_file = "edge_VW.cfg" edge_VW.test_iter = 20 - edge_VW.test_vals = [-8.901513, -2.707051, -0.000009, 0.000000] + edge_VW.test_vals = [-8.709237, -2.544367, -0.000009, 0.000000] test_list.append(edge_VW) # Rarefaction shock wave edge_PPR @@ -1015,7 +1031,7 @@ def main(): edge_PPR.cfg_dir = "nicf/edge" edge_PPR.cfg_file = "edge_PPR.cfg" edge_PPR.test_iter = 20 - edge_PPR.test_vals = [-12.051128, -5.877603, -0.000034, 0.000000] + edge_PPR.test_vals = [-11.792553, -5.626268, -0.000034, 0.000000] test_list.append(edge_PPR) @@ -1028,7 +1044,7 @@ def main(): Aachen_3D_restart.cfg_dir = "turbomachinery/Aachen_turbine" Aachen_3D_restart.cfg_file = "aachen_3D_MP_restart.cfg" Aachen_3D_restart.test_iter = 5 - Aachen_3D_restart.test_vals = [-7.689192, -8.475728, -6.036967, -6.427477, -5.830814, -4.599404, -5.529591, -5.302786, -3.822654, -5.242456, -5.726228, -3.630781, -2.214267, -2.893070, -0.579915] + Aachen_3D_restart.test_vals = [-7.691382, -8.453289, -6.055361, -6.412353, -5.832830, -4.592148, -5.534198, -5.313829, -3.836785, -5.245771, -5.791814, -3.650627, -2.214958, -2.881850, -0.594885] Aachen_3D_restart.enabled_with_asan = False test_list.append(Aachen_3D_restart) @@ -1037,7 +1053,7 @@ def main(): Jones_tc_restart.cfg_dir = "turbomachinery/APU_turbocharger" Jones_tc_restart.cfg_file = "Jones_restart.cfg" Jones_tc_restart.test_iter = 5 - Jones_tc_restart.test_vals = [-0.151366, -0.171658, -8.195252, -2.499024, -7.362886, -1.883840, 73291.000000, 73291.000000, 0.020062, 82.380000] + Jones_tc_restart.test_vals = [-0.151365, -0.171559, -8.195251, -2.499024, -7.362867, -1.884109, 73291.000000, 73291.000000, 0.020062, 82.380000] test_list.append(Jones_tc_restart) # 2D axial stage @@ -1053,7 +1069,7 @@ def main(): transonic_stator_restart.cfg_dir = "turbomachinery/transonic_stator_2D" transonic_stator_restart.cfg_file = "transonic_stator_restart.cfg" transonic_stator_restart.test_iter = 20 - transonic_stator_restart.test_vals = [-4.364091, -2.489509, -2.081581, 1.729990, -1.467009, 3.223101, -471620.000000, 94.839000, -0.071910] + transonic_stator_restart.test_vals = [-4.364098, -2.489485, -2.081630, 1.729983, -1.466951, 3.223070, -471620.000000, 94.839000, -0.071907] transonic_stator_restart.test_vals_aarch64 = [-4.367784, -2.492912, -2.082414, 1.727491, -1.466974, 3.224730, -471620.000000, 94.839000, -0.052082] test_list.append(transonic_stator_restart) @@ -1083,7 +1099,7 @@ def main(): uniform_flow.cfg_dir = "sliding_interface/uniform_flow" uniform_flow.cfg_file = "uniform_NN.cfg" uniform_flow.test_iter = 2 - uniform_flow.test_vals = [2.000000, 0.000000, -0.230680, -13.250344] + uniform_flow.test_vals = [2.000000, 0.000000, -0.230680, -13.252537] uniform_flow.test_vals_aarch64 = [2.000000, 0.000000, -0.230641, -13.249000] uniform_flow.tol = 0.000001 uniform_flow.unsteady = True @@ -1157,7 +1173,7 @@ def main(): bars_SST_2D.cfg_dir = "sliding_interface/bars_SST_2D" bars_SST_2D.cfg_file = "bars.cfg" bars_SST_2D.test_iter = 13 - bars_SST_2D.test_vals = [13.000000, -0.462805, -1.525513] + bars_SST_2D.test_vals = [13.000000, -0.396189, -1.444936] bars_SST_2D.multizone = True test_list.append(bars_SST_2D) @@ -1225,7 +1241,7 @@ def main(): fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" fsi2d.cfg_file = "configFSI.cfg" fsi2d.test_iter = 4 - fsi2d.test_vals = [4.000000, 0.000000, -3.725521, -4.278759] + fsi2d.test_vals = [4.000000, 0.000000, -3.725511, -4.278761] fsi2d.multizone = True fsi2d.unsteady = True test_list.append(fsi2d) @@ -1235,7 +1251,7 @@ def main(): fsi_cht.cfg_dir = "fea_fsi/stat_fsi" fsi_cht.cfg_file = "config.cfg" fsi_cht.test_iter = 20 - fsi_cht.test_vals = [5.000000, -5.077006, -5.379456, -9.247798, -9.319797, -9.184989, 608.350000, -0.012973, 0.000000, 29.000000] + fsi_cht.test_vals = [5.000000, -5.076664, -5.379765, -9.247797, -9.320280, -9.184828, 608.350000, -0.012973, 0.000000, 29.000000] fsi_cht.multizone = True test_list.append(fsi_cht) @@ -1244,7 +1260,7 @@ def main(): dyn_fsi.cfg_dir = "fea_fsi/dyn_fsi" dyn_fsi.cfg_file = "config.cfg" dyn_fsi.test_iter = 4 - dyn_fsi.test_vals = [-4.328792, -4.153004, 0.000000, 85.000000] + dyn_fsi.test_vals = [-4.328792, -4.153000, 0.000000, 86.000000] dyn_fsi.multizone = True dyn_fsi.unsteady = True test_list.append(dyn_fsi) @@ -1254,7 +1270,7 @@ def main(): airfoilRBF.cfg_dir = "fea_fsi/Airfoil_RBF" airfoilRBF.cfg_file = "config.cfg" airfoilRBF.test_iter = 1 - airfoilRBF.test_vals = [1.000000, 0.030416, -3.530954] + airfoilRBF.test_vals = [1.000000, 0.024591, -3.526663] airfoilRBF.tol = 0.0001 airfoilRBF.multizone = True test_list.append(airfoilRBF) @@ -1716,7 +1732,7 @@ def main(): opt_multiobj1surf_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_multiobj1surf_py.cfg_file = "inv_wedge_ROE_multiobj_1surf.cfg" opt_multiobj1surf_py.test_iter = 1 - opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.586730, 5.593636] + opt_multiobj1surf_py.test_vals = [1.000000, 1.000000, 36.816070, 5.993726] opt_multiobj1surf_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_multiobj1surf_py.timeout = 1600 opt_multiobj1surf_py.tol = 0.00001 @@ -1729,7 +1745,7 @@ def main(): opt_2surf1obj_py.cfg_dir = "optimization_euler/multiobjective_wedge" opt_2surf1obj_py.cfg_file = "inv_wedge_ROE_2surf_1obj.cfg" opt_2surf1obj_py.test_iter = 1 - opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005039, 0.000462] + opt_2surf1obj_py.test_vals = [1.000000, 1.000000, 2.005020, 0.000493] opt_2surf1obj_py.command = TestCase.Command(exec = "shape_optimization.py", param = "-g CONTINUOUS_ADJOINT -f") opt_2surf1obj_py.timeout = 1600 opt_2surf1obj_py.tol = 0.00001 @@ -1746,7 +1762,7 @@ def main(): pywrapper_naca0012.cfg_dir = "euler/naca0012" pywrapper_naca0012.cfg_file = "inv_NACA0012_Roe.cfg" pywrapper_naca0012.test_iter = 20 - pywrapper_naca0012.test_vals = [-4.031446, -3.524530, 0.273056, 0.009703] + pywrapper_naca0012.test_vals = [-4.561230, -3.981697, 0.297778, 0.026136] pywrapper_naca0012.command = TestCase.Command(exec = "SU2_CFD.py", param = "-f") pywrapper_naca0012.timeout = 1600 pywrapper_naca0012.tol = 0.00001 @@ -1787,7 +1803,7 @@ def main(): pywrapper_fsi2d.cfg_dir = "fea_fsi/WallChannel_2d" pywrapper_fsi2d.cfg_file = "configFSI.cfg" pywrapper_fsi2d.test_iter = 4 - pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.725521, -4.278759] + pywrapper_fsi2d.test_vals = [4.000000, 0.000000, -3.725511, -4.278761] pywrapper_fsi2d.command = TestCase.Command(exec = "SU2_CFD.py", param = "--nZone 2 --fsi True -f") pywrapper_fsi2d.unsteady = True pywrapper_fsi2d.multizone = True @@ -1802,7 +1818,7 @@ def main(): pywrapper_unsteadyCHT.cfg_dir = "py_wrapper/flatPlate_unsteady_CHT" pywrapper_unsteadyCHT.cfg_file = "unsteady_CHT_FlatPlate_Conf.cfg" pywrapper_unsteadyCHT.test_iter = 5 - pywrapper_unsteadyCHT.test_vals = [-1.614168, 2.259817, -0.009951, 0.169563] + pywrapper_unsteadyCHT.test_vals = [-1.614168, 2.260661, 0.000055, 0.103058] pywrapper_unsteadyCHT.command = TestCase.Command(exec = "python", param = "launch_unsteady_CHT_FlatPlate.py -f") pywrapper_unsteadyCHT.timeout = 1600 pywrapper_unsteadyCHT.tol = 0.00001 diff --git a/TestCases/serial_regression_AD.py b/TestCases/serial_regression_AD.py index fc9bf1036935..a551fa277d2d 100644 --- a/TestCases/serial_regression_AD.py +++ b/TestCases/serial_regression_AD.py @@ -96,7 +96,7 @@ def main(): discadj_rans_naca0012_sst.cfg_dir = "disc_adj_rans/naca0012" discadj_rans_naca0012_sst.cfg_file = "turb_NACA0012_sst.cfg" discadj_rans_naca0012_sst.test_iter = 10 - discadj_rans_naca0012_sst.test_vals = [-2.096038, -0.178557, 0.351620, -0.023443] + discadj_rans_naca0012_sst.test_vals = [-2.096037, -0.178557, 0.351610, -0.023443] test_list.append(discadj_rans_naca0012_sst) ####################################### @@ -108,7 +108,7 @@ def main(): discadj_incomp_NACA0012.cfg_dir = "disc_adj_incomp_euler/naca0012" discadj_incomp_NACA0012.cfg_file = "incomp_NACA0012_disc.cfg" discadj_incomp_NACA0012.test_iter = 20 - discadj_incomp_NACA0012.test_vals = [20.000000, -3.134640, -2.294875, 0.000000] + discadj_incomp_NACA0012.test_vals = [20.000000, -3.217506, -2.513786, 0.000000] test_list.append(discadj_incomp_NACA0012) ##################################### @@ -132,7 +132,7 @@ def main(): discadj_cylinder.cfg_dir = "disc_adj_rans/cylinder" discadj_cylinder.cfg_file = "cylinder.cfg" discadj_cylinder.test_iter = 9 - discadj_cylinder.test_vals = [1.639373, -2.834286, -0.009537, 0.000020] + discadj_cylinder.test_vals = [1.639367, -2.834306, -0.009537, 0.000020] discadj_cylinder.unsteady = True test_list.append(discadj_cylinder) @@ -145,7 +145,7 @@ def main(): discadj_DT_1ST_cylinder.cfg_dir = "disc_adj_rans/cylinder_DT_1ST" discadj_DT_1ST_cylinder.cfg_file = "cylinder.cfg" discadj_DT_1ST_cylinder.test_iter = 9 - discadj_DT_1ST_cylinder.test_vals = [1.196421, -3.339044, -0.006211, 0.000020] + discadj_DT_1ST_cylinder.test_vals = [1.196419, -3.339055, -0.006211, 0.000020] discadj_DT_1ST_cylinder.unsteady = True test_list.append(discadj_DT_1ST_cylinder) @@ -158,7 +158,7 @@ def main(): discadj_pitchingNACA0012.cfg_dir = "disc_adj_euler/naca0012_pitching" discadj_pitchingNACA0012.cfg_file = "inv_NACA0012_pitching.cfg" discadj_pitchingNACA0012.test_iter = 4 - discadj_pitchingNACA0012.test_vals = [-1.140869, -1.575299, -0.005305, 0.000003] + discadj_pitchingNACA0012.test_vals = [-1.150803, -1.584891, -0.005578, 0.000004] discadj_pitchingNACA0012.unsteady = True test_list.append(discadj_pitchingNACA0012) @@ -167,7 +167,7 @@ def main(): unst_deforming_naca0012.cfg_dir = "disc_adj_euler/naca0012_pitching_def" unst_deforming_naca0012.cfg_file = "inv_NACA0012_pitching_deform_ad.cfg" unst_deforming_naca0012.test_iter = 4 - unst_deforming_naca0012.test_vals = [-1.876120, -1.766274, 4314.900000, 0.000003] + unst_deforming_naca0012.test_vals = [-1.881846, -1.771958, 4469.400000, 0.000003] unst_deforming_naca0012.unsteady = True test_list.append(unst_deforming_naca0012) @@ -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.307361, -9.892466, -10.038191, -13.367660] + discadj_trans_stator.test_vals = [79.000000, -7.290460, -9.860576, -10.024735, -13.352842] discadj_trans_stator.test_vals_aarch64 = [79.000000, -7.308167, -9.891117, -10.038669, -13.368501] test_list.append(discadj_trans_stator) @@ -209,7 +209,7 @@ def main(): discadj_axial_stage.cfg_dir = "disc_adj_turbomachinery/axial_stage_2D" discadj_axial_stage.cfg_file = "Axial_stage2D.cfg" discadj_axial_stage.test_iter = 79 - discadj_axial_stage.test_vals = [79.000000, -6.499484, -6.634634] + discadj_axial_stage.test_vals = [79.000000, -6.499476, -6.634694] discadj_axial_stage.test_vals_aarch64 = [79.000000, -6.605593, -7.138207] test_list.append(discadj_axial_stage) @@ -248,7 +248,7 @@ def main(): discadj_fsi.cfg_dir = "disc_adj_fsi" discadj_fsi.cfg_file = "config.cfg" discadj_fsi.test_iter = 6 - discadj_fsi.test_vals = [6.000000, -1.956662, -3.071318, 0.000440, -1.062800] + discadj_fsi.test_vals = [6.000000, -1.957003, -3.071513, 0.000440, -1.062800] discadj_fsi.test_vals_aarch64 = [6.000000, -1.956662, -3.071318, 0.000440, -1.062800] test_list.append(discadj_fsi) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 707f08851a2f..c2cbec670ce5 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -187,7 +187,7 @@ def main(): tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump" tutorial_inv_bump.cfg_file = "inv_channel.cfg" tutorial_inv_bump.test_iter = 0 - tutorial_inv_bump.test_vals = [-1.437425, 4.075857, 0.085905, 0.123625] + tutorial_inv_bump.test_vals = [-1.437425, 4.075857, 0.021702, 0.026792] test_list.append(tutorial_inv_bump) # Inviscid Wedge @@ -195,7 +195,7 @@ def main(): tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge" tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg" tutorial_inv_wedge.test_iter = 0 - tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.191841, 0.033699] + tutorial_inv_wedge.test_vals = [-0.481460, 5.253008, -0.233459, 0.041019] tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) @@ -204,7 +204,7 @@ def main(): tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg" tutorial_inv_onera.test_iter = 0 - tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.243858, 0.110778] + tutorial_inv_onera.test_vals = [-5.204928, -4.597762, 0.250116, 0.092787] tutorial_inv_onera.no_restart = True test_list.append(tutorial_inv_onera) @@ -213,7 +213,7 @@ def main(): tutorial_lam_cylinder.cfg_dir = "../Tutorials/compressible_flow/Laminar_Cylinder" tutorial_lam_cylinder.cfg_file = "lam_cylinder.cfg" tutorial_lam_cylinder.test_iter = 0 - tutorial_lam_cylinder.test_vals = [-6.162141, -0.699617, -0.080602, 42.990503] + tutorial_lam_cylinder.test_vals = [-6.162141, -0.699617, 0.730462, 38.465990] tutorial_lam_cylinder.no_restart = True test_list.append(tutorial_lam_cylinder) @@ -259,7 +259,7 @@ def main(): tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-" tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg" tutorial_trans_flatplate_T3Am.test_iter = 20 - tutorial_trans_flatplate_T3Am.test_vals = [-5.589221, -1.700900, -3.101441, -0.104205, -3.690983, 3.287539, -2.394493, 1.119670] + tutorial_trans_flatplate_T3Am.test_vals = [-5.589226, -1.700900, -3.101453, -0.104209, -3.690983, 3.287539, -2.394493, 1.119670] tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-5.540938, -1.681627, -2.878831, -0.058224, -3.695533, 3.413628, -2.385345, 1.103633] tutorial_trans_flatplate_T3Am.no_restart = True test_list.append(tutorial_trans_flatplate_T3Am) @@ -287,7 +287,7 @@ def main(): tutorial_turb_oneram6.cfg_dir = "../Tutorials/compressible_flow/Turbulent_ONERAM6" tutorial_turb_oneram6.cfg_file = "turb_ONERAM6.cfg" tutorial_turb_oneram6.test_iter = 0 - tutorial_turb_oneram6.test_vals = [-4.564441, -11.533717, 0.251049, 0.081260] + tutorial_turb_oneram6.test_vals = [-4.564441, -11.533673, 0.251049, 0.081260] test_list.append(tutorial_turb_oneram6) # NICFD Nozzle @@ -314,7 +314,7 @@ def main(): tutorial_unst_naca0012.cfg_dir = "../Tutorials/compressible_flow/Unsteady_NACA0012" tutorial_unst_naca0012.cfg_file = "unsteady_naca0012.cfg" tutorial_unst_naca0012.test_iter = 520 - tutorial_unst_naca0012.test_vals = [520.000000, 0.000000, -5.299902, 0.000000, 0.299247, 0.714557, 0.002870, 0.007029] + tutorial_unst_naca0012.test_vals = [520.000000, 0.000000, -5.295222, 0.000000, 0.299997, 0.798871, 0.002555, 0.007836] tutorial_unst_naca0012.test_vals_aarch64 = [520, 0, -5.292359, 0, 0.284720, 0.766329, 0.000954, 0.007565] tutorial_unst_naca0012.unsteady = True test_list.append(tutorial_unst_naca0012) @@ -335,7 +335,7 @@ def main(): tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012" tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg" tutorial_design_inv_naca0012.test_iter = 0 - tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.142510, 0.172748] + tutorial_design_inv_naca0012.test_vals = [-3.585391, -2.989014, 0.156436, 0.193853] tutorial_design_inv_naca0012.no_restart = True test_list.append(tutorial_design_inv_naca0012) diff --git a/TestCases/vandv.py b/TestCases/vandv.py index c6ce2cb23828..a3aea1d0851e 100644 --- a/TestCases/vandv.py +++ b/TestCases/vandv.py @@ -45,7 +45,7 @@ def main(): p30n30.cfg_dir = "vandv/rans/30p30n" p30n30.cfg_file = "config.cfg" p30n30.test_iter = 5 - p30n30.test_vals = [-11.267106, -11.168215, -11.182822, -10.949673, -14.233489, 0.052235, 2.830394, 1.318894, -1.210646, 1.000000, 12.763000] + p30n30.test_vals = [-11.267231, -11.168332, -11.182969, -10.949857, -14.233489, 0.052235, 2.830394, 1.318894, -1.210500, 1.000000, 12.763000] test_list.append(p30n30) # This is not part of the V&V cases yet, its tested in this script because it is a relatively long test (~1 min). @@ -54,7 +54,7 @@ def main(): p30n30_ad.cfg_dir = "vandv/rans/30p30n" p30n30_ad.cfg_file = "config_ad.cfg" p30n30_ad.test_iter = 9 - p30n30_ad.test_vals = [-7.283709, -6.072615, -5.995304, -7.197048, -4.568373, -1.167146, -2.316777, 1.1791e-01, 3.4123e+01] + p30n30_ad.test_vals = [-7.448870, -6.332809, -6.255594, -7.455457, -4.760040, -1.167091, -2.316777, 0.117910, 34.123000] p30n30_ad.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD") test_list.append(p30n30_ad) @@ -72,7 +72,7 @@ def main(): bump_sst1994m.cfg_dir = "vandv/rans/bump_in_channel" bump_sst1994m.cfg_file = "turb_bump_sst.cfg" bump_sst1994m.test_iter = 5 - bump_sst1994m.test_vals = [-6.497322, -4.234388, -3.813607, -1.011693, -4.012643, 0.181789, 0.004933] + bump_sst1994m.test_vals = [-6.497142, -4.234210, -3.813559, -1.011510, -4.012312, 0.181606, 0.004933] bump_sst1994m.test_vals_aarch64 = [-13.042689, -10.812982, -10.604523, -7.655547, -10.816257, -5.308083, 0.004911] test_list.append(bump_sst1994m) @@ -91,7 +91,7 @@ def main(): swbli_sst.cfg_dir = "vandv/rans/swbli" swbli_sst.cfg_file = "config_sst.cfg" swbli_sst.test_iter = 5 - swbli_sst.test_vals = [-6.629003, -5.974424, -6.441377, -5.452202, -7.662611, 0.071744, 0.001815, -1.199321, -3.785268, 13.399000] + swbli_sst.test_vals = [-6.629007, -5.974427, -6.441393, -5.452208, -7.662648, 0.071811, 0.001815, -1.199326, -3.785344, 13.399000] test_list.append(swbli_sst) # DSMA661 - SA @@ -99,7 +99,7 @@ def main(): dsma661_sa.cfg_dir = "vandv/rans/dsma661" dsma661_sa.cfg_file = "dsma661_sa_config.cfg" dsma661_sa.test_iter = 5 - dsma661_sa.test_vals = [-11.240967, -8.243826, -8.958188, -5.895885, -10.737669, 0.155687, 0.024232] + dsma661_sa.test_vals = [-11.249578, -8.243691, -8.979211, -5.915958, -10.737668, 0.155687, 0.024232] dsma661_sa.test_vals_aarch64 = [-11.293183, -8.241775, -9.083761, -6.011398, -10.737680, 0.155687, 0.024232] test_list.append(dsma661_sa) diff --git a/config_template.cfg b/config_template.cfg index 951e5e6cbfcb..00730ca9d97d 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -1618,6 +1618,14 @@ CUSTOM_OBJFUNC= 'DRAG + 10 * pow(fmax(0.4-LIFT, 0), 2)' % Required for 2nd order upwind schemes (NO, YES) MUSCL_FLOW= YES % +% Reconstruct to first order on the edges of points where a no-slip wall ends on a boundary that +% continues its surface (a leading edge after a symmetry plane) or has a sharp edge (a sharp +% trailing edge). The gradient is singular there, and MUSCL across it can stall or destabilize +% the solver, multigrid in particular. With multigrid, the coarse-grid correction of the flow +% solution is also not prolongated to these points and their neighbours, and fades in linearly +% over the 4 coarse control volumes around them. Compressible flow solver only (NO, YES) +MUSCL_FIRST_ORDER_WALL_ENDS= NO +% % Option to ramp the MUSCL reconstruction scheme gradually from first to second order RAMP_MUSCL= NO % @@ -1785,8 +1793,8 @@ MG_PRE_SMOOTH= ( 2, 2, 2, 2 ) % Max. iterations for multi-grid post-smoothing level MG_POST_SMOOTH= ( 2, 2, 2, 2 ) % -% Jacobi implicit smoothing of the correction -MG_CORRECTION_SMOOTH= ( 1, 1, 1, 1 ) +% Jacobi implicit smoothing of the correction (default 0) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) % % Damping factor for the residual restriction MG_DAMP_RESTRICTION= 0.5 @@ -1794,6 +1802,16 @@ MG_DAMP_RESTRICTION= 0.5 % Damping factor for the correction prolongation MG_DAMP_PROLONGATION= 0.5 % +% Prolong the correction with a limited least-squares gradient over the coarse control +% volume instead of injecting the parent value into every child. The reconstruction is +% exact for a linear correction and the children still average back to the coarse value. +% The gradient is limited so no child leaves the range of the coarse neighbours. On walls and +% symmetry planes only the velocity keeps the constant operator. A coarse control volume whose +% neighbour directions give a fit condition number above 1e3, or whose stencil aspect ratio exceeds +% 100, keeps the constant operator for all variables (reported on screen); between aspect ratios +% 10 and 100 the gradient is faded out (NO, YES) +MG_LINEAR_PROLONGATION= NO +% % Enable early exit from multigrid smoothing when the residual RMS drops % below MG_SMOOTH_RES_THRESHOLD * initial_rms (NO, YES) MG_SMOOTH_EARLY_EXIT= YES @@ -1805,7 +1823,8 @@ MG_SMOOTH_RES_THRESHOLD= 0.9 % Smoothing coefficient for the Jacobi correction-prolongation smoother (default 1.25) MG_SMOOTH_COEFF= 1.25 % -% Print a compact per-cycle summary of smoothing iterations and residuals (NO, YES) +% Print a compact per-cycle summary of smoothing iterations, residuals and linear solver +% iterations, and the face-closure check of each coarse grid (NO, YES) MG_SMOOTH_OUTPUT= NO % % Stop smoothing when current_rms >= previous_rms * this value. Values below 1.0 exit @@ -1824,8 +1843,13 @@ MG_IMPLICIT_LINES= NO % % Per-level CFL scaling factors for the coarse multigrid levels. Entry i is the ratio % CFL(i+1)/CFL(i). If fewer values than MGLEVEL are given the last one is repeated -% (default 0.25, i.e. a quarter of the CFL per level) -MG_CFL_SCALING= ( 0.25 ) +% (default 0.5, i.e. half the CFL per level) +MG_CFL_SCALING= ( 0.5 ) +% +% Maximum linear solver iterations on the coarse multigrid levels. Entry i applies to level i+1, +% the last value is repeated, and the cap never exceeds LINEAR_SOLVER_ITER. The active level of the +% Full Multigrid startup and the discrete adjoint are not capped. Entries must be positive (default 3) +MG_LINEAR_SOLVER_ITER= ( 3 ) % % Number of iterations spent on each mesh during the Full Multigrid (FMG) startup phase. After % this many iterations the solution is prolongated to the next finer mesh. It is also the length @@ -1844,8 +1868,9 @@ MG_STARTUP_ITER= 100 MG_STARTUP_CONVERGENCE= -2 % % Full-MG promotion on stagnation: if the active level's residual ratio between -% successive iterations exceeds this for MG_STARTUP_STAGNATION_ITER consecutive -% iterations, promote to the next finer level early. 0 disables (default 0.99). +% successive iterations stays between this value and its inverse for +% MG_STARTUP_STAGNATION_ITER consecutive iterations, promote to the next finer level +% early. A growing residual does not count as stagnation. 0 disables (default 0.99). MG_STARTUP_STAGNATION= 0.99 % % Consecutive stalled iterations required before Full-MG promotes on stagnation. @@ -2132,6 +2157,9 @@ TIME_DISCRE_TURB= EULER_IMPLICIT % % Reduction factor of the CFL coefficient in the turbulence problem CFL_REDUCTION_TURB= 1.0 +% +% Number of turbulence iterations per flow iteration, at least 1 (default 1) +TURB_SUBITER= 1 % Control lower limit constants of the SST model (C*phi_infinity) LOWER_LIMIT_K_FACTOR= 1e-15 @@ -2546,6 +2574,13 @@ PARMETIS_TOLERANCE= 0.02 PARMETIS_EDGE_WEIGHT= 1 PARMETIS_POINT_WEIGHT= 0 % +% Make cutting a short edge of an anisotropic cell expensive, so that partition +% boundaries cross boundary layers in the wall-normal direction instead of running +% through them. Each graph edge is weighted by the longest node distance of its cells +% over its own length, and lines of strongly coupled points (wall-normal lines in a +% boundary layer) are kept whole on one rank (NO, YES) (default NO). +PARMETIS_ANISOTROPY_WEIGHT= NO +% % ----------------------- SOBOLEV GRADIENT SMOOTHING OPTIONS ----------------------% % % Activate the gradient smoothing solver for the discrete adjoint driver (NO, YES)