Controller Base Class

class pyrefine.controller.base.ControllerBase(project_name, pbs=None)

Driver for the complexity controller and updating any other inputs

Parameters
  • project_name (str) – The root name of the project (without any mesh numbers)

  • pbs (PBS) – PBS queue helper

initial_complexity

Complexity at iteration 1 of the adaptation cycle

Type

float

final_complexity

Complexity at final iteration of the adaptation cycle. Number of iterations can be computed if defined using ControllerBasic.compute_iterations

Type

float

restart_save_frequency

How often to save a meshb and -restart.solb file for restarting.

Type

int

save_all

Set to True to keep all files (no clean up operations).

Type

bool

set_file_extensions_to_cleanup_every_step(extensions)

If left unchecked, the directories growing quickly during the adaptation process. The basic controller will delete some intermediate files to reduce directory size. The list of file extensions to be deleted at the end of each adaptation cycle can be customized with this function.

The cleanup functionality can be turned off with save_all()

Parameters

extensions (List[str]) – list of strings representing the end of the file names, e.g. for rm {project_name}*.txt {project_name}*.dat, set extensions=[‘.txt’, ‘.dat’]

set_file_extensions_to_save_only_on_restart_iterations(extensions)

If left unchecked, the directories growing quickly during the adaptation process. The basic controller will delete some intermediate files to reduce directory size. File extensions set with this method will be deleted at the end of adaptation cycle except restart steps as determined by restart_save_frequency. The default extensions are [“.meshb”, “-restart.solb”]

The cleanup functionality can be turned off with save_all

Parameters

extensions (List[str]) – list of strings representing the end of the file names, e.g. for rm {project}*.txt {project}*.dat, set extensions=[‘.txt’, ‘.dat’]

cleanup(istep)

Clean up files at the end of the adaptation cycle

update_inputs(istep)

Update any input files for the given adaptation cycle

compute_complexity(istep, current_complexity)

Compute the complexity for the upcoming adaptation cycle, istep.

Parameters
  • istep (int) – Adaptation step number

  • current_complexity (float) – The current complexity in the driver. If doing a restart, the current complexity will be None

Return type

complexity

check_for_early_stop_condition(istep)

Check whether some condition has been met to stop the adaptation cycle loop but not raise an exception to kill python altogether

Parameters

istep (int) – Adaptation step number

Return type

early_stop