am_05/20/02: directory copied from /fs/othrorgs/home0/maute/work.d/wtmp.d to run on the IBM (blackforest, babyblue, dave) ATTENTION: /fs/othrorgs/home0/maute is accessible from all SCD machines. Therefore files can be overwritten if program started from other machine am 01/07/03: copied from $fshome/work.d/wtmp_ibm.d to read secondary history files which are 2d this version runs on babyblue(IBM). it's possible to transfer the code to other machines. however you might have to regenerate a new apex file by using $fshome/work.d/wtmp.d/apex.d/myglob.f on the maschine you want to use and insert the right altitude range am 01/24/03: copied from $fshome/work.d/maggrd_ibm2d.d purpose: make code easier to understand like $fshome/work.d/magion.d/ibm_qnmext_2d.d am 02/12/03: include sphere.f to relate the external coefficient to the internal coefficient (coeff.F) we got the code from Nils Olsen (cm3e) and included this with the flag icm3e = 0/1 we assume that m corresponds to the frequency this means we don't take seasonal and UT variations into account. we assume that the longitudinal variation corresponds to the temporal variation. if(m /= 0) then c_mptintgrd(n,m) = c_mptext(N,M)* | real(qnnmm(n,iabs(m))) +m/abs(m)*c_mptext(N,-M)* | imag(qnnmm(n,iabs(m))) else ! m = 0 with depth = 1000. km fak(n) = float(n)/float(n+1)*((re-1000.)/re)**(2*n+1) ! c_mptext/re n/(n+1)[(r_e-depth)/r_e]^(2n+1) c_mptintgrd(n,m) = c_mptext(N,M)*fak(n) endif am 11/14/03: replace mtime(1) for the day by day from source file mtime is model time and not the calander day. A test at aae station showed that the difference is around 0.01nT am 6/4/04: modified the code such that it runs on different platforms (SUN,LINUX,AIX) --------------------------------------------------------------------------- Read also magprt_grd.tex / in the doc directory the file calculates magnetic perturbation at the ground for a given station magnetic perturbation globally equivalent current function (global) magnetic potential (external component) and total magnetic potential what you need is a secondary history file, on which the following fields are saved on the magnetic TIEGCM grid in 2d: KQLAM, KQPHI to get these fields run the tiegcm1 and set in the file dynamo.F the flag icalkqlam=1 input parameter: defined in iface.F time: is given in index of the NetCDF file (note that for an initial run the first timestep is only a copy of the source- therefore there are no values) So most time the first index is 2 (counting start with 1) start_time index for starting time end_time index for stop time flags | imagprt = 2 ! output 0 global eqc/mag.potential (NetCDF file) ! 1 magnetic pertubation at the ground ! 2 both (0 & 1) - for ground magnetic perturbation output will be in ./output.d/"stationname".out bp,bl,bz : northward, eastward,downward component ( I think so) bx,by,bz : X,Y Z component h,d,bz : H,D, Z component unit [nT] you have to run the program for every station separately make sure that the station name is in the file "staloc" in the right format, you might have to add new stations. It's only necessary to write abbreviation, long station name, geographic latitude [deg], geographic longitude [deg] - for equivalent current function: output is in the directory "work"/maggrd.out work is specified in iface.F change it to your directory make sure that you created a directory eqc.out there for each timestep a seperate file will be created. The filename consists of the Netcdf source file name + 'eqc' + day month hour + .nc output fields: "EQUIVALENT CURRENT FUNCTION (TOROIDAL IONOSPHERIC PART) " "EQUIVALENT CURRENT FUNCTION (ANTISYMMETRIC PART) " "EQUIVALENT CURRENT FUNCTION (SYMMETRIC TOROIDAL PART) " "EQUIVALENT CURRENT FUNCTION (TOTAL) " "EQUIVALENT CURRENT FUNCTION (FIELD-ALIGNED PART) " "EQUIVALENT CURRENT FUNCTION (TOTAL SYMMETRIC) " note: that these are global fields therefore the program has to be run only once to generate these files. note that the files are overwritten, when the ground magnetic perturbation is calculated. Files are created by nothing written into them. In the newly created NetCDF file will be no output - magnetic potential: output in the same file as for the equivalent current function output fields: mgpex:long_name = "MAGNETIC POTENTIAL (EXTERNAL COMPONENT)" ; mgpto:long_name = "MAGNETIC POTENTIAL (TOTAL)" ; - magnetic fields (globally): all the privious mentioned fields + additional fields: mgprtn:long_name = "NORTHWARD MAGNETIC PERTUBATION mgprte:long_name = "EASTWARD MAGNETIC PERTUBATION mgprtz:long_name = "DOWNWARD MAGNETIC PERTUBATION things to change in iface.F: start_time end_time work (working directory where output is written adjust character lengths) flnm (NetCDF file name - secondary history TIEGCM output; has to be in work//flnm) fileapex= '/ptmp/maute/apex.d/apxntrp.grid.alt90_1000.f90.1997' (apex file for apex coordonates- make sure that it is the right year. If not generate a new file- do this on the same machine as you run the program) new apex-file: you might have to regenerate a new apex file by using /fs/othrorgs/home0/maute/work.d/wtmp.d/apex.d/myglob.f on the maschine you want to use and insert the right altitude range. specify apex-path (param.F) specify the altitude range alt (param.F) grid dimensions (param.F) can be modified by the user | rmlon=81,rmlat=97, ! dimension of regular mag.grid (user given) | rglon=81,rglat=97, ! dimension of regular geo.grid (user given) degree and order of normalized associated Legendre polynomials (coeff.F) can be modified by the user | nm = 48, | mm = 24 Q_n^m (coeff.F) order and degree can be changed by user also take odd Q_n^m into account | nqmax = 6, ! for qnm (qost in code) | mqmax = 6, ! for qnm (qost in code) | iodd_qnm = 0 ! take odd (n-m) for q_nm into accounts am 8/5/04 correct calculation of magnetic local time for station, was shifted by 12 hrs. xyz_magprt.F: xx = (smlon-xmlon)*12./180.+12. ! convert from mag.long to mag.loc.time if (xx .GE. 24.0) xx = xx - 24.0 if (xx .LT. 0.) xx = xx + 24.0 am 4/2011 * adjusted Makefile to 64 bit machines * nclplot.F correct line 117 rmlat to rmlon ! put magnetic coordinates to nc-file ! set rmlat regular latitude grid delta = 360./float(rmlon-1) do j = 1,rmlon reglon(j) = float(j-1)*delta -180. enddo line 140 rmlat to rmlon ! set rmlt regular magnetic local time delta = 24./float(rmlon-1) do j = 1,rmlon regmlt(j) = float(j-1)*delta enddo * mapirr2reg.F line 41 change from elseif(ns+(nint-1).gt.mlat) then ! shift if at the end ns = mlat - (nint-1) endif TO elseif(ns+(nint).gt.mlat) then ! shift if at the end ns = mlat - (nint) endif hope that this works fine * compile apex code without any optimization compile maggrd code without any optimization