irfpy.jupsci.mhddata
¶
MHD simulation result provided from Jia.
The data files are provided from Jia and named as
Ganymede_MHD_Bfield_Jia.mat
A magnetic field data.
MagneticField1201
.MHD_PrecipitationFlux_Jia.dat
A precipitation flux calculated from Jia.
Flux1205
. The flux is calculated as a multiple of the density and velocity along B.MHD_PlasmaParameters_3Rg_XianzheJia.mat
.Plasma parameters obtained from MHD data.
PlasmaParameter1205
.
The Bfield data provides the L-value, the magnetic field line at the equator.
(Indeed, for simplicity I assumed the L-value is the distance that is fartherest from the
position of interest traced along magnetic field line.)
This is implemented in the LValue1201
.
In addition to the provision by Jia, I made two more precipitation files.
MHD_PrecipitationFlux_YF_footprint.dat
Provides the precipitation flux at the footpoint of surface, by mapping the downgoing flux along B field.
MHD_PrecipitationFlux_YF_nadir.dat
Provides the precipitation flux at the surface (nadir mapping), for the plasma with pitchangle <90.
-
class
irfpy.jupsci.mhddata.
PlasmaParameter1205
[source]¶ Bases:
object
Plasma parameter provided from Jia in mid 2012.
>>> plaprm = PlasmaParameter1205()
The data file is read and stored to the attribute of
dataarray
.Implementation of quantity getter, e.g.:meth:getDensity or whatever, returns (200, 200, 200)-shape array, which represent the 3-D data. For example, getDensity()[30, 70, 128] represent the density at the coordinate of (x, y, z) = (xlist()[30, 70, 128], ylist()[30, 70, 128], zlist()[30, 70, 128])
See, if you want to know the details of the file format, see Plasma parameter near Ganymede.
-
logger
= <Logger PlasmaParameter1205 (DEBUG)>¶
-
dataarray
¶ Loaded data from the file.
-
xlist
()[source]¶ Return the np.array of x coordinates.
- Returns
The array of x coordinate system. Shape is (200, 200, 200)
-
bin_indexes
(x, y, z)[source]¶ Return the indexes of the given position
- Returns
Corresponding indexes. The returned is a tuple (ix, iy, iz). The given position (x, y, z) is inside (ix, iy, iz) and (ix+1, iy+1, iz+1).
-
interpolate3d
(x, y, z)[source]¶ >>> pp = PlasmaParameter1205()
Interpolate the data. This case is indeed on the grid.
>>> n, vx, vy, vz, t, pth = pp.interpolate3d(1.8, 1.2, 0.0) >>> print((' %.3f' * 6) % (n, vx, vy, vz, t, pth)) 0.259 -124.000 28.365 -14.754 18756.000 0.777
>>> n, vx, vy, vz, t, pth = pp.interpolate3d(1.81, 1.19, 0.02) >>> print((' %.3f' * 6) % (n, vx, vy, vz, t, pth)) 0.244 -125.355 26.277 -2.472 19178.578 0.750
-
-
class
irfpy.jupsci.mhddata.
MagneticField1201
(interpolate='l2')[source]¶ Bases:
object
Magnetic field data provided from Jia in January 2012.
>>> mf = MagneticField1201()
The data file,
Ganymede_MHD_Bfield_Jia.mat
is read.Note that the data include (0, 0, 0) where the calculation is not done (i.e. inside the inner boundary).
-
logger
= <Logger MagneticField1201 (DEBUG)>¶
-
interpolate3d
¶ Method to return the B vector at the arbitrary position.
According to interpolate in the initializer, algorithm is chosen. See also
interpolate3d_l2()
,interpolate3d_trilin()
andinterpolate3d_4p()
.
-
xlist
()[source]¶ Return the np.array of x coordinates.
- Returns
The array of x coordinate system. Shape is (200, 200, 200)
-
bin_indexes
(x, y, z)[source]¶ Return the indexes of the given position
- Returns
Corresponding indexes. The returned is a tuple (ix, iy, iz). The given position (x, y, z) is inside (ix, iy, iz) and (ix+1, iy+1, iz+1).
-
set_interpolate_strategy
(strategy='none')[source]¶ Set strategy for R<1.1.
As R<1.1, no data is available. Indeed, zero is filled. Here I try to make several strategy.
- “none”
Do nothing. Just return 0 as the neighboring grid.
- “project”
Project the data at 1.15 Rj of the same latitude and longitude. Projection valid if r<1.15
-
interpolate3d_4p
(x, y, z)[source]¶ Return the B vector at the arbitorary position.
>>> mf = MagneticField1201(interpolate='4p') >>> print(mf.interpolate3d(1, 3, 5)) [ -8.7307 9.42083 -79.092 ] >>> print(mf.interpolate3d(1.01, 3.01, 5.01)) [ -8.583675 9.400121 -79.05206 ]
-
interpolate3d_trilin
(x, y, z)[source]¶ Return the B vector at the arbitorary position.
The trilinear interpolation is used.
>>> mf = MagneticField1201(interpolate='trilin') >>> print(mf.interpolate3d(1, 3, 5)) [ -8.7307 9.42083 -79.092 ] >>> print(mf.interpolate3d(1.01, 3.01, 5.01)) [ -8.58011575 9.40287633 -79.053923 ]
-
-
class
irfpy.jupsci.mhddata.
LValue1201
[source]¶ Bases:
object
L-value class.
L-value calculated from
MagneticField1201
.>>> lval = LValue1201() >>> l = lval.lvalue() >>> print(lval.lonlist()[10], lval.latlist()[70], lval.lvalue()[10, 70]) 20.0 -20.0 1.202
The data file is, as the file size is very small, in the
irfpy.pep
package distribution.Updating the data file, run the script in
src/scripts/apps120811_flux_recalc/mhd_lvalue.py
.
-
irfpy.jupsci.mhddata.
t2vth
(temperature_eV, mass=1.0, charge=1.0)[source]¶ Convert the temperature to the thermal velocity.
- Parameters
mass – Mass in the unit of amu.
charge – Charge in the unit of electricity (1.6e-19)
The definition of the thermal velocity is
\[v_\mathrm{th}^2 = \frac{kT}{m}\]Here temperature, T, is in Kelvins. If one converts the temperature to the unit of electron volts, one can get
\[v_\mathrm{th}^2 = \frac{eT'}{m}\]>>> print('%.2e' % t2vth(1)) # T=1eV for proton, vth=9.79 km/s (not 13.8 km/s!!) 9.79e+03
>>> print('%.2e' % t2vth(0.5, mass=16)) # T=0.5eV for oxygen, vth=1.73 km/s. 1.73e+03
-
class
irfpy.jupsci.mhddata.
PrecipitationFlux
(type='footprint')[source]¶ Bases:
object
Precipitation flux calculated.
Data files should be placed on the path pointed by [pep] mhddatapath. The file name should be
MHD_PrecipitationFlux_YF_footprint
andMHD_PrecipitationFlux_YF_nadir
.When contructing you can specify which you use.
>>> flux_fp = PrecipitationFlux(type='footprint') >>> flux_na = PrecipitationFlux(type='nadir')
Initialize the PrecipitationFlux
- Parameters
type – “footprint” for the footprint mapping data, “nadir” for the nadir pointing data,
-
logger
= <Logger PrecipitationFlux (DEBUG)>¶
-
class
irfpy.jupsci.mhddata.
Flux1205
[source]¶ Bases:
object
Flux data provided from Jia in March 2012.
>>> flux = Flux1205()
The constructor will read the data from the data file. Data file should have the name as
<pathname>/MHD_PrecipitationFlux_Jia.dat
where<pathname>
should be specified by.irfpyrc
file via[pep]
section withmhddatapath
entry.The data is loaded as a numpy array internally. You can access the data via
xlist()
,ylist()
,zlist()
for the coordinates of the data point andflist()
for the flux. The flux is in the unit of/cm2 /s
.Primitive way of accessing to data is using
dataarray
attribute. It has (20000, 6) shape. The 2nd loop is X, Y, Z, longitude, latitude and flux. The flux is in the unit of/cm2 /s
.-
logger
= <Logger Flux1205 (DEBUG)>¶
-
dataarray
¶ Data array with (20000, 6) shape.
-
reshape
(array)[source]¶ Reshape into 2D array.
The obtained data is 20000 element flattened array. This could be reshaped into 2D array. The best way is to convert to (200, 100) shaped array. First argument is fixed longitude and the second is fixed latitude.
This means that the
>>> m = Flux1205() >>> lon2d = m.reshape(m.lonlist()) >>> (lon2d[0, :] == -180).all() True >>> lat2d = m.reshape(m.latlist()) >>> (lat2d[:, 0] == 90).all() True
-