Skip to content

Commit

Permalink
Merge pull request #1362 from suargi/fix_fullmultigrid
Browse files Browse the repository at this point in the history
Solve segmentation faults for FULLMG_CYCLE
  • Loading branch information
pcarruscag authored May 17, 2022
2 parents 2ce680a + eef893e commit 6ca6ec2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
7 changes: 6 additions & 1 deletion Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,12 @@ class CConfig {
* \brief Set the number of multigrid levels.
* \param[in] val_nMGLevels - Index of the mesh were the CFL is applied
*/
void SetMGLevels(unsigned short val_nMGLevels) { nMGLevels = val_nMGLevels; }
void SetMGLevels(unsigned short val_nMGLevels) {
nMGLevels = val_nMGLevels;
if (MGCycle == FULLMG_CYCLE) {
SetFinestMesh(val_nMGLevels);
}
}

/*!
* \brief Get the index of the finest grid.
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/integration/CIntegration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CIntegration {
size; /*!< \brief MPI Size. */
bool Convergence, /*!< \brief To indicate if the flow solver (direct, adjoint, or linearized) has converged or not. */
Convergence_FSI, /*!< \brief To indicate if the FSI problem has converged or not. */
Convergence_FullMG; /*!< \brief Initial value of the residual to evaluate the convergence level. */
Convergence_FullMG; /*!< \brief To indicate if the full multigrid has converged or not. */

/*!
* \brief Do the space integration of the numerical system.
Expand Down
14 changes: 7 additions & 7 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2516,10 +2516,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr

for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();

Coord = geometry->nodes->GetCoord(iPoint);
Coord_Normal = geometry->nodes->GetCoord(iPointNormal);

Normal = geometry->vertex[iMarker][iVertex]->GetNormal();

Expand Down Expand Up @@ -2585,13 +2583,15 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
CSkinFriction[iMarker](iVertex,iDim) = TauTangent[iDim] * factorFric;
}

WallDistMod = GeometryToolbox::Distance(nDim, Coord, Coord_Normal);

/*--- Compute non-dimensional velocity and y+ ---*/

FrictionVel = sqrt(fabs(WallShearStress[iMarker][iVertex]) / Density);

if (!wallfunctions) {

if (!wallfunctions && (MGLevel == MESH_0 || geometry->nodes->GetDomain(iPoint))) {
// for CMultiGridGeometry, the normal neighbor of halo nodes in not set
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
WallDistMod = GeometryToolbox::Distance(nDim, Coord, Coord_Normal);
YPlus[iMarker][iVertex] = WallDistMod * FrictionVel / (Viscosity / Density);
}

Expand Down Expand Up @@ -2628,7 +2628,7 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
HeatFlux[iMarker][iVertex] = thermal_conductivity_tr*dTn + thermal_conductivity_ve*dTven;
}

/*--- Note that y+, and heat are computed at the
/*--- Note that heat is computed at the
halo cells (for visualization purposes), but not the forces ---*/

if ((geometry->nodes->GetDomain(iPoint)) && (Monitoring == YES)) {
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/solvers/CTurbSSTSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned sh

/*--- Single grid simulation ---*/

if (iMesh == MESH_0) {
if (iMesh == MESH_0 || config->GetMGCycle() == FULLMG_CYCLE) {

/*--- Define some auxiliary vector related with the residual ---*/

Expand Down

0 comments on commit 6ca6ec2

Please sign in to comment.