autosim.experimental.simulations.hydrodynamics_2d

autosim.experimental.simulations.hydrodynamics_2d#

Simplified 2D hydrodynamics simulator (velocity + pressure only).

This module provides an MHD-style spatiotemporal generator without magnetic fields. It evolves incompressible 2D flow with a pressure-projection method on a periodic grid.

Returned channels are: [u, v, p].

class Hydrodynamics2D(parameters_range=None, output_names=None, return_timeseries=False, log_level='progress_bar', n=64, L=1.0, T=1.0, dt=0.01, cfl=0.35)[source]#

Bases: SpatioTemporalSimulator

Simplified 2D hydrodynamics simulator with no magnetic field.

The solver uses a forced incompressible Navier-Stokes model:

\[\begin{split}\begin{aligned} \partial_t \mathbf{u} + \mathbf{u}\cdot\nabla\mathbf{u} &= -\nabla p + \nu\nabla^2\mathbf{u} + \mathbf{f}, \\ \nabla\cdot\mathbf{u} &= 0. \end{aligned}\end{split}\]

The output channels are velocity components and pressure, \([u, v, p]\).

Parameters:
  • parameters_range (dict[str, tuple[float, float]] | None) – Bounds on sampled parameters: - nu: kinematic viscosity - force: forcing amplitude

  • output_names (list[str] | None) – Names for output channels. Defaults to ["u", "v", "p"].

  • return_timeseries (bool) – If True, returns full trajectory; otherwise final frame only.

  • log_level (str) – Logging level passed to base Simulator.

  • n (int) – Grid resolution per axis.

  • L (float) – Domain size in each direction.

  • T (float) – Total simulation time.

  • dt (float) – Fixed integration step.

  • cfl (float)

Notes

Output shape before flattening: - timeseries: (nt, n, n, 3) - final only: (n, n, 3)

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

Run sampled trajectories and return spatiotemporal tensors.

Parameters:
  • n (int)

  • random_seed (int | None)

  • ensure_exact_n (bool)

Return type:

dict

simulate_hydrodynamics_2d(params, return_timeseries=False, n=64, L=1.0, T=1.0, dt=0.01, cfl=0.35)[source]#

Simulate a simplified 2D incompressible flow with forcing.

Parameters:
  • params (Tensor) – [nu, force] where - nu: kinematic viscosity - force: forcing amplitude

  • return_timeseries (bool) – Return full trajectory if True, final frame otherwise.

  • n (int) – Number of grid points in each spatial direction.

  • L (float) – Domain length in each spatial direction.

  • T (float) – Total simulation time.

  • dt (float) – Base integration step.

  • cfl (float) – CFL factor used to limit the adaptive integration step.

Returns:

Timeseries (nt, n, n, 3) or final snapshot (n, n, 3) with channels [u, v, p].

Return type:

Tensor