jf1uids.option_classes.simulation_config module

Contents

jf1uids.option_classes.simulation_config module#

class jf1uids.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 jf1uids.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 jf1uids.option_classes.simulation_config.SimulationConfig(runtime_debugging: 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, 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_settings: None | BoundarySettings1D | BoundarySettings = None, fixed_timestep: bool = False, exact_end_time: bool = True, source_term_aware_timestep: bool = False, num_timesteps: int = 1000, differentiation_mode: int = 0, num_checkpoints: int = 100, return_snapshots: bool = False, snapshot_settings: SnapshotSettings = (True, 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, wind_config: WindConfig = (False, 10, 1, False), cosmic_ray_config: CosmicRayConfig = (False, False), cooling_config: CoolingConfig = (False, (1, (None,))), neural_net_force_config: NeuralNetForceConfig = (False, None), cnn_mhd_corrector_config: CNNMHDconfig = (False, None))[source]#

Bases: NamedTuple

Configuration 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_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.

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.

geometry: int#

The geometry of the simulation.

grid_spacing: float#

Grid spacing.

limiter: int#

The limiter for the reconstruction.

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.

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

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 9

snapshot_settings: SnapshotSettings#

Snapshot settings

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.

use_specific_snapshot_timepoints: bool#

Return snapshots at specific time points.

wind_config: WindConfig#

The configuration for the stellar wind module.

class jf1uids.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)[source]#

Bases: NamedTuple

Settings 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_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.

jf1uids.option_classes.simulation_config.finalize_config(config: SimulationConfig, state_shape) SimulationConfig[source]#

Finalizes the simulation configuration.