_models#
Physical property metadata for PSI’s model quantities and scales.
This module provides the Props dataclass and three read-only mapping objects
that fully describe every quantity PSI’s modeling codes write to HDF files:
The filename/lookup identifier (e.g.,
'br')Human-readable description (e.g.,
'MAS Magnetic Field (Radial Component)')Native code
Unit(e.g.,Unit("2.20689 G")orUnit("MAS_b"))Dimensionality (e.g., 3 for 3-D output fields)
Scalar or vector classification
Mesh staggering code (e.g.,
0b011)
For metadata access, one should use the provided getter functions rather than the mapping objects directly.
Mapping |
Model |
Contents |
|---|---|---|
MAS (Magnetohydrodynamic Algorithm outside a Sphere) |
19 3-D output fields: velocity, magnetic field, current density, temperature, density, pressure, wave energy, Elsässer amplitudes, heating |
|
POT3D (High Performance Potential Field Solver) |
3 magnetic field components (br, bt, bp) |
|
PSI coordinate grids (shared by MAS, POT3D, and related codes) |
3 1-D coordinate scale arrays (r, t, p) |
Coordinate scales#
Every PSI HDF file stores three 1-D coordinate arrays alongside its data. These arrays define the spherical grid on which model output is sampled and are standard across MAS, POT3D, and most other PSI codes:
Key |
Symbol |
Physical quantity |
Units |
Range |
|---|---|---|---|---|
|
\(r\) |
Radial distance |
solar radii ( |
\(r \geq 1\,R_\odot\) |
|
\(\theta\) |
Co-latitude (pole = 0) |
radians ( |
\([0,\,\pi]\) |
|
\(\varphi\) |
Longitude |
radians ( |
\([0,\,2\pi]\) |
PSI HDF files are written in Fortran order (column-major), so the first Fortran dimension varies fastest in memory. When read into NumPy (row-major), the axis order is reversed: a 3-D array has shape \((N_\varphi, N_\theta, N_r)\) and the three scale arrays map to axes as follows:
Key |
Fortran dimension |
NumPy axis |
|
|---|---|---|---|
|
1st (fastest-varying) |
last |
|
|
2nd |
middle |
|
|
3rd (slowest-varying) |
first |
|
MAS Model Quantities#
MAS outputs 19 3-D fields in spherical coordinates. Code-unit values are converted
to physical (CGS/SI) unit by multiplying by the normalization constants defined in
psi_io._units. Approximate physical scales are given in parentheses.
Key |
Symbol |
Physical quantity |
Physical unit (CGS) |
Type |
Mesh code |
|---|---|---|---|---|---|
|
\(v_r\) |
Radial velocity |
km s⁻¹ ( |
vector |
|
|
\(v_\theta\) |
Co-latitude velocity |
km s⁻¹ |
vector |
|
|
\(v_\varphi\) |
Longitude velocity |
km s⁻¹ |
vector |
|
|
\(B_r\) |
Radial magnetic field |
G ( |
vector |
|
|
\(B_\theta\) |
Co-latitude magnetic field |
G |
vector |
|
|
\(B_\varphi\) |
Longitude magnetic field |
G |
vector |
|
|
\(J_r\) |
Radial current density |
A m⁻² ( |
vector |
|
|
\(J_\theta\) |
Co-latitude current density |
A m⁻² |
vector |
|
|
\(J_\varphi\) |
Longitude current density |
A m⁻² |
vector |
|
|
\(T\) |
Single-fluid temperature |
MK ( |
scalar |
|
|
\(T_e\) |
Electron temperature |
MK |
scalar |
|
|
\(T_p\) |
Proton temperature |
MK |
scalar |
|
|
\(\rho\) |
Plasma density |
cm⁻³ ( |
scalar |
|
|
\(p\) |
Plasma pressure |
erg cm⁻³ ( |
scalar |
|
|
\(e^+\) |
Forward Alfvén wave energy density |
erg cm⁻³ |
scalar |
|
|
\(e^-\) |
Backward Alfvén wave energy density |
erg cm⁻³ |
scalar |
|
|
\(z^+\) |
Outward Elsässer amplitude |
km s⁻¹ |
scalar |
|
|
\(z^-\) |
Inward Elsässer amplitude |
km s⁻¹ |
scalar |
|
|
\(Q\) |
Volumetric heating rate |
erg cm⁻³ s⁻¹ ( |
scalar |
|
POT3D Model Quantities#
POT3D solves for the potential magnetic field \(\mathbf{B} = -\nabla\Psi\) driven by a photospheric radial-field boundary condition. It outputs three spherical magnetic field components:
Key |
Symbol |
Physical quantity |
Physical unit |
Mesh code |
|---|---|---|---|---|
|
\(B_r\) |
Radial magnetic field |
input magnetogram unit (typically G) |
|
|
\(B_\theta\) |
Co-latitude magnetic field |
input magnetogram unit |
|
|
\(B_\varphi\) |
Longitude magnetic field |
input magnetogram unit |
|
Note
POT3D mesh codes are the bitwise complement of the corresponding MAS magnetic field
codes: POT3D_mesh = 0b111 ^ MAS_mesh. Where MAS places each component on the
face through which it is the outward normal (face-centred), POT3D places the same
component on the opposite pair of edges (edge-centred).
Warning
POT3D does not apply a normalization: values are in whatever physical unit the
input boundary magnetogram was provided in (typically Gauss, but run-dependent).
The code unit POT3D_b has a scale factor of 1
(dimensionless-unscaled). Always supply the correct unit explicitly when
converting; read(unit='physical') without a unit override will return
dimensionless values.
Staggered Grid Overview#
MAS and POT3D solve their equations on a three-dimensional staggered (Yee-type) spherical grid \((r, \theta, \varphi)\). Different physical quantities are located at different positions within each grid cell so that discrete differential operators (curl, divergence) are exactly satisfied.
With the convention used in this module, numpy arrays loaded from PSI HDF files have shape \((N_{\phi}, N_{\theta}, N_r)\) — longitude index varies slowest, radial index fastest. Mesh codes therefore assign bits as follows:
Bit position |
Numpy axis |
Coordinate |
|---|---|---|
Most-significant bit (MSB) |
|
\(r\) (radial) |
Middle bit |
|
\(\theta\) (co-latitude) |
Least-significant bit (LSB) |
|
\(\varphi\) (longitude) |
A bit value of 1 means the quantity is on the half mesh along that axis
(displaced half a grid spacing), while 0 means it is on the main mesh.
The resulting grid positions for MAS vector components are:
Quantity type |
Mesh code |
\(r\) |
\(\theta\) |
\(\varphi\) |
Grid position |
|---|---|---|---|---|---|
|
|
half |
main |
main |
\(r\)-face center |
|
|
main |
half |
main |
\(\theta\)-face center |
|
|
main |
main |
half |
\(\varphi\)-face center |
|
|
main |
half |
half |
\(r\)-edge center |
|
|
half |
main |
half |
\(\theta\)-edge center |
|
|
half |
half |
main |
\(\varphi\)-edge center |
Scalars ( |
|
half |
half |
half |
Cell corner |
This Yee-type arrangement ensures that \(\nabla \cdot \mathbf{B} = 0\) is satisfied exactly at the discrete level: each \(B\) component lives on the face through which it is the outward normal. The current density components \(\mathbf{J} = \nabla \times \mathbf{B}\) then live on the corresponding cell edges. Scalar thermodynamic quantities (density, temperature, pressure) occupy the cell corners, which are equivalent to cell centers on the dual grid.
See Also#
psi_io._mesh:Defines
Meshand the mesh normalization helpers.psi_io._units:Provides the custom astropy unit referenced by each
Props.psi_io.mhd_io:Uses these mappings to auto-configure lazy HDF readers.
Classes
|
Immutable property bundle for a single PSI model quantity. |
Functions
|
Extract the MAS/POT3D quantity name from a filename stem. |
|
Extract the sequence number from a filename stem. |
|
Return the |
|
Return the |
|
Return the |
|
Return the |
|
Parse a PSI HDF filename that follows the strict |
Attributes
Literal type alias for the 19 named MAS output quantities. |
|
Literal type alias for the two recognized PSI model types. |
|
Literal type alias for the 3 POT3D magnetic field output quantities. |
|
Literal type alias for the three PSI coordinate scale identifiers. |