dedalus.core.evaluator¶
Class for centralized evaluation of expression trees.
Module Contents¶
-
FILEHANDLER_MODE_DEFAULT¶
-
FILEHANDLER_PARALLEL_DEFAULT¶
-
FILEHANDLER_TOUCH_TMPFILE¶
-
logger¶
-
class
Evaluator(domain, vars)¶ Coordinates evaluation of operator trees through various handlers.
Parameters: - domain (domain object) – Problem domain
- vars (dict) – Variables for parsing task expression strings
-
add_dictionary_handler(self, **kw)¶ Create a dictionary handler and add to evaluator.
-
add_system_handler(self, **kw)¶ Create a system handler and add to evaluator.
-
add_file_handler(self, filename, **kw)¶ Create a file handler and add to evaluator.
-
add_handler(self, handler)¶ Add a handler to evaluator.
-
evaluate_group(self, group, **kw)¶ Evaluate all handlers in a group.
-
evaluate_scheduled(self, wall_time, sim_time, iteration, **kw)¶ Evaluate all scheduled handlers.
-
evaluate_handlers(self, handlers, id=None, **kw)¶ Evaluate a collection of handlers.
-
require_coeff_space(self, fields)¶ Move all fields to coefficient layout.
-
static
get_fields(tasks)¶ Get field set for a collection of tasks.
-
static
attempt_tasks(tasks, **kw)¶ Attempt tasks and return the unfinished ones.
-
class
Handler(domain, vars, group=None, wall_dt=np.inf, sim_dt=np.inf, iter=np.inf)¶ Group of tasks with associated scheduling data.
Parameters: - domain (domain object) – Problem domain
- vars (dict) – Variables for parsing task expression strings
- group (str, optional) – Group name for forcing selected handelrs (default: None)
- wall_dt (float, optional) – Wall time cadence for evaluating tasks (default: infinite)
- sim_dt (float, optional) – Simulation time cadence for evaluating tasks (default: infinite)
- iter (int, optional) – Iteration cadence for evaluating tasks (default: infinite)
-
add_task(self, task, layout='g', name=None, scales=None)¶ Add task to handler.
-
add_tasks(self, tasks, **kw)¶ Add multiple tasks.
-
add_system(self, system, **kw)¶ Add fields from a FieldSystem.
-
class
DictionaryHandler(*args, **kw)¶ Bases:
dedalus.core.evaluator.HandlerHandler that stores outputs in a dictionary.
-
process(self, **kw)¶ Reference fields from dictionary.
-
-
class
SystemHandler¶ Bases:
dedalus.core.evaluator.HandlerHandler that sets fields in a FieldSystem.
-
build_system(self)¶ Build FieldSystem and set task outputs.
-
process(self, **kw)¶ Gather fields into system.
-
-
class
FileHandler(base_path, *args, max_writes=np.inf, max_size=2**30, parallel=None, mode=None, **kw)¶ Bases:
dedalus.core.evaluator.HandlerHandler that writes tasks to an HDF5 file.
Parameters: - base_path (str) – Base path for analyis output folder
- max_writes (int, optional) – Maximum number of writes per set (default: infinite)
- max_size (int, optional) – Maximum file size to write to, in bytes (default: 2**30 = 1 GB). (Note: files may be larger after final write.)
- parallel (bool, optional) – Perform parallel writes from each process to single file (True), or separately write to individual process files (False). Default behavior set by config option.
- mode (str, optional) – ‘overwrite’ to delete any present analysis output with the same base path. ‘append’ to begin with set number incremented past any present analysis output. Default behavior set by config option.
-
current_path¶
-
check_file_limits(self)¶ Check if write or size limits have been reached.
-
get_file(self)¶ Return current HDF5 file, creating if necessary.
-
create_current_file(self)¶ Generate new HDF5 file in current_path.
-
setup_file(self, file)¶
-
process(self, world_time, wall_time, sim_time, timestep, iteration, **kw)¶ Save task outputs to HDF5 file.
-
get_write_stats(self, layout, scales, constant, index)¶ Determine write parameters for nonconstant subspace of a field.
-
get_hdf5_spaces(self, layout, scales, constant, index)¶ Create HDF5 space objects for writing nonconstant subspace of a field.