Skip to content

Commit

Permalink
Deprecate old Cubic EoS (#1519)
Browse files Browse the repository at this point in the history
* cubic_deprecation

* Deprecation tests and update docs

* run Black

* remove deprecation of stateblock and derived class

* remove unused import

* Try converting plain text reference to preferred implementation to Sphinx link

---------

Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
  • Loading branch information
dallan-keylogic and lbianchi-lbl authored Nov 21, 2024
1 parent 3fa6904 commit b0f9156
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Cubic Equations of State
========================

.. deprecated:: 2.7
Use :class:`idaes.models.properties.modular_properties.eos.ceos` in the Modular Property Framework instead.

This property package implements a general form of a cubic equation of state which can be used for most cubic-type equations of state. This package supports phase equilibrium calculations with a smooth phase transition formulation that makes it amenable for equation oriented optimization. The following equations of state are currently supported:

* Peng-Robinson
Expand Down
13 changes: 13 additions & 0 deletions idaes/models/properties/cubic_eos/cubic_prop_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
)
from pyomo.common.config import ConfigDict, ConfigValue, In
from pyomo.contrib.incidence_analysis import solve_strongly_connected_components
from pyomo.common.deprecation import deprecated

# Import IDAES cores
from idaes.core import (
Expand Down Expand Up @@ -97,6 +98,12 @@
_log = idaeslog.getLogger(__name__)


@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the May 2025 release.",
version="2.7.0",
)
@declare_process_block_class("CubicParameterBlock")
class CubicParameterData(PhysicalParameterBlock):
"""
Expand Down Expand Up @@ -222,6 +229,12 @@ def define_metadata(cls, obj):
)


@deprecated(
msg="The standalone cubic property package has been deprecated in favor of the "
"cubic equation of state for the modular property framework. This class will be "
"removed in the May 2025 release.",
version="2.7.0",
)
class CubicEoSInitializer(InitializerBase):
"""
Initializer for CubicEoS property packages.
Expand Down
8 changes: 5 additions & 3 deletions idaes/models/properties/cubic_eos/tests/test_BT_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)
from pyomo.util.check_units import assert_units_consistent

import idaes.logger as idaeslog
from idaes.models.properties.tests.test_harness import PropertyTestHarness
from idaes.core.solvers import get_solver

Expand Down Expand Up @@ -76,12 +77,13 @@ def configure(self):
@pytest.mark.skipif(not prop_available, reason="Cubic root finder not available")
class TestBTExample(object):
@pytest.mark.component
def test_units(self):
def test_units(self, caplog):
m = ConcreteModel()

m.fs = FlowsheetBlock(dynamic=False)

m.fs.props = BT_PR.BTParameterBlock(valid_phase=("Vap", "Liq"))
with caplog.at_level(idaeslog.WARNING):
m.fs.props = BT_PR.BTParameterBlock(valid_phase=("Vap", "Liq"))
assert "May 2025 release." in caplog.text

m.fs.state = m.fs.props.build_state_block([0], defined_state=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)

from idaes.core import FlowsheetBlock, Component
import idaes.logger as idaeslog
from idaes.models.properties.cubic_eos.cubic_prop_pack import (
CubicParameterBlock,
CubicStateBlock,
Expand Down Expand Up @@ -51,12 +52,13 @@ class TestParameterBlock(object):
not cubic_roots_available(), reason="Cubic functions not available"
)
@pytest.mark.unit
def test_build_default(self):
def test_build_default(self, caplog):
m = ConcreteModel()

m.fs = FlowsheetBlock(dynamic=False)

m.fs.params = CubicParameterBlock()
with caplog.at_level(idaeslog.WARNING):
m.fs.params = CubicParameterBlock()
assert "May 2025 release." in caplog.text

assert m.fs.params.state_block_class is CubicStateBlock
assert m.fs.params.config.valid_phase == ("Vap", "Liq")
Expand Down

0 comments on commit b0f9156

Please sign in to comment.