autosim.experimental.simulations.compressible_fluid#

Simple 2D compressible-fluid simulator (PDEBench-style fields).

State channels are [rho, u, v, p], evolved with a compact finite-volume local Lax-Friedrichs (Rusanov) scheme for the 2D Euler equations on a periodic grid.

class CompressibleFluid2D(parameters_range=None, output_names=None, return_timeseries=False, log_level='progress_bar', n=64, L=1.0, T=0.8, dt_save=0.01, cfl=0.35, scenario='shear_layers', flux_scheme='llf')[source]#

Bases: SpatioTemporalSimulator

Minimal 2D compressible Euler simulator.

The solver evolves conservative variables \(U = [\rho, \rho u, \rho v, E]\) using:

\[\partial_t U + \partial_x F(U) + \partial_y G(U) = 0, \qquad E = \frac{p}{\gamma - 1} + \frac{1}{2}\rho(u^2 + v^2).\]

The returned primitive-variable channels are \([\rho, u, v, p]\).

Parameters:
  • parameters_range (dict[str, tuple[float, float]] | None) – gamma (adiabatic index), amp (initial perturbation amplitude).

  • return_timeseries (bool) – If True, return full trajectory, otherwise final snapshot.

  • n (int) – Grid size (n x n).

  • L (float) – Domain length per axis.

  • T (float) – Final time.

  • dt_save (float) – Save interval when return_timeseries=True.

  • cfl (float) – CFL number for adaptive stepping.

  • scenario (str) –

    Initial-condition family. One of:

    • "shear_layers" (default): dual shear layers with multimode perturbations

    • "vortex_sheet": single shear sheet with sinusoidal displacement

    • "blast_wave": smooth radial over-pressure/density pulse

  • flux_scheme (str) –

    Numerical interface flux. One of:

    • "llf": local Lax-Friedrichs (more diffusive, robust)

    • "hll": HLL flux (less diffusive, sharper fronts)

  • output_names (list[str] | None)

  • log_level (str)

forward_samples_spatiotemporal(n, random_seed=None, ensure_exact_n=False)[source]#

Generate spatiotemporal samples from the simulator.

Parameters:
  • n (int) – Number of samples to generate.

  • random_seed (int | None) – Random seed for reproducibility. Defaults to None.

  • ensure_exact_n (bool) – When True, retry failed simulations until exactly n successful samples are collected. Defaults to False.

Returns:

A dictionary containing the reshaped spatiotemporal data, constant scalars, and constant fields.

Return type:

dict

simulate_compressible_fluid_2d(gamma, amp, return_timeseries, n, L, T, dt_save, cfl, scenario='shear_layers', flux_scheme='llf')[source]#

Run a simple 2D compressible Euler simulation with periodic boundaries.

Parameters:
Return type:

Tensor