anchor.diff:                  
               ! downstream distance from far wake onset to downstream turbine
               deltax0 = x - x0
  -
  -            ! far wake region
  -            if (x >= x0) then
  -                
  +            
  +            if (x > 0.0_dp) then
  +            
                   ! horizontal spread
                   call sigmay_func(ky, deltax0, rotorDiameter(turb), yaw(turb), sigmay)
  -                
  +            
                   ! vertical spread
                   call sigmaz_func(kz, deltax0, rotorDiameter(turb), sigmaz)
  -                
  +            
                   ! horizontal cross-wind wake displacement from hub
                   call wake_offset_func(rotorDiameter(turb), theta_c_0, x0, yaw(turb), &
                                        & ky_local(turb), kz_local(turb), Ct(turb), sigmay, &
                                        & sigmaz, wake_offset)
  -                                     
  +                                 
                   ! horizontal distance from downstream hub location to wake center
                   deltay = velY(loc) - (turbineYw(turb) + wake_offset)
  -                
  +            
                   ! vertical distance from downstream hub location to wake center
                   deltaz = velZ(loc) - turbineZ(turb)
  -                
  -                ! velocity difference in the wake
  -                call deltav_func(deltay, deltaz, Ct(turb), & 
  -                                 & yaw(turb), sigmay, sigmaz, rotorDiameter(turb), deltav)
  -
  -            ! near wake region (linearized)
  -            else if (x > 0.0_dp) then
  -
  -                ! horizontal spread at point of interest
  -                call sigmay_func(ky_local(turb), deltax0, rotorDiameter(turb), &
  -                                & yaw(turb), sigmay)
  -                
  -                ! vertical spread at point of interest
  -                call sigmaz_func(kz_local(turb), deltax0, rotorDiameter(turb), sigmaz)
  -                                                
  -                ! horizontal cross-wind wake displacement from hub
  -                call wake_offset_func(rotorDiameter(turb), theta_c_0, x0, yaw(turb), &
  -                                     & ky_local(turb), kz_local(turb), Ct(turb), sigmay, &
  -                                     & sigmaz, wake_offset)
  -                
  -                ! horizontal distance from downstream hub location to wake center
  -                deltay = velY(loc) - (turbineYw(turb) + wake_offset)
  -                
  -                ! vertical distance from downstream hub location to wake center
  -                deltaz = velZ(loc) - turbineZ(turb)
  -                
  -                ! horizontal spread at far wake onset
  -                call sigmay_func(ky_local(turb), 0.0_dp, rotorDiameter(turb), yaw(turb), &
  -                                & sigmay0)
  -                
  -                ! vertical spread at far wake onset
  -                call sigmaz_func(kz_local(turb), 0.0_dp, rotorDiameter(turb), sigmaz0)
  -                
  -                ! velocity deficit in the nearwake (linear model)
  -                call deltav_near_wake_lin_func(deltay, deltaz, Ct(turb), yaw(turb), & 
  -                                              & sigmay0, sigmaz0, rotorDiameter(turb), & 
  -                                              & x, x0, sigmay0, sigmaz0, deltav)
  -
  +
  +                ! far wake region
  +                if (x >= x0) then
  +
  +                    ! velocity difference in the wake
  +                    call deltav_func(deltay, deltaz, Ct(turb), & 
  +                                     & yaw(turb), sigmay, sigmaz, rotorDiameter(turb), deltav)
  +
  +                ! near wake region (linearized)
  +                else
  +                
  +                    ! horizontal spread at far wake onset
  +                    call sigmay_func(ky_local(turb), 0.0_dp, rotorDiameter(turb), yaw(turb), &
  +                                    & sigmay0)
  +                
  +                    ! vertical spread at far wake onset
  +                    call sigmaz_func(kz_local(turb), 0.0_dp, rotorDiameter(turb), sigmaz0)
  +                
  +                    ! velocity deficit in the nearwake (linear model)
  +                    call deltav_near_wake_lin_func(deltay, deltaz, Ct(turb), yaw(turb), & 
  +                                                  & sigmay0, sigmaz0, rotorDiameter(turb), & 
  +                                                  & x, x0, sigmay0, sigmaz0, deltav)
  +
  +                end if
  +            
  +                ! combine deficits according to selected method wake combination method
  +                call wake_combination_func(wind_speed, wtVelocity(turb), deltav,         &
  +                                           wake_combination_method, deficit_sum) 
  +            
               end if
               
  -            ! combine deficits according to selected method wake combination method
  -            call wake_combination_func(wind_speed, wtVelocity(turb), deltav,         &
  -                                       wake_combination_method, deficit_sum)  
  +            ! if (x < 0.0_dp ) then
  +!                 print *, "deltav: ", deltav
  +!                 print *, "deficit sum at ", turb, ": ", deficit_sum 
  +!                 print *, "deltax: ", x
  +!                 print *, "deltav: ", deltav
  +!             end if
  +            
           end do
           
           ! final velocity calculation for location loc
           wsArray(loc) = wind_speed - deficit_sum
  -        print *, deficit_sum
  +        ! print *, 'deficit sum: ', deficit_sum
       end do
   
   end subroutine porteagel_visualize
  
positive.code:         ! initialize deficit summation term to zero
          deficit_sum = 0.0_dp
          
  !         print *, turbineXw(turbI)
          
          do, u=1, nTurbines ! at turbineX-locations
              
              ! get index of upstream turbine
  
negative.code:                 
              end if
          end do
          
          ! final velocity calculation for turbine turbI
          wtVelocity(turbI) = wind_speed - deficit_sum
      
      end do
  
      do, loc=1, nSamples
           
          ! set combined velocity deficit to zero for loc
          deficit_sum = 0.0_dp
          
          do, turb=1, nTurbines ! at turbineX-locations
          
              ! set velocity deficit at loc due to turb to zero
              deltav = 0.0_dp
  
              ! determine the onset location of far wake
              call x0_func(rotorDiameter(turb), yaw(turb), Ct(turb), alpha, TIturbs(turb), &
                          & beta, x0)
  