FELiCS.Fields.Mode#

Module Contents#

Classes#

ModeType

Enumeration of mode roles in the analysis.

AnalysisType

Enumeration of analysis types supported for modes.

Mode

Field-based representation of a computational mode.

Attributes#

FELiCS.Fields.Mode.logger#
class FELiCS.Fields.Mode.ModeType(*args, **kwds)#

Bases: enum.Enum

Enumeration of mode roles in the analysis.

Members#

NONE0

No specific mode type.

DIRECT1

Direct eigenmode.

ADJOINT2

Adjoint eigenmode.

RESPONSE3

Response mode in resolvent or input–output analysis.

FORCING4

Forcing mode in resolvent or input–output analysis.

NONE = 0#
DIRECT = 1#
ADJOINT = 2#
RESPONSE = 3#
FORCING = 4#
class FELiCS.Fields.Mode.AnalysisType(*args, **kwds)#

Bases: enum.Enum

Enumeration of analysis types supported for modes.

Members#

NONE0

No analysis type.

MODAL1

Modal (eigenvalue) analysis.

RESOLVENT2

Resolvent analysis.

INPUT_OUTPUT3

Input–output analysis.

NONE = 0#
MODAL = 1#
RESOLVENT = 2#
INPUT_OUTPUT = 3#
class FELiCS.Fields.Mode.Mode(FEMSpace, mesh, name='q_hat', isStateVector=True, m=0, analysisType='Modal', modeType=None)#

Bases: FELiCS.Fields.Field.Field

Field-based representation of a computational mode.

This class extends Field to represent modes in a FEM-based analysis, such as eigenmodes, forcing modes or response modes. It stores additional metadata such as gain, frequency, eigenvalue, wave number, and error metrics, together with an analysis type and a mode type.

Initialize the Mode object

Parameters:
  • FEMSpace (dolfinx.fem.FunctionSpace) – The finite element space defining the discretization.

  • mesh (FELiCS.SpaceDisc.FELiCSMesh) – Mesh on which the FEM space is defined.

  • name (str, optional) – Name of the underlying field. Default is "q_hat".

  • isStateVector (bool, optional) – If True, this mode is treated as a state vector in a mixed formulation. Default is True.

  • m (int, optional) – Wave number associated with a spectral spatial dimension. Default is 0.

  • analysisType (str, optional) – Type of analysis for which this mode is defined. The string is mapped (case-insensitively) to AnalysisType (e.g. 'Modal', 'Resolvent'). Default is 'Modal'.

  • modeType (str or None, optional) – Mode role within the chosen analysis type, mapped to ModeType (e.g. 'direct', 'adjoint', 'response', 'forcing'). If None, a sensible default is chosen based on analysisType.

Variables:
  • analysisType (AnalysisType) – The specific analysis type enum associated with this mode.

  • modeType (ModeType) – The specific role of the mode (e.g. DIRECT, ADJOINT, FORCING).

  • waveNumber (int) – Wave number associated with the mode (initialized by m).

  • namesOfSubFields (list) – List of names of the subfields (variables) constituting the mode.

  • omega (float) – Property returning the eigenvalue (Modal) or frequency (Resolvent/IO).

  • gain (float) – Property returning the mode gain (returns -9999. if undefined).

  • error (float) – Property returning the error associated with the mode (returns -9999. if undefined).

property name#

Name of the mode.

For state-vector modes (isStateVector is True), this is always returned as "q_hat", irrespective of the underlying field name. Otherwise, the name from the base Field class is used.

property omega#

Angular frequency associated with the mode.

For modal analysis, this is the eigenvalue. For resolvent and input–output analysis, this is the real frequency.

Returns:

Eigenvalue (modal) or frequency (resolvent / input–output).

Return type:

float

property gain#

Gain associated with the mode.

Returns:

The mode gain. If undefined, returns -9999. and issues a warning.

Return type:

float

property gainNumber#

Get the gain number of the mode.

Returns:

Gain number of the mode. Returns -1 if undefined.

Return type:

int

property frequency#

Get the frequency of the mode.

Returns:

Frequency of the mode. Returns -9999. if undefined.

Return type:

float

property eigenValue#

Get the eigenvalue of the mode.

Returns:

Eigenvalue of the mode. Returns -9999. if undefined.

Return type:

float

property waveNumber#

Get the wave number of the mode.

Returns:

Wave number of the mode. Returns -9999. if undefined.

Return type:

float

property guess#

Get the initial guess of the mode.

Returns:

Initial guess used. Returns -9999. if undefined.

Return type:

float

property error#

Get the error associated with the mode.

Returns:

Error of the mode. Returns -9999. if undefined.

Return type:

float

describe()#

Log a summary of the mode’s properties.

Prints the mode type, and depending on the analysis type, logs relevant metrics such as guess and eigenvalue (Modal) or frequency, gain, and gain number (Resolvent/Input-Output).

exportToH5(writer, fileName=None)#

Export the mode to an HDF5 file.

If no file name is provided, a default name is constructed from the analysis type, mode type, and frequency/eigenvalue (and gain number for resolvent modes). Mode metadata such as omega and, where applicable, gain and gain number are written as attributes.

Parameters:
  • writer (object) – Writer object providing an exportFieldToH5(field, fileName, attrList) method.

  • fileName (str, optional) – Base file name (without directory). If None, a default is generated based on analysis type and mode properties.

importData(reader, importDirPath, importFileName=None)#

Import mode data from an HDF5 file.

If no explicit file name is provided, a default name is constructed from the analysis type, mode type, and frequency/eigenvalue (and gain number for resolvent modes). After importing the field coefficients via the parent Field method, the eigenvalue, frequency, gain and gain number are read back from file attributes.

Parameters:
  • reader (object) – Reader object providing an importInField(field, filePath, groupName) method.

  • importDirPath (str) – Directory from which the mode file is read.

  • importFileName (str, optional) – Explicit file name to import from. If None, a default name is constructed from the mode metadata.

Returns:

  • Mode – The updated mode (self) with imported coefficients and metadata.

  • list of str – List of variable names that were not found in the file.

Notes

For Resolvent and Input-Output analyses, the mode frequency is populated from the ‘omega’ dataset in the HDF5 file.