anchor.diff:          logical, intent(in) :: reverse
           integer, intent(in) :: vsmooth
           integer, intent(in) :: winsz
  -        
  +
           logical :: externalN ! flag whether N is read from a field in the forcing dataset
           integer :: nx,nxu, ny,nyv, nz, i,j,k, smoothz
           integer :: uk, vi !store a separate value of i for v and of k for u to we can handle nx+1, ny+1
  
positive.code:                 ! $omp end parallel
              endif
          else
                  domain%nsquared = options%lt_options%N_squared
          endif
  
          ! smooth array has it's own parallelization, so this probably can't go in a critical section
  
negative.code:                         ! look up table is computed in log space
                          domain%nsquared(:,j,k) = log(domain%nsquared(:,j,k))
                      end do
  
                      if (smooth_nsq) then
                          do j=1,nz
                              ! compute window as above.
                              top = min(j+vsmooth,nz)
                              bottom = max(1, j - (vsmooth - (top-j)) )
  
                              do smoothz = bottom, j-1
                                  domain%nsquared(:,j,k) = domain%nsquared(:,j,k) + domain%nsquared(:,smoothz,k)
                              end do
  