Skip to content
Snippets Groups Projects

Custom rk

Merged Maximilian Schanner requested to merge custom-rk into main
Files
9
+ 24
16
@@ -31,31 +31,39 @@ Internally, the magnetic field vector is generated on a 3D grid:
.. code-block:: python
from pymagglobal import Model, coefficients, REARTH
from utils import gen_Bxyz_grid
import generate
model = Model('gufm1')
epoch = 1840
_, _, coeffs = coefficients(epoch, model)
# the dimension of the grid is 2*a*REARTH
a = 5
(g_X, g_Y, g_Z), (B_x, B_y, B_z), (B_n, B_e, B_c) = \
gen_Bxyz_grid(coeffs, a=a, res=50)
(g_X, g_Y, g_Z), (B_x, B_y, B_z), (B_n, B_e, B_c) = generate.bxyz_grid(
coeffs,
a=a,
res=50,
)
From the vectors, fieldlines are generated using Mayavi's `flow` method:
.. code-block:: python
from mayavi import mlab
mlab.flow(B_x, B_y, B_z,
figure=fig,
extent=[-REARTH*a, REARTH*a,
-REARTH*a, REARTH*a,
-REARTH*a, REARTH*a],
integration_direction='both',
seed_resolution=2000,
seed_visible=False,
color=(1., 1., 1.),
line_width=2)
mlab.flow(
B_x, B_y, B_z,
figure=fig,
extent=[
-REARTH*a, REARTH*a,
-REARTH*a, REARTH*a,
-REARTH*a, REARTH*a,
],
integration_direction='both',
seed_resolution=2000,
seed_visible=False,
color=(1., 1., 1.),
line_width=2,
)
Loading