astronomix.option_classes.simulation_params module#
Runtime simulation parameters.
Unlike the simulation configuration, these parameters can be changed without triggering a recompilation, and the simulation can be differentiated with respect to them (CFL number, gas constants, viscosity, end time, …). The per-module parameter containers are bundled in here too.
- class astronomix.option_classes.simulation_params.FixedBoundaryState(x: FixedBoundaryState1D = (Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32)), y: FixedBoundaryState1D = (Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32)), z: FixedBoundaryState1D = (Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32)))[source]#
Bases:
NamedTuplePer-axis fixed boundary states used when a boundary is FIXED_BOUNDARY.
- x: FixedBoundaryState1D#
Alias for field number 0
- y: FixedBoundaryState1D#
Alias for field number 1
- z: FixedBoundaryState1D#
Alias for field number 2
- class astronomix.option_classes.simulation_params.FixedBoundaryState1D(left_state: Array = Array([], shape=(0,), dtype=float32), right_state: Array = Array([], shape=(0,), dtype=float32))[source]#
Bases:
NamedTupleThe prescribed left/right states for a single axis with FIXED_BOUNDARY.
- left_state: Array#
Left state of shape (num_variables,).
- right_state: Array#
Right state of shape (num_variables,).
- class astronomix.option_classes.simulation_params.SimulationParams(C_cfl: float = 0.4, gravitational_constant: float = 1.0, gravitational_potential: array = Array([], shape=(0,), dtype=float32), viscosity: float = 0.0, thermal_conductivity: float = 0.0, isothermal_sound_speed: float = 1.0, gamma: float = 1.6666666666666667, minimum_density: float = 1e-14, minimum_pressure: float = 1e-14, positivity_max_velocity: float = 50.0, dt_max: float = inf, t_start: float = 0.0, t_end: float = 0.2, snapshot_timepoints: array = Array([0.], dtype=float32), fixed_boundary_state: FixedBoundaryState = ((Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32)), (Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32)), (Array([], shape=(0,), dtype=float32), Array([], shape=(0,), dtype=float32))), turbulent_forcing_params: TurbulentForcingParams = (0.02, 50.0, 2.0, 1.0, 4.0, 1.0), wind_params: WindParams = (0.0, 0.0, 100000.0), cosmic_ray_params: CosmicRayParams = (0.0, 0.1), cooling_params: CoolingParams = (0.76, 0.02, 10000.0, (1.0, 1.0, 100000000.0)), neural_net_force_params: NeuralNetForceParams = (None,), cnn_mhd_corrector_params: CNNMHDconfig = (False, None))[source]#
Bases:
NamedTupleDifferent from the simulation configuration, the simulation parameters do not require recompilation when changed. The simulation can be differentiated with respect to them.
- C_cfl: float#
The Courant-Friedrichs-Lewy number, a factor in the time step calculation.
- cnn_mhd_corrector_params: CNNMHDconfig#
The parameters of the CNN MHD corrector module.
- cooling_params: CoolingParams#
The parameters of the cooling module.
- cosmic_ray_params: CosmicRayParams#
Cosmic ray parameters
- dt_max: float#
The maximum time step.
- fixed_boundary_state: FixedBoundaryState#
The fixed boundary state if the boundary type of the specific boundary is set to FIXED_BOUNDARY.
- gamma: float#
The adiabatic index of the gas.
- gravitational_constant: float#
Gravitational constant.
- gravitational_potential: array#
External, static gravitational potential evaluated at the cell centers of the grid (without ghost cells). Only used when config.gravity_config.external_potential is True; it is added on top of the self-gravity potential in _compute_total_potential and padded to the ghost-cell-extended shape of a state field internally.
- isothermal_sound_speed: float#
The isothermal sound speed used when config.equation_of_state is ISOTHERMAL. NOTE: CURRENTLY ONLY IMPLEMENTED FOR FINITE DIFFERENCE MODE.
- minimum_density: float#
Minimum allowed density. NOTE: CURRENTLY ONLY USED IN FINITE DIFFERENCE MODE IF positivity protection is active.
- minimum_pressure: float#
Minimum allowed pressure. NOTE: CURRENTLY ONLY USED IN FINITE DIFFERENCE MODE IF positivity protection is active.
- neural_net_force_params: NeuralNetForceParams#
The parameters of the neural network force module.
- positivity_max_velocity: float#
Velocity ceiling applied to cells fixed by the REDISTRIBUTE positivity mode (mirrors HOW-MHD
velpmx1). Only used when a positivity mode isPOSITIVITY_REDISTRIBUTE.
- snapshot_timepoints: array#
Snapshot timepoints
- t_end: float#
The final time of the simulation.
- t_start: float#
The initial (clock) time of the simulation. The time loop starts integrating from here and the snapshot grid spans [t_start, t_end]. Defaults to 0.0; set to a checkpoint’s time to resume a run (see astronomix.setup_helpers.restart_from_latest_checkpoint).
- thermal_conductivity: float#
Constant thermal conductivity kappa in the conductive energy source div(kappa grad T) (config.thermal_conduction). T is taken from the ideal-gas relation T = p / rho (code units, R = 1). NOTE: CURRENTLY ONLY IMPLEMENTED FOR FINITE DIFFERENCE MODE.
- turbulent_forcing_params: TurbulentForcingParams#
The parameters of the turbulent forcing module.
- viscosity: float#
Dynamic or kinematic viscosity depending on the viscosity_type in SimulationConfig.
- wind_params: WindParams#
The parameters of the stellar wind module.