anchor.diff:                      call deltav_near_wake_lin_func(deltay, deltaz, &
                                        & Ct(turb), yaw(turb), sigmay0, sigmaz0, & 
                                        & rotorDiameter(turb), x, x0, sigmay0, sigmaz0, deltav)
  -
  -                    ! 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 ((deltax0 > 0.0_dp) .and. (TI_calculation_method > 0)) then
                   
  
positive.code:                 ! calculate wake spreading parameter at each turbine if desired
                  if (calc_k_star .eqv. .true.) then
                      call k_star_func(TIturbs(turb), k_star(turb))
                      ky_local(turb) = k_star(turb)
                      kz_local(turb) = k_star(turb)
                  end if
                  
                  ! far wake region
                  if (x >= x0) then
                  
                      ! determine the initial wake angle at the onset of far wake
                      call theta_c_0_func(yaw(turb), Ct(turb), theta_c_0)
              
                      ! horizontal spread
                      call sigmay_func(ky_local(turb), deltax0, rotorDiameter(turb), &
                                      & yaw(turb), sigmay)
                      !print *, "sigmay ", sigmay
                      ! vertical spread
                      call sigmaz_func(kz_local(turb), deltax0, rotorDiameter(turb), sigmaz)
                      !print *, "sigmaz ", 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)
                      !print *, "wake_offset ", wake_offset                 
                      ! cross wind distance from downstream hub location to wake center
                      deltay = turbineYw(turbI) - (turbineYw(turb) + wake_offset)
                  
                      ! cross wind distance from hub height to height of point of interest
                      deltaz = turbineZ(turbI) - turbineZ(turb)
                  
                      ! velocity difference in the wake
                      call deltav_func(deltay, deltaz, Ct(turb), & 
                                       & yaw(turb), sigmay, sigmaz, rotorDiameter(turb), deltav)
      
                      ! linear supposition
                      !deficit_sum = deficit_sum + deltav
              
                      ! combine deficits according to selected method wake combination method
                      call wake_combination_func(wind_speed, wtVelocity(turb), deltav,         &
                                                 wake_combination_method, deficit_sum)  
  
                  ! near wake region (linearized)
                  else
                  
                      ! determine the initial wake angle at the onset of far wake
                      call theta_c_0_func(yaw(turb), Ct(turb), theta_c_0)
      
                      ! horizontal spread at point of interest (currently same as x0)
                      call sigmay_func(ky_local(turb), deltax0, rotorDiameter(turb), yaw(turb), sigmay)
                      
                      ! vertical spread at point of interest (currently same as x0)
                      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)
                      
                      ! distance from downstream hub location to wake center
                      deltay = turbineYw(turbI) - (turbineYw(turb) + wake_offset)
                  
                      ! vertical distance from downstream hub location to wake center
                      deltaz = turbineZ(turbI) - turbineZ(turb)
                  
                      ! horizontal spread at far wake onset
                      call sigmay_func(ky_local, 0.0_dp, rotorDiameter(turb), yaw(turb), sigmay0)
  
negative.code:     deltav = (((deltav0m - deltavr)/x0) * x + deltavr) *              &
          exp(-0.5_dp * (deltay / sigmay) ** 2) *                       &
          exp(-0.5_dp * (deltaz / sigmaz) ** 2)
      ! if (deltav > 0.5) then
  !         print *, deltav
  !     end if
      
  end subroutine deltav_near_wake_lin_func
  
  