Skip to content

Commit

Permalink
fix loop ranges for polar projection (#1919)
Browse files Browse the repository at this point in the history
TYPE: bug fix
KEYWORDS: lat/long projection only, polar boundary condition, loop ranges in advect_w

SOURCE: internal and Forum, see Issue #1916 for link

DESCRIPTION OF CHANGES:
Problem:
Loop ranges in polar boundary condition inconsistent with set variables and regular code.
Not sure if any effect, since it only affects w at poles.
Solution:
Change ranges from kte,kte to kts+1,kte+1 in advect_w

ISSUE: For use when this PR closes an issue.
Fixes #1916

LIST OF MODIFIED FILES:
M dyn_em/module_advect_em.F

TESTS CONDUCTED:

Compile only (needs confirmation test to check if any effects).
Jenkins PASSed
RELEASE NOTE: Fixed loop range in advect_w for lat-long map projection.
  • Loading branch information
dudhia committed Dec 6, 2023
1 parent 3dd1546 commit 3557d20
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dyn_em/module_advect_em.F
Expand Up @@ -4620,14 +4620,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, &
! (latitudes are as for u grid, longitudes are displaced)
! Therefore: flow is only from one side for points next to poles
IF ( config_flags%polar .AND. (j == jds+1) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1)
END DO
END DO
ELSE IF( config_flags%polar .AND. (j == jde) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0)
Expand Down Expand Up @@ -4934,14 +4934,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, &
! (latitudes are as for u grid, longitudes are displaced)
! Therefore: flow is only from one side for points next to poles
IF ( config_flags%polar .AND. (j == jds+1) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1)
END DO
END DO
ELSE IF( config_flags%polar .AND. (j == jde) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0)
Expand Down Expand Up @@ -5293,14 +5293,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, &
! (latitudes are as for u grid, longitudes are displaced)
! Therefore: flow is only from one side for points next to poles
IF ( config_flags%polar .AND. (j == jds+1) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1)
END DO
END DO
ELSE IF( config_flags%polar .AND. (j == jde) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0)
Expand Down Expand Up @@ -5525,14 +5525,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, &
! (latitudes are as for u grid, longitudes are displaced)
! Therefore: flow is only from one side for points next to poles
IF ( config_flags%polar .AND. (j == jds+1) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1)
END DO
END DO
ELSE IF( config_flags%polar .AND. (j == jde) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0)
Expand Down Expand Up @@ -12541,14 +12541,14 @@ SUBROUTINE advect_weno_w ( w, w_old, tendency, &
! (latitudes are as for u grid, longitudes are displaced)
! Therefore: flow is only from one side for points next to poles
IF ( config_flags%polar .AND. (j == jds+1) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1)
END DO
END DO
ELSE IF( config_flags%polar .AND. (j == jde) ) THEN
DO k=kts,ktf
DO k=kts+1,ktf+1
DO i = i_start, i_end
mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS
tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0)
Expand Down

0 comments on commit 3557d20

Please sign in to comment.