ibfoamrig.core.ResidualData#

class ibfoamrig.core.ResidualData(frame)[source]#

Bases: object

Solver residuals over the iterations or time steps of a run.

classmethod from_file(path)[source]#

Loads a residuals.dat file written by OpenFOAM.

Parameters:

path (StrPath) – Path to the file.

Returns:

The loaded residuals.

Raises:
Return type:

Self

property fields: list[str]#

Names of the residual columns, without Time.

final()[source]#

Returns the residuals of the last iteration.

Returns:

A mapping from residuals name to its last value, or None if it was not solved in the last iteration.

Raises:

ValueError – If the frame has no rows.

Return type:

dict[str, float | None]

is_converged(tol)[source]#

Checks whether the last residuals are below a tolerance.

Parameters:

tol (float | Mapping[str, float]) – One tolerance for all residuals, or a mapping from name to tolerance. Name is either a column or the base name of a vector or tensor, which covers all its components. Residuals missing from the mapping are not checked.

Returns:

True if every checked residual is below its tolerance. A null residual counts as not converged.

Raises:
  • KeyError – If a name in tol matches no residual column.

  • ValueError – If the frame has no rows.

Return type:

bool