dedalus.extras.flow_tools ========================= .. py:module:: dedalus.extras.flow_tools .. autoapi-nested-parse:: Extra tools that are useful in hydrodynamical problems. Module Contents --------------- .. py: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.) .. rubric:: 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. .. py:method:: add_frequency(freq) Add an on-grid frequency. .. py:method:: 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 .. py:method:: compute_dt() .. py:method:: compute_timestep() Compute CFL-limited timestep. .. py:attribute:: cadence :value: 1 .. py:attribute:: frequencies .. py:attribute:: max_change .. py:attribute:: max_dt .. py:attribute:: min_change :value: 0.0 .. py:attribute:: min_dt :value: 0.0 .. py:attribute:: reducer .. py:attribute:: safety :value: 1.0 .. py:attribute:: solver .. py:attribute:: stored_dt .. py:attribute:: threshold :value: 0.0 .. py: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) .. py:method:: global_max(data, empty=-np.inf) Compute global max of all array data. .. py:method:: global_mean(data) Compute global mean of all array data. .. py:method:: global_min(data, empty=np.inf) Compute global min of all array data. .. py:method:: reduce_scalar(local_scalar, mpi_reduce_op) Compute global reduction of a scalar from each process. .. py:attribute:: comm .. py: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) .. rubric:: Examples >>> flow = GlobalFlowProperty(solver) >>> flow.add_property('sqrt(u*u + w*w) * Lz / nu', name='Re') ... >>> flow.max('Re') 1024.5 .. py:method:: add_property(property, name, precompute_integral=False) Add a property. .. py:method:: grid_average(name) Compute global mean of a property on the grid. .. py:method:: max(name) Compute global max of a property on the grid. .. py:method:: min(name) Compute global min of a property on the grid. .. py:method:: volume_average(name) :abstractmethod: Compute volume average of a property. .. py:method:: volume_integral(name) Compute volume integral of a property. .. py:attribute:: cadence :value: 1 .. py:attribute:: properties .. py:attribute:: reducer .. py:attribute:: solver .. py:data:: logger