model_handling_flux

Module Contents

Classes

FluxCalculatorModes

ModelHandler

Base class for all specific model handler.

class model_handling_flux.FluxCalculatorModes
single_core = single_core_per_bottom_model
on_bottom_cores = on_bottom_model_cores
on_extra_cores = on_extra_cores
none = none
class model_handling_flux.ModelHandler(global_settings, my_directory, model_handlers={})

Bases: model_handling.ModelHandlerBase

Base class for all specific model handler.

This constructor must be called in the constructor of the child class as e.g. ModelHandlerBase.__init__(self, model_handling.ModelTypes.bottom, global_settings, my_directory) The child class must be implmented as ModelHandler in a python module called model_handling_ABCD.py where ABCD is a four letter acronym of your model.

Parameters
  • global_settings (class:GlobalSettings) – Object containing the global settings

  • my_directory (str) – Name of the model’s input folder, usually model_domain, e.g. MOM5_Baltic. IMPORTANT: model names can only have four letters as e.g. MOM5, CCLM, GETM etc.

  • model_handlers – Dictionary with model handlers of other models that are coupled to the flux calculator. The keys are the directory names of the other models. Default: {} must be present to be created in the model_handling.get_model_handler method.

create_work_directory(self, work_directory_root, start_date, end_date)

Method to perform model-specific steps for creating the work directory.

This method is overwritten by the child class and will be called after the work directory has been created and the content of the input folder has been copied to that work directory.

It should typically do:

  • Copy the executable(s) to the work directory (not into subfolders)

  • Apply current start date and end date to input files

Parameters
  • work_directory_root (str) – Is the local work directory common to all models, thus it is one lvel above my_directory

  • start_date (str) – Start date of the current working period, format YYYYMMDD, e.g. 20220325 for the 25th of March 2022

  • end_date (str) – End date of the current working period, format YYYYMMDD, e.g. 20220325 for the 25th of March 2022

get_model_executable(self)

Method to get the name of the model’s excutable.

This method is overwritten by the child class and will be called when the MPI run script is created.

It should typically do:

  • Return the name of the executable that is located in your work directory after create_work_directory has been called.

Returns

Name of the excutable, e.g. “fms_MOM_SIS.x”

Return type

str

get_num_threads(self)

Method to get the number of threads the model is using.

This method is overwritten by the child class and will be called when the paralleization layout is created.

It should typically do:

  • Return the number of threads using e.g. settings in the model’s input files.

Returns

Number of used threads

Return type

int

get_my_threads(self)