diff --git a/README.md b/README.md index a08fe17..143e549 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ To-date, this has only been tested with [cyipopt](https://cyipopt.readthedocs.io ### Closing dual infeasibility In some cases Ipopt might struggle to close unscaled dual infeasibility even when primal is reduced to <1e-8. This will be typically seen in the solver trace, that shows **inf_pr** being reduced to <1e-8 and **inf_du** stops being reduced and solver does not terminate or terminates with **Solved to Acceptable level**. [This is a result of using approximated hessian in the GrayBox model causing issues in calculations of dual infeasibility error.](https://list.coin-or.org/pipermail/ipopt/2007-February/000700.html) -### Solutions +#### Solutions A. Set Ipopt solver option "recalc_y" to "yes" This option will force Ipopt to use least squares method to calculate dual infeasibility, potentially improving accuracy of its estimates and reduce it to below tolerance level. Details on the [recalc_y](https://coin-or.github.io/Ipopt/OPTIONS.html#OPT_recalc_y) and [recalc_y_feas_tol](https://coin-or.github.io/Ipopt/OPTIONS.html#OPT_recalc_y_feas_tol). @@ -101,6 +101,27 @@ Supported PyomoProperties with exact derivatives: These properties are accessed as any other property in ReaktoroBlock. Simply pass ('scalingTendencyDirect',phase) to outputs. +### Failing due to iterates diverging +In some cases you might experience a failed solve with error + + EXIT: Iterates diverging; problem might be unbounded. + +This, in general, is a result of bad scaling. If your model solves with out a ReaktoroBlock, then the likely culprit is autoscaling for Jacobian (and possibly variables as well). In this case its recommend to provide manual scaling for the jacobian via user scaling option when building Reaktoro, for example as follows (check thermal_precipitation.py example): + + jacobian_options={ + "user_scaling": { + ("molarEnthalpy", None): 1, + ("specificHeatCapacityConstP", None): 1, + }, + } + +You can check the jacobian scaling by calling: + + your_reaktoro_block.display_jacobian_scaling() + +An alternative is to increase the divergence tolerance: + + solver.options["diverging_iterates_tol"] = 1e30 ## 7. Requesting new features or issues Please include a minimal example using Reaktoro for your specific feature or issue request if possible. Please also include full traceback for errors the occur. diff --git a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb index b886e13..e2d0591 100644 --- a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb +++ b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb @@ -13,7 +13,7 @@ "* IDAES - Python package extending Pyomo for flowsheet modeling\n", "* cyipopt - Solver necessary for use with gray box models\n", "* Reaktoro-pse - Python package for building Reaktoro gray box models\n", - "* WaterTAP - Unit models" + "* WaterTAP - for cyipopt-solver wrapper " ] }, { @@ -25,7 +25,7 @@ "* Setting up basic speciation block and calculating properties for a sea water composition\n", " * Demonstrate key configuration options\n", " * Key display options\n", - " * How to adjust apparent species to achieve thermodynamic zero charge\n", + " * How to adjust apparent species to achieve zero charge\n", " * Adding chemical to adjust pH\n" ] }, @@ -108,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 72, "metadata": {}, "outputs": [], "source": [ @@ -153,11 +153,11 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 73, "metadata": {}, "outputs": [], "source": [ - "\"\"\"This a typical composition of sea water with ion concentration in mg/L and pH\"\"\"\n", + "\"\"\"This is a typical composition of sea water with ion concentration in mg/L and pH\"\"\"\n", "\n", "sea_water_composition = {\n", " \"Na\": 10556,\n", @@ -175,12 +175,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Define standard Pyomo model and WaterTAP property package" + "### Define standard Pyomo model" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 74, "metadata": {}, "outputs": [], "source": [ @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 75, "metadata": {}, "outputs": [], "source": [ @@ -228,12 +228,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 76, "metadata": {}, "outputs": [], "source": [ "\"\"\"Ions\"\"\"\n", - "\n", "ions = list(sea_water_composition.keys())\n", "\n", "\"\"\"Ions concentration variable\"\"\"\n", @@ -255,12 +254,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 77, "metadata": {}, "outputs": [], "source": [ "\"\"\"Charge neutrality\"\"\"\n", - "\n", "m.fs.sea_water.charge = Var(initialize=0)\n", "set_scaling_factor(m.fs.sea_water.charge, 1e8)\n", "\n", @@ -282,7 +280,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 78, "metadata": {}, "outputs": [], "source": [ @@ -309,19 +307,19 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 79, "metadata": {}, "outputs": [], "source": [ "\"\"\"We need to define an output dictionary with our properties - this can also be an Pyomo IndexedVar please check examples in examples folder for how to use IndexedVars as outputs\"\"\"\n", "\n", "m.fs.sea_water.outputs = {\n", + " (\"density\", None): m.fs.sea_water.density,\n", + " (\"charge\", None): m.fs.sea_water.charge,\n", " (\n", " \"osmoticPressure\",\n", " \"H2O\",\n", " ): m.fs.sea_water.osmotic_pressure, # not how the second key is the water, we can get osmotic pressure for different components in the system\n", - " (\"density\", None): m.fs.sea_water.density,\n", - " (\"charge\", None): m.fs.sea_water.charge,\n", " \"speciesAmount\": True,\n", "} # - this will force reaktor to return exact speciation with all species" ] @@ -331,66 +329,22 @@ "metadata": {}, "source": [ "### Configure ReaktoroBlock\n", - "We choose PhreeqC Pitzer database is its a good choice for high salinity feeds like sea water. \n", + "We choose PhreeqC Pitzer database is a\\ good choice for high salinity feeds like sea water. \n", "For comparison of PhreeqC data base following paper is a good reference: https://doi.org/10.1016/j.earscirev.2021.103888 " ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 80, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 19:37:54 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 19:37:54 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2024-09-12 19:37:55 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 19:37:55 [ERROR] idaes.core.base.process_block: Failure in build: fs.sea_water.eq_reaktoro_properties\n", - "Traceback (most recent call last):\n", - " File \"d:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\idaes\\core\\base\\process_block.py\", line 41, in _rule_default\n", - " b.build()\n", - " File \"D:\\github\\reaktoro-pse\\src\\reaktoro_pse\\reaktoro_block.py\", line 262, in build\n", - " self.build_gray_box(self)\n", - " File \"D:\\github\\reaktoro-pse\\src\\reaktoro_pse\\reaktoro_block.py\", line 650, in build_gray_box\n", - " block.rkt_block_builder.build_reaktoro_block()\n", - " File \"D:\\github\\reaktoro-pse\\src\\reaktoro_pse\\core\\reaktoro_block_builder.py\", line 64, in build_reaktoro_block\n", - " self.build_output_constraints()\n", - " File \"D:\\github\\reaktoro-pse\\src\\reaktoro_pse\\core\\reaktoro_block_builder.py\", line 180, in build_output_constraints\n", - " self.block.outputs = Var(new_output_vars.keys(), initialize=1)\n", - " ^^^\n", - "NameError: name 'Var' is not defined\n", - "ERROR: Constructing component 'fs.sea_water.eq_reaktoro_properties' from\n", - "data=None failed:\n", - " NameError: name 'Var' is not defined\n" - ] - }, - { - "ename": "NameError", - "evalue": "name 'Var' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[9], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m m\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39meq_reaktoro_properties \u001b[38;5;241m=\u001b[39m ReaktoroBlock(\n\u001b[0;32m 2\u001b[0m system_state\u001b[38;5;241m=\u001b[39m{\n\u001b[0;32m 3\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtemperature\u001b[39m\u001b[38;5;124m\"\u001b[39m: m\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39mtemperature,\n\u001b[0;32m 4\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpressure\u001b[39m\u001b[38;5;124m\"\u001b[39m: m\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39mpressure,\n\u001b[0;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpH\u001b[39m\u001b[38;5;124m\"\u001b[39m: m\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39mpH,\n\u001b[0;32m 6\u001b[0m },\n\u001b[0;32m 7\u001b[0m aqueous_phase\u001b[38;5;241m=\u001b[39m{\n\u001b[0;32m 8\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcomposition\u001b[39m\u001b[38;5;124m\"\u001b[39m: m\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39mspecies_mass_flow, \u001b[38;5;66;03m# This is the spices mass flow\u001b[39;00m\n\u001b[0;32m 9\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mconvert_to_rkt_species\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;66;03m# We can use default converter as its defined for default database (Phreeqc and pitzer)\u001b[39;00m\n\u001b[0;32m 10\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mactivity_model\u001b[39m\u001b[38;5;124m\"\u001b[39m: reaktoro\u001b[38;5;241m.\u001b[39mActivityModelPitzer(), \u001b[38;5;66;03m# Can provide a string, or Reaktoro initialized class\u001b[39;00m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfixed_solvent_specie\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mH2O\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;66;03m# We need to define our aqueous solvent as we have to speciate the block\u001b[39;00m\n\u001b[0;32m 12\u001b[0m },\n\u001b[0;32m 13\u001b[0m outputs\u001b[38;5;241m=\u001b[39mm\u001b[38;5;241m.\u001b[39mfs\u001b[38;5;241m.\u001b[39msea_water\u001b[38;5;241m.\u001b[39moutputs, \u001b[38;5;66;03m# outputs we desired\u001b[39;00m\n\u001b[0;32m 14\u001b[0m database_file\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpitzer.dat\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;66;03m# needs to be a string that names the database file or points to its location\u001b[39;00m\n\u001b[0;32m 15\u001b[0m dissolve_species_in_reaktoro\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;66;03m# This will sum up all species into elements in Reaktoro directly, if set to false, it will build Pyomo constraints instead\u001b[39;00m\n\u001b[0;32m 16\u001b[0m assert_charge_neutrality\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, \u001b[38;5;66;03m# This is True by Default, but here we actually want to adjust the input speciation till the charge is zero\u001b[39;00m\n\u001b[0;32m 17\u001b[0m )\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\pyomo\\core\\base\\block.py:571\u001b[0m, in \u001b[0;36mBlockData.__setattr__\u001b[1;34m(self, name, val)\u001b[0m\n\u001b[0;32m 566\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__dict__\u001b[39m:\n\u001b[0;32m 567\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(val, Component):\n\u001b[0;32m 568\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[0;32m 569\u001b[0m \u001b[38;5;66;03m# Pyomo components are added with the add_component method.\u001b[39;00m\n\u001b[0;32m 570\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m--> 571\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madd_component(name, val)\n\u001b[0;32m 572\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 573\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[0;32m 574\u001b[0m \u001b[38;5;66;03m# Other Python objects are added with the standard __setattr__\u001b[39;00m\n\u001b[0;32m 575\u001b[0m \u001b[38;5;66;03m# method.\u001b[39;00m\n\u001b[0;32m 576\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[0;32m 577\u001b[0m \u001b[38;5;28msuper\u001b[39m(BlockData, \u001b[38;5;28mself\u001b[39m)\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__setattr__\u001b[39m(name, val)\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\pyomo\\core\\base\\block.py:1105\u001b[0m, in \u001b[0;36mBlockData.add_component\u001b[1;34m(self, name, val)\u001b[0m\n\u001b[0;32m 1097\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\n\u001b[0;32m 1098\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConstructing \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m from data=\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 1099\u001b[0m val\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1102\u001b[0m \u001b[38;5;28mstr\u001b[39m(data),\n\u001b[0;32m 1103\u001b[0m )\n\u001b[0;32m 1104\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 1105\u001b[0m val\u001b[38;5;241m.\u001b[39mconstruct(data)\n\u001b[0;32m 1106\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m:\n\u001b[0;32m 1107\u001b[0m err \u001b[38;5;241m=\u001b[39m sys\u001b[38;5;241m.\u001b[39mexc_info()[\u001b[38;5;241m1\u001b[39m]\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\pyomo\\core\\base\\block.py:2161\u001b[0m, in \u001b[0;36mBlock.construct\u001b[1;34m(self, data)\u001b[0m\n\u001b[0;32m 2159\u001b[0m obj\u001b[38;5;241m.\u001b[39mconstruct(data\u001b[38;5;241m.\u001b[39mget(name, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[0;32m 2160\u001b[0m \u001b[38;5;66;03m# Trigger the (normal) initialization of the block\u001b[39;00m\n\u001b[1;32m-> 2161\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_getitem_when_not_present(_idx)\n\u001b[0;32m 2162\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m 2163\u001b[0m \u001b[38;5;66;03m# We must allow that id(self) may no longer be in\u001b[39;00m\n\u001b[0;32m 2164\u001b[0m \u001b[38;5;66;03m# _BlockConstruction.data, as _getitem_when_not_present will\u001b[39;00m\n\u001b[0;32m 2165\u001b[0m \u001b[38;5;66;03m# have already removed the entry for scalar blocks (as the\u001b[39;00m\n\u001b[0;32m 2166\u001b[0m \u001b[38;5;66;03m# BlockData and the Block component are the same object)\u001b[39;00m\n\u001b[0;32m 2167\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m data \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\pyomo\\core\\base\\block.py:2076\u001b[0m, in \u001b[0;36mBlock._getitem_when_not_present\u001b[1;34m(self, idx)\u001b[0m\n\u001b[0;32m 2073\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 2075\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 2076\u001b[0m obj \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_rule(_block, idx)\n\u001b[0;32m 2077\u001b[0m \u001b[38;5;66;03m# If the user returns a block, transfer over everything\u001b[39;00m\n\u001b[0;32m 2078\u001b[0m \u001b[38;5;66;03m# they defined into the empty one we created. We do\u001b[39;00m\n\u001b[0;32m 2079\u001b[0m \u001b[38;5;66;03m# this inside the try block so that any abstract\u001b[39;00m\n\u001b[0;32m 2080\u001b[0m \u001b[38;5;66;03m# components declared by the rule have the opportunity\u001b[39;00m\n\u001b[0;32m 2081\u001b[0m \u001b[38;5;66;03m# to be initialized with data from\u001b[39;00m\n\u001b[0;32m 2082\u001b[0m \u001b[38;5;66;03m# _BlockConstruction.data as they are transferred over.\u001b[39;00m\n\u001b[0;32m 2083\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m _block \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(obj, BlockData):\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\pyomo\\core\\base\\initializer.py:349\u001b[0m, in \u001b[0;36mIndexedCallInitializer.__call__\u001b[1;34m(self, parent, idx)\u001b[0m\n\u001b[0;32m 347\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_fcn(parent, \u001b[38;5;241m*\u001b[39midx)\n\u001b[0;32m 348\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m--> 349\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_fcn(parent, idx)\n", - "File \u001b[1;32md:\\Software\\miniconda\\envs\\reaktoro-pse-dev\\Lib\\site-packages\\idaes\\core\\base\\process_block.py:41\u001b[0m, in \u001b[0;36m_rule_default\u001b[1;34m(b, *args)\u001b[0m\n\u001b[0;32m 35\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 36\u001b[0m \u001b[38;5;124;03mDefault rule for ProcessBlock, which calls build(). A different rule can\u001b[39;00m\n\u001b[0;32m 37\u001b[0m \u001b[38;5;124;03mbe specified to add additional build steps, or to not call build at all\u001b[39;00m\n\u001b[0;32m 38\u001b[0m \u001b[38;5;124;03musing the normal rule argument to ProcessBlock init.\u001b[39;00m\n\u001b[0;32m 39\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 40\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m---> 41\u001b[0m b\u001b[38;5;241m.\u001b[39mbuild()\n\u001b[0;32m 42\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[0;32m 43\u001b[0m logging\u001b[38;5;241m.\u001b[39mgetLogger(\u001b[38;5;18m__name__\u001b[39m)\u001b[38;5;241m.\u001b[39mexception(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFailure in build: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mb\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n", - "File \u001b[1;32mD:\\github\\reaktoro-pse\\src\\reaktoro_pse\\reaktoro_block.py:262\u001b[0m, in \u001b[0;36mReaktoroBlockData.build\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 260\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_rkt_jacobian(\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m 261\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_rkt_solver(\u001b[38;5;28mself\u001b[39m)\n\u001b[1;32m--> 262\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_gray_box(\u001b[38;5;28mself\u001b[39m)\n", - "File \u001b[1;32mD:\\github\\reaktoro-pse\\src\\reaktoro_pse\\reaktoro_block.py:650\u001b[0m, in \u001b[0;36mReaktoroBlockData.build_gray_box\u001b[1;34m(self, block)\u001b[0m\n\u001b[0;32m 644\u001b[0m block\u001b[38;5;241m.\u001b[39mrkt_block_builder \u001b[38;5;241m=\u001b[39m ReaktoroBlockBuilder(\n\u001b[0;32m 645\u001b[0m block, block\u001b[38;5;241m.\u001b[39mrkt_solver, build_on_init\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[0;32m 646\u001b[0m )\n\u001b[0;32m 647\u001b[0m block\u001b[38;5;241m.\u001b[39mrkt_block_builder\u001b[38;5;241m.\u001b[39mconfigure_jacobian_scaling(\n\u001b[0;32m 648\u001b[0m jacobian_scaling_type\u001b[38;5;241m=\u001b[39mscaling_type, user_scaling\u001b[38;5;241m=\u001b[39mscaling\n\u001b[0;32m 649\u001b[0m )\n\u001b[1;32m--> 650\u001b[0m block\u001b[38;5;241m.\u001b[39mrkt_block_builder\u001b[38;5;241m.\u001b[39mbuild_reaktoro_block()\n", - "File \u001b[1;32mD:\\github\\reaktoro-pse\\src\\reaktoro_pse\\core\\reaktoro_block_builder.py:64\u001b[0m, in \u001b[0;36mReaktoroBlockBuilder.build_reaktoro_block\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 62\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mblock\u001b[38;5;241m.\u001b[39mreaktoro_model \u001b[38;5;241m=\u001b[39m ExternalGreyBoxBlock(external_model\u001b[38;5;241m=\u001b[39mexternal_model)\n\u001b[0;32m 63\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_input_constraints()\n\u001b[1;32m---> 64\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_output_constraints()\n", - "File \u001b[1;32mD:\\github\\reaktoro-pse\\src\\reaktoro_pse\\core\\reaktoro_block_builder.py:180\u001b[0m, in \u001b[0;36mReaktoroBlockBuilder.build_output_constraints\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 178\u001b[0m new_output_vars[key] \u001b[38;5;241m=\u001b[39m obj\n\u001b[0;32m 179\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m new_output_vars \u001b[38;5;241m!=\u001b[39m {}:\n\u001b[1;32m--> 180\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mblock\u001b[38;5;241m.\u001b[39moutputs \u001b[38;5;241m=\u001b[39m Var(new_output_vars\u001b[38;5;241m.\u001b[39mkeys(), initialize\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)\n\u001b[0;32m 181\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, obj \u001b[38;5;129;01min\u001b[39;00m new_output_vars\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m 182\u001b[0m obj\u001b[38;5;241m.\u001b[39mset_pyomo_var(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mblock\u001b[38;5;241m.\u001b[39moutputs[key])\n", - "\u001b[1;31mNameError\u001b[0m: name 'Var' is not defined" + "2024-09-19 14:10:10 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-19 14:10:10 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-19 14:10:10 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" ] } ], @@ -408,6 +362,7 @@ " \"fixed_solvent_specie\": \"H2O\", # We need to define our aqueous solvent as we have to speciate the block\n", " },\n", " outputs=m.fs.sea_water.outputs, # outputs we desired\n", + " database='PhreeqcDatabase', #can also be reaktoro.PhreeqcDatabase('pitzer.dat')\n", " database_file=\"pitzer.dat\", # needs to be a string that names the database file or points to its location\n", " dissolve_species_in_reaktoro=True, # This will sum up all species into elements in Reaktoro directly, if set to false, it will build Pyomo constraints instead\n", " assert_charge_neutrality=False, # This is True by Default, but here we actually want to adjust the input speciation till the charge is zero\n", @@ -418,7 +373,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Inspecting Reaktoro block outputs and inputs" + "### Inspecting Reaktoro block " ] }, { @@ -430,7 +385,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 81, "metadata": {}, "outputs": [ { @@ -467,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 82, "metadata": {}, "outputs": [ { @@ -485,8 +440,6 @@ } ], "source": [ - "\"\"\" for speciation block\"\"\"\n", - "\n", "conversion_dict = m.fs.sea_water.eq_reaktoro_properties.rkt_inputs.constraint_dict\n", "for element, species in conversion_dict.items():\n", " print(element, species)" @@ -496,12 +449,23 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Lets inspect outputs from reaktoro graybox model" + "### Lets inspect outputs from reaktoro graybox model" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Note how we are missing osmoticPressure, and instead have speciesActivityLn and speciesStandardVolume as our outputs, this is becouse osmoticPressure is a pyomo property, rather a native property supplied by reaktoro. You can inspect how this property is created by checking the:\n", + "* osmoticPressure in PyomoProperties class located in [reaktoro_pse.core.reaktoro_outputs](https://github.com/watertap-org/reaktoro-pse/blob/33b4cf14df8cb94f21fa826feae2fb6b51ea580a/src/reaktoro_pse/core/reaktoro_outputs.py#L118)\n", + "* build_osmotic_constraint in [reaktoro_pse.core.pyomo_property_writer.property_functions](https://github.com/watertap-org/reaktoro-pse/blob/main/src/reaktoro_pse/core/pyomo_property_writer/property_functions.py)\n", + "\n", + "This two location will also show how we can access reaktoro database to pull out fixed parameters and create a custom pyomo property. " ] }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 83, "metadata": {}, "outputs": [ { @@ -541,18 +505,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Lets inspect outputs from main reaktoro model\n", - "\n", - "Note how we are missing osmoticPressure, and instead have speciesActivityLn and speciesStandardVolume as our outputs, this is becouse we osmoticPressure is a pyomo property, rather a native property supplied by reaktoro. You can inspect how this property is created by checking the:\n", - "* osmoticPressure in PyomoProperties class located in [reaktoro_pse.core.reaktoro_outputs](https://github.com/watertap-org/reaktoro-pse/blob/33b4cf14df8cb94f21fa826feae2fb6b51ea580a/src/reaktoro_pse/core/reaktoro_outputs.py#L118)\n", - "* build_osmotic_constraint in [reaktoro_pse.core.pyomo_property_writer.property_functions](https://github.com/watertap-org/reaktoro-pse/blob/main/src/reaktoro_pse/core/pyomo_property_writer/property_functions.py)\n", - "\n", - "This two location will also show how we can access reaktoro database to pull out fixed parameters and create a custom pyomo property. " + "### Lets initialize our model" ] }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 84, "metadata": {}, "outputs": [], "source": [ @@ -599,16 +557,16 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 85, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:35 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block for fs.sea_water.eq_reaktoro_properties----\n", - "2024-09-11 13:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-11 13:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-19 14:10:11 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.sea_water.eq_reaktoro_properties----\n", + "2024-09-19 14:10:11 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-19 14:10:11 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", "Density: 1023.4759353858051\n", "Osmotic pressure: 2268715.8260405306\n", "Solution charge: 0.05577128070860777\n" @@ -638,15 +596,15 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 86, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:35 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", - "2024-09-11 13:28:35 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", + "2024-09-19 14:10:11 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", + "2024-09-19 14:10:11 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", "| Property | Value | Unit |\n", "+-----------------+------------+------+\n", "| Temperature | 293.0000 | K |\n", @@ -698,7 +656,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 87, "metadata": {}, "outputs": [], "source": [ @@ -717,7 +675,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 88, "metadata": {}, "outputs": [ { @@ -743,7 +701,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 89, "metadata": {}, "outputs": [ { @@ -751,7 +709,7 @@ "output_type": "stream", "text": [ "cyipopt-watertap: cyipopt with user variable scaling and IDAES jacobian constraint scaling\n", - "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.2.\n", + "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.\n", "\n", "Number of nonzeros in equality constraint Jacobian...: 310\n", "Number of nonzeros in inequality constraint Jacobian.: 0\n", @@ -790,7 +748,7 @@ "Number of equality constraint Jacobian evaluations = 3\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 2\n", - "Total seconds in IPOPT = 0.141\n", + "Total seconds in IPOPT = 0.166\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -808,7 +766,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 90, "metadata": {}, "outputs": [ { @@ -849,14 +807,14 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 91, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "outputs : Size=15, Index={('speciesAmount', 'K+'), ('speciesAmount', 'Mg+2'), ('speciesAmount', 'CO3-2'), ('speciesAmount', 'CO2'), ('speciesAmount', 'Cl-'), ('speciesAmount', 'Na+'), ('speciesAmount', 'OH-'), ('speciesAmount', 'MgCO3'), ('speciesAmount', 'H2O'), ('speciesAmount', 'H+'), ('speciesAmount', 'HCO3-'), ('speciesAmount', 'MgOH+'), ('speciesAmount', 'HSO4-'), ('speciesAmount', 'Ca+2'), ('speciesAmount', 'SO4-2')}\n", + "outputs : Size=15, Index={('speciesAmount', 'HSO4-'), ('speciesAmount', 'K+'), ('speciesAmount', 'MgOH+'), ('speciesAmount', 'Na+'), ('speciesAmount', 'OH-'), ('speciesAmount', 'H+'), ('speciesAmount', 'SO4-2'), ('speciesAmount', 'MgCO3'), ('speciesAmount', 'HCO3-'), ('speciesAmount', 'CO2'), ('speciesAmount', 'Ca+2'), ('speciesAmount', 'CO3-2'), ('speciesAmount', 'Cl-'), ('speciesAmount', 'H2O'), ('speciesAmount', 'Mg+2')}\n", " Key : Lower : Value : Upper : Fixed : Stale : Domain\n", " ('speciesAmount', 'CO2') : None : 8.820292774576382e-05 : None : False : False : Reals\n", " ('speciesAmount', 'CO3-2') : None : 2.0221381093695295e-05 : None : False : False : Reals\n", @@ -890,7 +848,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 92, "metadata": {}, "outputs": [], "source": [ @@ -925,7 +883,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 93, "metadata": {}, "outputs": [ { @@ -947,6 +905,8 @@ " initialize=1,\n", ")\n", "set_scaling_factor(m.fs.modified_sea_water.scaling_tendencies, 1)\n", + "\n", + "\"\"\"set up modified outputs\"\"\"\n", "m.fs.modified_sea_water.outputs = {(\"pH\", None): m.fs.modified_sea_water.pH}\n", "for key, obj in m.fs.modified_sea_water.scaling_tendencies.items():\n", " m.fs.modified_sea_water.outputs[(\"scalingTendency\", key)] = obj\n", @@ -964,16 +924,16 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 94, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:35 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-11 13:28:35 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-11 13:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" + "2024-09-19 14:10:11 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-19 14:10:11 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-19 14:10:12 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" ] } ], @@ -981,7 +941,7 @@ "m.fs.modified_sea_water.eq_reaktoro_properties = ReaktoroBlock(\n", " exact_speciation=True,\n", " aqueous_phase={\n", - " \"composition\": m.fs.sea_water.eq_reaktoro_properties.outputs, # This is the spices mass flow\n", + " \"composition\": m.fs.sea_water.eq_reaktoro_properties.outputs, # This is true spices mass flow\n", " \"convert_to_rkt_species\": False, # already has right naming convection\n", " \"activity_model\": reaktoro.ActivityModelPitzer(), # Can provide a string, or Reaktoro initialized class\n", " },\n", @@ -1015,18 +975,18 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 95, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "H [(1.0, 'OH-'), (2.0, 'H2O'), (1.0, 'H+'), (1.0, 'HCO3-'), (1.0, 'MgOH+'), (1.0, 'HSO4-'), (1, 'HCl')]\n", - "C [(1.0, 'CO3-2'), (1.0, 'CO2'), (1.0, 'MgCO3'), (1.0, 'HCO3-')]\n", - "O [(3.0, 'CO3-2'), (2.0, 'CO2'), (1.0, 'OH-'), (3.0, 'MgCO3'), (1.0, 'H2O'), (3.0, 'HCO3-'), (1.0, 'MgOH+'), (4.0, 'HSO4-'), (4.0, 'SO4-2')]\n", + "H [(1.0, 'HSO4-'), (1.0, 'MgOH+'), (1.0, 'OH-'), (1.0, 'H+'), (1.0, 'HCO3-'), (2.0, 'H2O'), (1, 'HCl')]\n", + "C [(1.0, 'MgCO3'), (1.0, 'HCO3-'), (1.0, 'CO2'), (1.0, 'CO3-2')]\n", + "O [(4.0, 'HSO4-'), (1.0, 'MgOH+'), (1.0, 'OH-'), (4.0, 'SO4-2'), (3.0, 'MgCO3'), (3.0, 'HCO3-'), (2.0, 'CO2'), (3.0, 'CO3-2'), (1.0, 'H2O')]\n", "Na [(1.0, 'Na+')]\n", - "Mg [(1.0, 'Mg+2'), (1.0, 'MgCO3'), (1.0, 'MgOH+')]\n", + "Mg [(1.0, 'MgOH+'), (1.0, 'MgCO3'), (1.0, 'Mg+2')]\n", "S [(1.0, 'HSO4-'), (1.0, 'SO4-2')]\n", "Cl [(1.0, 'Cl-'), (1, 'HCl')]\n", "K [(1.0, 'K+')]\n", @@ -1051,16 +1011,16 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 96, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:36 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block for fs.modified_sea_water.eq_reaktoro_properties----\n", - "2024-09-11 13:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-11 13:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" + "2024-09-19 14:10:12 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.modified_sea_water.eq_reaktoro_properties----\n", + "2024-09-19 14:10:12 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-19 14:10:12 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" ] } ], @@ -1074,12 +1034,12 @@ "source": [ "Verify out properties look good\n", "\n", - "Note, how the pH thats estimated by Reaktoro is the same as our sea_water feed pH, even as we did not provide as an input! This is because we did not add any acid yet." + "Note, how the pH thats estimated by Reaktoro is the same as our sea_water feed pH, even as we did not provide it as an input! This is because we did not add any acid yet." ] }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 97, "metadata": {}, "outputs": [ { @@ -1088,8 +1048,8 @@ "text": [ "Sea water pH: 7.56\n", "Reaktoro block outputs\n", - "('pH', None) 7.560000000009307\n", - "('scalingTendency', 'Calcite') 0.9443058925435645\n", + "('pH', None) 7.560000000058571\n", + "('scalingTendency', 'Calcite') 0.94430589265305\n", "('scalingTendency', 'Gypsum') 0.2001546710736435\n" ] } @@ -1098,7 +1058,7 @@ "print(\"Sea water pH: \", m.fs.sea_water.pH.value)\n", "print(\"Reaktoro block outputs\")\n", "for key, obj in m.fs.modified_sea_water.outputs.items():\n", - " print(key, obj.value)" + " print(key, obj.value) " ] }, { @@ -1110,7 +1070,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 98, "metadata": {}, "outputs": [], "source": [ @@ -1119,7 +1079,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 99, "metadata": {}, "outputs": [ { @@ -1127,7 +1087,7 @@ "output_type": "stream", "text": [ "cyipopt-watertap: cyipopt with user variable scaling and IDAES jacobian constraint scaling\n", - "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.2.\n", + "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.\n", "\n", "Number of nonzeros in equality constraint Jacobian...: 416\n", "Number of nonzeros in inequality constraint Jacobian.: 0\n", @@ -1149,17 +1109,17 @@ " 2 0.0000000e+00 1.15e-02 2.59e-01 -1.0 6.52e+01 - 7.39e-01 1.00e+00h 1\n", " 3 0.0000000e+00 1.00e-04 8.49e-04 -1.0 6.96e+00 - 1.00e+00 1.00e+00h 1\n", " 4 0.0000000e+00 1.08e-08 2.36e-07 -2.5 6.19e-02 - 1.00e+00 1.00e+00h 1\n", - " 5 0.0000000e+00 1.34e-11 0.00e+00 -3.8 5.28e-06 - 1.00e+00 1.00e+00h 1\n", + " 5 0.0000000e+00 6.00e-12 0.00e+00 -3.8 5.27e-06 - 1.00e+00 1.00e+00h 1\n", "\n", "Number of Iterations....: 5\n", "\n", " (scaled) (unscaled)\n", "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Constraint violation....: 1.1368683772161603e-10 1.3449685809518996e-11\n", + "Constraint violation....: 1.1368683772161603e-10 5.9960925113955454e-12\n", "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Overall NLP error.......: 1.1368683772161603e-10 1.3449685809518996e-11\n", + "Overall NLP error.......: 1.1368683772161603e-10 5.9960925113955454e-12\n", "\n", "\n", "Number of objective function evaluations = 6\n", @@ -1169,7 +1129,7 @@ "Number of equality constraint Jacobian evaluations = 6\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 5\n", - "Total seconds in IPOPT = 0.738\n", + "Total seconds in IPOPT = 0.995\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -1186,14 +1146,14 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 100, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Adjusted pH: 7.0 Acid dose: 8.488219373145391 PPM, Acid mass flow: 8.569016923056081e-06 kg/s\n" + "Adjusted pH: 7.0 Acid dose: 8.488219373634116 PPM, Acid mass flow: 8.56901692354946e-06 kg/s\n" ] } ], @@ -1228,7 +1188,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 101, "metadata": {}, "outputs": [ { @@ -1268,25 +1228,19 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 102, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-11 13:28:37 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-11 13:28:37 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" + "2024-09-19 14:10:13 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-19 14:10:13 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-19 14:10:14 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-19 14:10:14 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['OH-', 'H+'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" ] } ], @@ -1331,19 +1285,19 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 103, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing speciation block for fs.combined_block.eq_reaktoro_properties----\n", - "2024-09-11 13:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-11 13:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-11 13:28:38 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block for fs.combined_block.eq_reaktoro_properties----\n", - "2024-09-11 13:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-11 13:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing speciation block fs.combined_block.eq_reaktoro_properties----\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.combined_block.eq_reaktoro_properties----\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-19 14:10:14 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" ] } ], @@ -1360,7 +1314,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 104, "metadata": {}, "outputs": [ { @@ -1368,7 +1322,7 @@ "output_type": "stream", "text": [ "cyipopt-watertap: cyipopt with user variable scaling and IDAES jacobian constraint scaling\n", - "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.2.\n", + "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.\n", "\n", "Number of nonzeros in equality constraint Jacobian...: 741\n", "Number of nonzeros in inequality constraint Jacobian.: 0\n", @@ -1389,17 +1343,17 @@ " 1 0.0000000e+00 1.36e-01 1.85e+02 -1.0 3.09e+02 - 4.28e-01 1.00e+00h 1\n", " 2 0.0000000e+00 6.78e-03 1.16e-01 -1.0 1.25e+02 - 8.17e-01 1.00e+00h 1\n", " 3 0.0000000e+00 1.87e-05 1.07e-03 -1.0 7.77e+00 - 1.00e+00 1.00e+00h 1\n", - " 4 0.0000000e+00 2.93e-10 0.00e+00 -2.5 2.16e-02 - 1.00e+00 1.00e+00h 1\n", + " 4 0.0000000e+00 3.25e-10 0.00e+00 -2.5 2.16e-02 - 1.00e+00 1.00e+00h 1\n", "\n", "Number of Iterations....: 4\n", "\n", " (scaled) (unscaled)\n", "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Constraint violation....: 1.4877200271730665e-09 2.9344793261998348e-10\n", + "Constraint violation....: 1.5445698054705091e-09 3.2493874257966127e-10\n", "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Overall NLP error.......: 1.4877200271730665e-09 2.9344793261998348e-10\n", + "Overall NLP error.......: 1.5445698054705091e-09 3.2493874257966127e-10\n", "\n", "\n", "Number of objective function evaluations = 5\n", @@ -1409,7 +1363,7 @@ "Number of equality constraint Jacobian evaluations = 5\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 4\n", - "Total seconds in IPOPT = 1.439\n", + "Total seconds in IPOPT = 1.727\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -1434,20 +1388,180 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 105, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "('pH', None) Modified block result: 6.5 Combined block result: 6.50000000000402\n", - "('scalingTendency', 'Calcite') Modified block result: 0.05914069504427688 Combined block result: 0.059140695044997055\n", - "('scalingTendency', 'Gypsum') Modified block result: 0.20015129373415003 Combined block result: 0.2001512937341513\n" + "Acid dose: 24.463034333865636 PPM, Acid mass flow: 2.4695892740401498e-05 kg/s\n", + "('pH', None) Modified block result: 6.5 Combined block result: 6.499999999992031\n", + "('scalingTendency', 'Calcite') Modified block result: 0.05914069504427689 Combined block result: 0.0591406950428457\n", + "('scalingTendency', 'Gypsum') Modified block result: 0.2001512937341488 Combined block result: 0.20015129373415202\n" ] } ], "source": [ + "print(\n", + " \"Acid dose:\",\n", + " m.fs.acid_dose.value,\n", + " \"PPM, Acid mass flow:\",\n", + " m.fs.acid_mass_flow.value,\n", + " \"kg/s\",\n", + ")\n", + "for key in m.fs.combined_block.outputs:\n", + " print(\n", + " key,\n", + " \"Modified block result:\",\n", + " m.fs.modified_sea_water.outputs[key].value,\n", + " \"Combined block result:\",\n", + " m.fs.combined_block.outputs[key].value,\n", + " )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Effect of concentrating feed on scaling tendency" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "species_concentrations : Size=7, Index={Na, K, Ca, Mg, Cl, SO4, HCO3}, Units=mg/l\n", + " Key : Lower : Value : Upper : Fixed : Stale : Domain\n", + " Ca : None : 4000 : None : True : False : Reals\n", + " Cl : None : 18977.21910552184 : None : False : False : Reals\n", + " HCO3 : None : 1400 : None : True : False : Reals\n", + " K : None : 3800 : None : True : False : Reals\n", + " Mg : None : 12620 : None : True : False : Reals\n", + " Na : None : 105560 : None : True : False : Reals\n", + " SO4 : None : 26490 : None : True : False : Reals\n", + "cyipopt-watertap: cyipopt with user variable scaling and IDAES jacobian constraint scaling\n", + "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.\n", + "\n", + "Number of nonzeros in equality constraint Jacobian...: 741\n", + "Number of nonzeros in inequality constraint Jacobian.: 0\n", + "Number of nonzeros in Lagrangian Hessian.............: 25\n", + "\n", + "Total number of variables............................: 146\n", + " variables with only lower bounds: 58\n", + " variables with lower and upper bounds: 0\n", + " variables with only upper bounds: 0\n", + "Total number of equality constraints.................: 146\n", + "Total number of inequality constraints...............: 0\n", + " inequality constraints with only lower bounds: 0\n", + " inequality constraints with lower and upper bounds: 0\n", + " inequality constraints with only upper bounds: 0\n", + "\n", + "iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls\n", + " 0 0.0000000e+00 8.79e+00 1.00e+00 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: warning, solve was not successful for fs.modified_sea_water.eq_reaktoro_properties, fail# 0\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: ----inputs were -----\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: temperature: 293.0\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: pressure: 99999.99999999999\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HSO4-: 1.7594437775443555e-08\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: MgOH+: 1.604443880478305e-06\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: OH-: 6.37104094537878e-07\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: H+: 3.032890641028458e-08\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HCO3-: 0.009902528965279584\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: H2O: 55.50621669626999\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HCl: 0.002133373074580665\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: MgCO3: 0.00012560109058233512\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: CO2: 0.00033035888141949105\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: CO3-2: 0.00013619293446544742\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: SO4-2: 0.12405007760830096\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Na+: 2.065643266087756\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Mg+2: 0.23346809667423543\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Cl-: 2.4078242088776785\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: K+: 0.04372326504021617\n", + "2024-09-19 14:10:22 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Ca+2: 0.04489778718517536\n", + "Warning: Cutting back alpha due to evaluation error\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: warning, solve was not successful for fs.combined_block.eq_reaktoro_properties, fail# 0\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: ----inputs were -----\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: temperature: 293.0\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: pressure: 99999.99999999999\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HSO4-: 1.3088946968016992e-08\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: MgOH+: 1.0093929687179643e-06\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: OH-: 5.245335030235727e-07\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: H+: 3.3844108207283815e-08\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HCO3-: 0.006027316818875802\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: H2O: 55.50621669626999\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: HCl: 0.0014053482956129441\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: MgCO3: 7.182854775879258e-05\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: CO2: 0.00020928090458152663\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: CO3-2: 7.820715777981107e-05\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: SO4-2: 0.0754917926250328\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Na+: 1.2570658641013657\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Mg+2: 0.14208369278354807\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Cl-: 1.4653205344148135\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: K+: 0.026608187798665795\n", + "2024-09-19 14:10:26 [WARNING] idaes.reaktoro_pse.core.reaktoro_solver: Ca+2: 0.02732295385691924\n", + "Warning: Cutting back alpha due to evaluation error\n", + " 1 0.0000000e+00 7.70e+00 1.15e+03 -1.0 2.91e+03 - 7.73e-02 1.25e-01f 4\n", + " 2 0.0000000e+00 1.17e+01 1.14e+05 -1.0 6.05e+03 - 1.37e-01 1.00e+00f 1\n", + " 3 0.0000000e+00 7.94e+00 1.85e+02 -1.0 5.29e+03 - 1.74e-01 1.00e+00h 1\n", + " 4 0.0000000e+00 4.57e-03 3.73e+00 -1.0 3.73e+02 - 9.61e-01 1.00e+00h 1\n", + " 5 0.0000000e+00 1.04e-05 1.83e-02 -1.0 1.30e+01 - 1.00e+00 1.00e+00h 1\n", + " 6 0.0000000e+00 5.38e-11 0.00e+00 -2.5 3.14e-02 - 1.00e+00 1.00e+00h 1\n", + "\n", + "Number of Iterations....: 6\n", + "\n", + " (scaled) (unscaled)\n", + "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", + "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", + "Constraint violation....: 5.3781645803496758e-11 5.3781645803496758e-11\n", + "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", + "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", + "Overall NLP error.......: 5.3781645803496758e-11 5.3781645803496758e-11\n", + "\n", + "\n", + "Number of objective function evaluations = 7\n", + "Number of objective gradient evaluations = 7\n", + "Number of equality constraint evaluations = 11\n", + "Number of inequality constraint evaluations = 0\n", + "Number of equality constraint Jacobian evaluations = 7\n", + "Number of inequality constraint Jacobian evaluations = 0\n", + "Number of Lagrangian Hessian evaluations = 6\n", + "Total seconds in IPOPT = 11.112\n", + "\n", + "EXIT: Optimal Solution Found.\n", + "Acid dose: 436.1156867615722 PPM, Acid mass flow: 0.0004655624493608873 kg/s\n", + "('pH', None) Modified block result: 5.810743404942449 Combined block result: 5.810743404944667\n", + "('scalingTendency', 'Calcite') Modified block result: 1 Combined block result: 1.0000000000076419\n", + "('scalingTendency', 'Gypsum') Modified block result: 3.807228841742566 Combined block result: 3.8072288417426083\n" + ] + } + ], + "source": [ + "\"\"\"Increase feed concentration\"\"\"\n", + "for ion, pyo_obj in m.fs.sea_water.species_concentrations.items():\n", + " if ion!='Cl':\n", + " pyo_obj.fix(pyo_obj.value*10)\n", + "\n", + "m.fs.modified_sea_water.pH.unfix()\n", + "m.fs.modified_sea_water.outputs['scalingTendency','Calcite'].fix(1)\n", + "m.fs.sea_water.species_concentrations.display()\n", + "\n", + "cy_solver = get_solver(solver=\"cyipopt-watertap\")\n", + "cy_solver.options[\"max_iter\"] = 25\n", + "result = cy_solver.solve(m, tee=True)\n", + "assert_optimal_termination(result)\n", + "print(\n", + " \"Acid dose:\",\n", + " m.fs.acid_dose.value,\n", + " \"PPM, Acid mass flow:\",\n", + " m.fs.acid_mass_flow.value,\n", + " \"kg/s\",\n", + ")\n", "for key in m.fs.combined_block.outputs:\n", " print(\n", " key,\n", diff --git a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb index 0e96956..c40f35c 100644 --- a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb +++ b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 172, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ @@ -126,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 173, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -158,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 174, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -208,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 175, + "execution_count": 39, "metadata": {}, "outputs": [], "source": [ @@ -259,7 +259,7 @@ }, { "cell_type": "code", - "execution_count": 176, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -291,25 +291,19 @@ }, { "cell_type": "code", - "execution_count": 177, + "execution_count": 41, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:33 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:33 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2024-09-12 12:28:33 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:33 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['H+', 'OH-'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-12 12:28:33 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['H+', 'OH-'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", - "2024-09-12 12:28:33 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:14 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['H+', 'OH-'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-12 21:03:14 [WARNING] idaes.reaktoro_pse.core.reaktoro_inputs: Registered an empty constraint for ['H+', 'OH-'], this can lead to unexpected results depending on reaktoro configuration, please use with caution\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" ] } ], @@ -362,7 +356,7 @@ }, { "cell_type": "code", - "execution_count": 178, + "execution_count": 42, "metadata": {}, "outputs": [ { @@ -408,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 179, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -440,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 180, + "execution_count": 44, "metadata": {}, "outputs": [], "source": [ @@ -488,42 +482,50 @@ }, { "cell_type": "code", - "execution_count": 181, + "execution_count": 45, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:34 [INFO] idaes.init.fs.feed.properties: fs.feed.properties State Released.\n", - "2024-09-12 12:28:34 [INFO] idaes.init.fs.feed: Initialization Complete.\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing speciation block fs.feed.reaktoro_properties----\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.feed.reaktoro_properties----\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "outputs : Size=15, Index={('speciesAmount', 'OH-'), ('speciesAmount', 'Cl-'), ('speciesAmount', 'Ca+2'), ('speciesAmount', 'CO3-2'), ('speciesAmount', 'HCO3-'), ('speciesAmount', 'CO2'), ('speciesAmount', 'K+'), ('speciesAmount', 'MgCO3'), ('speciesAmount', 'Na+'), ('speciesAmount', 'SO4-2'), ('speciesAmount', 'H+'), ('speciesAmount', 'HSO4-'), ('speciesAmount', 'H2O'), ('speciesAmount', 'MgOH+'), ('speciesAmount', 'Mg+2')}\n", + "2024-09-12 21:03:14 [INFO] idaes.init.fs.feed.properties: fs.feed.properties State Released.\n", + "2024-09-12 21:03:14 [INFO] idaes.init.fs.feed: Initialization Complete.\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing speciation block fs.feed.reaktoro_properties----\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.feed.reaktoro_properties----\n", + "2024-09-12 21:03:14 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "outputs : Size=15, Index={('speciesAmount', 'MgCO3'), ('speciesAmount', 'OH-'), ('speciesAmount', 'CO2'), ('speciesAmount', 'Cl-'), ('speciesAmount', 'HCO3-'), ('speciesAmount', 'Ca+2'), ('speciesAmount', 'Na+'), ('speciesAmount', 'H+'), ('speciesAmount', 'MgOH+'), ('speciesAmount', 'Mg+2'), ('speciesAmount', 'CO3-2'), ('speciesAmount', 'K+'), ('speciesAmount', 'H2O'), ('speciesAmount', 'SO4-2'), ('speciesAmount', 'HSO4-')}\n", " Key : Lower : Value : Upper : Fixed : Stale : Domain\n", - " ('speciesAmount', 'CO2') : None : 8.11468696026348e-05 : None : False : False : Reals\n", - " ('speciesAmount', 'CO3-2') : None : 2.1445433582590796e-05 : None : False : False : Reals\n", - " ('speciesAmount', 'Ca+2') : None : 0.009631002164385633 : None : False : False : Reals\n", - " ('speciesAmount', 'Cl-') : None : 0.4627181384403514 : None : False : False : Reals\n", - " ('speciesAmount', 'H+') : None : 3.6980404138489146e-08 : None : False : False : Reals\n", - " ('speciesAmount', 'H2O') : None : 53.56349911190051 : None : False : False : Reals\n", - " ('speciesAmount', 'HCO3-') : None : 0.0021283963816330857 : None : False : False : Reals\n", - " ('speciesAmount', 'HSO4-') : None : 1.0015065682548559e-08 : None : False : False : Reals\n", - " ('speciesAmount', 'K+') : None : 0.009379055998898623 : None : False : False : Reals\n", - " ('speciesAmount', 'Mg+2') : None : 0.05008757813300501 : None : False : False : Reals\n", - " ('speciesAmount', 'MgCO3') : None : 2.022034257777046e-05 : None : False : False : Reals\n", - " ('speciesAmount', 'MgOH+') : None : 6.144821297281374e-07 : None : False : False : Reals\n", + " ('speciesAmount', 'CO2') : None : 8.114686961181917e-05 : None : False : False : Reals\n", + " ('speciesAmount', 'CO3-2') : None : 2.1445433580077e-05 : None : False : False : Reals\n", + " ('speciesAmount', 'Ca+2') : None : 0.009631002164385625 : None : False : False : Reals\n", + " ('speciesAmount', 'Cl-') : None : 0.4627181384403513 : None : False : False : Reals\n", + " ('speciesAmount', 'H+') : None : 3.698040414274932e-08 : None : False : False : Reals\n", + " ('speciesAmount', 'H2O') : None : 53.56349911190052 : None : False : False : Reals\n", + " ('speciesAmount', 'HCO3-') : None : 0.002128396381628784 : None : False : False : Reals\n", + " ('speciesAmount', 'HSO4-') : None : 1.0015065683702304e-08 : None : False : False : Reals\n", + " ('speciesAmount', 'K+') : None : 0.009379055998898626 : None : False : False : Reals\n", + " ('speciesAmount', 'Mg+2') : None : 0.05008757813300742 : None : False : False : Reals\n", + " ('speciesAmount', 'MgCO3') : None : 2.022034257540142e-05 : None : False : False : Reals\n", + " ('speciesAmount', 'MgOH+') : None : 6.144821296573801e-07 : None : False : False : Reals\n", " ('speciesAmount', 'Na+') : None : 0.4431001172616517 : None : False : False : Reals\n", - " ('speciesAmount', 'OH-') : None : 5.820318170562861e-07 : None : False : False : Reals\n", - " ('speciesAmount', 'SO4-2') : None : 0.026609914667020593 : None : False : False : Reals\n", - "Density reaktoro 1022.0762152208728 Density Seawater pack 1020.8392240913253\n", - "Osmotic pressure 2306930.392393324 Density Seawater pack 2306399.8414143943\n", - "Adjusted pH 7.560000000075305\n", - "Solution reaktoro_charge 0.053807138247791896\n" + " ('speciesAmount', 'OH-') : None : 5.820318169892357e-07 : None : False : False : Reals\n", + " ('speciesAmount', 'SO4-2') : None : 0.026609914667020566 : None : False : False : Reals\n", + "Density reaktoro 1022.0762152208721 Density Seawater pack 1020.8392240913253\n", + "Osmotic pressure 2306930.3923933315 Density Seawater pack 2306399.8414143943\n", + "Adjusted pH 7.560000000025274\n", + "Solution reaktoro_charge 0.05380713824780617\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "D:\\github\\reaktoro-pse\\src\\reaktoro_pse\\core\\reaktoro_jacobian.py:324: RuntimeWarning: invalid value encountered in divide\n", + " jac_val = np.average(diff / step)\n" ] } ], @@ -560,51 +562,51 @@ }, { "cell_type": "code", - "execution_count": 182, + "execution_count": 46, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H+') : 3.69804041447456e-08, IDX: 0\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H2O') : 53.563499111900505, IDX: 1\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO3-2') : 2.1445433578637304e-05, IDX: 2\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO2') : 8.11468696171412e-05, IDX: 3\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Ca+2') : 0.009631002164385663, IDX: 4\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Cl-') : 0.46271813844035137, IDX: 5\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HCO3-') : 0.0021283963816255535, IDX: 6\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'SO4-2') : 0.026609914667020562, IDX: 7\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HSO4-') : 1.0015065684362347e-08, IDX: 8\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Mg+2') : 0.0500875781330082, IDX: 9\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'K+') : 0.009379055998898635, IDX: 10\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgCO3') : 2.022034257474189e-05, IDX: 11\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgOH+') : 6.144821296279714e-07, IDX: 12\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Na+') : 0.44310011726165166, IDX: 13\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'OH-') : 5.820318169524704e-07, IDX: 14\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('pH', None) : 1.0, IDX: 0\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesStandardVolume', 'H2O') : 1.8068735534310952e-05, IDX: 1\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesActivityLn', 'H2O') : 0.016823324806228862, IDX: 2\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('temperature', None) : 298.00000000000006, IDX: 3\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('density', None) : 1000.0, IDX: 4\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('charge', None) : 1e-08, IDX: 5\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H+') : 3.6980404138489285e-08, IDX: 6\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H2O') : 53.563499111900505, IDX: 7\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO3-2') : 2.144543358259081e-05, IDX: 8\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO2') : 8.114686960263499e-05, IDX: 9\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Ca+2') : 0.009631002164385631, IDX: 10\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Cl-') : 0.4627181384403515, IDX: 11\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HCO3-') : 0.002128396381633086, IDX: 12\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'SO4-2') : 0.026609914667020607, IDX: 13\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HSO4-') : 1.0015065682548575e-08, IDX: 14\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Mg+2') : 0.050087578133005004, IDX: 15\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'K+') : 0.009379055998898635, IDX: 16\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgCO3') : 2.0220342577770482e-05, IDX: 17\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgOH+') : 6.144821297281377e-07, IDX: 18\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Na+') : 0.44310011726165177, IDX: 19\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'OH-') : 5.820318170562875e-07, IDX: 20\n" + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H+') : 3.69804041447456e-08, IDX: 0\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H2O') : 53.563499111900505, IDX: 1\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO3-2') : 2.1445433578637304e-05, IDX: 2\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO2') : 8.11468696171412e-05, IDX: 3\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Ca+2') : 0.009631002164385663, IDX: 4\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Cl-') : 0.46271813844035137, IDX: 5\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HCO3-') : 0.0021283963816255535, IDX: 6\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'SO4-2') : 0.026609914667020562, IDX: 7\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HSO4-') : 1.0015065684362347e-08, IDX: 8\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Mg+2') : 0.0500875781330082, IDX: 9\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'K+') : 0.009379055998898635, IDX: 10\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgCO3') : 2.022034257474189e-05, IDX: 11\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgOH+') : 6.144821296279714e-07, IDX: 12\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Na+') : 0.44310011726165166, IDX: 13\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'OH-') : 5.820318169524704e-07, IDX: 14\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('pH', None) : 1.0, IDX: 0\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesStandardVolume', 'H2O') : 1.8068735534310952e-05, IDX: 1\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesActivityLn', 'H2O') : 0.016823324806228907, IDX: 2\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('temperature', None) : 298.00000000000006, IDX: 3\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('density', None) : 1000.0, IDX: 4\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('charge', None) : 1e-08, IDX: 5\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H+') : 3.6980404142749385e-08, IDX: 6\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'H2O') : 53.563499111900505, IDX: 7\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO3-2') : 2.1445433580077033e-05, IDX: 8\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'CO2') : 8.114686961181937e-05, IDX: 9\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Ca+2') : 0.009631002164385623, IDX: 10\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Cl-') : 0.46271813844035137, IDX: 11\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HCO3-') : 0.0021283963816287857, IDX: 12\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'SO4-2') : 0.026609914667020562, IDX: 13\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'HSO4-') : 1.0015065683702319e-08, IDX: 14\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Mg+2') : 0.05008757813300744, IDX: 15\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'K+') : 0.009379055998898635, IDX: 16\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgCO3') : 2.0220342575401426e-05, IDX: 17\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'MgOH+') : 6.144821296573815e-07, IDX: 18\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'Na+') : 0.44310011726165177, IDX: 19\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Jacobian scale for ('speciesAmount', 'OH-') : 5.820318169892369e-07, IDX: 20\n" ] } ], @@ -614,55 +616,55 @@ }, { "cell_type": "code", - "execution_count": 183, + "execution_count": 47, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----displaying jacobian outputs and types-----\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H2O'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO3-2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Ca+2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Cl-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HCO3-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'SO4-2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HSO4-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Mg+2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'K+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgCO3'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgOH+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Na+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'OH-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----done-----\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----displaying jacobian outputs and types-----\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('pH', None): Jac type: numeric\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesStandardVolume', 'H2O'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesActivityLn', 'H2O'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('temperature', None): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('density', None): Jac type: numeric\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('charge', None): Jac type: numeric\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H2O'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO3-2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Ca+2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Cl-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HCO3-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'SO4-2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HSO4-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Mg+2'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'K+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgCO3'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgOH+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Na+'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'OH-'): Jac type: exact\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----done-----\n" + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----displaying jacobian outputs and types-----\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H2O'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO3-2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Ca+2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Cl-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HCO3-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'SO4-2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HSO4-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Mg+2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'K+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgCO3'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgOH+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Na+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'OH-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----done-----\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----displaying jacobian outputs and types-----\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('pH', None): Jac type: numeric\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesStandardVolume', 'H2O'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesActivityLn', 'H2O'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('temperature', None): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('density', None): Jac type: numeric\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('charge', None): Jac type: numeric\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'H2O'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO3-2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'CO2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Ca+2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Cl-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HCO3-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'SO4-2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'HSO4-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Mg+2'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'K+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgCO3'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'MgOH+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'Na+'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: ('speciesAmount', 'OH-'): Jac type: exact\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.core.reaktoro_jacobian: -----done-----\n" ] } ], @@ -683,7 +685,7 @@ }, { "cell_type": "code", - "execution_count": 184, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ @@ -699,15 +701,15 @@ }, { "cell_type": "code", - "execution_count": 185, + "execution_count": 49, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for speciation block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", "| Property | Value | Unit |\n", "+-----------------+------------+------+\n", "| Temperature | 298.0000 | K |\n", @@ -740,8 +742,8 @@ "| :: Na+ | 4.4310e-01 | mol |\n", "| :: OH- | 5.8203e-07 | mol |\n", "+-----------------+------------+------+\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", - "2024-09-12 12:28:34 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: -----Displaying information for property block ------\n", + "2024-09-12 21:03:15 [INFO] idaes.reaktoro_pse.reaktoro_block: +-----------------+------------+------+\n", "| Property | Value | Unit |\n", "+-----------------+------------+------+\n", "| Temperature | 298.0000 | K |\n", @@ -794,7 +796,7 @@ }, { "cell_type": "code", - "execution_count": 186, + "execution_count": 50, "metadata": {}, "outputs": [], "source": [ @@ -815,7 +817,7 @@ }, { "cell_type": "code", - "execution_count": 187, + "execution_count": 51, "metadata": {}, "outputs": [ { @@ -850,7 +852,7 @@ }, { "cell_type": "code", - "execution_count": 188, + "execution_count": 52, "metadata": {}, "outputs": [ { @@ -879,17 +881,17 @@ " 1 0.0000000e+00 4.04e+01 8.92e+03 -1.0 5.38e+06 - 9.54e-01 1.00e+00h 1\n", " 2 0.0000000e+00 9.11e-04 8.83e+00 -1.0 8.49e+01 - 9.90e-01 1.00e+00h 1\n", " 3 0.0000000e+00 6.48e-07 7.22e-02 -1.0 1.34e-02 - 9.90e-01 1.00e+00h 1\n", - " 4 0.0000000e+00 9.87e-11 0.00e+00 -1.0 9.10e-06 - 9.90e-01 1.00e+00h 1\n", + " 4 0.0000000e+00 9.91e-11 0.00e+00 -1.0 9.14e-06 - 9.90e-01 1.00e+00h 1\n", "\n", "Number of Iterations....: 4\n", "\n", " (scaled) (unscaled)\n", "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Constraint violation....: 2.2737367544323206e-10 9.8696162353917316e-11\n", + "Constraint violation....: 9.9088737215424771e-11 9.9088737215424771e-11\n", "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Overall NLP error.......: 2.2737367544323206e-10 9.8696162353917316e-11\n", + "Overall NLP error.......: 9.9088737215424771e-11 9.9088737215424771e-11\n", "\n", "\n", "Number of objective function evaluations = 5\n", @@ -899,7 +901,7 @@ "Number of equality constraint Jacobian evaluations = 5\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 4\n", - "Total seconds in IPOPT = 0.566\n", + "Total seconds in IPOPT = 0.477\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -917,17 +919,17 @@ }, { "cell_type": "code", - "execution_count": 189, + "execution_count": 53, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Density reaktoro 1022.4474912371847 Density Seawater pack 1021.7122612878534\n", - "Osmotic pressure 2386602.5446863584 Density Seawater pack 2394583.8495394876\n", - "Adjusted pH 7 Acid dose 8.43304628189279 Acid mass flow 7.959225027956702e-06\n", - "Solution reaktoro_charge 0 intial Cl 17000 final Cl 18976.7654001602\n" + "Density reaktoro 1022.447491237185 Density Seawater pack 1021.7122612878533\n", + "Osmotic pressure 2386602.544686371 Density Seawater pack 2394583.849539473\n", + "Adjusted pH 7 Acid dose 8.433046282104545 Acid mass flow 7.95922502815656e-06\n", + "Solution reaktoro_charge 0 intial Cl 17000 final Cl 18976.76540015999\n" ] } ], @@ -972,7 +974,7 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 54, "metadata": {}, "outputs": [], "source": [ @@ -1017,7 +1019,7 @@ }, { "cell_type": "code", - "execution_count": 191, + "execution_count": 55, "metadata": {}, "outputs": [], "source": [ @@ -1069,7 +1071,7 @@ }, { "cell_type": "code", - "execution_count": 192, + "execution_count": 56, "metadata": {}, "outputs": [], "source": [ @@ -1117,7 +1119,7 @@ }, { "cell_type": "code", - "execution_count": 193, + "execution_count": 57, "metadata": {}, "outputs": [ { @@ -1181,43 +1183,43 @@ }, { "cell_type": "code", - "execution_count": 194, + "execution_count": 58, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:35 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:36 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:37 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", - "2024-09-12 12:28:38 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:16 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:17 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding H\n", + "2024-09-12 21:03:18 [INFO] idaes.reaktoro_pse.core.reaktoro_inputs: Exact speciation is not provided! Fixing aqueous solvent and, excluding O\n", + "2024-09-12 21:03:19 [INFO] idaes.reaktoro_pse.core.reaktoro_gray_box: RKT gray box using BFGS hessian type\n" ] } ], @@ -1255,14 +1257,14 @@ }, { "cell_type": "code", - "execution_count": 195, + "execution_count": 59, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:38 [WARNING] idaes.core.util.scaling: Missing scaling factor for fs.RO.feed_side.area\n" + "2024-09-12 21:03:19 [WARNING] idaes.core.util.scaling: Missing scaling factor for fs.RO.feed_side.area\n" ] } ], @@ -1312,57 +1314,57 @@ }, { "cell_type": "code", - "execution_count": 196, + "execution_count": 60, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Osmotic pressure is 23.945838495394877 bar\n", - "2024-09-12 12:28:38 [INFO] idaes.init.fs.pump.control_volume.properties_out: fs.pump.control_volume.properties_out State Released.\n", - "2024-09-12 12:28:38 [INFO] idaes.init.fs.pump.control_volume: Initialization Complete\n", - "2024-09-12 12:28:38 [INFO] idaes.init.fs.pump.control_volume.properties_in: fs.pump.control_volume.properties_in State Released.\n", - "2024-09-12 12:28:38 [INFO] idaes.init.fs.pump: Initialization Complete: optimal - Optimal Solution Found\n", - "2024-09-12 12:28:39 [INFO] idaes.init.fs.RO.feed_side: Initialization Complete\n", - "2024-09-12 12:28:39 [INFO] idaes.init.fs.RO.feed_side.properties: fs.RO.feed_side.properties State Released.\n", - "2024-09-12 12:28:39 [INFO] idaes.init.fs.RO.feed_side.properties_interface: fs.RO.feed_side.properties_interface State Released.\n", - "2024-09-12 12:28:39 [INFO] idaes.init.fs.RO.permeate_side: fs.RO.permeate_side State Released.\n", - "2024-09-12 12:28:39 [INFO] idaes.init.fs.RO.mixed_permeate: fs.RO.mixed_permeate State Released.\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.0,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.0,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.1,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.1,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.2,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.2,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.3,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.3,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.4,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.4,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.5,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.5,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.6,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.6,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.7,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.7,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.8,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.8,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.9,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.9,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,1.0,Liq,H2O] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,1.0,Liq,TDS] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.0] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.1] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.2] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.3] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.4] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.5] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.6] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.7] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.8] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.9] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:41 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,1.0] has no initial value: setting to 0.0\n", - "2024-09-12 12:28:42 [INFO] idaes.init.fs.RO: Initialization Complete: optimal - Optimal Solution Found\n" + "Osmotic pressure is 23.94583849539473 bar\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.pump.control_volume.properties_out: fs.pump.control_volume.properties_out State Released.\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.pump.control_volume: Initialization Complete\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.pump.control_volume.properties_in: fs.pump.control_volume.properties_in State Released.\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.pump: Initialization Complete: optimal - Optimal Solution Found\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.RO.feed_side: Initialization Complete\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.RO.feed_side.properties: fs.RO.feed_side.properties State Released.\n", + "2024-09-12 21:03:19 [INFO] idaes.init.fs.RO.feed_side.properties_interface: fs.RO.feed_side.properties_interface State Released.\n", + "2024-09-12 21:03:20 [INFO] idaes.init.fs.RO.permeate_side: fs.RO.permeate_side State Released.\n", + "2024-09-12 21:03:20 [INFO] idaes.init.fs.RO.mixed_permeate: fs.RO.mixed_permeate State Released.\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.0,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.0,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.1,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.1,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.2,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.2,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.3,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.3,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.4,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.4,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.5,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.5,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.6,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.6,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.7,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.7,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.8,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.8,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.9,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,0.9,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,1.0,Liq,H2O] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.material_flow_dx[0.0,1.0,Liq,TDS] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.0] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.1] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.2] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.3] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.4] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.5] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.6] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.7] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.8] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,0.9] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:21 [INFO] idaes.watertap.core.util.initialization: variable fs.RO.feed_side.pressure_dx[0.0,1.0] has no initial value: setting to 0.0\n", + "2024-09-12 21:03:22 [INFO] idaes.init.fs.RO: Initialization Complete: optimal - Optimal Solution Found\n" ] } ], @@ -1387,7 +1389,7 @@ }, { "cell_type": "code", - "execution_count": 197, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ @@ -1413,43 +1415,43 @@ }, { "cell_type": "code", - "execution_count": 198, + "execution_count": 62, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.1]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.2]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.3]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.4]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.5]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.6]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.7]----\n", - "2024-09-12 12:28:42 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.8]----\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.9]----\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[1.0]----\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", - "2024-09-12 12:28:43 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.1]----\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.2]----\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.3]----\n", + "2024-09-12 21:03:22 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.4]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.5]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.6]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.7]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.8]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[0.9]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.reaktoro_block: ---initializing property block fs.eq_ro_chem_props[1.0]----\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_state: Equilibrated successfully\n", + "2024-09-12 21:03:23 [INFO] idaes.reaktoro_pse.core.reaktoro_block_builder: Initialized rkt block\n" ] } ], @@ -1467,51 +1469,51 @@ }, { "cell_type": "code", - "execution_count": 199, + "execution_count": 63, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "(0.1, 'osmoticPressure', 'H2O') 2939053.117353327\n", - "(0.2, 'osmoticPressure', 'H2O') 3017519.218751651\n", - "(0.3, 'osmoticPressure', 'H2O') 3088095.0912944092\n", - "(0.4, 'osmoticPressure', 'H2O') 3151184.836854814\n", - "(0.5, 'osmoticPressure', 'H2O') 3207402.889657486\n", - "(0.6, 'osmoticPressure', 'H2O') 3257501.7266927077\n", - "(0.7, 'osmoticPressure', 'H2O') 3302299.968480068\n", - "(0.8, 'osmoticPressure', 'H2O') 3342615.6638003206\n", - "(0.9, 'osmoticPressure', 'H2O') 3379209.611475703\n", - "(1.0, 'osmoticPressure', 'H2O') 3412744.2641929174\n", - "(0.1, 'scalingTendency', 'Calcite') 0.3904573895124057\n", - "(0.1, 'scalingTendency', 'Gypsum') 0.2325782413466776\n", - "(0.2, 'scalingTendency', 'Calcite') 0.407609840785208\n", - "(0.2, 'scalingTendency', 'Gypsum') 0.23886443474197905\n", - "(0.3, 'scalingTendency', 'Calcite') 0.4233144890780858\n", - "(0.3, 'scalingTendency', 'Gypsum') 0.24451680330654701\n", + "(0.1, 'osmoticPressure', 'H2O') 2939053.1173533094\n", + "(0.2, 'osmoticPressure', 'H2O') 3017519.2187516335\n", + "(0.3, 'osmoticPressure', 'H2O') 3088095.0912943752\n", + "(0.4, 'osmoticPressure', 'H2O') 3151184.836854797\n", + "(0.5, 'osmoticPressure', 'H2O') 3207402.8896574676\n", + "(0.6, 'osmoticPressure', 'H2O') 3257501.7266926733\n", + "(0.7, 'osmoticPressure', 'H2O') 3302299.96848005\n", + "(0.8, 'osmoticPressure', 'H2O') 3342615.6638003034\n", + "(0.9, 'osmoticPressure', 'H2O') 3379209.6114756856\n", + "(1.0, 'osmoticPressure', 'H2O') 3412744.264192903\n", + "(0.1, 'scalingTendency', 'Calcite') 0.3904573895123874\n", + "(0.1, 'scalingTendency', 'Gypsum') 0.23257824134667626\n", + "(0.2, 'scalingTendency', 'Calcite') 0.40760984078519846\n", + "(0.2, 'scalingTendency', 'Gypsum') 0.23886443474197938\n", + "(0.3, 'scalingTendency', 'Calcite') 0.42331448907811065\n", + "(0.3, 'scalingTendency', 'Gypsum') 0.24451680330654857\n", "(0.4, 'scalingTendency', 'Calcite') 0.4375762578057707\n", - "(0.4, 'scalingTendency', 'Gypsum') 0.24956901966732592\n", - "(0.5, 'scalingTendency', 'Calcite') 0.4504628522244689\n", - "(0.5, 'scalingTendency', 'Gypsum') 0.2540712165336725\n", + "(0.4, 'scalingTendency', 'Gypsum') 0.24956901966733036\n", + "(0.5, 'scalingTendency', 'Calcite') 0.4504628522244636\n", + "(0.5, 'scalingTendency', 'Gypsum') 0.2540712165336714\n", "(0.6, 'scalingTendency', 'Calcite') 0.46208907002059463\n", - "(0.6, 'scalingTendency', 'Gypsum') 0.2580841853698539\n", - "(0.7, 'scalingTendency', 'Calcite') 0.4725994427969331\n", - "(0.7, 'scalingTendency', 'Gypsum') 0.2616737337701911\n", - "(0.8, 'scalingTendency', 'Calcite') 0.4821508970510643\n", - "(0.8, 'scalingTendency', 'Gypsum') 0.26490545937772736\n", - "(0.9, 'scalingTendency', 'Calcite') 0.49089706523990606\n", - "(0.9, 'scalingTendency', 'Gypsum') 0.2678402170863724\n", - "(1.0, 'scalingTendency', 'Calcite') 0.49897616595577055\n", - "(1.0, 'scalingTendency', 'Gypsum') 0.2705309061912855\n", - "(0.1, 'pH', None) 7.0\n", + "(0.6, 'scalingTendency', 'Gypsum') 0.25808418536985545\n", + "(0.7, 'scalingTendency', 'Calcite') 0.4725994427969109\n", + "(0.7, 'scalingTendency', 'Gypsum') 0.2616737337701931\n", + "(0.8, 'scalingTendency', 'Calcite') 0.4821508970510586\n", + "(0.8, 'scalingTendency', 'Gypsum') 0.2649054593777289\n", + "(0.9, 'scalingTendency', 'Calcite') 0.4908970652398945\n", + "(0.9, 'scalingTendency', 'Gypsum') 0.26784021708637085\n", + "(1.0, 'scalingTendency', 'Calcite') 0.498976165955778\n", + "(1.0, 'scalingTendency', 'Gypsum') 0.27053090619127795\n", + "(0.1, 'pH', None) 7.000000000000013\n", "(0.2, 'pH', None) 7.0\n", - "(0.3, 'pH', None) 7.000000000000013\n", + "(0.3, 'pH', None) 7.0\n", "(0.4, 'pH', None) 7.0\n", "(0.5, 'pH', None) 7.0\n", - "(0.6, 'pH', None) 7.000000000000013\n", - "(0.7, 'pH', None) 7.0\n", - "(0.8, 'pH', None) 7.000000000000007\n", + "(0.6, 'pH', None) 7.000000000000009\n", + "(0.7, 'pH', None) 7.000000000000013\n", + "(0.8, 'pH', None) 7.000000000000009\n", "(0.9, 'pH', None) 7.0\n", "(1.0, 'pH', None) 7.0\n" ] @@ -1531,7 +1533,7 @@ }, { "cell_type": "code", - "execution_count": 200, + "execution_count": 64, "metadata": {}, "outputs": [ { @@ -1566,10 +1568,10 @@ " (scaled) (unscaled)\n", "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Constraint violation....: 3.2514299586061668e-09 3.2514299586061668e-09\n", + "Constraint violation....: 3.2514297920727131e-09 3.2514297920727131e-09\n", "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Overall NLP error.......: 3.2514299586061668e-09 3.2514299586061668e-09\n", + "Overall NLP error.......: 3.2514297920727131e-09 3.2514297920727131e-09\n", "\n", "\n", "Number of objective function evaluations = 4\n", @@ -1579,7 +1581,7 @@ "Number of equality constraint Jacobian evaluations = 4\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 3\n", - "Total seconds in IPOPT = 1.568\n", + "Total seconds in IPOPT = 1.994\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -1599,7 +1601,7 @@ }, { "cell_type": "code", - "execution_count": 201, + "execution_count": 65, "metadata": {}, "outputs": [ { @@ -1651,7 +1653,7 @@ }, { "cell_type": "code", - "execution_count": 202, + "execution_count": 66, "metadata": {}, "outputs": [ { @@ -1693,14 +1695,14 @@ }, { "cell_type": "code", - "execution_count": 203, + "execution_count": 67, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Current recovery 0.2662990759628974\n", + "Current recovery 0.266299075962888\n", "cyipopt-watertap: cyipopt with user variable scaling and IDAES jacobian constraint scaling\n", "This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.2.\n", "\n", @@ -1730,10 +1732,10 @@ " (scaled) (unscaled)\n", "Objective...............: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Dual infeasibility......: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Constraint violation....: 2.5853097440631245e-11 2.5853097440631245e-11\n", + "Constraint violation....: 2.5851321083791845e-11 2.5851321083791845e-11\n", "Variable bound violation: 0.0000000000000000e+00 0.0000000000000000e+00\n", "Complementarity.........: 0.0000000000000000e+00 0.0000000000000000e+00\n", - "Overall NLP error.......: 2.5853097440631245e-11 2.5853097440631245e-11\n", + "Overall NLP error.......: 2.5851321083791845e-11 2.5851321083791845e-11\n", "\n", "\n", "Number of objective function evaluations = 5\n", @@ -1743,7 +1745,7 @@ "Number of equality constraint Jacobian evaluations = 5\n", "Number of inequality constraint Jacobian evaluations = 0\n", "Number of Lagrangian Hessian evaluations = 4\n", - "Total seconds in IPOPT = 3.244\n", + "Total seconds in IPOPT = 4.254\n", "\n", "EXIT: Optimal Solution Found.\n" ] @@ -1766,7 +1768,7 @@ }, { "cell_type": "code", - "execution_count": 204, + "execution_count": 68, "metadata": {}, "outputs": [ {