astronomix.data_classes.simulation_helper_data#
Geometric helper data for the simulation.
Bundles the precomputed per-cell geometry (cell centers, radii, volumes, cell
boundaries) used throughout the solver and the snapshot diagnostics, together
with the machinery to build only the fields the active subsystems actually need
(see HelperDataRequirements), optionally on the host, and to pad /
shard / unpad them for the time integrator.
Module Contents#
Classes#
Helper data used throughout the simulation. |
|
Per-field requirements for |
Functions#
Generate the helper data for the simulation. |
API#
- class astronomix.data_classes.simulation_helper_data.HelperData[source]#
Bases:
typing.NamedTupleHelper data used throughout the simulation.
- geometric_centers: jax.numpy.ndarray = None#
- volumetric_centers: jax.numpy.ndarray = None#
- cell_centers_x: jax.numpy.ndarray = None#
- cell_centers_y: jax.numpy.ndarray = None#
- cell_centers_z: jax.numpy.ndarray = None#
- r: jax.numpy.ndarray = None#
- r_hat_alpha: jax.numpy.ndarray = None#
- cell_volumes: jax.numpy.ndarray = None#
- inner_cell_boundaries: jax.numpy.ndarray = None#
- outer_cell_boundaries: jax.numpy.ndarray = None#
- class astronomix.data_classes.simulation_helper_data.HelperDataRequirements[source]#
Bases:
typing.NamedTuplePer-field requirements for
HelperData.Each flag indicates whether the matching
HelperDatafield is consumed by any active subsystem (solver, physics module, snapshot calculator). Fields whose flag isFalseare left unmaterialised and stay at theHelperDatadefault ofNone.- needs_geometric_centers: bool = False#
- needs_volumetric_centers: bool = False#
- needs_cell_centers_x: bool = False#
- needs_cell_centers_y: bool = False#
- needs_cell_centers_z: bool = False#
- needs_r: bool = False#
- needs_r_hat_alpha: bool = False#
- needs_cell_volumes: bool = False#
- needs_inner_cell_boundaries: bool = False#
- needs_outer_cell_boundaries: bool = False#
- astronomix.data_classes.simulation_helper_data.get_helper_data(config: astronomix.option_classes.simulation_config.SimulationConfig, sharding: Union[types.NoneType, jax.NamedSharding] = None, padded: bool = False, requirements: Union[types.NoneType, astronomix.data_classes.simulation_helper_data.HelperDataRequirements] = None) astronomix.data_classes.simulation_helper_data.HelperData[source]#
Generate the helper data for the simulation.
Only the fields requested by
requirementsare materialised; the rest stay at theHelperDatadefault ofNone. WhenrequirementsisNone(the default), all fields are built so that scripts usingget_helper_datato construct initial conditions keep working. The time integrator passes a config-derivedHelperDataRequirementsexplicitly so the in-simulation helper data is minimal.With
config.host_helper_data=Truethe arrays are built inside a CPU device context and only the requested fields are moved onto the target device (respectingshardingfor 3D Cartesiangeometric_centers). Fields needed only as intermediates (e.g. the fullX, Y, Zmeshgrid when onlyris requested) never materialise on the accelerator.