Skip to content

Commit

Permalink
(*)Correct dimensionally inconsistent advective CFL
Browse files Browse the repository at this point in the history
  Corrects the dimensionally inconsistent expressions for the CFL number in
the tracer advection code, in which a negligible thickness had been added to
the cell volume to avoid division by zero.  This change does not alter the
solutions in the MOM6-examples test cases, but now it permits dimensional
rescaling of lengths over a much larger range, and it could change answers if
the minimum layer thicknesses are small enough.
  • Loading branch information
Hallberg-NOAA committed Dec 4, 2019
1 parent 6ab1721 commit babc30a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/tracer/MOM_tracer_advect.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
else
uhh(I) = uhr(I,j,k)
endif
!ts2(I) = 0.5*(1.0 + uhh(I)/(hprev(i+1,j,k)+h_neglect))
CFL(I) = - uhh(I)/(hprev(i+1,j,k)+h_neglect) ! CFL is positive
!ts2(I) = 0.5*(1.0 + uhh(I) / (hprev(i+1,j,k) + h_neglect*G%areaT(i+1,j)))
CFL(I) = - uhh(I) / (hprev(i+1,j,k) + h_neglect*G%areaT(i+1,j)) ! CFL is positive
else
hup = hprev(i,j,k) - G%areaT(i,j)*min_h
hlos = MAX(0.0,-uhr(I-1,j,k))
Expand All @@ -497,8 +497,8 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
else
uhh(I) = uhr(I,j,k)
endif
!ts2(I) = 0.5*(1.0 - uhh(I)/(hprev(i,j,k)+h_neglect))
CFL(I) = uhh(I)/(hprev(i,j,k)+h_neglect) ! CFL is positive
!ts2(I) = 0.5*(1.0 - uhh(I) / (hprev(i,j,k) + h_neglect*G%areaT(i,j)))
CFL(I) = uhh(I) / (hprev(i,j,k) + h_neglect*G%areaT(i,j)) ! CFL is positive
endif
enddo

Expand Down Expand Up @@ -573,7 +573,7 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
! Original implementation of PLM
!flux_x(I,m) = uhh(I)*(Tr(m)%t(i+1,j,k) - slope_x(i+1,m)*ts2(I))
endif
!ts2(I) = 0.5*(1.0 - uhh(I)/(hprev(i,j,k)+h_neglect))
!ts2(I) = 0.5*(1.0 - uhh(I)/(hprev(i,j,k)+h_neglect*G%areaT(i,j)))
enddo ; enddo
endif ! usePPM

Expand Down Expand Up @@ -856,8 +856,8 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, &
else
vhh(i,J) = vhr(i,J,k)
endif
!ts2(i) = 0.5*(1.0 + vhh(i,J) / (hprev(i,j+1,k)+h_neglect))
CFL(i) = - vhh(i,J) / (hprev(i,j+1,k)+h_neglect) ! CFL is positive
!ts2(i) = 0.5*(1.0 + vhh(i,J) / (hprev(i,j+1,k) + h_neglect*G%areaT(i,j+1))
CFL(i) = - vhh(i,J) / (hprev(i,j+1,k) + h_neglect*G%areaT(i,j+1)) ! CFL is positive
else
hup = hprev(i,j,k) - G%areaT(i,j)*min_h
hlos = MAX(0.0,-vhr(i,J-1,k))
Expand All @@ -868,8 +868,8 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, &
else
vhh(i,J) = vhr(i,J,k)
endif
!ts2(i) = 0.5*(1.0 - vhh(i,J) / (hprev(i,j,k)+h_neglect))
CFL(i) = vhh(i,J) / (hprev(i,j,k)+h_neglect) ! CFL is positive
!ts2(i) = 0.5*(1.0 - vhh(i,J) / (hprev(i,j,k) + h_neglect*G%areaT(i,j)))
CFL(i) = vhh(i,J) / (hprev(i,j,k) + h_neglect*G%areaT(i,j)) ! CFL is positive
endif
enddo

Expand Down

0 comments on commit babc30a

Please sign in to comment.