anchor.diff:                  ! get index of upstream turbine
                   turb = sorted_x_idx(u) + 1
           
  -                ! downstream distance between turbines
  -                x = turbineXw(turbI) - turbineXw(turb)
  +                ! downstream distance between turbines, adjust for downstream turbine yaw
  +                x = turbineXw(turbI) - turbineXw(turb) + LocalRotorPointY*sin(yaw(turbI))
               
                   ! set this iterations velocity deficit to 0
                   deltav = 0.0_dp
                   
                   ! check turbine relative locations
  -                if (x > 0.0_dp) then
  +                if (x > (0.0_dp + tol)) then
                   
                       ! determine the onset location of far wake
                       call x0_func(rotorDiameter(turb), yaw(turb), Ct(turb), alpha, & 
  
positive.code:                                          
                                           
                      !print *, "wake_offset ", wake_offset                 
                      ! cross wind distance from downstream hub location to wake center
                      deltay = LocalRotorPointY + turbineYw(turbI) - (turbineYw(turb) + wake_offset)
              
                      ! cross wind distance from hub height to height of point of interest
                      deltaz = LocalRotorPointZ + turbineZ(turbI) - turbineZ(turb)
                      !print *, deltaz, deltay
                      ! far wake region
                      if (x >= x0) then
  
negative.code:     ! model out
      real(dp), dimension(nTurbines), intent(out) :: wtVelocity
  
      intrinsic sin, cos, atan, max, sqrt, log
      
      
  
      ! bastankhah and porte agel 2016 define yaw to be positive clockwise, this is reversed
      yaw = - yawDeg*pi/180.0_dp
      
      ! set tolerance for location checks
      tol = 0.1_dp
      
      ! initialize wind turbine velocities to 0.0
      wtVelocity = 0.0_dp
      
      ! initialize TI of all turbines to free-stream value
      !print *, "start TIturbs: ", TIturbs
  