watertap.core.util package

Subpackages

Submodules

watertap.core.util.initialization module

This module contains utility functions for initialization of WaterTAP models.

watertap.core.util.initialization.assert_degrees_of_freedom(blk, expected_dof)[source]

Assert that degrees of freedom are expected_dof. If not expected_dof, throw an error and stop.

Keyword Arguments:
  • blk – block to check

  • expected_dof – Integer number of degrees of freedom blk should have

Returns:

None

watertap.core.util.initialization.assert_no_degrees_of_freedom(blk)[source]

Assert that degrees of freedom are 0. If blk has non-zero degrees of freedom, throw an error and stop.

Keyword Arguments:

blk – block to check

Returns:

None

watertap.core.util.initialization.check_dof(blk, fail_flag=False, logger=<LoggerAdapter idaes.watertap.core.util.initialization (INFO)>, expected_dof=0)[source]

Check that degrees of freedom are 0, or the expected amount expected_dof. If not 0 or expected_dof, either throw a warning and continue or throw an error and stop.

Keyword Arguments:
  • blk – block to check

  • fail_flag – Boolean argument to specify error or warning

  • (Default – fail_flag=False produces logger warning. Set fail_flag=True to raise an error and stop the initialization routine.)

  • logger – Optional argument for loading idaes.getInitLogger object (e.g., logger=init_log)

  • expected_dof – Integer number of degrees of freedom blk should have

Returns:

None

watertap.core.util.initialization.check_solve(results, checkpoint=None, logger=<LoggerAdapter idaes.watertap.core.util.initialization (INFO)>, fail_flag=False)[source]

Check that solver termination is optimal and OK in an initialization routine. If the check fails, proceed through initialization with only a logger warning by default, or set fail_flag=True to raise an error. This should also work for checking a solve outside of an initialization routine.

Keyword Arguments:
  • results – solver results

  • checkpoint – Optional string argument to specify the step of initialization being checked (e.g., checkpoint=”Initialization step 1: solve indexed blocks”)

  • logger – Optional argument for loading idaes.getInitLogger object (e.g., logger=init_log)

  • fail_flag – Boolean argument to specify error or warning (Default: fail_flag=False produces logger warning. set fail_flag=True to raise an error and stop the initialization routine.)

Returns:

None

watertap.core.util.misc module

watertap.core.util.misc.is_constant_up_to_units(expr)[source]

Determines if a Pyomo expression is constant, even if units are involved :param expr: A Pyomo expression or a numeric value

Returns:

True if the expr is constant besides units, False otherwise

Return type:

bool

watertap.core.util.scaling module

This module contains a utility function for the scaling of WaterTAP property model constraints.

Module contents