Skip to content

Commit

Permalink
Explicitly initialize all of domore_u and domore_v
Browse files Browse the repository at this point in the history
  Added code to explicitly initialize the entire arrays of domore_u and domore_v
to .false.   Curiously, the value used for the initialization of these logical
arrays does not matter to the solutions, because if .false. they are reevaluated
after the first halo update (and always on the first iteration, and if .true. a
number of fluxes are exactly 0 anyway.  Of the two choices, .false. is more
efficient in that it avoids extra calculations of 0 fluxes.  However, if they
are not explicitly initialized, this can be detected by performance analysis
software like valgrid, so this change is primarly to avoid generating warnings.
All answers are bitwise identical, and this should address both MOM6 issue #304
and MOM6 issue #305.
  • Loading branch information
Hallberg-NOAA committed May 24, 2016
1 parent a07f62d commit 947eca6
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions SIS_tracer_advect.F90
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,15 @@ subroutine advect_tracer(Tr, h_prev, h_end, uhtr, vhtr, ntr, dt, G, IG, CS) ! (,
uhr(:,:,:) = 0.0 ; vhr(:,:,:) = 0.0
hprev(:,:,:) = landvolfill
h_neglect = IG%H_subroundoff
! Initialize domore_u and domore_v to .false.; they will be reevaluated later.
domore_u(:,:) = .false. ; domore_v(:,:) = .false.

!$OMP parallel default(none) shared(ncat,is,ie,js,je,domore_k,uhr,vhr,uhtr,vhtr,dt, &
!$OMP hprev,G,h_prev,h_end,isd,ied,jsd,jed,uh_neglect, &
!$OMP h_neglect,vh_neglect,ntr,Tr,domore_u,domore_v)
!$OMP do
do k=1,ncat
domore_k(k)=1
do j=js,je; domore_u(j,k) = .false.; enddo
do j=js-1,je; domore_v(j,k) = .false.; enddo
! Put the remaining (total) thickness fluxes into uhr and vhr.
do j=js,je ; do I=is-1,ie ; uhr(I,j,k) = dt*uhtr(I,j,k) ; enddo ; enddo
do J=js-1,je ; do i=is,ie ; vhr(i,J,k) = dt*vhtr(i,J,k) ; enddo ; enddo
Expand Down Expand Up @@ -491,11 +492,20 @@ subroutine advect_scalar(scalar, h_prev, h_end, uhtr, vhtr, dt, G, IG, CS) ! (,
max_iter = 3
if (CS%dt > 0.0) max_iter = 2*INT(CEILING(dt/CS%dt)) + 1

! This initializes the halos of uhr and vhr because pass_vector might do
! calculations on them, even though they are never used.
! This initializes the halos of uhr and vhr because pass_vector might do
! calculations on them, even though they are never used.
uhr(:,:,:) = 0.0 ; vhr(:,:,:) = 0.0
hprev(:,:,:) = landvolfill
h_neglect = IG%H_subroundoff

! Initialize domore_u and domore_v. Curiously, the value used for
! initialization does not matter to the solutions, because if .false.
! they are reevaluated after the first halo update (and always on the first
! iteration, and if .true. a number of fluxes are exactly 0 anyway. Of the
! two choices, .false. is more efficient in that it avoids extra
! calculations of 0 fluxes.
domore_u(:,:) = .false. ; domore_v(:,:) = .false.

!$OMP parallel default(none) shared(is,ie,js,je,ncat,domore_k,uhr,vhr,uhtr,vhtr,dt,G, &
!$OMP hprev,h_prev,h_end,isd,ied,jsd,jed,uh_neglect, &
!$OMP h_neglect,vh_neglect,domore_u,domore_v)
Expand All @@ -504,19 +514,8 @@ subroutine advect_scalar(scalar, h_prev, h_end, uhtr, vhtr, dt, G, IG, CS) ! (,
domore_k(k)=1

! Put the remaining (total) thickness fluxes into uhr and vhr.
! Initialise domore_u, domore_v
do j=js,je
domore_u(j, k) = .false.
do I=is-1,ie
uhr(I,j,k) = dt*uhtr(I,j,k)
enddo
enddo
do J=js-1,je
domore_v(j, k) = .false.
do i=is,ie
vhr(i,J,k) = dt*vhtr(i,J,k)
enddo
enddo
do j=js,je ; do I=is-1,ie ; uhr(I,j,k) = dt*uhtr(I,j,k) ; enddo ; enddo
do J=js-1,je ; do i=is,ie ; vhr(i,J,k) = dt*vhtr(i,J,k) ; enddo ; enddo
! Find the previous total mass (or volume) of ice, but in the case that this
! category is now dramatically thinner than it was previously, add a tiny
! bit of extra mass to avoid nonsensical tracer concentrations. This will
Expand Down

0 comments on commit 947eca6

Please sign in to comment.