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(local_scalar, mpi_reduce_op)

Compute global reduction of a scalar from each process.

global_min(data, empty=np.inf)

Compute global min of all array data.

global_max(data, empty=-np.inf)

Compute global max of all array data.

global_mean(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(property, name, precompute_integral=False)

Add a property.

min(name)

Compute global min of a property on the grid.

max(name)

Compute global max of a property on the grid.

grid_average(name)

Compute global mean of a property on the grid.

volume_integral(name)

Compute volume integral of a property.

abstract volume_average(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()
compute_timestep()

Compute CFL-limited timestep.

add_frequency(freq)

Add an on-grid frequency.

add_velocity(velocity)

Add grid-crossing frequency from a velocity vector.

Parameters:

velocity (field object) – The velocity; must be a vector with a tensorsig of length 1