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_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 CFL-limited timestep.
- add_frequency(freq)
Add an on-grid frequency.
- add_velocity(velocity, axis)
Add grid-crossing frequency from a velocity along one axis.
- add_velocities(components)
Add grid-crossing frequencies from a tuple of velocity components.
- add_nonconservative_diffusivity(diffusivity)
Add grid-crossing frequencies from a diffusivity along all axes. This method treats the non-conservative form, e.g.
dt(C) = diff*di(di(C)) + …
- The corresponding timescale for the i-th axis is therefore
freq_i = diff / spacing_i**2
- add_conservative_diffusivity(diffusivity)
Add grid-crossing frequencies from a diffusivity along all axes. This method treats the conservative form, e.g.
dt(C) = di(diff*di(C)) + …
- Expanding the divergence gives advective terms and diffusive terms
di(diff*di(C)) = di(diff)*di(C) + diff*di(di(C))
- This results in advective and diffusive frequencies
freq_adv_i = di(diff) / spacing_i freq_diff_i = diff / spacing_i**2