1c1 < subroutine calccloc(model_ctpoten,ifbad) --- > subroutine calccloc (istep,model_ctpoten,ifcen,ifbad) 20,25d19 < ! where one example of this is CMIT which makes the convection center always at the pole < ! (offc=offa=dskofc=0, dskofa=-2.5deg) outside this routine whether ifbad is 0 or not. < ! Sep 12: bae: Add efxS,efxN,ifarad to find auroral radius and to replace arad=crad+2 if ifarad>0 < ! ifarad = 2 (do 2 things:) calc Ra (arad) and use Rc=Ra-4 deg instead of < ! the default 12 deg for Rc (crad) when both ifbad>0 < ! ih=1,2 for SH and NH 27a22,28 > ! May 13 bae: revisions for ifbad=0 or 1 outside calccloc and in revcloc or > ! CMIT validate_potential_parameters. Added more printout for istep > ! Fixed problems: (1) kmlt_min,max integer not real, > ! (2) i1,i2 for knx1 bad from j_min not i_min, > ! (3) inx used for inm,p ixm,p not i_min,max (deleted inx) > ! (4) j1 and j2 not revised for NH (ih=2) so always using SH phihm to calc theta0, > ! and when j1,j2 correct for phihm, change mlatdeg(nmlat) from -90 to +90 mlat 30c31 < ! --- > ! ih=1,2 for SH and NH 50,53c51 < #if defined(INTERCOMM) || defined(CISMAH) < !FIXME: this shouldn't require cism_coupling_module < use cism_coupling_module,only: validate_potential_parameters < #endif --- > ! use cism_coupling_module,only: validate_potential_parameters 55c53,54 < ! ... Arguments ........................................................ --- > ! ... Arguments ........................................................ > integer,intent(in) :: istep,ifcen 59c58 < integer,parameter :: ifwr=0 ! ifwr=1 is a print flag for extra output --- > integer,parameter :: ifwr=0 ! ifwr=1,2 is a print flag for extra output 61,70c60,70 < ! ... Local variables .................................................. < real,dimension(nmlonp1) :: < | mltsh, ! CMIT/MIX: hours from noon clockwise PM to AM to noon, < ! AMIE: hours from 0 to 24 MLT < | mltnh ! CMIT/MIX: hours from midnight clockwise AM to PM to midnight < ! AMIE: hours from 0 to 24 MLT < < real,dimension(nmlat_subset) :: < | ylatm_deg_nh, ! Magnetic latitude in Northern Hemisphere (degrees) < | ylatm_deg_sh ! Magnetic latitude in Southern Hemisphere (degrees) --- > ! ... Local variables .................................................. > ! 05/13 bae: Use the TIEGCM distorted magnetic grid of ylatm,ylonm with phihm > ! Do not use the real mlat/mlt grids of AMIE or CMIT etc > ! real,dimension(nmlonp1) :: > ! | mltsh, ! CMIT/MIX: hours from noon clockwise PM to AM to noon, > ! ! AMIE: hours from 0 to 24 MLT > ! | mltnh ! CMIT/MIX: hours from midnight clockwise AM to PM to midnight > ! ! AMIE: hours from 0 to 24 MLT! > ! real,dimension(nmlat_subset) :: > ! | ylatm_deg_nh, ! Magnetic latitude in Northern Hemisphere (degrees) equ to +90 > ! | ylatm_deg_sh ! Magnetic latitude in Southern Hemisphere (degrees) -90 to equ 73,75c73,75 < real :: phihm_min(2), phihm_max(2) < integer j_min(2), i_min(2), kmlt_min(2) < integer j_max(2), i_max(2), kmlt_max(2) --- > real :: phihm_min(2), phihm_max(2), kmlt_min(2), kmlt_max(2) > integer j_min(2), i_min(2) > integer j_max(2), i_max(2) 77c77 < integer :: inx(2,2),jinx(nmlonp1,2) --- > integer :: jinx(nmlonp1,2) 82c82 < real :: mlatdeg(nmlat_subset),mltarr(nmlonp1) --- > real :: mlatdeg(nmlat),mltarr(nmlonp1) 88c88 < integer :: ihb,ihg --- > 94,97c94,96 < mltSh(i) = (ylonm(i)-sunlons(1)) * rtd / 15. + 12. < if (mltSh(i) .gt. 24.) mltSh(i) = mltSh(i) - 24. < if (mltSh(i) .lt. 0.) mltSh(i) = mltSh(i) + 24. < mltNh(i) = mltSh(i) --- > mltarr(i) = (ylonm(i)-sunlons(1)) * rtd / 15. + 12. > if (mltarr(i) .gt. 24.) mltarr(i) = mltarr(i) - 24. > if (mltarr(i) .lt. 0.) mltarr(i) = mltarr(i) + 24. 100c99 < ! ! Get points from poles to about +/-35 mlat --- > ! ! Get points from poles to about +/-35 mlat or use nmlat_subset=nmlat/4-1 108,110c107,108 < do j=1,nmlat_subset < ylatm_deg_sh(j) = ylatm(j)*rtd < ylatm_deg_nh(j) = ylatm(nmlat-j+1) * rtd --- > do j=1,nmlat > mlatdeg(j) = ylatm(j)*rtd 111a110,111 > if (istep<2) write (6,"(1x,'mlatdeg =',10f6.2)") mlatdeg > if (istep<2) write (6,"(1x,'mltarr =',10f6.2)") mltarr 116,118c116 < ! Dec 2011 for CMIT tests (j1 and j2 are used often, so must redefine them for each ih) < j1 = 1 < j2 = nmlat_subset --- > 120,125c118,120 < do j=1,nmlat_subset < mlatdeg(j) = abs(ylatm_deg_sh(j)) < enddo < do i=1,nmlonp1 < mltarr(i) = mltsh(i) < enddo --- > ! SH (ih=1) j1 and j2 are used often, so must redefine them for each ih > j1 = 1 > j2 = nmlat_subset 127,132c122,124 < do j=1,nmlat_subset < mlatdeg(j) = ylatm_deg_nh(j) < enddo < do i=1,nmlonp1 < mltarr(i) = mltnh(i) < enddo --- > ! NH (ih=2) > j1 = nmlat + 1 - nmlat_subset > j2 = nmlat 136,139c128,131 < if (ifwr .eq. 1) write (6,"(1x, < | 'Original convection/oval params (By,loc,off,dsk', < | 'n=',11f9.4)") dskofc(ih)*rtd,theta0(ih)*rtd < --- > if (ifwr .ge. 1 .or. istep<3) write (6,"(1x, > | 'Original convection params istep,ih offc,dskofc,crad =',2i5, > | 3f9.4)") istep,ih,offc(ih)*rtd,dskofc(ih)*rtd, > | theta0(ih)*rtd 152c144 < if (abs(mlatdeg(j)) .gt. 89.99) kmlt_min(ih) = 6. !FIXME: Magic numbers --- > if (abs(mlatdeg(j)) .gt. 89.99) kmlt_max(ih) = 6. !FIXME: Magic numbers 166a159,166 > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'istep ih i,j,min,mlt,mlat i,j,max,mlt,mlat CP =', > | i5,1x,3i4,3f8.2,1x,2i4,3f8.2,1x,f8.2)") > | istep,ih,i_min(ih),j_min(ih),phihm_min(ih)*0.001,kmlt_min(ih), > | mlatdeg(j_min(ih)),i_max(ih),j_max(ih), > | phihm_max(ih)*0.001,kmlt_max(ih),mlatdeg(j_max(ih)), > | model_ctpoten(ih) > 184,187c184,187 < if (ifwr .eq. 1) < | write (6,"(1x,'rhon,x thetan,x x,yn x,y,x dskof,offc,radc =', < | 11f6.1)") rhon,rhox,thetandeg,thetaxdeg,xn,yn,xx,yx, < | dskofcen(ih),offcen(ih),radcen(ih) --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ifcen,bad rhon,x thetan,x x,yn x,yx off,dsk,', > | 'radc =',3i2,11f6.1)") ifcen,ifbad,rhon,rhox,thetandeg, > | thetaxdeg,xn,yn,xx,yx,offcen(ih),dskofcen(ih),radcen(ih) 195a196,200 > > ! Skip calculation of dskoffc and offc when ifcen=1 and use radcen as crad > ! and ASSUME revcloc sets dskoffc (usually zero) and offc (NON-ZERO!) properly > if (ifcen==1) cycle > 203c208 < mltinx(i,k) = -999. --- > ! mltinx(i,k) = -999. ! mltinx is always defined later on, so don't check on it alone 207,208c212,215 < ! MLT is 0.3 MLT apart (24/80=0.3) so find half this for testing near edge < dmlthalf = 0.5 * 24./(nmlonp1-1) --- > ! Find ~half d(MLT) spacing for testing near edge (MLT spaced 24./(nmlonp1-1) hours apart) > dmlthalf = 0.75 * 24./(nmlonp1-1) > if (istep<3) write (6,"(1x,'ifcen,bad dmlthalf =',3i2,f8.2)") > | ifcen,ifbad,dmlthalf 223c230,231 < i1 = j_min(ih) - nmlonp1/3 --- > ! i1 = j_min(ih) - nmlonp1/3 ! j_min should be i_min! > i1 = i_min(ih) - nmlonp1/3 225c233,234 < i2 = j_min(ih) + nmlonp1/3 --- > ! i2 = j_min(ih) + nmlonp1/3 ! j_min should be i_min! > i2 = i_min(ih) + nmlonp1/3 228,229c237,239 < if (ifwr .eq. 1) write (6,"(1x,'k j1,2 i1,2=',i2,2i3,2i4)") < | k,j1,j2,i1,i2 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih k j1,2 i1,2=',2i2,2i3,2i4)") > | ih,k,j1,j2,i1,i2 235c245 < ! MLT is dmlthalf*2 apart in hours - find edge --- > ! dmlthalf*2=d(MLT) - find edge ~18MLT 245,249c255,259 < if (ifwr .eq. 2) write (6,"(1x,'latinx(i,k),i=i1,i2)=',10f7.2)") < | (latinx(i,k),i=i1,i2) < if (ifwr .eq. 2) < | write (6,"(1x,'knx1 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx1 i18 =',i4)")i18 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx1 i j v mlt dmlt18 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-18.), > | latinx(i,k),i=i1,i2) 255c265,266 < if (ifwr .eq. 1) write (6,"(1x,'i<1 dusk: i1,2=',2i4)") i1,i2 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'i<1 dusk: i1,2=',2i4)") i1,i2 261,262c272,273 < ! MLT is dmlthalf*2 apart in hours - find edge < if (abs(mltinx(i,k)-18.) .lt. dmlthalf) i18=i --- > ! dmlthalf*2=d(MLT) - find edge ~18MLT > if (abs(mltinx(i,k)-18.) .lt. dmlthalf) i18=i 271,275c282,286 < if (ifwr .eq. 2) write (6,"(1x,'latinx(i,k),i=i1,i2)=',10f7.2)") < | (latinx(i,k),i=i1,i2) < if (ifwr .eq. 2) < | write (6,"(1x,'knx2 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx2 i18 =',i4)")i18 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx2 i j v mlt dmlt18 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-18.), > | latinx(i,k),i=i1,i2) 278c289 < if (i_min(ih) + nmlonp1/3 .gt. nmlonp1) then --- > if (i_min(ih) + nmlonp1/3 .gt. nmlonp1) then 281,282c292,293 < if (ifwr .eq. 1) write (6,"(1x,'i>nmlonp1 dusk: i1,2=',2i4)") < | i1,i2 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'i>nmlonp1 dusk: i1,2=',2i4)") i1,i2 288,289c299,300 < ! MLT is dmlthalf*2 apart in hours - find edge < if (abs(mltinx(i,k)-18.) .lt. dmlthalf) i18=i --- > ! dmlthalf*2=d(MLT) - find edge ~18MLT > if (abs(mltinx(i,k)-18.) .lt. dmlthalf) i18=i 298,303c309,314 < if (ifwr .eq. 2) write (6,"(1x,'latinx(i,k),i=i1,i2)=',10f7.2)") < | (latinx(i,k),i=i1,i2) < if (ifwr .eq. 2) < | write (6,"(1x,'knx3 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) < endif ! if (inx(ih,k) + nmlonp1/3 .gt. nmlonp1) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx3 i18 =',i4)")i18 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx3 i j v mlt dmlt18 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-18.), > | latinx(i,k),i=i1,i2) > endif ! if (inx(ih,k) + nmlonp1/3 .gt. nmlonp1) 315c326,327 < if (ifwr .eq. 1) write(6,"(1x,'k j1,2 i1,2=',5i3)")k,j1,j2,i1,i2 --- > if (ifwr .ge. 1 .or. istep<3) > | write(6,"(1x,'ih k j1,2 i1,2=',6i3)") ih,k,j1,j2,i1,i2 321c333 < ! MLT is dmlthalf*2 apart in hours - find edge --- > ! dmlthalf*2=d(MLT) - find edge ~6MLT 331,333c343,347 < if (ifwr .eq. 2) < | write (6,"(1x,'knx4 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx4 i06 =',i4)")i06 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx4 i j v mlt dmlt06 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-6.), > | latinx(i,k),i=i1,i2) 343,344c357,358 < ! MLT is dmlthalf*2 apart in hours - find edge < if (abs(mltinx(i,k)-6.) .lt. dmlthalf) i06=i --- > ! dmlthalf*2=d(MLT) - find edge ~6MLT > if (abs(mltinx(i,k)-6.) .lt. dmlthalf) i06=i 354,356c368,372 < if (ifwr .eq. 2) < | write (6,"(1x,'knx5 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx5 i06 =',i4)")i06 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx5 i j v mlt dmlt06 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-6.), > | latinx(i,k),i=i1,i2) 359c375 < if (i_max(ih) + nmlonp1/3 .gt. nmlonp1) then --- > if (i_max(ih) + nmlonp1/3 .gt. nmlonp1) then 367,368c383,384 < ! MLT is dmlthalf*2 apart in hours - find edge < if (abs(mltinx(i,k)-6.) .lt. dmlthalf) i06=i --- > ! dmlthalf*2=d(MLT) - find edge ~6MLT > if (abs(mltinx(i,k)-6.) .lt. dmlthalf) i06=i 377,380c393,398 < if (ifwr .eq. 2) < | write (6,"(1x,'knx6 i j v mlt lat =',3i4,3e12.4)") (k,i, < | jinx(i,k),vinx(i,k),mltinx(i,k),latinx(i,k),i=i1,i2) < endif ! if (i_max(ih) + nmlonp1/3 .gt. nmlonp1) --- > if (ifwr .ge. 2 .or. istep<2) write (6,"(1x,'knx6 i06 =',i4)")i06 > if (ifwr .ge. 2 .or. istep<2) > | write (6,"(1x,'knx6 i j v mlt dmlt06 lat =',3i4,4e12.4)") > | (k,i,jinx(i,k),vinx(i,k),mltinx(i,k),abs(mltinx(i,k)-6.), > | latinx(i,k),i=i1,i2) > endif ! if (i_max(ih) + nmlonp1/3 .gt. nmlonp1) 385,386c403,405 < if (ifwr .eq. 1) write (6,"(1x,'lat_i18(1),_i06(2) =',2f6.1)") < | latinx(i18,1),latinx(i06,2) --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih lat_i18(1),_i06(2) =',i2,2f6.1)") > | ih,latinx(i18,1),latinx(i06,2) 395c414,415 < if (ifwr .eq. 1) write (6,"(1x,'dskof =',f6.1)") dskof --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih dskof =',i2,f6.1)") ih,dskof 399,402c419,422 < inm3 = inx(ih,1) - (nmlonp1-1)/8 < inp3 = inx(ih,1) + (nmlonp1-1)/8 < ixm3 = inx(ih,2) - (nmlonp1-1)/8 < ixp3 = inx(ih,2) + (nmlonp1-1)/8 --- > inm3 = i_min(ih) - (nmlonp1-1)/8 > inp3 = i_min(ih) + (nmlonp1-1)/8 > ixm3 = i_max(ih) - (nmlonp1-1)/8 > ixp3 = i_max(ih) + (nmlonp1-1)/8 411c431 < do i=inm3+1,inx(ih,1) --- > do i=inm3+1,i_min(ih) 418c438 < do i=inx(ih,1)+1,inp3 --- > do i=i_min(ih)+1,inp3 425c445 < do i=ixm3+1,inx(ih,2) --- > do i=ixm3+1,i_max(ih) 432c452 < do i=inx(ih,2)+1,ixp3 --- > do i=i_max(ih)+1,ixp3 437,438c457,459 < if (ifwr .eq. 1) write (6,"(1x,'inx1,2 inm,p3 ixm,p3 =',6i4)") < | inx(ih,1),inx(ih,2),inm3,inp3,ixm3,ixp3 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih imin,max inm,p3 ixm,p3 =',7i4)") > | ih,i_min(ih),i_max(ih),inm3,inp3,ixm3,ixp3 453,455c474,476 < if (ifwr .eq. 1) < |write(6,"(1x,'lat,mlt_inm3,inp3,ixp3,ixm3 offcn,x,deg=',11f6.1)") < | latnm3,mltinx(inm3,1),latnp3,mltinx(inp3,1),latxp3, --- > if (ifwr .ge. 1 .or. istep<3) > | write(6,"(1x,'ih lat,mlt_inm3,inp3,ixp3,ixm3 offcn,x,deg=',i2, > | 11f6.1)") ih,latnm3,mltinx(inm3,1),latnp3,mltinx(inp3,1),latxp3, 471,472c492,494 < if (ifwr .eq. 1) write (6,"(1x,'18 sinl,cosl,cosm,colat asin=', < | 5e12.4)") sinl18,cosl18,cosm18,colat18,asind --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih 18 sinl,cosl,cosm,colat asin=',i2,5e12.4)") > | ih,sinl18,cosl18,cosm18,colat18,asind 477,478c499,500 < if (ifwr .eq. 1) write (6,"(1x,'x18 y18 rho18 =',3f6.1)") < | x18,y18,rho18 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih x18 y18 rho18 =',i2,3f6.1)") ih,x18,y18,rho18 486,487c508,510 < if (ifwr .eq. 1) write (6,"(1x,'06 sinl,cosl,cosm,colat asin=', < | 5e12.4)") sinl06,cosl06,cosm06,colat06,asind --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih 06 sinl,cosl,cosm,colat asin=',i2,5e12.4)") > | ih,sinl06,cosl06,cosm06,colat06,asind 492,493c515,516 < if (ifwr .eq. 1) write (6,"(1x,'x06 y06 rho06 =',3f6.1)") < | x06,y06,rho06 --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih x06 y06 rho06 =',i2,3f6.1)")ih,x06,y06,rho06 500c523 < | 'instead of calc crad =',2e12.4)") crad0,crad --- > | ' instead of calc crad =',2e12.4)") crad0,crad 502,503c525,526 < if (ifwr .eq. 1) write (6,"(1x, < | 'radius: 0,18,06,c rho18,06,c,a deg=',8f6.1)") crad0,colat18, --- > if (ifwr .ge. 1 .or. istep<3) write (6,"(1x,'ih=',i2,' radius:', > | ' 0,18,06,c rho18,06,c,a deg=',8f6.1)") ih,crad0,colat18, 507,509c530,533 < if (ifwr .eq. 1)write(6,"(1x,'min/max latd3,n3 offc =',8e12.4)") < | latinx(inm3,1),latinx(inp3,1),offcn,latinx(ixp3,2), < | latinx(ixm3,2),offcx,offcdeg,offc(ih) --- > if (ifwr .ge. 1 .or. istep<3) > | write(6,"(1x,'ih min/max latd3,n3 offc =',i2,8e12.4)") > | ih,latinx(inm3,1),latinx(inp3,1),offcn,latinx(ixp3,2), > | latinx(ixm3,2),offcx,offcdeg,offc(ih) 513,515c537,540 < if (ifwr .eq. 1) write (6,"(1x,'18,06 mlt,lat dskof,c,a=', < | 7e12.4)") mltinx(i18,1),latinx(i18,1),mltinx(i06,2), < | latinx(i06,2),dskof,dskofc(ih) --- > if (ifwr .ge. 1 .or. istep<3) > | write (6,"(1x,'ih 18,06 mlt,lat dskof,c,a=',i2,7e12.4)") > | ih,mltinx(i18,1),latinx(i18,1),mltinx(i06,2), > | latinx(i06,2),dskof,dskofc(ih) 517,518c542,543 < if (ifwr .eq. 1) write (6, < | "('Revised convection/oval params hem,By,off,dsk,n=', --- > if (ifwr .ge. 1 .or. istep<3) write (6, > | "('Revised convection/oval params hem,off,dsk,n=', 521d545 < enddo ! ih=1,2 (and cycle point for 'cycle' of the do loop to continue ih=2 or end) 522a547 > enddo ! ih=1,2 (and cycle point for 'cycle' of the do loop to continue ih=2 or end) 524,526c549,558 < #if defined(INTERCOMM) || defined(CISMAH) < call validate_potential_parameters(offc, dskofc, theta0, ifbad) < #endif --- > ! Print out revised convection parameters each timestep > write (6,"(1x,'calccloc before revcloc (orig ifbad>0): istep ', > | 'ifbad offcS,N dskofcS,N cradS,N radcenS,N =',i6,2i2,1x,4f7.2, > | 1x,2f7.2,1x,2f7.2)") > | istep,ifbad(1),ifbad(2),offc(1)*rtd,offc(2)*rtd,dskofc(1)*rtd, > | dskofc(2)*rtd,theta0(1)*rtd,theta0(2)*rtd,radcen(1),radcen(2) > > ! Revise center and theta0 depending of values of ifbad in each hemisphere > ! call validate_potential_parameters(offc, dskofc, theta0, ifbad) > call revcloc (ifbad,ifwr,istep,ifcen,radcen,kmlt_min,kmlt_max) 529a562,685 > !----------------------------------------------------------------------- > subroutine revcloc (ifbad,ifwr,istep,ifcen,radcen,kmlt_min, > | kmlt_max) > > ! This subroutine sets defaults for the convection center and radius > ! if the calccloc routine has one or more bad estimates (ifbad not 0). > ! The defaults should be varied according to taste and the high-latitude > ! model used. > > ! Aug 2012: Check if bad convection center or radius in SH and NH. > ! If both hems bad, can leave the defaults found in aurora_cons for the > ! center or the radius (crad in deg, theta0 in radians used in colath). > ! crad could be radcen or a min crad of 10 deg > ! If 1 hemisphere only is bad (ihb) and one is good (ihg), could set > ! ihb to ihg with neg By, or set dskofc=0 and offc to some non-zero > ! number so the auroral coordinates are OK in aurora.F > ! The auroral center (offa,dskofa) and radius (arad) can be revised in aurora.F > ! from values of convection set here depending on flags like CMIT, AMIE, or irdpot > ! phin,phid can use the defaults set in aurora.F that depend on IMF By > ! > ! ... Use Association .................................................. > use aurora_module,only: ! dimension (2) is for south, north hemispheres > | theta0, ! theta0(2), ! convection reversal boundary in radians > | offc, ! offc(2), ! offset of convection towards 0 MLT relative to mag pole (rad) > | dskofc ! dskofc(2) ! offset of convection in radians towards 18 MLT (f(By)) > use cons_module,only: rtd > implicit none > > ! ... Arguments ........................................................ > integer,intent(in) :: ifbad(2),ifwr,istep,ifcen > real,intent(in) :: radcen(2) ! convection radius in degrees from min/max > real,intent(in) :: kmlt_min(2),kmlt_max(2) ! min/max MLTs of neg/pos CP > > ! ... Local variables .................................................. > integer :: ih,ihb,ihg > real :: craduse,offcdeg,dskof > > ! ... Begin ............................................................ > > ! Set default center of convection if desired (note, both CANNOT be zero!) > ! CANNOT have offc=dskofc=0 or divide by zero in potm in heelis.F > offcdeg = 1.1 > dskof = 0. > > ! Set craduse=radcen(ih) when ifcen=1 (ifbad can only be 0 or 1, not 2 or 3) > if (ifcen==1) then > do ih=1,2 > craduse = max(10.,radcen(ih)) > theta0(ih) = craduse / rtd > offc(ih) = offcdeg / rtd > dskofc(ih) = dskof / rtd > enddo ! ih=1,2 > ! Revise theta0 in bad hem to good hem only in case where ifbad is only bad in 1 hem > if (ifbad(1)==1 .and. ifbad(2)==0) theta0(1)=theta0(2) > if (ifbad(2)==1 .and. ifbad(1)==0) theta0(2)=theta0(1) > ! 6/13 found SWMF had SH~18deg and NH~28deg for ifbad=1,1 and died shortly thereafter in threed table > ! Set theta0=min(radcen(ih)) in this case > if (ifbad(1) .gt. 0 .and. ifbad(2) .gt. 0) then > write(6,"(1x,'Use defaults, ifbad are both bad,kmlt:',2i2, > | 4f7.2)") ifbad,kmlt_min,kmlt_max > craduse = max(10.,min(radcen(1),radcen(2))) > theta0(1) = craduse / rtd > theta0(2) = craduse / rtd > endif > return > endif > > ! If the calculation of the convection location is good in both hemispheres, > ! can use the use a default center and keep the crad if desired > if (ifbad(1)+ifbad(2) .eq. 0) then > do ih=1,2 > offc(ih) = offcdeg / rtd > dskofc(ih) = dskof / rtd > enddo ! ih=1,2 > return > endif > > ! If the calculation of the convection location is bad in both hemispheres, > ! use desired defaults for the center and radius > if (ifbad(1) .gt. 0 .and. ifbad(2) .gt. 0) then > write(6,"(1x,'Use defaults, ifbad are both bad,kmlt:',2i2, > | 4f7.2)") ifbad,kmlt_min,kmlt_max > do ih=1,2 > ! Use the distance between min and max potentials (assuming zero center) > ! 6/13 found SWMF had SH~18deg and NH~28deg for ifbad=1,1 and died shortly thereafter in threed table > ! Set theta0=min(radcen(ih)) in this case > !! craduse = max(10.,radcen(ih)) > craduse = max(10.,min(radcen(1),radcen(2))) > theta0(ih) = craduse / rtd > offc(ih) = offcdeg / rtd > dskofc(ih) = dskof / rtd > enddo ! ih=1,2 > > else > > ! Now revise if only 1 hemisphere is bad > if (ifbad(1)+ifbad(2)>0) then > if (ifbad(1)>0) then > ihb = 1 > ihg = 2 > else > ihb = 2 > ihg = 1 > endif > theta0(ihb) = theta0(ihg) > ! Set to opposite hem > ! offc(ihb) = offc(ihg) > ! dskofc(ihb) = -dskofc(ihg) > ! Or set center to default > do ih=1,2 > offc(ih) = offcdeg / rtd > dskofc(ih) = dskof / rtd > enddo ! ih=1,2 > endif ! for revisions for 1 bad hemispheres > > endif ! for revisions for both bad hemispheres > > if (ifwr .ge. 1 .or. istep<3) write (6, > | "('Revised convection/oval params SH,NH: off,dsk,rad=', > | 6f8.2)") offc(1)*rtd,dskofc(1)*rtd,theta0(1)*rtd, > | offc(2)*rtd,dskofc(2)*rtd,theta0(2)*rtd > > end subroutine revcloc > !-----------------------------------------------------------------------