anchor.diff:      real(dp), dimension(nSamples), intent(out) :: wsArray
   
       intrinsic sin, cos, atan, max, sqrt, log
  +    
  +    !print *, "entering visualization code"
   
       ! bastankhah and porte agel 2016 define yaw to be positive clockwise, this is reversed
       yaw = - yawDeg*pi/180.0_dp
  
positive.code:                                              
                  ! far wake region
                  if (x > discontinuity_point) then
  
                      ! velocity difference in the wake
                      call deltav_func(deltay, deltaz, Ct(turb), yaw(turb),  &
                                      & sigmay, sigmaz, rotorDiameter(turb), deltav)
                      !print *, "here 2"
                      !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"
                  end if
  
negative.code:         
      ! wake combination method error 
      else
          !print *, "Invalid added TI calculation method. Must be one of [1,2,3]."
          stop 1
      end if            
      
  