FieldModel¶
- class disco.FieldModel(Bx, By, Bz, Ex, Ey, Ez, axes, B0=<Quantity 31000. nT>, extra_fields=None)[source]¶
Bases:
objectMagnetic and electric field models used to propagate particles.
Get an instance that is dimensionalized and stored on the GPU.
Input argument should have astropy units attached.
- Parameters:
- Bx: array of shape (nx, ny, nz, nt), with units
External Magnetic Field X component, SM Coordinates
- By: array of shape (nx, ny, nz, nt), with units
External Magnetic Field Y component, SM Coordinates
- Bz: array of shape (nx, ny, nz, nt), with units
External Magnetic Field Z component, SM Coordinates
- Ex: array of shape (nx, ny, nz, nt), with units
Electric Field X component, SM Coordinates
- Ey: array of shape (nx, ny, nz, nt), with units
Electric Field Y component, SM Coordinates
- Ez: array of shape (nx, ny, nz, nt), with units
Electric Field Z component, SM Coordinates
- axes: Axes
Rectilinear grid information and inner boundary
- B0: scalar with units, optional
Internal Dipole strength to add to external field interpolating.
- extra_fields: dict, optional
Dictionary of additional fields to include in the field model, such as plasma parameters rho, p, T, etc. The keys should be strings representing the field names, and the values should be arrays with shape (nx, ny, nz, nt) with no units.
Methods Summary
dimensionalize(mass, charge)Convert to a
DimensionalizedFieldModelinstance.duplicate_in_time([time_axis])Duplicate the
FieldModelin time, to support tracing in a single time step.load(hdf_path[, B0])Load a FieldModel from an HDF5 file.
save(hdf_path)Save the
FieldModelto an HDF5 file.Methods Documentation
- dimensionalize(mass, charge)[source]¶
Convert to a
DimensionalizedFieldModelinstance.- Parameters:
- massscalar with untis
Scalar mass, used for dimensionalization
- chargescalar with untis
Scalar charge, used for dimensionalization
- duplicate_in_time(time_axis=<Quantity [-1., 1.] yr>)[source]¶
Duplicate the
FieldModelin time, to support tracing in a single time step.- Parameters:
- time_axis: array with units of time
Time axis values to use for duplication. The default is made sufficiently large that it is unrealistic for a particle to ever hit the time limit bounds.
- Returns:
- instance of FieldModel with duplicated time axis
- classmethod load(hdf_path, B0=<Quantity 31000. nT>)[source]¶
Load a FieldModel from an HDF5 file.
- Parameters:
- hdf5_path: str
Path to the HDF5 file to load from.
- B0: scalar with units, optional
Internal Dipole strength to add to external field interpolating.
- Returns:
FieldModelAn instance of
FieldModelloaded from the HDF5 file.
- Raises:
ValueErrorIf the shapes of the arrays in the HDF5 file do not match expected dimensions.
Notes
Required HDF5 variables:
Bx: shape (nx, ny, nz, nt), units nTBy: shape (nx, ny, nz, nt), units nTBz: shape (nx, ny, nz, nt), units nTEx: shape (nx, ny, nz, nt), units mV/mEy: shape (nx, ny, nz, nt), units mV/mEz: shape (nx, ny, nz, nt), units mV/mxaxis: shape (nx,), units Reyaxis: shape (ny,), units Rezaxis: shape (nz,), units Retaxis: shape (nt,), units secondsr_inner: scalar, units Re
Additional comments:
B values must have the dipole subtracted (also known as being the “external” model)
Any NaN’s encoutered will halt integration immediately, so they can be used to place irregular outer boundaries.
- save(hdf_path)[source]¶
Save the
FieldModelto an HDF5 file. Can be loaded with theFieldModel.load()method.- Parameters:
- hdf5_path: str
Path to the HDF5 file to save to.