diff --git a/doc/options.yaml b/doc/options.yaml index 8e967937f..e025ccb85 100644 --- a/doc/options.yaml +++ b/doc/options.yaml @@ -493,7 +493,8 @@ oversetUpdateMode: Only the weights are updated and the donors are unchanged. This is used when the entire overset mesh is warped together, such as with USMesh in IDWarp. This is fast to run but only works for small design changes. - Large design changes will cause the solver to stall because of nonphysical interpolation weights. + Large design changes can shift the position of interpolate cells relative to their donors enough to cause nonphysical interpolation weights. + In this case, an error is raised. full: > The overset connectivity is recomputed from stratch. This is usually only used when the component meshes are warped independently, such as with MultiUSMesh in IDWarp. diff --git a/src/overset/oversetAPI.F90 b/src/overset/oversetAPI.F90 index fe667c1cf..485905a7b 100644 --- a/src/overset/oversetAPI.F90 +++ b/src/overset/oversetAPI.F90 @@ -2101,16 +2101,16 @@ end subroutine setExplicitHoleCut subroutine updateOverset(flag, n, closedFamList, nFam) ! This is the main gateway routine for updating the overset - ! connecitivty during a solution. It is wrapped and intended to be + ! connectivity during a solution. It is wrapped and intended to be ! called from Python. What this routine does depends on the value ! of oversetUpdateMode: ! updateFrozen: Nothing happens. The initial - ! connecitivty computed during initialzation is kept. + ! connectivity computed during initialzation is kept. - ! updteFast: Update just the weight, but leave the donors + ! updateFast: Update just the weight, but leave the donors ! unchanged. This is only applicable when the entire mesh is - ! warped at the same time with pyWarpuStruct. + ! warped at the same time like with USMesh in IDWarp. ! updateFull: Complete from scratch update. Run the full ! oversetComm routine. diff --git a/src/overset/oversetCommUtilites.F90 b/src/overset/oversetCommUtilites.F90 index ae565166a..2ca0cc882 100644 --- a/src/overset/oversetCommUtilites.F90 +++ b/src/overset/oversetCommUtilites.F90 @@ -1740,7 +1740,7 @@ subroutine updateOversetConnectivity(level, sps) ! mesh. It does *not* completely redo the connectivity. Rather, a ! newton search on the existing donors are performed using the ! updated coordinates. This type of update is only applicable if the - ! entire volume mesh is warped as one a-la pyWarpUstruct. This + ! entire volume mesh is warped as one like with USMesh in IDWarp. This ! actually ends up being a fairly small correction most of the time, ! however, desipite looks to the contrary is actually quite fast to ! run. @@ -1767,6 +1767,9 @@ subroutine updateOversetConnectivity(level, sps) real(kind=realType) :: frac(3), frac0(3), xCen(3) integer(kind=intType), dimension(8), parameter :: indices=(/1,2,4,3,5,6,8,7/) + ! Set a tolerance for checking whether fractions are between 0 and 1 + real(kind=realType) :: fracTol=1e-8 + ! Pointers to the overset comms to make it easier to read commPattern => commPatternOverset(level, sps) internal => internalOverset(level, sps) @@ -1913,6 +1916,12 @@ subroutine updateOversetConnectivity(level, sps) call newtonUpdate(xCen, & flowDoms(d1, level, sps)%x(i1-1:i1+1, j1-1:j1+1, k1-1:k1+1, :), frac0, frac) + ! Check if the fractions are between 0 and 1 + if (ANY(frac > one + fracTol) .or. ANY(frac < zero - fracTol)) then + print *, "Invalid overset connectivity update. Use 'frozen' or 'full' oversetUpdateMode instead." + error stop + end if + ! Set the new weights call fracToWeights(frac, internal%donorInterp(i, :)) enddo localInterp @@ -1951,6 +1960,12 @@ subroutine updateOversetConnectivity(level, sps) call newtonUpdate(xCen, & flowDoms(d2, level, sps)%x(i2-1:i2+1, j2-1:j2+1, k2-1:k2+1, :), frac0, frac) + ! Check if the fractions are between zero and one + if (ANY(frac > one + fracTol) .or. ANY(frac < zero - fracTol)) then + print *, "Invalid overset connectivity update. Use 'frozen' or 'full' oversetUpdateMode instead." + error stop + end if + ! Set the new weights call fracToWeights(frac, commPattern%sendList(ii)%interp(j, :)) enddo