|
653 | 653 | "\n", |
654 | 654 | "print()\n", |
655 | 655 | "print(\"Solving optimization problem...\")\n", |
| 656 | + "\n", |
| 657 | + "# Pass 1: smoothed VLE transition\n", |
| 658 | + "eps_nominal = value(m.fs.F101.control_volume.properties_in[0.0].eps_2_Vap_Liq)\n", |
| 659 | + "m.fs.F101.control_volume.properties_in[0.0].eps_2_Vap_Liq.set_value(eps_nominal * 2.5)\n", |
| 660 | + "m.fs.F101.control_volume.properties_out[0.0].eps_2_Vap_Liq.set_value(eps_nominal * 2.5)\n", |
| 661 | + "\n", |
656 | 662 | "opt_res = solver.solve(m, tee=True)\n", |
| 663 | + "assert opt_res.solver.termination_condition == TerminationCondition.optimal\n", |
| 664 | + "\n", |
| 665 | + "# Pass 2: restore default smoothness\n", |
| 666 | + "m.fs.F101.control_volume.properties_in[0.0].eps_2_Vap_Liq.set_value(eps_nominal)\n", |
| 667 | + "m.fs.F101.control_volume.properties_out[0.0].eps_2_Vap_Liq.set_value(eps_nominal)\n", |
| 668 | + "\n", |
| 669 | + "opt_res = solver.solve(m, tee=True)\n", |
| 670 | + "assert opt_res.solver.termination_condition == TerminationCondition.optimal\n", |
657 | 671 | "\n", |
658 | 672 | "print(\"Optimal solution process results:\")\n", |
659 | 673 | "report(m)" |
|
677 | 691 | "outputs": [], |
678 | 692 | "source": [ |
679 | 693 | "# testing model results\n", |
680 | | - "assert opt_res.solver.termination_condition == TerminationCondition.optimal\n", |
681 | | - "\n", |
682 | 694 | "assert value(m.fs.R101.rate_reaction_extent[0, \"R1\"]) == pytest.approx(\n", |
683 | 695 | " 311.3070, rel=1e-5\n", |
684 | 696 | ")\n", |
|
0 commit comments