TurbulentTrajectory#

class TurbulentTrajectory(velocity_field, map_dimensions, additional_dimension_mapping=None, **kwargs)[source]#

Numerically integrates the path of particles in a mean velocity field and incorporates random turbulent velocity fluctuations based on Langevin updates from sampled RST values. Looks up and returns additional fields for the previous particle positions.

Example usage
Instantiation#
velocity_field_3d = ...  # shape - (X, Y, Z, 10)
map_dimensions = [(x_lo, x_hi), (y_lo, y_hi), (z_lo, z_hi)]
field_list = []  # ... no addition a field mapping
trajectory_module = TurbulentTrajectory(velocity_field_3d, map_dimensions, field_list)
Call function#
r_init = ...  # initial_positions of shape (N, 3)
timing = np.arange(0., 1.01, 0.01)
r_at_timing, fields = trajectory_module(r_init, timing, dt_max=0.01,
                                       return_velocities=True)
increment particle positions#
r_init = ...  # initial_positions of shape (N, 3)
delta_t = tf.constant(0.01, tf.float32)
r_new, fields = self.trajectory_module.increment_particles(r_init, dt=delta_t)
Parameters:
  • velocity_field

  • map_dimensions

  • additional_dimension_mapping

Methods:

__call__(initial_positions, timing, dt_max)

Evaluates the increment particle function for multiple steps, and for the times matching the argument values, stores the position.

increment_particles(particle_positions, dt)

For given particle positions and specified time-interval returns the values of all additional fields at the initial particle position and moves the particles according to:

turbulence_reseed_update(in_tol, ...)

Updates turbulence velocity for a subset of particles based on their positions.

warmup_step(particle_positions)

Updates turbulence velocity of all particles based on sampled RST values at their positions.

__call__(initial_positions, timing, dt_max, verbose=True, return_velocities=False)[source]#

Evaluates the increment particle function for multiple steps, and for the times matching the argument values, stores the position.

Parameters:
  • initial_positions (Tensor) – (#particles, 3)

  • timing (Tensor) – float - in seconds

  • dt_max (float) – Maximal temporal step width in milliseconds

  • verbose (bool) – bool

  • return_velocities (bool) – if True, the velocities for each time-step is saved and returned as entry of the additional fields dictionary

Return type:

(Tensor, dict)

Returns:

(#particles, n_steps, 3) - tf.Tensors, Trajectory, dict(field-name: tf.Tensor with shape (#particles, n_steps, n_components)) field values at trajectory locations

increment_particles(particle_positions: Tensor, dt: Tensor, return_velocities: bool = False)[source]#

For given particle positions and specified time-interval returns the values of all additional fields at the initial particle position and moves the particles according to:

\[ \begin{align}\begin{aligned}r_{t+\delta t} = r_{t} + \delta t (U(r_{t}) + u_{t})\\u_{t} = u_{t-\delta t} e^{-\frac{\delta t}{\tau}} + \zeta \sqrt{1-e^{-2 \frac{\delta t}{\tau}}}\end{aligned}\end{align} \]

where U is the mean velocity in m/ms, u is fluctuating velocity in m/ms, \(\tau\) is the Langevin timescale in ms, and \(\zeta\) is a random Gaussian sample from the Reynolds stress tensor.

Parameters:
  • particle_positions (Tensor) – (-1, 3) batch of 3D particle coordinates

  • dt (Tensor) – scalar value in ms

  • return_velocities (bool) – if True the additional field lookup contains the field “velocity”

Returns:

new particle positions (-1, 3), dict(**aditional_fields[-1, c])

turbulence_reseed_update(in_tol, new_particle_positions)[source]#
Updates turbulence velocity for a subset of particles based on their positions.

Intended for use when initializing newly seeded particles during reseeding.

Parameters:
  • in_tol – Indices of subset of particles

  • new_particle_positions (Tensor) – (-1, 3) 3D particle coordinates for subset of particles

warmup_step(particle_positions)[source]#

Updates turbulence velocity of all particles based on sampled RST values at their positions. Used to initialize turbulence velocity to prevent transient states due to long Langevin timescales

Parameters:

particle_positions (Tensor) – (-1, 3) batch of 3D particle coordinates