anchor.diff:          ! get index of downstream turbine
           turbI = sorted_x_idx(d) + 1
           
  -        ! initialize the TI_area_ratio to 0.0 for each turbine
  -        ti_area_ratio = 0.0_dp
  -        
           do, p=1, nRotorPoints
  +        
  +            ! initialize the TI_area_ratio to 0.0 for each turbine
  +            ti_area_ratio = 0.0_dp
       
               ! initialize deficit summation term to zero
               deficit_sum = 0.0_dp
  
positive.code:                     if ((x > 0.0_dp) .and. (TI_calculation_method > 0)) then
                          !print *, "turbI, turb: ", turbI, turb
                          ! calculate TI value at each turbine
                          print *, "turb, turbI: ", turb, turbI
                          call added_ti_func(TI, Ct(turb), x, ky_local, rotorDiameter(turb), & 
                                             & rotorDiameter(turbI), deltay, turbineZ(turb), &
                                             & turbineZ(turbI), TIturbs(turb), &
  
negative.code:         
          ! Check if this is the max and use it if it is
          if (ti_area_ratio_tmp > ti_area_ratio) then
  !            print *, "ti_area_ratio_tmp > ti_area_ratio"
             TI_dst = TI_tmp
             ti_area_ratio = ti_area_ratio_tmp
          end if
  