32 subroutine cgeomag(yearin, llh, h, icon)
36 #include "Zmagfield.h" 46 real*4 gnm(nmax, 0:nmax), hnm(nmax, nmax), year
47 real*4 gnmd(nmax, 0:nmax), hnmd(nmax, nmax)
49 common /zmagcoef/ gnm, gnmd, hnm, hnmd, year, nmx
54 real*4 r, sumn, sume, sumd, t, cost, sint, x, tlonr, gmnc,
55 * cosml, sinml, hmnc, temp
57 real*4 ssumd, ssumn, ssume
60 real*4 kdpmnxsinn, kpmnxn, kpmnxisinn
64 if(llh%sys .eq.
'llh')
then 71 if( abs(yearin-year) .gt. 7.)
then 74 *
' Year spec. for geomag data is invalid.', 1)
76 elseif(abs(cdata%r(1)) .gt. 90.5
d0)
then 79 elseif(abs(cdata%r(2)) .gt. 360.5
d0)
then 82 elseif(cdata%r(3) .gt. 100000.
d3)
then 85 elseif(cdata%r(3) .lt. -3000.
d3)
then 90 r=1./( 1.+cdata%r(3)/eradius )
95 t=(90.-cdata%r(1))*torad
100 tlonr=cdata%r(2)*torad
111 ssumn = ssumn+ (gmnc*cosml+hmnc*sinml)*
112 * kdpmnxsinn(m, n, sint, x)
113 ssume = ssume+ m *(-gmnc*sinml + hmnc*cosml)
114 * * kpmnxisinn(m, n, sint, x)
115 ssumd = ssumd + (gmnc*cosml+ hmnc*sinml)
116 * * kpmnxn(m, n, sint, x)
118 ssumn = ssumn + gmnc*kdpmnxsinn(m, n, sint, x)
119 ssumd = ssumd + gmnc*kpmnxn(m, n, sint, x)
123 sumn = sumn + ssumn*temp
124 sume = sume + ssume*temp
125 sumd = sumd + ssumd*temp *(n + 1)
137 call cerrormsg(
'Geometrical input data wrong', 0)
146 character*(*) filepath
155 real*4 gnm(nmax, 0:nmax), hnm(nmax, nmax), year
156 real*4 gnmd(nmax, 0:nmax), hnmd(nmax, nmax)
158 common /zmagcoef/ gnm, gnmd, hnm, hnmd, year, nmx
163 integer devn, icon, leng, kgetenv
168 if(filepath .eq.
' ')
then 171 leng = kgetenv(
"COSMOSTOP"//null, path)
174 *
'Env. variable "COSMOSTOP" cannot be found', 0)
176 path = path(1:leng)//
"/Data/Geomag/igrf" 180 call copenf(devn, path(1:klena(path)), icon)
184 *
'above file cannot be opened for geomagnetic data', 0)
194 subroutine cgmgigrf(devn, filepath, yearin)
198 character*(*) filepath
208 real*4 gnm(nmax, 0:nmax), hnm(nmax, nmax), year
209 real*4 yearmin, yearmax
210 real*4 gnmd(nmax, 0:nmax), hnmd(nmax, nmax)
212 common /zmagcoef/ gnm, gnmd, hnm, hnmd, year, nmx
227 integer klena, msglen
231 integer:: n11, n12, n21, n22, n, m
232 integer:: targetf1, targetf2
234 real(4):: year1, year2, sv, dy, yearx
244 read(devn,
'(a)' ) msg
245 if( msg(1:1) /=
"#" .and. msg(1:3) /=
"c/s")
exit 251 call kcountfields(msg, nf)
253 write(0,*)
' input igrf data is invalid' 254 write(0,*)
' the first line is ', msg
255 write(0,*)
' detected in cgmgIgrf ' 258 call kcgetafield(msg, 4, n1, n2)
260 write(0,*)
' strange in cgmgIgrf' 263 read( msg(n1:n2), *) year1
266 call kcgetafield(msg, nf-1, n1, n2)
267 read( msg(n1:n2), *) yearmax
269 if(year < year1 )
then 275 call kcgetafield(msg, i, n1, n2)
276 read(msg(n1:n2), *) year2
277 if( year < year2 .and. year >= year1 )
then 293 if( abs(dy) > 11. )
then 294 write(0,*)
'yearin to cgmgIgrf is out of range' 295 write(0,*)
'yearin=', yearin
301 read(devn,
'(a)', end=1000) msg
302 call kcgetafield(msg, 2, n1, n2)
303 read( msg(n1:n2), *) n
304 call kcgetafield(msg, 3, n1, n2)
305 read( msg(n1:n2), *) m
306 if( n > nmax .or. m > nmax )
then 307 write(0,*)
' too large m or n; m=', m,
' n=',n
308 write(0,*)
' max should be ', nmax
309 write(0,*)
' cgmgIgrf ' 313 call kcgetafield(msg, 1, n1, n2)
314 call kcgetafield(msg, targetf1, n11, n12)
315 call kcgetafield(msg, targetf2, n21, n22)
318 if( msg(n1:n2) ==
'g' )
then 319 read( msg(n11:n12), *) gnm(n,m)
320 read( msg(n21:n22), *) gnmd(n,m)
321 if( year2 <= yearmax)
then 322 gnmd(n,m) = ( gnmd(n,m) - gnm(n,m) )/ (year2-year1)
324 call kcgetafield(msg, nf, n1, n2)
325 read(msg(n1:n2), *) sv
328 elseif(msg(n1:n2) ==
'h' )
then 329 read( msg(n11:n12), *) hnm(n,m)
330 read( msg(n21:n22), *) hnmd(n,m)
331 if( year2 <= yearmax )
then 332 hnmd(n,m) = ( hnmd(n,m) - hnm(n,m) )/ (year2-year1)
334 call kcgetafield(msg, nf, n1, n2)
335 read(msg(n1:n2), *) sv
339 write(0,*)
' igff data strange the line is' 347 gnm(n, m) = gnm(n, m) + dy*gnmd(n, m)
349 hnm(n, m) = hnm(n,m) + dy*hnmd(n, m)
355 write(0, *)
'Geomagnetic data has been read from', filepath
356 write(0, *)
' year=',yearin,
' # of expansion terms=', nmx
373 real*4 gnm(nmax, 0:nmax), hnm(nmax, nmax), year
374 real*4 gnmd(nmax, 0:nmax), hnmd(nmax, nmax)
376 common /zmagcoef/ gnm, gnmd, hnm, hnmd, year, nmx
379 write(*,*)
'year=',year,
' nmax=', nmx
380 write(*,
'(" m n gnm hnm dgnm dhnm")')
384 write(*,
'(2i3,2f7.0,2f7.1)') m, n,
385 * gnm(n, m), 0., gnmd(n, m), 0.
387 write(*,
'(2i3,2f7.0,2f7.1)') m, n,
388 * gnm(n, m), hnm(n,m), gnmd(n,m), hnmd(n,m)
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine cerrormsg(msg, needrtn)
! for length to thickness conversion or v v ! integer maxnodes real Hinf ! This is used when making table for dim simulation ! The slant length for vertical height to km is ! divided by LenStep m steps ! It can cover the slant length of about km for cos
subroutine crdgeomag(filepath, yearin)
block data cblkIncident data *Za1ry *HeightOfInj d3
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
subroutine cgeomag(yearin, llh, h, icon)
subroutine ctranscoord2(sys, a, b)
subroutine cgmgigrf(devn, filepath, yearin)
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
subroutine copenf(io, fnin, icon)
subroutine csetmagfield(sys, b1, b2, b3, b)
brief set Calculated magnetic field to /magfield/ b