c------------------------------------------------------------------------------- c Driver program for example #4: c c Create a time series of main field (n = 1 to 13) coefficients from 1960 to c 2000 in 5 year increments. c------------------------------------------------------------------------------- implicit none integer i,j,k,n,m,iyear c begin CM4 declarations ------------------------------------------------------- character*80 path(3) integer unit(3) logical load(3),indx(2),gmut,cord,pred(6),curr,coef integer nhmf(2),nlmf(2),perr,oerr,cerr real*8 ut,mut,theta,phi,alt,dst,f107,bmdl(3,7),jmdl(3,4) real*8 gmdl(195,5) ! row number is number of coefficients for ! n = 1 to 13 ! ! column 1: g ,h ! " 2: dg/dt ,dh/dt ! " 3: d2g/dt2,d2h/dt2 ! " 4: d3g/dt3,d3h/dt3 ! " 5: d4g/dt4,d4h/dt4 ! ! note that time derivatives may be ! distributed across the column dimension ! only because one set of coefficients is ! desired, otherwise the declaration would ! have the form: ! ! real*8 gmdl(max(5*195,...),?) c end CM4 declarations --------------------------------------------------------- c begin CM4 assignments -------------------------------------------------------- path(1)='../umdl.CM4' ! path for model coefficients unit(1)=11 ! logical unit for model coefficients load(1)=.true. ! set to initially read model coefficients indx(1)=.false. ! ... indx(2)=.false. ! ... gmut =.true. ! ... cord =.true. ! ... pred(1)=.true. ! compute internal B fields pred(2)=.false. ! don't compute magnetospheric B field pred(3)=.false. ! don't compute ionospheric B field pred(4)=.false. ! don't compute toroidal B field... pred(5)=.false. ! ... pred(6)=.false. ! ... curr =.false. ! no current density J fields computed coef =.true. ! coefficients generated nhmf(1)=13 ! n_max for "main field" nhmf(2)=0 ! ... nlmf(1)=1 ! n_min for "main field" nlmf(2)=1 ! ... theta =90.d0 ! ... phi =0.d0 ! ... alt =0.d0 ! ... perr =1 ! error print flag oerr =6 ! error logical unit cerr =0 ! error flag c end CM4 assignments ---------------------------------------------------------- c begin time series loop ------------------------------------------------------- ut=1960.d0 do i=1,9 ! 5 year increments call cm4field (path,unit,load,indx,gmut,cord,pred,curr,coef, 1 nhmf,nlmf,ut,mut,theta,phi,alt,dst,f107,bmdl, 2 jmdl,gmdl,perr,oerr,cerr) if (cerr.gt.49) stop iyear=1960+5*(i-1) write(*,1000) iyear k=0 do n=1,13 do m=0,n if (m.eq.0) then k=k+1 write(*,1001) n,m,gmdl(k,1), 1 gmdl(k,2), 2 gmdl(k,3), 3 gmdl(k,4), 4 gmdl(k,5) else k=k+2 write(*,1002) n,m,gmdl(k-1,1),gmdl(k,1), 1 gmdl(k-1,2),gmdl(k,2), 2 gmdl(k-1,3),gmdl(k,3), 3 gmdl(k-1,4),gmdl(k,4), 4 gmdl(k-1,5),gmdl(k,5) end if end do end do ut=ut+5.d0 ! increment by 5 years end do c end time series loop --------------------------------------------------------- stop 1000 format(' ',/,1x,'Main field coefficients at ',I4,/,' ',/,2x,'n',2x 1,'m',11x,'g',11x,'h',7x,'dg/dt',7x,'dh/dt',5x,'d2g/dt2',5x,'d2h/dt 22',5x,'d3g/dt3',5x,'d3h/dt3',5x,'d4g/dt4',5x,'d4h/dt4',/,' ') 1001 format(2(1x,i2),5(1x,f11.4,12x)) 1002 format(2(1x,i2),10(1x,f11.4)) end include '../cm4field.f'