Navigation

  • index
  • modules |
  • next |
  • previous |
  • SigmaMu 1.0-b1 documentation »
  • API documentation »
  • Process modelling »
  • Handler classes related to residuals

Handler classes related to residuals¶

Residuals are used both by Model and by simu.ThermoContribution.

Residual¶

class simu.core.utilities.residual.Residual¶

Class representing a single residual.

The post-constructor will raise a DimensionalityError if the tolerance unit is not compatible with the value unit.

A possible offset in the tolerance unit, such as in degrees Celsius or gauge pressures, will be eliminated automatically. That is:

>>> from simu import SymbolQuantity as S, Quantity as Q
>>> val = S("r", "barg")
>>> r1 = Residual(val, Q(1e-7, "barg"))
>>> r2 = Residual(val, Q(1e-7, "bar"))
>>> f"{r1.tolerance - r2.tolerance:.15f~}"
'0.000000000000000 bar'

(there is a silly rounding error, hence the trick with the formatting to make this doctest work)

value: Quantity¶

The value as a symbolic quantity

tolerance: Quantity¶

The absolute tolerance of the residual as a numeric quantity in the same physical dimensions as the value

__init__(
value: Quantity,
tolerance: Quantity,
) → None¶

ResidualHandler¶

class simu.core.utilities.residual.ResidualHandler¶

This class, being instantiated as the simu.Model.residuals attribute, allows to define residuals, i.e. process constraints.

__init__()¶
add(
name: str,
residual: Quantity,
tol_unit: str,
tol: float = 1e-07,
)¶

Define a residual, to approach zero withing its tolerance when the model is solved.

Parameters:
  • name – A unique name within the local context

  • residual – The residual to be zero.

  • tol_unit – The unit of the tolerance, which must be compatible with the unit of the residual quantity.

  • tol – The tolerance value. A normal recommendation is to give 1e-7 for a typical unit of measurement, which for extensive variables is largely problem size dependent. An industrial flow is typically characterized by kg/h, while a lab scale experiment can operate with g/h.

create_proxy() → Mapping[str, Residual]¶

Create a proxy object

ResiduaProxy¶

simu.core.utilities.residual.ResidualProxy¶

This is just a dictionary, mapping the names (str) to the Residual objects

Table of Contents

Contents:

  • Introduction
  • Getting started
  • Tutorial
  • API documentation
    • Thermodynamic Modelling
    • Process modelling
    • Numerical solvers
    • Utilities
    • Predefined models
  • Frequently asked questions
  • Release notes
  • License
  • Literature

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • SigmaMu 1.0-b1 documentation »
  • API documentation »
  • Process modelling »
  • Handler classes related to residuals
© Copyright 2021-2025, Volker Siepmann. Created using Sphinx 9.1.0.