exceptions#

Module: fridom.framework.exceptions

Exceptions

FieldSpaceError(is_spectral)

Raise when attempting to perform an operation on a field in the wrong space.

NotSetUpError(module_name, attribute)

Raise when an operation is attempted before the module is set up.

PartialDomainError(topo)

Raise when an operation is attempted on a field that is not fully extended.

TooManyArgumentsError(max_args, **provided_args)

Raise when too many arguments are provided.

exceptions.py - Custom exceptions for the framework.

exception fridom.framework.exceptions.TooManyArgumentsError(max_args: int, **provided_args: any)[source]#

Bases: Exception

Raise when too many arguments are provided.

static check(max_args: int, **provided_args: any) None[source]#

Check if the number of provided arguments is correct.

exception fridom.framework.exceptions.PartialDomainError(topo: tuple[bool])[source]#

Bases: NotImplementedError

Raise when an operation is attempted on a field that is not fully extended.

Description#

Fields in the computational framework are marked with a topo attribute, which is a tuple of booleans indicating whether the field is extended in each spatial direction. For example, a field with topo=(True, True, False) depends on x and y, but not on z.

Certain operations require the field to be fully extended in all directions (i.e., topo=(True, True, True)). If an unsupported operation is attempted on a field that is not fully extended, this exception is raised.

static check(field: fr.ScalarField) None[source]#

Check if the given field is fully extended.

Parameters#

fieldfr.ScalarField

The field to check.

Raises#

PartialDomainError: If topo is not fully extended.

exception fridom.framework.exceptions.FieldSpaceError(is_spectral: bool)[source]#

Bases: NotImplementedError

Raise when attempting to perform an operation on a field in the wrong space.

Description#

Fields in the computational framework have an is_spectral attribute, which is a boolean indicating whether the field is in spectral space.

Certain operations require the field to be either in spectral space (is_spectral=True) or physical space (is_spectral=False). If an unsupported operation is attempted on a field in the wrong state, this exception is raised.

Parameters#

is_spectralbool

The is_spectral attribute of the field.

static check_if_spectral(field: fr.FieldBase) None[source]#

Check if the given field is in spectral space.

Parameters#

fieldfr.FieldBase

The field to check.

Raises#

FieldSpaceError: If is_spectral is False.

static check_if_physical(field: fr.FieldBase) None[source]#

Check if the given field is in physical space.

Parameters#

fieldfr.FieldBase

The field to check.

Raises#

FieldSpaceError: If is_spectral is True.

exception fridom.framework.exceptions.NotSetUpError(module_name: str, attribute: str)[source]#

Bases: AttributeError

Raise when an operation is attempted before the module is set up.

static check(instance: fr.modules.Module | fr.grid.GridBase, attribute: str) None[source]#

Check if the module or grid is set up.

Parameters#

instanceModule | GridBase

The instance to check.

attributestr

The attribute being accessed.