NaNChecker#
- class fridom.framework.modules.nan_checker.NaNChecker(clock_trigger: ClockTrigger | None = None)[source]#
Bases:
ModuleCheck if a state vector contains NaN values.
Description#
This module checks if the state vector contains NaN values. If it does, the model panic flag is set to True and the model is stopped. Since it can be computationally expensive to check for NaNs every iteration, the module has a clock trigger that specifies when to check for NaNs.
Parameters#
- clock_triggerfr.ClockTrigger, optional
When to check for NaNs. If not specified, the module will check every 100 iteration steps.
- __init__(clock_trigger: ClockTrigger | None = None) None[source]#
Methods
__init__([clock_trigger])disable()Disable the module.
enable()Enable the module.
is_enabled()Whether the module is enabled or not.
reset()Stop and start the module.
setup(mset[, setup_mode])Set the module up.
start()Start the module.
stop()Stop the module.
update(mz)Update the model state.
Attributes
When to check for NaNs.
diff_moduleThe differentiation module to be used by this module.
gridThe grid of the model settings.
infoReturn a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
is_setupWhether the module is set up.
msetThe model settings.
required_haloThe required halo points for this module.
- name = 'NaN Checker'#
- update(mz: ModelState) ModelState[source]#
Update the model state.
Description#
This method is called by the model at each time step. Child classes should overwrite this method to update the module. Make sure to decorate the method with the @module_method decorator.
Parameters#
- mzfr.ModelState
The model state at the current time step.
Returns#
- fr.ModelState
The updated model state.
- log_level: str | int | None#
- property clock_trigger: ClockTrigger#
When to check for NaNs.