dedalus.core.evaluator ====================== .. py:module:: dedalus.core.evaluator .. autoapi-nested-parse:: Class for centralized evaluation of expression trees and handling the results. Module Contents --------------- .. py:class:: DictionaryHandler(*args, **kw) Handler that stores outputs in a dictionary. .. py:method:: process(**kw) Reference fields from dictionary. .. py:attribute:: fields .. py:class:: Evaluator(dist, vars) Coordinates evaluation of operator trees through various handlers. :Parameters: * **dist** (*dist object*) -- Problem dist * **vars** (*dict*) -- Variables for parsing task expression strings .. py:method:: add_dictionary_handler(**kw) Create a dictionary handler and add to evaluator. .. py:method:: add_file_handler(filename, parallel=None, **kw) Create a file handler and add to evaluator. .. py:method:: add_handler(handler) Add a handler to evaluator. .. py:method:: add_system_handler(**kw) Create a system handler and add to evaluator. .. py:method:: attempt_tasks(tasks, **kw) :staticmethod: Attempt tasks and return the unfinished ones. .. py:method:: evaluate_group(group, **kw) Evaluate all handlers in a group. .. py:method:: evaluate_handlers(handlers, id=None, **kw) Evaluate a collection of handlers. .. py:method:: evaluate_scheduled(**kw) Evaluate all scheduled handlers. .. py:method:: get_fields(tasks) :staticmethod: Get field set for a collection of tasks. .. py:method:: require_coeff_space(fields) Move all fields to coefficient layout. .. py:method:: require_grid_space(fields) Move all fields to grid layout. .. py:attribute:: dist .. py:attribute:: groups .. py:attribute:: handlers :value: [] .. py:attribute:: vars .. py:class:: H5FileHandlerBase(base_path, *args, max_writes=None, mode=None, **kw) Handler 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: None (infinite). * **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. .. py:method:: add_task(*args, **kw) Add task to handler. .. py:method:: close_file(file) :abstractmethod: Close current HDF5 file after processing. .. py:method:: create_current_file() Generate and setup new HDF5 file from root process. .. py:method:: create_task_dataset(file, task) Create dataset for a task. .. py:method:: get_data_distribution(task, rank=None) Determine write parameters for a task. .. py:method:: get_file(**kw) Return current HDF5 file, creating if necessary. .. py:method:: open_file(mode='r+') :abstractmethod: Open current HDF5 file for processing. .. py:method:: process(iteration, wall_time=0, sim_time=0, timestep=0) Save task outputs to HDF5 file. .. py:method:: setup_file(file) Prepare new HDF5 file for writing. .. py:method:: write_file_metadata(file, **kw) Write file metadata and time scales. .. py:method:: write_task(file, task) :abstractmethod: Write task data. .. py:attribute:: base_path .. py:property:: current_file .. py:property:: current_path .. py:attribute:: file_write_num :value: 0 .. py:attribute:: max_writes :value: None .. py:attribute:: name .. py:attribute:: set_num .. py:attribute:: total_write_num .. py:class:: H5GatherFileHandler(base_path, *args, max_writes=None, mode=None, **kw) H5FileHandler that gathers global data to write from root process. .. py:method:: close_file(file) Close current HDF5 file after processing. .. py:method:: open_file(mode='r+') Open current HDF5 file for processing. .. py:method:: write_file_metadata(file, **kw) Write file metadata and time scales. .. py:method:: write_task(file, task) Write task data. .. py:class:: H5ParallelFileHandler(*args, **kw) H5FileHandler using parallel HDF5 writes. .. py:method:: close_file(file) Close current HDF5 file after processing. .. py:method:: create_current_file() Generate and setup new HDF5 file. .. py:method:: create_task_dataset(file, task) Create dataset for a task. .. py:method:: get_hdf5_spaces(task, index) Create HDF5 space objects for writing local portion of a task. .. py:method:: open_file(mode='r+') Return current HDF5 file. Must already exist. .. py:method:: write_task(file, task) Write task data. .. py:class:: H5VirtualFileHandler(base_path, *args, max_writes=None, mode=None, **kw) H5FileHandler using process files and virtual joint files. .. py:method:: close_file(file) Close current HDF5 file after processing. .. py:method:: create_current_file() Generate and setup new HDF5 file. .. py:method:: create_task_dataset(file, task) Create dataset for a task. .. py:method:: empty() .. py:method:: merge_task(file, task_name, overwrite=False) :staticmethod: Merge virtual dataset into regular dataset. .. py:method:: open_file(mode='r+') Open current HDF5 file for processing. .. py:method:: setup_process_file(file) Prepare new HDF5 file for writing. .. py:method:: write_file_metadata(file, **kw) Write file metadata and time scales. .. py:method:: write_task(file, task) Write task data. .. py:property:: current_process_file .. py:class:: Handler(dist, vars, group=None, wall_dt=None, sim_dt=None, iter=None, custom_schedule=None) Group of tasks with associated evaluation schedule. :Parameters: * **domain** (*domain object*) -- Problem domain * **vars** (*dict*) -- Variables for parsing task expression strings * **group** (*str, optional*) -- Group name for forcing selected handlers (default: None). * **wall_dt** (*float, optional*) -- Wall time cadence for evaluating tasks (default: None). * **sim_dt** (*float, optional*) -- Simulation time cadence for evaluating tasks (default: None). * **iter** (*int, optional*) -- Iteration cadence for evaluating tasks (default: None). * **custom_schedule** (*function, optional*) -- Custom scheduling function returning a boolean for triggering output (default: None). Signature for IVPs: custom_schedule(iteration, wall_time, sim_time, timestep) Signature for BVPs: custom_schedule(iteration) .. py:method:: add_system(system, **kw) Add fields from a FieldSystem. .. py:method:: add_task(task, layout='g', name=None, scales=None) Add task to handler. .. py:method:: add_tasks(tasks, **kw) Add multiple tasks. .. py:method:: check_schedule(**kw) .. py:attribute:: custom_schedule :value: None .. py:attribute:: dist .. py:attribute:: group :value: None .. py:attribute:: iter :value: None .. py:attribute:: last_iter_div :value: -1 .. py:attribute:: last_sim_div :value: -1 .. py:attribute:: last_wall_div :value: -1 .. py:attribute:: sim_dt :value: None .. py:attribute:: tasks :value: [] .. py:attribute:: vars .. py:attribute:: wall_dt :value: None .. py:class:: SystemHandler(dist, vars, group=None, wall_dt=None, sim_dt=None, iter=None, custom_schedule=None) Handler that sets fields in a FieldSystem. .. py:method:: build_system() Build FieldSystem and set task outputs. .. py:method:: process(**kw) Gather fields into system. .. py:data:: FILEHANDLER_MODE_DEFAULT .. py:data:: FILEHANDLER_PARALLEL_DEFAULT .. py:data:: FILEHANDLER_TOUCH_TMPFILE .. py:data:: logger