dedalus.extras.flow_tools

Extra tools that are useful in hydrodynamical problems.

Module Contents

logger
class GlobalArrayReducer(comm, dtype=np.float64)

Directs parallelized reduction of distributed array data.

Parameters:
  • comm (MPI communicator) – MPI communicator
  • dtype (data type, optional) – Array data type (default: np.float64)
reduce_scalar(self, local_scalar, mpi_reduce_op)

Compute global reduction of a scalar from each process.

global_min(self, data, empty=np.inf)

Compute global min of all array data.

global_max(self, data, empty=-np.inf)

Compute global max of all array data.

global_mean(self, data)

Compute global mean of all array data.

class GlobalFlowProperty(solver, cadence=1)

Directs parallelized determination of a global flow property on the grid.

Parameters:
  • solver (solver object) – Problem solver
  • cadence (int, optional) – Iteration cadence for property evaluation (default: 1)

Examples

>>> flow = GlobalFlowProperty(solver)
>>> flow.add_property('sqrt(u*u + w*w) * Lz / nu', name='Re')
...
>>> flow.max('Re')
1024.5
add_property(self, property, name, precompute_integral=False)

Add a property.

min(self, name)

Compute global min of a property on the grid.

max(self, name)

Compute global max of a property on the grid.

grid_average(self, name)

Compute global mean of a property on the grid.

volume_average(self, name)

Compute volume average of a property.

class CFL(solver, initial_dt, cadence=1, safety=1.0, max_dt=np.inf, min_dt=0.0, max_change=np.inf, min_change=0.0, threshold=0.0)

Computes CFL-limited timestep from a set of frequencies/velocities.

Parameters:
  • solver (solver object) – Problem solver
  • initial_dt (float) – Initial timestep
  • cadence (int, optional) – Iteration cadence for computing new timestep (default: 1)
  • safety (float, optional) – Safety factor for scaling computed timestep (default: 1.)
  • max_dt (float, optional) – Maximum allowable timestep (default: inf)
  • min_dt (float, optional) – Minimum allowable timestep (default: 0.)
  • max_change (float, optional) – Maximum fractional change between timesteps (default: inf)
  • min_change (float, optional) – Minimum fractional change between timesteps (default: 0.)
  • threshold (float, optional) – Fractional change threshold for changing timestep (default: 0.)

Notes

The new timestep is computed by summing across the provided frequencies for each grid point, and then reciprocating the maximum “total” frequency from the entire grid.

compute_dt(self)

Compute CFL-limited timestep.

add_frequency(self, freq)

Add an on-grid frequency.

add_velocity(self, velocity, axis)

Add grid-crossing frequency from a velocity along one axis.

add_velocities(self, components)

Add grid-crossing frequencies from a tuple of velocity components.