anchor.diff:              ! scale rotor sample point coordinate by rotor diameter (in rotor hub ref. frame)
               LocalRotorPointY = RotorPointsY(p)*0.5_dp*rotorDiameter(turbI)
               LocalRotorPointZ = RotorPointsZ(p)*0.5_dp*rotorDiameter(turbI)
  -!             print *, "rotorDiameter after local rotor points", rotorDiameter
  -!             print *, "local rotor points Y,Z: ", LocalRotorPointY, LocalRotorPointZ
  +!             !print *, "rotorDiameter after local rotor points", rotorDiameter
  +!             !print *, "local rotor points Y,Z: ", LocalRotorPointY, LocalRotorPointZ
           
               do, u=1, nTurbines ! at turbineX-locations
               
  
positive.code:                         !print *, "rotorDiameter after TI calcs", rotorDiameter
                      end if
                      
  !                     print *, "deficit_sum, turbI, p, turb: ", deficit_sum, turbI, p, turb
                  
                  end if
              
  
negative.code:                                              
                  ! far wake region
                  if (x > discontinuity_point) then
                  
                      !print *, "entering second logic"
  
                      ! velocity difference in the wake
                      call deltav_func(deltay, deltaz, Ct(turb), yaw(turb),  &
                                      & sigmay, sigmaz, rotorDiameter(turb), opt_exp_fac, &
                                      & deltav)
                      !print *, "here 2"
                      !print *, 'deficit sum fw: ', deficit_sum
                  ! near wake region (linearized)
                  else
                      !print *, "entering else"
                      
                      ! determine distance from discontinuity point to far wake onset
                      deltax0_dp = discontinuity_point - x0
                  
                      !print *, "entering horizontal spread"
                      ! horizontal spread at far wake onset
                      call sigmay_func(ky_local(turb), deltax0_dp, rotorDiameter(turb), yaw(turb), &
                                      & sigmay_dp)
                      !print *, "entering vertical spread"
                      ! vertical spread at far wake onset
                      call sigmaz_func(kz_local(turb), deltax0_dp, rotorDiameter(turb), sigmaz_dp)
                      !print *, "entering near wake linearized"
                      ! 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,    & 
                                       & opt_exp_fac, deltav)
                      !print *, "exited near wake linearize"
                                       
                      !print *, "here 3"
                  end if
  