|
32 | 32 | "cell_type": "code", |
33 | 33 | "execution_count": 1, |
34 | 34 | "metadata": { |
| 35 | + "editable": true, |
| 36 | + "slideshow": { |
| 37 | + "slide_type": "" |
| 38 | + }, |
35 | 39 | "tags": [ |
36 | 40 | "nbval-ignore-output" |
37 | 41 | ] |
|
51 | 55 | "source": [ |
52 | 56 | "import biosteam as bst\n", |
53 | 57 | "import numpy as np\n", |
| 58 | + "bst.nbtutorial()\n", |
54 | 59 | "chemicals = bst.Chemicals(['Water', 'Ethanol'])\n", |
55 | 60 | "bst.settings.set_thermo(chemicals)\n", |
56 | 61 | "\n", |
|
473 | 478 | "cell_type": "code", |
474 | 479 | "execution_count": 16, |
475 | 480 | "metadata": { |
| 481 | + "editable": true, |
| 482 | + "slideshow": { |
| 483 | + "slide_type": "" |
| 484 | + }, |
476 | 485 | "tags": [ |
477 | 486 | "nbval-raises-exception" |
478 | 487 | ] |
479 | 488 | }, |
480 | 489 | "outputs": [ |
481 | 490 | { |
482 | | - "ename": "InfeasibleRegion", |
483 | | - "evalue": "phase composition is infeasible", |
484 | | - "output_type": "error", |
485 | | - "traceback": [ |
486 | | - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
487 | | - "\u001b[1;31mInfeasibleRegion\u001b[0m Traceback (most recent call last)", |
488 | | - "Cell \u001b[1;32mIn[16], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m vle(x\u001b[38;5;241m=\u001b[39mnp\u001b[38;5;241m.\u001b[39marray([\u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.8\u001b[39m]), P\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m101325\u001b[39m)\n\u001b[0;32m 2\u001b[0m vle\n", |
489 | | - "File \u001b[1;32m~\\code\\biosteam\\thermosteam\\thermosteam\\equilibrium\\vle.py:450\u001b[0m, in \u001b[0;36mVLE.__call__\u001b[1;34m(self, T, P, V, H, S, Q, B, x, y, gas_conversion, liquid_conversion)\u001b[0m\n\u001b[0;32m 448\u001b[0m thermal_condition\u001b[38;5;241m.\u001b[39mP \u001b[38;5;241m=\u001b[39m P\n\u001b[0;32m 449\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m x_spec:\n\u001b[1;32m--> 450\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_Px(P, np\u001b[38;5;241m.\u001b[39masarray(x))\n\u001b[0;32m 451\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m: \u001b[38;5;66;03m# y_spec\u001b[39;00m\n\u001b[0;32m 452\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_Py(P, np\u001b[38;5;241m.\u001b[39masarray(y))\n", |
490 | | - "File \u001b[1;32m~\\code\\biosteam\\thermosteam\\thermosteam\\equilibrium\\vle.py:664\u001b[0m, in \u001b[0;36mVLE.set_Px\u001b[1;34m(self, P, x)\u001b[0m\n\u001b[0;32m 662\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_N \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m2\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnumber of species in equilibrium must be 2 to specify x\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m 663\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_thermal_condition\u001b[38;5;241m.\u001b[39mT, y \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_bubble_point\u001b[38;5;241m.\u001b[39msolve_Ty(x, P) \n\u001b[1;32m--> 664\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_lever_rule(x, y)\n", |
491 | | - "File \u001b[1;32m~\\code\\biosteam\\thermosteam\\thermosteam\\equilibrium\\vle.py:646\u001b[0m, in \u001b[0;36mVLE._lever_rule\u001b[1;34m(self, x, y)\u001b[0m\n\u001b[0;32m 644\u001b[0m split_frac \u001b[38;5;241m=\u001b[39m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_z[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m-\u001b[39mx[\u001b[38;5;241m0\u001b[39m])\u001b[38;5;241m/\u001b[39m(y[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m-\u001b[39mx[\u001b[38;5;241m0\u001b[39m])\n\u001b[0;32m 645\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m0.00001\u001b[39m \u001b[38;5;241m<\u001b[39m split_frac \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m1.00001\u001b[39m:\n\u001b[1;32m--> 646\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m InfeasibleRegion(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mphase composition\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 647\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m split_frac \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m 648\u001b[0m split_frac \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n", |
492 | | - "\u001b[1;31mInfeasibleRegion\u001b[0m: phase composition is infeasible" |
| 491 | + "name": "stdout", |
| 492 | + "output_type": "stream", |
| 493 | + "text": [ |
| 494 | + "\u001b[31m\u001b[1mInfeasibleRegion\u001b[0m: phase composition is infeasible\n" |
493 | 495 | ] |
494 | 496 | } |
495 | 497 | ], |
496 | 498 | "source": [ |
497 | | - "vle(x=np.array([0.2, 0.8]), P=101325)\n", |
498 | | - "vle" |
| 499 | + "with bst.print_error: vle(x=np.array([0.2, 0.8]), P=101325)" |
499 | 500 | ] |
500 | 501 | }, |
501 | 502 | { |
|
514 | 515 | }, |
515 | 516 | { |
516 | 517 | "cell_type": "code", |
517 | | - "execution_count": null, |
| 518 | + "execution_count": 17, |
518 | 519 | "metadata": { |
519 | 520 | "tags": [ |
520 | 521 | "nbval-skip" |
521 | 522 | ] |
522 | 523 | }, |
523 | | - "outputs": [], |
| 524 | + "outputs": [ |
| 525 | + { |
| 526 | + "data": { |
| 527 | + "text/plain": [ |
| 528 | + "LLE(imol=MolarFlowIndexer(\n", |
| 529 | + " L=[('Water', 290.6), ('Octane', 0.02062), ('Butanol', 4.3)],\n", |
| 530 | + " l=[('Water', 13.35), ('Octane', 99.98), ('Butanol', 25.7)]),\n", |
| 531 | + " thermal_condition=ThermalCondition(T=360.00, P=101325))" |
| 532 | + ] |
| 533 | + }, |
| 534 | + "execution_count": 17, |
| 535 | + "metadata": {}, |
| 536 | + "output_type": "execute_result" |
| 537 | + } |
| 538 | + ], |
524 | 539 | "source": [ |
525 | 540 | "bst.settings.set_thermo(['Water', 'Octane', 'Butanol'])\n", |
526 | 541 | "lle = bst.equilibrium.LLE()\n", |
|
552 | 567 | }, |
553 | 568 | { |
554 | 569 | "cell_type": "code", |
555 | | - "execution_count": 17, |
| 570 | + "execution_count": 18, |
556 | 571 | "metadata": {}, |
557 | 572 | "outputs": [ |
558 | 573 | { |
|
563 | 578 | " thermal_condition=ThermalCondition(T=298.15, P=101325))" |
564 | 579 | ] |
565 | 580 | }, |
566 | | - "execution_count": 17, |
| 581 | + "execution_count": 18, |
567 | 582 | "metadata": {}, |
568 | 583 | "output_type": "execute_result" |
569 | 584 | } |
|
596 | 611 | }, |
597 | 612 | { |
598 | 613 | "cell_type": "code", |
599 | | - "execution_count": 18, |
| 614 | + "execution_count": 19, |
600 | 615 | "metadata": {}, |
601 | 616 | "outputs": [ |
602 | 617 | { |
|
609 | 624 | " thermal_condition=ThermalCondition(T=355.00, P=101325))" |
610 | 625 | ] |
611 | 626 | }, |
612 | | - "execution_count": 18, |
| 627 | + "execution_count": 19, |
613 | 628 | "metadata": {}, |
614 | 629 | "output_type": "execute_result" |
615 | 630 | } |
|
621 | 636 | }, |
622 | 637 | { |
623 | 638 | "cell_type": "code", |
624 | | - "execution_count": 19, |
| 639 | + "execution_count": 20, |
625 | 640 | "metadata": {}, |
626 | 641 | "outputs": [ |
627 | 642 | { |
|
634 | 649 | " thermal_condition=ThermalCondition(T=355.00, P=101325))" |
635 | 650 | ] |
636 | 651 | }, |
637 | | - "execution_count": 19, |
| 652 | + "execution_count": 20, |
638 | 653 | "metadata": {}, |
639 | 654 | "output_type": "execute_result" |
640 | 655 | } |
|
647 | 662 | }, |
648 | 663 | { |
649 | 664 | "cell_type": "code", |
650 | | - "execution_count": 20, |
651 | | - "metadata": {}, |
| 665 | + "execution_count": 21, |
| 666 | + "metadata": { |
| 667 | + "editable": true, |
| 668 | + "slideshow": { |
| 669 | + "slide_type": "" |
| 670 | + }, |
| 671 | + "tags": [] |
| 672 | + }, |
652 | 673 | "outputs": [ |
653 | 674 | { |
654 | 675 | "data": { |
|
660 | 681 | " thermal_condition=ThermalCondition(T=358.76, P=101325))" |
661 | 682 | ] |
662 | 683 | }, |
663 | | - "execution_count": 20, |
| 684 | + "execution_count": 21, |
664 | 685 | "metadata": {}, |
665 | 686 | "output_type": "execute_result" |
666 | 687 | } |
|
669 | 690 | "vlle(V=0.5, P=101325)\n", |
670 | 691 | "vlle" |
671 | 692 | ] |
| 693 | + }, |
| 694 | + { |
| 695 | + "cell_type": "raw", |
| 696 | + "metadata": { |
| 697 | + "editable": true, |
| 698 | + "raw_mimetype": "text/restructuredtext", |
| 699 | + "slideshow": { |
| 700 | + "slide_type": "" |
| 701 | + }, |
| 702 | + "tags": [] |
| 703 | + }, |
| 704 | + "source": [ |
| 705 | + " .. warning:: VLLE is an experimental feature; results may not be accurate nor consistent. " |
| 706 | + ] |
672 | 707 | } |
673 | 708 | ], |
674 | 709 | "metadata": { |
|
0 commit comments