astronomix.option_classes.simulation_config module#
- class astronomix.option_classes.simulation_config.BoundarySettings(x, y, z)[source]#
Bases:
NamedTuple- x: BoundarySettings1D#
Alias for field number 0
- y: BoundarySettings1D#
Alias for field number 1
- z: BoundarySettings1D#
Alias for field number 2
- class astronomix.option_classes.simulation_config.BoundarySettings1D(left_boundary, right_boundary)[source]#
Bases:
NamedTuple- left_boundary: int#
Alias for field number 0
- right_boundary: int#
Alias for field number 1
- class astronomix.option_classes.simulation_config.SimulationConfig(solver_mode: int = 0, numerical_precision: int = 0, runtime_debugging: bool = False, donate_state: bool = False, memory_analysis: bool = False, print_elapsed_time: bool = False, progress_bar: bool = False, dimensionality: int = 1, state_struct: bool = False, geometry: int = 0, mhd: bool = False, fv_magnetic_integrator: int = 0, enforce_positivity: bool = True, self_gravity: bool = False, self_gravity_version: int = 1, box_size: float = 1.0, num_cells: int = 400, reconstruction_order: int = 1, limiter: int = 0, riemann_solver: int = 0, split: int = 0, time_integrator: int = 0, num_ghost_cells: int = 2, grid_spacing: float = 0.0025, boundary_handling: int = 0, boundary_settings: None | BoundarySettings1D | BoundarySettings = None, fixed_timestep: bool = False, exact_end_time: bool = True, source_term_aware_timestep: bool = False, num_timesteps: int = 1000, use_max_adaptive_timestep: bool = True, differentiation_mode: int = 0, num_checkpoints: int = 100, return_snapshots: bool = False, snapshot_settings: SnapshotSettings = (True, False, False, False, False, False, False, False, False), activate_snapshot_callback: bool = False, use_specific_snapshot_timepoints: bool = False, num_snapshots: int = 10, first_order_fallback: bool = False, turbulent_forcing_config: TurbulentForcingConfig = (False,), wind_config: WindConfig = (False, 10, 1, False), cosmic_ray_config: CosmicRayConfig = (False, False), cooling_config: CoolingConfig = (False, 2, (1, (None,))), neural_net_force_config: NeuralNetForceConfig = (False, None), cnn_mhd_corrector_config: CNNMHDconfig = (False, None))[source]#
Bases:
NamedTupleConfiguration object for the simulation. The simulation configuration are parameters defining the simulation where changes necessitate recompilation.
- activate_snapshot_callback: bool#
Call a user given function on the snapshot data, e.g. for saving or plotting. Must have signature callback(time, state, registered_variables).
- boundary_handling: int#
Explicit boundary handling mode.
- boundary_settings: None | BoundarySettings1D | BoundarySettings#
Boundary settings for the simulation.
- box_size: float#
The size of the simulation box.
- cnn_mhd_corrector_config: CNNMHDconfig#
Configuration of the CNN MHD corrector module.
- cooling_config: CoolingConfig#
The configuration for the cooling module.
- cosmic_ray_config: CosmicRayConfig#
Cosmic rays
- differentiation_mode: int#
The differentiation mode one whats to use the solver in (forwards or backwards).
- dimensionality: int#
The number of dimensions of the simulation.
- donate_state: bool#
Donate the state arrays to the time integration function to reduce memory allocations. If activated, the initial state arrays will be invalid after the simulation.
- enforce_positivity: bool#
Enforce positivity of density and pressure. NOTE: CURRENTLY ONLY IMPLEMENTED FOR FINITE DIFFERENCE MODE.
- exact_end_time: bool#
Exactly reach the end time. In adaptive timestepping, one might otherwise overshoot.
- first_order_fallback: bool#
Fallback to the first order Godunov scheme.
- fixed_timestep: bool#
Enables a fixed timestep for the simulation based on the specified number of timesteps.
- fv_magnetic_integrator: int#
Integrator used for the magnetic part in the FV MHD scheme.
- geometry: int#
The geometry of the simulation.
- grid_spacing: float#
Grid spacing.
- limiter: int#
The limiter for the reconstruction. Only affects finite volume mode.
- memory_analysis: bool#
Memory analysis of the main time integration function
- mhd: bool#
Magnetohydrodynamics switch.
- neural_net_force_config: NeuralNetForceConfig#
Configuration of the neural network force module.
- num_cells: int#
The number of cells in the simulation (including ghost cells).
- num_checkpoints: int#
The number of checkpoints used in the setup with backwards differetiability and adaptive time stepping.
- num_ghost_cells: int#
The number of ghost cells.
- num_snapshots: int#
The number of snapshots to return.
- num_timesteps: int#
The number of timesteps for the fixed timestep mode.
- numerical_precision: int#
Precision mode.
- print_elapsed_time: bool#
Print the elapsed time of the simulation
- progress_bar: bool#
Activate progress bar
- reconstruction_order: int#
The reconstruction order is the number of cells on each side of the cell of interest used to calculate the gradients for the reconstruction at the interfaces.
- return_snapshots: bool#
Return intermediate snapshots of the time evolution instead of only the final fluid state.
- riemann_solver: int#
The Riemann solver used Only for finite volume mode.
- runtime_debugging: bool#
Debug runtime errors, throws exceptions on e.g. negative pressure or density. Significantly reduces performance.
- self_gravity: bool#
Self gravity switch, currently only for periodic boundaries.
- self_gravity_version: int#
Alias for field number 14
- snapshot_settings: SnapshotSettings#
Snapshot settings
- solver_mode: int#
Basic solver mode, either finite volume or finite difference. FINITE_DIFFERENCE is for now only planned for the HOW_MHD scheme (Jeongbhin Seo, Dongsu Ryu, 2023).
- source_term_aware_timestep: bool#
Adds the sources with the current timestep to a hypothetical state to estimate the actual timestep. Useful for time-dependent sources, but additional computational overhead.
- split: int#
Dimensional splitting / unsplit mode. Note that the UNSPLIT scheme currently interferes with energy conservation in settings with self-gravity.
- state_struct: bool#
Use a struct for the state.
- time_integrator: int#
Time integration method.
- turbulent_forcing_config: TurbulentForcingConfig#
Turbulent forcing configuration.
- use_max_adaptive_timestep: bool#
Use a maximum timestep in adaptive timestep mode.
- use_specific_snapshot_timepoints: bool#
Return snapshots at specific time points.
- wind_config: WindConfig#
The configuration for the stellar wind module.
- class astronomix.option_classes.simulation_config.SnapshotSettings(return_states: bool = True, return_final_state: bool = False, return_total_mass: bool = False, return_total_energy: bool = False, return_internal_energy: bool = False, return_kinetic_energy: bool = False, return_gravitational_energy: bool = False, return_radial_momentum: bool = False, return_magnetic_divergence: bool = False)[source]#
Bases:
NamedTupleSettings for the snapshot output of the simulation.
- return_final_state: bool#
Whether to return the final state of the simulation.
- return_gravitational_energy: bool#
Whether to return gravitational energy
- return_internal_energy: bool#
Whether to return internal energy
- return_kinetic_energy: bool#
Whether to return kinetic energy
- return_magnetic_divergence: bool#
Whether to return the magnetic field divergence NOTE: currently only implemented for finite difference MHD
- return_radial_momentum: bool#
Whether to return radial momentum
- return_states: bool#
Whether to return states during the simulation.
- return_total_energy: bool#
Whether to return the total energy at the times the snapshots were taken.
- return_total_mass: bool#
Whether to return the total mass at the times the snapshots were taken.
- astronomix.option_classes.simulation_config.finalize_config(config: SimulationConfig, state_shape) SimulationConfig[source]#
Finalizes the simulation configuration.