MagneticFieldModel

class rbinvariantslib.models.MagneticFieldModel(x, y, z, Bx, By, Bz, inner_boundary)

Bases: object

Represents a magnetic field model, with methods for sampling the magnetic field at an aribtrary point.

Attributes:
xarray of (m, n, p)

X coordinates of data, in SM coordiantes and units of Re

yarray of (m, n, p)

Y coordinates of data, in SM coordiantes and units of Re

zarray of (m, n, p)

Z coordinates of data, in SM coordiantes and units of Re

Bxarray of (m, n, p)

Magnetic field X component, in SM coordinates and units of Gauss

Byarray of (m, n, p)

Magnetic field Y component, in SM coordinates and units of Gauss

Bzarray of (m, n, p)

Magnetic field Z component, in SM coordinates and units of Gauss

inner_boundaryfloat

Minimum radius to be considered too close to the earth for model to cover.

Methods Summary

interpolate(point[, radius])

Interpolate mesh to find magnetic field at given point.

trace_field_line(starting_point, step_size)

Perform a field line trace.

Methods Documentation

interpolate(point, radius=0.1)

Interpolate mesh to find magnetic field at given point.

Uses a distance-weighted average of neighboring points.

Parameters:
point: tuple

Position tuple of (x, y, z)

Returns:
Btuple

Interpolated value of the mesh at given point.

trace_field_line(starting_point, step_size) FieldLineTrace

Perform a field line trace. Implements RK45 in both directions, stopping when outside the grid.

Parameters:
starting_pointtuple of floats

Starting point of the field line trace, as (x, y, z) tuple of floats, in units of Re. Trace will go in both directions until it hits the model inner or outer boundary.

step_sizefloat, optional

Step size to use with the field line trace. If not sure, try 1e-3.

Returns:
traceFieldLineTrace

Coordinates and magnetic field vector along the field line trace