subroutine magdif(xx,yy,eta,detadr) c===========================================================================* c SUN AND LATE-TYPE STAR BABCOCK-LEIGHTON DYNAMOS: c c computes magnetic diffusivity and its radial derivative c at at r/R=yy, cos(theta)=xx c c Diffusivity is unity in envelope, and falls by a factor etadf at r/R=rzc; c falloff is error function with half-width w/R=ybl. See sec. 2.2 in DC99 c c eta is magnetic diffusivity c detadr is radial derivative of magnetic diffusivity c=========================================================================== c Refs: Dikpati & Charbonneau 1999 , ApJ, 518, 508-ff c c Last revised 10/07/2001 c=========================================================================== implicit none include "arrays.global.f" c Input real xx,yy c Output real eta,detadr c Local real tt,g1r,dg1r,df,pi data pi/3.1415926536/ real erf c--------------------------------------------------------------------------- if(yy.gt.1.0)then c --> exterior: eta=1. eta=1. detadr=0. else c --> interior: error function profile tt=(yy-rzc)/ybl g1r=0.5*(1.+erf(tt)) dg1r=1./(ybl*sqrt(pi)) *exp(-tt**2) df=1./etadf eta =df+(1.-df)*g1r detadr= (1.-df)*dg1r endif return end