autosim.simulations.spatiotemporal.navier_stokes_conditioned#

Conditioned Navier-Stokes smoke simulator.

simulate_conditioned_navier_stokes_2d(params, *, return_timeseries=False, n=64, L=32.0, T=2.0, dt=0.01, snapshot_dt=None, nu=0.03, smoke_diffusivity=0.0005, cfl=0.35, smoothness=6.0, noise_scale=11.0, bc_mode='periodic', buoyancy_mode='anomaly', random_seed=None)[source]#

Simulate a conditioned 2D smoke-flow Navier-Stokes system.

State channels are [smoke, u, v], where smoke is a passive scalar that drives buoyancy forcing in the vertical velocity equation.

Parameters:
  • params (Tensor) – first value is interpreted as the vertical buoyancy coefficient.

  • return_timeseries (bool) – Whether to return the full saved trajectory or only the final state.

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

  • L (float) – Physical domain length.

  • T (float) – Final simulation time.

  • dt (float) – Maximum solver step size.

  • snapshot_dt (float | None) – Time interval between saved trajectory frames.

  • nu (float) – Velocity viscosity.

  • smoke_diffusivity (float) – Diffusivity for the smoke scalar.

  • cfl (float) – Courant number used to adapt the step size.

  • smoothness (float) – Smoothness of the sampled initial smoke field.

  • noise_scale (float) – Amplitude scale for the sampled initial smoke field.

  • bc_mode (str) – zero-gradient BCs for smoke and no-slip BCs for velocity.

  • buoyancy_mode (str) – smoke - mean(smoke); "raw" forces with raw smoke values.

  • random_seed (int | None) – Seed for reproducible initial-condition sampling.

Return type:

Tensor

class ConditionedNavierStokes2D(parameters_range=None, output_names=None, return_timeseries=False, log_level='progress_bar', n=64, L=32.0, T=2.0, dt=0.01, snapshot_dt=None, nu=0.03, cfl=0.35, bc_mode='periodic', buoyancy_mode='anomaly', skip_nt=0, random_seed=None)[source]#

Bases: SpatioTemporalSimulator

Conditioned 2D Navier-Stokes smoke simulator inspired by PDEArena.

The state contains smoke concentration \(s\) and incompressible velocity \(\mathbf{u}\). The solver evolves:

\[\begin{split}\begin{aligned} \partial_t s + \mathbf{u}\cdot\nabla s &= \kappa\nabla^2 s, \\ \partial_t \mathbf{u} + \mathbf{u}\cdot\nabla\mathbf{u} &= -\nabla p + \nu\nabla^2\mathbf{u} + b(s)\mathbf{e}_y, \\ \nabla\cdot\mathbf{u} &= 0. \end{aligned}\end{split}\]

The returned channels are smoke and velocity components: \([s, u, v]\).

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

Run sampled trajectories and return [batch,time,x,y,channels] data.

Parameters:
  • n (int)

  • random_seed (int | None)

  • ensure_exact_n (bool)

Return type:

dict