Skip to content

Commit

Permalink
added fast update fraction check
Browse files Browse the repository at this point in the history
  • Loading branch information
sseraj committed Jul 19, 2022
1 parent 6cc30fa commit 959be77
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion doc/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions src/overset/oversetAPI.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 16 additions & 1 deletion src/overset/oversetCommUtilites.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 959be77

Please sign in to comment.