jaxfluids.io_utils package
Submodules
jaxfluids.io_utils.logger module
- class jaxfluids.io_utils.logger.Logger(logger_name: str = '', logging_level: str = 'INFO')[source]
Bases:
objectLogger for the JAX-FLUIDS solver. Logs information during the simulation to file and/or screen.
- configure_logger(log_path: str) None[source]
Configures the logger. Sets up formatter, file and stream handler.
- Parameters:
log_path (str) – Path to which logs are saved.
- log_end_time_step(info_list: List) None[source]
Logs information at the end of an integration step.
- Parameters:
info_list (List) – List of strings to be printed at the end of an integration step.
- log_numerical_setup_and_case_setup(numerica_setup_dict: Dict, case_setup_dict: Dict) None[source]
Logs numerical setup and input file.
- Parameters:
numerica_setup_dict (Dict) – Dictionary which contains information on the numerical setup.
case_setup_dict (Dict) – Dictionary which contains information on the case setup.
- log_sim_finish(end_time: float) None[source]
Logs the simulation end.
- Parameters:
end_time (float) – Final simulation time.
- log_start_time_step(info_list: List) None[source]
Logs information at the beginning of an integration step.
- Parameters:
info_list (List) – List of strings to be printed at the start of an integration step.
- log_turbulent_stats_at_start(turb_stats_dict: Dict) None[source]
Logs the turbulent statistics of the initial turbulent flow field.
- Parameters:
turb_stats_dict (Dict) – Dictionary which information on turbulent statistics.
jaxfluids.io_utils.output_writer module
- class jaxfluids.io_utils.output_writer.OutputWriter(input_reader: InputReader, unit_handler: UnitHandler, domain_information: DomainInformation, material_manager: MaterialManager, levelset_handler: LevelsetHandler, derivative_stencil_conservatives: SpatialDerivative, derivative_stencil_geometry: SpatialDerivative | None)[source]
Bases:
objectOutput writer for JAX-FLUIDS. The OutputWriter class can write h5 and xdmf files. h5 and xdmf files can be visualized in paraview. Xdmf output is activated via the is_xdmf_file flag under the output keyword in the numerical setup.
If the xdmf option is activated, a single xdmf file is written for each h5 file. Additionally, at the end of the simulation, an time series xdmf file is written which summarizes the whole simulation. This enables loading the entire timeseries into Paraview.
- compute_absolute_velocity(velocity: Array) Array[source]
Computes the absolute velocity field for h5 output.
- Parameters:
velocity (jnp.ndarray) – Buffer of velocities.
- Returns:
Buffer of absolute velocity.
- Return type:
jnp.ndarray
- compute_absolute_vorticity(velocity: Array) Array[source]
Computes absolute vorticity field for h5 output.
- Parameters:
velocity (jnp.ndarray) – Buffer of velocities.
- Returns:
Buffer of absolute vorticity.
- Return type:
jnp.ndarray
- compute_mach_number(primes: Array, volume_fraction: Array | None) Array[source]
Computes the Mach number field for h5 output.
- Parameters:
primes (jnp.ndarray) – Buffer of primitive variables.
volume_fraction (Union[jnp.ndarray, None]) – Buffer of volume fraction.
- Returns:
Buffer of Mach number.
- Return type:
jnp.ndarray
- compute_miscellaneous(primes: Array, quantity: str, volume_fraction: Array | None) Array[source]
Compute miscellaneous output fields for h5 output.
- Parameters:
primes (jnp.ndarray) – Buffer of primitive variables.
quantity (str) – String identifier of the quantity to be computed.
volume_fraction (Union[jnp.ndarray, None]) – Buffer of the volume fraction field, only for two-phase simulations. Otherwise None.
- Returns:
Computed phyiscal output quantity.
- Return type:
jnp.ndarray
- compute_real_buffer(buffer: Array, volume_fraction: Array) Array[source]
For two-phase simulations, merges the two separate phase buffers into a single real buffer. Calculation is done as a arithmetic average based on the volume fraction.
- Parameters:
buffer (jnp.ndarray) – Data buffer.
volume_fraction (jnp.ndarray) – Buffer of the volume fraction.
- Returns:
Combined data buffer of the ‘real’ fluid.
- Return type:
jnp.ndarray
- compute_schlieren(density: Array) Array[source]
Computes numerical schlieren field for h5 output.
- Parameters:
density (jnp.ndarray) – Buffer of density.
- Returns:
Buffer of schlieren.
- Return type:
jnp.ndarray
- compute_vorticity(velocity: Array) Array[source]
Computes vorticity field for h5 output.
- Parameters:
velocity (jnp.ndarray) – Buffer of velocities.
- Returns:
Buffer of vorticity.
- Return type:
jnp.ndarray
- create_folder() None[source]
Sets up a folder for the simulation. Dumps the numerical setup and cas setup into the simulation folder and creates an output folder within in simulation folder into which simulation output is saved.
simulation_folder —- Numerical setup —- Case setup —- domain
- get_folder_name() Tuple[str, str][source]
Returns a name for the simulation folder based on the case name.
- get_xdmf(group: str, quant: str, h5file_name: str, Nx: int, Ny: int, Nz: int) str[source]
Returns the string for the xdmf file for the given output quantity.
- Parameters:
- Returns:
Xdmf string for the specified quantity.
- Return type:
- write_output(buffer_dictionary: Dict[str, Dict[str, Array | float]], force_output: bool, simulation_finish: bool = False) None[source]
Writes h5 and (optional) xdmf output.
- Parameters: