3-Dimensional MHD Simulation of Earth's Magnetosphere (English)
(Example to execute the MHD Code and Graphic programs)


We will demonstrate how to execute the 3-Dimensional magnetohydrodynamic (MHD) Simulation of Earth's Magnetosphere in 1/4 volume and how to use the graphics programs to make PostScript files and VRML files in this section. In the MHD model, MHD and Maxwell's equations are solved in the solar-magnetospheric coordinate system by using modified leap-frog method when the upstream solar wind and interplanetary magnetic field (IMF) boundary conditions are given. Moreover, north-south symmetry and dawn-dusk symmetry are assumed, therefore it is enough to solve 1/4 volume as the simulation box. The main simulation Fortran program, earthb10.f is fully vectorized and can be executed on many kinds of computers. By executing the main MHD simulation code, a simulated binary file is produced as output. When the output binary file is used as input, graphics programs can be executed to make PostScript files and VRML files for three dimensional visualization.
 main program : earthb10.f
     earthb10.f  using modified leap-frog scheme
     3D MHD simulation of 1/4 earth's magnetosphere
     Cartesian coordinate   finite resistivity  45 degree boundary


 graphics program to make PostScript files

 1. gm150b.f (main) + gsub150.f (subroutine)
    noon-midnight meridian and equatorial plots (black and white)
 2. gm220b.f (main) + gsub220.f (subroutine)
    energy distribution of cross section
 3. gm480b.f (main) + gsub480.f (subroutine)
    3-dimensional magnetic field lines

 3-dimensional graphics program by VRML files
    

 1. zvrmagb.f (main) + zvrsubb.f (subroutine)
    3-dimensional magnetic field lines
 2. zvrcrob.f (main) + zvrsubb.f (subroutine)
    cross sectional pattern by pixel image


**Summary of parameters in MHD Simulation Code**

(nx,ny,nz)=(180,60,60)        : grid number without boundary
 nxp=30                       : parameter to determine earth position
 last=1024                    : number of time steps
 iiq0=8                       : a unit of modified leap-frog scheme 
 iip0= 32                     : adjust upstream boundary condition
 iis0= 1024                   : sampling step of data
 thx=4.00                     : parameter to adjust time step
 
(xl,yl,zl)=(90.5,30.5,30.5)Re : length in each direction
 hx=xl/float(nx+1)=0.5Re      : grid interval in x direction
 hy=yl/float(ny+1)=0.5Re      : grid interval in y direction
 hz=zl/float(nz+1)=0.5Re      : grid interval in z direction
 t=0.5*hx*thx                 : time interval
 t(real)=t*ts                 : real time to one time step advance
        =0.5*0.5*4.00*0.937   : ts is normalization value in time
        =0.937 sec

 x=0.5*hx*float(2*i-nx2-1+2*nxp) : x position versus grid number
 y=0.5*hy*float(2*j-3)           : y position versus grid number
 z=0.5*hz*float(2*k-3)           : z position versus grid number

  where nx2=nx+2, ny2=ny+2 and nz2=nz+2

 ro01=5.0E-4 (5/cc)           : mass density of solar wind
 pr01=3.56E-8                 : pressure of solar wind
 vsw=0.044   (300km/s)        : speed of solar wind
 bis=CP(11)=1.5E-4 (5nT)      : amplitude of IMF

 eatt                         : resistivity
 rmuu                         : viscosity
 eud0                         : friction or collision term


1-dimensional array variable f(i1)=f(i,j,k,m)

 n1=nx+2,n2=n1*(ny+2),n3=n2*(nz+2)
 nb=8,nbb=11,n4=n3*nb,n5=n3*nbb

 i1=i+n1*(j-1)+n2*(k-1)+n3*(m-1)
 
    m=1  : rho,  plasma density
    m=2  : Vx
    m=3  : Vy
    m=4  : Vz
    m=5  : P,    plasma pressure
    m=6  : Bx
    m=7  : By
    m=8  : Bz


**execution of main program**
1. f77 -O earthb10.f
2. a.out &

  where file must be defined in open statement like

c      open(10,file='earthb10.data',
c    1         access='sequential',form='unformatted')
       open(11,file='earthb11.data',
     1         access='sequential',form='unformatted')
c

or

1. f77 -o earthb10 -O earthb10.f
2. earthb10 &

**execution of PostScript graphics program**

1. f77 -c -O gsub150.f
2. f77 -O gm150b.f gsub150.o
3. a.out > gm150a.ps &
4. gs gm150a.ps
5. lp gm150a.ps

1. f77 -c -O gsub220.f
2. f77 -O gm220b.f gsub220.o
3. a.out > gm220a.ps &

1. f77 -c -O gsub480b.f
2. f77 -O gm480b.f gsub480b.o
3. a.out & : output is written in fort.10

**execution of VRML graphics program**

 1. f77 -c -O zvrsubb.f
 2. f77 -O zvrmagb.f zvrsubb.o
 3. a.out & : output is written in fort.10
 4. mv fort.10 fort.102

 1. f77 -c -O zvrsubb.f
 5. f77 -O zvrcrob.f zvrsubb.o
 6. a.out & : output is written in fort.10
 7. mv fort.10 fort.101
 8. cat fort.101 fort.102 > zvrml01.wrl

References:

T. Ogino, A three-dimensional MHD simulation of the interaction of the solar
    wind with the earth's magnetosphere: The generation of field-aligned
    currents, J. Geophys. Res., 91, 6791-6806 (1986).

T. Ogino, R.J. Walker and M. Ashour-Abdalla, A global magnetohydrodynamic
    simulation of the magnetosheath and magnetopause when the interplanetary
    magnetic field is northward, IEEE Transactions on Plasma Science,
    Vol.20, No.6, 817-828 (1992).

T. Ogino, Two-Dimensional MHD Code, (in Computer Space Plasma Physics),
    Ed. by H. Matsumoto and Y. Omura, Terra Scientific Publishing Company,
    161-215, 411-467 (1993).

T. Ogino, R.J. Walker and M. Ashour-Abdalla, A global magnetohydrodynamic
    simulation of the response of the magnetosphere to a northward turning of
    the interplanetary magnetic field, J. Geophys. Res., Vol.99, No.A6,
    11,027-11,042 (1994).



Simulation Home Page
GEDAS Home Page
STELab Home Page.