anchor.diff:              ! downstream distance from far wake onset to downstream turbine
               deltax0 = x - x0
               
  -            if (x > (0.0_dp + tol)) then
  +            if (x > 0.0_dp) then
               
                   ! horizontal spread
                   call sigmay_func(ky, deltax0, rotorDiameter(turb), yaw(turb), sigmay)
  
positive.code:                         !print *, "rotorDiameter after far deltav ", rotorDiameter
                      ! near wake region (linearized)
                      else
                  
                          ! horizontal spread at far wake onset
                          call sigmay_func(ky_local, 0.0_dp, rotorDiameter(turb), yaw(turb), sigmay0)
                          !print *, "rotorDiameter after sigmay0", rotorDiameter
                  
                          ! vertical spread at far wake onset
                          call sigmaz_func(kz_local, 0.0_dp, rotorDiameter(turb), sigmaz0)
                          !print *, "rotorDiameter after sigmaz0", rotorDiameter
                          ! 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)
                          !print *, "rotorDiameter after deltav near ", rotorDiameter
                      end if
  
negative.code:                     !print *, 'deficit sum fw: ', deficit_sum
                  ! near wake region (linearized)
                  else
                      
                      ! determine distance from discontinuity point to far wake onset
                      deltax0_dp = discontinuity_point - x0
                  
                      ! horizontal spread at far wake onset
                      call sigmay_func(ky_local(turb), deltax0_dp, rotorDiameter(turb), yaw(turb), &
                                      & sigmay_dp)
                  
                      ! vertical spread at far wake onset
                      call sigmaz_func(kz_local(turb), deltax0_dp, rotorDiameter(turb), sigmaz_dp)
                  
                      ! velocity deficit in the nearwake (linear model)
                      call deltav_near_wake_lin_func(deltay, deltaz,        &
                                       & Ct(turb), yaw(turb), sigmay_dp, sigmaz_dp,           & 
                                       & rotorDiameter(turb), x, x0, sigmay_dp, sigmaz_dp,    & 
                                       & deltav)
                                       
                      !print *, "here 3"
  