subroutine delta_wind_direction (i_cross,j_cross,tt,temp_FF_subgrid,angle_diff)
use uEMEP_definitions
implicit none
integer, intent(in) :: i_cross,j_cross,tt
real, intent(in) :: temp_FF_subgrid
real, intent(out) :: angle_diff
real :: meandering_degree_max=20.
real cos_subgrid_loc,sin_subgrid_loc
if (use_last_meteo_in_dispersion) then
cos_subgrid_loc=meteo_subgrid(i_cross,j_cross,tt,cos_subgrid_index)
sin_subgrid_loc=meteo_subgrid(i_cross,j_cross,tt,sin_subgrid_index)
angle_diff=abs(asin(meteo_subgrid(i_cross,j_cross,tt,sin_subgrid_index)*last_meteo_subgrid(i_cross,j_cross,cos_subgrid_index) &
-meteo_subgrid(i_cross,j_cross,tt,cos_subgrid_index)*last_meteo_subgrid(i_cross,j_cross,sin_subgrid_index) ))/2.
angle_diff=min(angle_diff,3.14159/4.) !Less than 45 degrees
!write(*,*) i_cross,j_cross,angle_diff(i_cross,j_cross)*180/3.14159
else
angle_diff=0.
endif
if (use_meandering_in_dispersion) then
angle_diff=angle_diff+(meandering_degree_max*3.14159/180.)*exp(-(temp_FF_subgrid-FF_min_dispersion)/(FF_min_dispersion*2.))
endif
end subroutine delta_wind_direction