;;; Calculate the curl of a 3-d vector field function curl_r,f,rr_1,cot_theta COMPILE_OPT IDL2,HIDDEN return,yder(f[*,*,*,2])-zder(f[*,*,*,1])+cot_theta*rr_1*f[*,*,*,2] end function curl_theta,f,rr_1 COMPILE_OPT IDL2,HIDDEN return,zder(f[*,*,*,0])-xder(f[*,*,*,2])-rr_1*f[*,*,*,2] end function curl_phi,f,rr_1 COMPILE_OPT IDL2,HIDDEN return,xder(f[*,*,*,1])-yder(f[*,*,*,0])+rr_1*f[*,*,*,1] end function curl_sph,f,rr_1,cot_theta COMPILE_OPT IDL2,HIDDEN w=make_array(size=size(f),/nozero) w[*,*,*,0]=curl_r(f,rr_1,cot_theta) w[*,*,*,1]=curl_theta(f,rr_1) w[*,*,*,2]=curl_phi(f,rr_1) return,w end