diff --git a/setup.py b/setup.py index 8fb0cbfafd..bfa901049e 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ # primary requirements for unit and property models # maintainers: switch to SPECIAL_DEPENDENCIES_FOR_RELEASE when cutting a release of watertap *SPECIAL_DEPENDENCIES_FOR_PRERELEASE, - "pyomo>=6.6.1,<6.7", # (also needed for units in electrolyte database (edb)) + "pyomo>=6.6.1", # (also needed for units in electrolyte database (edb)) "pyyaml", # watertap.core.wt_database # the following requirements are for the electrolyte database (edb) "pymongo>3", # database interface diff --git a/watertap/core/plugins/solvers.py b/watertap/core/plugins/solvers.py index 25411f31c3..5bc7bdee36 100644 --- a/watertap/core/plugins/solvers.py +++ b/watertap/core/plugins/solvers.py @@ -10,11 +10,12 @@ # "https://github.com/watertap-org/watertap/" ################################################################################# +import logging + import pyomo.environ as pyo from pyomo.core.base.block import _BlockData from pyomo.core.kernel.block import IBlock from pyomo.solvers.plugins.solvers.IPOPT import IPOPT -import pyomo.repn.plugins.nl_writer as _nl_writer import idaes.core.util.scaling as iscale from idaes.core.util.scaling import ( @@ -25,17 +26,15 @@ from idaes.logger import getLogger _log = getLogger("watertap.core") -_SuffixData = _nl_writer._SuffixData +_pyomo_nl_writer_log = logging.getLogger("pyomo.repn.plugins.nl_writer") -class _WTSuffixData(_SuffixData): - def update(self, suffix): - self.datatype.add(suffix.datatype) - for obj, val in suffix.items(): - self._store(obj, val) - def store(self, obj, val): - self._store(obj, val) +def _pyomo_nl_writer_logger_filter(record): + msg = record.getMessage() + if "scaling_factor" in msg and "model contains export suffix" in msg: + return False + return True @pyo.SolverFactory.register( @@ -58,10 +57,6 @@ def _presolve(self, *args, **kwds): "IpoptWaterTAP.solve takes 1 positional argument: a Pyomo ConcreteModel or Block" ) - # hot patch _SuffixData to prevent an overload - # on error reporting about `scaling_factor` - _nl_writer._SuffixData = _WTSuffixData - # until proven otherwise self._cleanup_needed = False @@ -103,6 +98,7 @@ def _presolve(self, *args, **kwds): self._model = args[0] self._cache_scaling_factors() self._cleanup_needed = True + _pyomo_nl_writer_log.addFilter(_pyomo_nl_writer_logger_filter) # NOTE: This function sets the scaling factors on the # constraints. Hence we cache the constraint scaling @@ -154,11 +150,11 @@ def _presolve(self, *args, **kwds): raise def _cleanup(self): - _nl_writer._SuffixData = _SuffixData if self._cleanup_needed: self._reset_scaling_factors() # remove our reference to the model del self._model + _pyomo_nl_writer_log.removeFilter(_pyomo_nl_writer_logger_filter) def _postsolve(self): self._cleanup() diff --git a/watertap/core/plugins/tests/test_solvers.py b/watertap/core/plugins/tests/test_solvers.py index dd6c8afe7b..79755a4155 100644 --- a/watertap/core/plugins/tests/test_solvers.py +++ b/watertap/core/plugins/tests/test_solvers.py @@ -16,13 +16,12 @@ from pyomo.solvers.plugins.solvers.IPOPT import IPOPT from pyomo.common.errors import ApplicationError -import pyomo.repn.plugins.nl_writer as _nl_writer from idaes.core.util.scaling import ( set_scaling_factor, constraints_with_scale_factor_generator, ) from idaes.core.solvers import get_solver -from watertap.core.plugins.solvers import IpoptWaterTAP, _SuffixData +from watertap.core.plugins.solvers import IpoptWaterTAP, _pyomo_nl_writer_log class TestIpoptWaterTAP: @@ -112,7 +111,6 @@ def test_postsolve_unscaled_constraints_and_bounds_cleanup(self, m, s): assert cons_with_sf == [(m.b.d, 1e6)] assert not hasattr(s, "_model") - assert _nl_writer._SuffixData is _SuffixData @pytest.mark.unit def test_option_absorption(self, m, s): @@ -121,7 +119,7 @@ def test_option_absorption(self, m, s): pyo.assert_optimal_termination(results) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] del s.options["ignore_variable_scaling"] @pytest.mark.unit @@ -138,7 +136,7 @@ def test_presolve_passthrough(self, m, s): s._presolve(m, tee=True) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] s.options["nlp_scaling_method"] = "user-scaling" @pytest.mark.unit @@ -148,7 +146,7 @@ def test_passthrough_positive(self, m, s): del s.options["nlp_scaling_method"] self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] @pytest.mark.unit def test_passthrough_negative(self, m, s): @@ -160,7 +158,7 @@ def test_passthrough_negative(self, m, s): del s.options["ignore_variable_scaling"] self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] @pytest.mark.unit def test_presolve_incorrect_number_of_arguments(self, m, s): @@ -181,7 +179,7 @@ def test_presolve_AMPL_evaluation_error(self, m, s): s.solve(m) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] m.a.value = 1 @pytest.mark.unit @@ -199,7 +197,7 @@ def test_presolve_AMPL_evaluation_error_cleans_up(self, m, s): s.solve(m) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] m.a.value = 1 @pytest.mark.unit @@ -217,7 +215,7 @@ def _bad_presolve(*args, **kwargs): s.solve(m) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] IPOPT._presolve = IPOPT_presolve @pytest.mark.unit @@ -235,7 +233,7 @@ def _bad_constraint_autoscale_large_jac(*args, **kwargs): s.solve(m) self._test_bounds(m) assert not hasattr(s, "_scaling_cache") - assert _nl_writer._SuffixData is _SuffixData + assert _pyomo_nl_writer_log.filters == [] iscale.constraint_autoscale_large_jac = constraint_autoscale_large_jac @pytest.fixture(scope="class") diff --git a/watertap/examples/custom_model_demo/simple_prop_pack.py b/watertap/examples/custom_model_demo/simple_prop_pack.py index 88d10c75b6..ad201c10b4 100644 --- a/watertap/examples/custom_model_demo/simple_prop_pack.py +++ b/watertap/examples/custom_model_demo/simple_prop_pack.py @@ -77,9 +77,7 @@ def build(self): self.NaCl = Component() # parameters - self.cp = Param( - mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K) - ) + self.cp = Param(initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) dens_mass_param_dict = {"0": 995, "1": 756} self.dens_mass_param = Param( diff --git a/watertap/examples/flowsheets/case_studies/activated_sludge/ASM2D_flowsheet_noPHA.py b/watertap/examples/flowsheets/case_studies/activated_sludge/ASM2D_flowsheet_noPHA.py index 712a857b2f..7cf536917c 100644 --- a/watertap/examples/flowsheets/case_studies/activated_sludge/ASM2D_flowsheet_noPHA.py +++ b/watertap/examples/flowsheets/case_studies/activated_sludge/ASM2D_flowsheet_noPHA.py @@ -347,7 +347,7 @@ def function(unit): seq.run(m, function) - solver = get_solver(options={"bound_push": 1e-4}) + solver = get_solver() results = solver.solve(m, tee=False) check_solve(results, logger=_log, fail_flag=True) diff --git a/watertap/examples/flowsheets/case_studies/activated_sludge/tests/test_asm2_noPHA_flowsheet.py b/watertap/examples/flowsheets/case_studies/activated_sludge/tests/test_asm2_noPHA_flowsheet.py index 61616f3f33..0604b9b25a 100644 --- a/watertap/examples/flowsheets/case_studies/activated_sludge/tests/test_asm2_noPHA_flowsheet.py +++ b/watertap/examples/flowsheets/case_studies/activated_sludge/tests/test_asm2_noPHA_flowsheet.py @@ -43,7 +43,6 @@ def test_structure(self, model): assert degrees_of_freedom(model) == 0 assert_optimal_termination(model.results) - @pytest.mark.requires_idaes_solver @pytest.mark.integration def test_results(self, model): # Treated water @@ -144,10 +143,10 @@ def test_results(self, model): 0.101, rel=1e-2 ) assert value(model.fs.Sludge.conc_mass_comp[0, "X_MeOH"]) == pytest.approx( - 1.36e-9, rel=1e2 + 1.81e-7, rel=1e2 ) assert value(model.fs.Sludge.conc_mass_comp[0, "X_MeP"]) == pytest.approx( - 1.2e-8, rel=1e2 + 1.44e-6, rel=1e2 ) assert value(model.fs.Sludge.conc_mass_comp[0, "X_PAO"]) == pytest.approx( 1.95e-6, rel=1e2 diff --git a/watertap/examples/flowsheets/full_treatment_train/flowsheet_components/chemistry/tests/test_posttreatment.py b/watertap/examples/flowsheets/full_treatment_train/flowsheet_components/chemistry/tests/test_posttreatment.py index d31b1ce65c..82079bb41a 100644 --- a/watertap/examples/flowsheets/full_treatment_train/flowsheet_components/chemistry/tests/test_posttreatment.py +++ b/watertap/examples/flowsheets/full_treatment_train/flowsheet_components/chemistry/tests/test_posttreatment.py @@ -53,7 +53,6 @@ def test_ideal_naocl_mixer(): ].value == pytest.approx(5.373448801531194e-07, rel=1e-3) -@pytest.mark.requires_idaes_solver @pytest.mark.component def test_ideal_naocl_chlorination(): model = run_ideal_naocl_chlorination_example() @@ -65,10 +64,9 @@ def test_ideal_naocl_chlorination(): ].value == pytest.approx(4.254858076511e-07, rel=1e-3) assert model.fs.ideal_naocl_chlorination_unit.outlet.mole_frac_comp[ 0, "H_+" - ].value == pytest.approx(5.75022333462775e-11, rel=1e-3) + ].value == pytest.approx(5.64e-11, rel=1e-1) -@pytest.mark.requires_idaes_solver @pytest.mark.component def test_ideal_naocl_chlorination_full_block(): model = run_chlorination_block_example(fix_free_chlorine=True) @@ -87,10 +85,10 @@ def test_ideal_naocl_chlorination_full_block(): ) assert model.fs.ideal_naocl_chlorination_unit.outlet.mole_frac_comp[ 0, "OCl_-" - ].value == pytest.approx(4.5088044031726496e-07, rel=1e-3) + ].value == pytest.approx(4.48e-07, rel=1e-2) assert model.fs.ideal_naocl_chlorination_unit.outlet.mole_frac_comp[ 0, "H_+" - ].value == pytest.approx(5.4260427865375997e-11, rel=1e-3) + ].value == pytest.approx(5.43e-11, rel=1e-1) @pytest.mark.component diff --git a/watertap/examples/flowsheets/full_treatment_train/model_components/seawater_salt_prop_pack.py b/watertap/examples/flowsheets/full_treatment_train/model_components/seawater_salt_prop_pack.py index f36875e4da..0acac9601b 100644 --- a/watertap/examples/flowsheets/full_treatment_train/model_components/seawater_salt_prop_pack.py +++ b/watertap/examples/flowsheets/full_treatment_train/model_components/seawater_salt_prop_pack.py @@ -88,22 +88,18 @@ def build(self): self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight", ) self.dens_mass = Param( - mutable=False, initialize=1000, units=pyunits.kg / pyunits.m**3, doc="Density", ) - self.cp = Param( - mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K) - ) + self.cp = Param(initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) # ---default scaling--- self.set_default_scaling("temperature", 1e-2) diff --git a/watertap/property_models/NDMA_prop_pack.py b/watertap/property_models/NDMA_prop_pack.py index 0cf5950398..45f9667d3c 100644 --- a/watertap/property_models/NDMA_prop_pack.py +++ b/watertap/property_models/NDMA_prop_pack.py @@ -86,15 +86,12 @@ def build(self): self.Liq = LiquidPhase() # heat capacity - self.cp = Param( - mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K) - ) + self.cp = Param(initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) # molecular weight mw_comp_data = {"H2O": 18.01528e-3, "NDMA": 74.0819e-3} self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight kg/mol", diff --git a/watertap/property_models/NaCl_T_dep_prop_pack.py b/watertap/property_models/NaCl_T_dep_prop_pack.py index 249204ed4e..6ce18287c7 100644 --- a/watertap/property_models/NaCl_T_dep_prop_pack.py +++ b/watertap/property_models/NaCl_T_dep_prop_pack.py @@ -91,7 +91,6 @@ def build(self): mw_comp_data = {"H2O": 18.01528e-3, "NaCl": 58.44e-3} self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight kg/mol", diff --git a/watertap/property_models/NaCl_prop_pack.py b/watertap/property_models/NaCl_prop_pack.py index 3fc14c24d6..d8a0c12795 100644 --- a/watertap/property_models/NaCl_prop_pack.py +++ b/watertap/property_models/NaCl_prop_pack.py @@ -94,7 +94,6 @@ def build(self): mw_comp_data = {"H2O": 18.01528e-3, "NaCl": 58.44e-3} self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight kg/mol", diff --git a/watertap/property_models/activated_sludge/asm1_properties.py b/watertap/property_models/activated_sludge/asm1_properties.py index 94b0421b43..31d50b608c 100644 --- a/watertap/property_models/activated_sludge/asm1_properties.py +++ b/watertap/property_models/activated_sludge/asm1_properties.py @@ -99,14 +99,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=4182, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, initialize=997, doc="Density of water", units=pyo.units.kg / pyo.units.m**3, diff --git a/watertap/property_models/activated_sludge/asm2d_properties.py b/watertap/property_models/activated_sludge/asm2d_properties.py index 6fd5b1af49..12ebf82420 100644 --- a/watertap/property_models/activated_sludge/asm2d_properties.py +++ b/watertap/property_models/activated_sludge/asm2d_properties.py @@ -136,14 +136,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=4182, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, initialize=997, doc="Density of water", units=pyo.units.kg / pyo.units.m**3, diff --git a/watertap/property_models/activated_sludge/modified_asm2d_properties.py b/watertap/property_models/activated_sludge/modified_asm2d_properties.py index e4035145e0..68eebf8edc 100644 --- a/watertap/property_models/activated_sludge/modified_asm2d_properties.py +++ b/watertap/property_models/activated_sludge/modified_asm2d_properties.py @@ -144,14 +144,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=4182, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, initialize=997, doc="Density of water", units=pyo.units.kg / pyo.units.m**3, diff --git a/watertap/property_models/anaerobic_digestion/adm1_properties.py b/watertap/property_models/anaerobic_digestion/adm1_properties.py index ea626c8256..a6c56a27d4 100644 --- a/watertap/property_models/anaerobic_digestion/adm1_properties.py +++ b/watertap/property_models/anaerobic_digestion/adm1_properties.py @@ -97,14 +97,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=4182, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, initialize=997, doc="Density of water", units=pyo.units.kg / pyo.units.m**3, diff --git a/watertap/property_models/anaerobic_digestion/adm1_properties_vapor.py b/watertap/property_models/anaerobic_digestion/adm1_properties_vapor.py index ab77302b0c..149f187777 100644 --- a/watertap/property_models/anaerobic_digestion/adm1_properties_vapor.py +++ b/watertap/property_models/anaerobic_digestion/adm1_properties_vapor.py @@ -70,14 +70,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=1.996, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, # initialize=0.927613356, initialize=0.01, doc="Density of water", diff --git a/watertap/property_models/anaerobic_digestion/modified_adm1_properties.py b/watertap/property_models/anaerobic_digestion/modified_adm1_properties.py index 69d34f302f..298cf7ea4c 100644 --- a/watertap/property_models/anaerobic_digestion/modified_adm1_properties.py +++ b/watertap/property_models/anaerobic_digestion/modified_adm1_properties.py @@ -101,14 +101,12 @@ def build(self): # Heat capacity of water self.cp_mass = pyo.Param( - mutable=False, initialize=4182, doc="Specific heat capacity of water", units=pyo.units.J / pyo.units.kg / pyo.units.K, ) # Density of water self.dens_mass = pyo.Param( - mutable=False, initialize=997, doc="Density of water", units=pyo.units.kg / pyo.units.m**3, diff --git a/watertap/property_models/coagulation_prop_pack.py b/watertap/property_models/coagulation_prop_pack.py index 423f30e1d4..4617c7401c 100644 --- a/watertap/property_models/coagulation_prop_pack.py +++ b/watertap/property_models/coagulation_prop_pack.py @@ -88,9 +88,7 @@ def build(self): self.Sludge = Component() # heat capacity of liquid - self.cp = Param( - mutable=False, initialize=4184, units=pyunits.J / (pyunits.kg * pyunits.K) - ) + self.cp = Param(initialize=4184, units=pyunits.J / (pyunits.kg * pyunits.K)) # reference density of liquid self.ref_dens_liq = Param( diff --git a/watertap/property_models/cryst_prop_pack.py b/watertap/property_models/cryst_prop_pack.py index a8a22744a5..b94dee0261 100644 --- a/watertap/property_models/cryst_prop_pack.py +++ b/watertap/property_models/cryst_prop_pack.py @@ -165,7 +165,6 @@ def build(self): mw_comp_data = {"H2O": 18.01528e-3, "NaCl": 58.44e-3} self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight kg/mol", @@ -1959,11 +1958,6 @@ def calculate_scaling_factors(self): ) / iscale.get_scaling_factor(self.dens_mass_solute[p]) iscale.set_scaling_factor(self.flow_vol_phase[p], sf) - # Scaling for flow volume - if self.is_property_constructed("flow_vol"): - sf = iscale.get_scaling_factor(self.flow_vol_phase) - iscale.set_scaling_factor(self.flow_vol, sf) - # Scaling material heat capacities if self.is_property_constructed("cp_mass_solute"): for p in ["Sol", "Liq"]: diff --git a/watertap/property_models/seawater_ion_prop_pack.py b/watertap/property_models/seawater_ion_prop_pack.py index ae40cea11a..aa8f318c42 100644 --- a/watertap/property_models/seawater_ion_prop_pack.py +++ b/watertap/property_models/seawater_ion_prop_pack.py @@ -90,22 +90,18 @@ def build(self): self.mw_comp = Param( self.component_list, - mutable=False, initialize=extract_data(mw_comp_data), units=pyunits.kg / pyunits.mol, doc="Molecular weight", ) self.dens_mass = Param( - mutable=False, initialize=1000, units=pyunits.kg / pyunits.m**3, doc="Density", ) - self.cp = Param( - mutable=False, initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K) - ) + self.cp = Param(initialize=4.2e3, units=pyunits.J / (pyunits.kg * pyunits.K)) # ---default scaling--- self.set_default_scaling("temperature", 1e-2) diff --git a/watertap/property_models/seawater_prop_pack.py b/watertap/property_models/seawater_prop_pack.py index 493d99215e..afa38d52f6 100644 --- a/watertap/property_models/seawater_prop_pack.py +++ b/watertap/property_models/seawater_prop_pack.py @@ -112,7 +112,6 @@ def build(self): self.mw_comp = Param( self.component_list, - mutable=False, initialize=mw_comp_data, units=pyunits.kg / pyunits.mol, doc="Molecular weight", diff --git a/watertap/property_models/water_prop_pack.py b/watertap/property_models/water_prop_pack.py index ad622ad25f..e10a5b1b01 100644 --- a/watertap/property_models/water_prop_pack.py +++ b/watertap/property_models/water_prop_pack.py @@ -101,7 +101,6 @@ def build(self): # molecular weight self.mw_comp = Param( self.component_list, - mutable=False, initialize=18.01528e-3, units=pyunits.kg / pyunits.mol, doc="Molecular weight", diff --git a/watertap/unit_models/electrodialysis_0D.py b/watertap/unit_models/electrodialysis_0D.py index 93c52f8118..c6e0cad517 100644 --- a/watertap/unit_models/electrodialysis_0D.py +++ b/watertap/unit_models/electrodialysis_0D.py @@ -276,7 +276,6 @@ def build(self): # Create unit model parameters and vars self.water_density = Param( initialize=1000, - mutable=False, units=pyunits.kg * pyunits.m**-3, doc="density of water", ) diff --git a/watertap/unit_models/nanofiltration_0D.py b/watertap/unit_models/nanofiltration_0D.py index 1e579de176..70d8b5ea72 100644 --- a/watertap/unit_models/nanofiltration_0D.py +++ b/watertap/unit_models/nanofiltration_0D.py @@ -230,7 +230,7 @@ def build(self): self.flowsheet().config.time, self.solute_list, initialize=1e-8, - bounds=(1e-11, 1e-5), + bounds=(1e-11, 1e-4), domain=NonNegativeReals, units=units_meta("length") * units_meta("time") ** -1, doc="Solute permeability coeff.", diff --git a/watertap/unit_models/tests/test_osmotically_assisted_reverse_osmosis_1D.py b/watertap/unit_models/tests/test_osmotically_assisted_reverse_osmosis_1D.py index 3e3e41e122..9fdb62f83c 100644 --- a/watertap/unit_models/tests/test_osmotically_assisted_reverse_osmosis_1D.py +++ b/watertap/unit_models/tests/test_osmotically_assisted_reverse_osmosis_1D.py @@ -329,7 +329,6 @@ def test_calculate_scaling(self, RO_frame): for i in badly_scaled_var_generator(m): print(i[0].name, i[1]) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_initialize(self, RO_frame): initialization_tester(RO_frame) @@ -341,7 +340,6 @@ def test_var_scaling(self, RO_frame): [print(i[0], i[1]) for i in badly_scaled_var_lst] assert badly_scaled_var_lst == [] - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_solve(self, RO_frame): m = RO_frame @@ -350,7 +348,6 @@ def test_solve(self, RO_frame): # Check for optimal solution assert_optimal_termination(results) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_conservation(self, RO_frame): m = RO_frame @@ -402,7 +399,6 @@ def test_conservation(self, RO_frame): <= 1e-5 ) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_solution(self, RO_frame): m = RO_frame @@ -474,7 +470,6 @@ def test_solution(self, RO_frame): m.fs.unit.permeate_side.deltaP_stage[0] ) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_CP_calculation_with_kf_fixed(self): """Testing 1D-OARO with ConcentrationPolarizationType.calculated option enabled. @@ -575,7 +570,7 @@ def test_CP_calculation_with_kf_fixed(self): assert badly_scaled_var_lst == [] # test solve - results = solver.solve(m) + results = solver.solve(m, tee=True) # Check for optimal solution assert_optimal_termination(results) @@ -622,7 +617,7 @@ def test_CP_calculation_with_kf_fixed(self): assert pytest.approx(43.7056, rel=1e-3) == value( m.fs.unit.permeate_side.properties[0, 0].conc_mass_phase_comp["Liq", "NaCl"] ) - assert pytest.approx(45.156, rel=1e-3) == value( + assert pytest.approx(45.111, rel=1e-3) == value( m.fs.unit.permeate_side.properties_interface[ 0, x_interface_in ].conc_mass_phase_comp["Liq", "NaCl"] @@ -645,7 +640,6 @@ def test_CP_calculation_with_kf_fixed(self): m.fs.unit.permeate_side.cp_modulus[0, 1, "NaCl"] ) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_CP_calculation_with_kf_calculation(self): """Testing 1D-OARO with ConcentrationPolarizationType.calculated option and MassTransferCoefficient.calculated @@ -788,7 +782,6 @@ def test_CP_calculation_with_kf_calculation(self): ].conc_mass_phase_comp["Liq", "NaCl"] ) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_Pdrop_fixed_per_unit_length(self): """Testing 1D-OARO with PressureChangeType.fixed_per_unit_length option.""" @@ -951,7 +944,6 @@ def test_Pdrop_fixed_per_unit_length(self): ].conc_mass_phase_comp["Liq", "NaCl"] ) - @pytest.mark.requires_idaes_solver @pytest.mark.component def test_Pdrop_calculation(self): """Testing 1D-OARO with PressureChangeType.calculated option.""" @@ -1119,7 +1111,6 @@ def test_Pdrop_calculation(self): water_recovery_list = [0.15, 0.2, 0.3, 0.4, 0.5, 0.55] - @pytest.mark.requires_idaes_solver @pytest.mark.parametrize("water_recovery", water_recovery_list) @pytest.mark.component def test_water_recovery_sweep(self, water_recovery):