diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 97ba5c8..9809174 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,11 +1,14 @@ - - + + + - - + + + + - + + + + + + + + + + + - - + + + @@ -123,7 +181,21 @@ @@ -160,50 +232,50 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + diff --git a/data/xmls/elementz.xml b/data/xmls/elementz.xml deleted file mode 100644 index eb2a2c2..0000000 --- a/data/xmls/elementz.xml +++ /dev/null @@ -1,942 +0,0 @@ - - - - - - The standard entropy (1/2 H2gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and Chemical Reference - Data, Monograph 9, p. 1310. G_0 = -19.48112E6 J kmol-1 - - - - - - - The standard entropy (1/2 D2 gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1040. - - - - - - - There is no reference state thermodynamic data tabulated - for this element. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1361. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1493. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 361. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 177. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 550. - - - - - - - The standard entropy (1/2 N2 gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1621. - - - - - - - The standard entropy (1/2 O2 gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1745. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1099. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1695. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1637. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1529. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 59. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1881. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1817. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1859. - - - - - - - The standard entropy (1/2 Cl2 gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 811. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 175. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1465. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 703. - - - - - - - No reference state data for this element in the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1907. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1917. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 959. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1571. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1221. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 943. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1697. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1005. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1935. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1253. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 88. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 69. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 107 - - - - - - - The standard entropy (1/2 Br2 gas) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 470. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1491. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1849. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1891. - - - - - - - No reference state data found for Y. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1943. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1675. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1577. - - - - - - - The standard entropy was taken from the OECD-NEA - handbook (Guillaumont et al., 2003) "UPDATE ON THE - CHEMICAL THERMODYNAMICS OF URANIUM, NEPTUNIUM, - PLUTONIUM, AMERICIUM AND TECHNETIUM", Table 7-1, - p. 127. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 92. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 90. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 84. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 67. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 79. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 64. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 109. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 106. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 111. - - - - - - - The standard entropy (1/2 I2) was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1413. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1933. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 977. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 319. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 68. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 80. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 85. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 77. - - - - - - - There is no handbook standard state thermodynamic data for - this element. There are estimates for stability constants - of aqueous and solid species in Spahiu and Bruno (1995), - A Selected Thermodynamic Database for REE to be Used in - HLNW Performance Assessment Exercises. SKB Technical - Report 95-35. Stockholm, Sweden: Swedish Nuclear Fuel and - Waste Management Company. The compilation of Konings - et al. list an estimated standard entropy value for Pm - of 158.0 J/K/mol at 298.15 K but with a non-zero enthalpy of - formation which is not indicative of a reference state - form for this element. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 100. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 52. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 55. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 104. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 50. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 62. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 51. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 109. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 115. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 70. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1363. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1899. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1925. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 89. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 81. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1979), Thermodynamic Properties of - Minerals and Related Substances at 298.15 K - and 1 bar (10^5 Pascals) Pressure abd at Higher - Temperatures, USGS Bulletin 1452, p. 65. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 103. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 70. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1373. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1907. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1835. - - - - - - - The standard entropy was taken from Robie and - Hemingway (1995), Thermodynamic Properties of - Minerals and Related Substances, USGS Bulletin - 2131, p. 74. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - The standard entropy was taken from the NIST-JANAF - Handbook (Chase 1998), Journal of Physical and - Chemical Reference Data, Monograph 9, p. 1857. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - The standard entropy was taken from the OECD-NEA - handbook (Guillaumont et al., 2003) "UPDATE ON THE - CHEMICAL THERMODYNAMICS OF URANIUM, NEPTUNIUM, - PLUTONIUM, AMERICIUM AND TECHNETIUM", Table 8-1, - p. 145. - - - - - - - No standard state thermodynamic data for this element. - - - - - - - The standard entropy was taken from the OECD-NEA - handbook (Guillaumont et al., 2003) "UPDATE ON THE - CHEMICAL THERMODYNAMICS OF URANIUM, NEPTUNIUM, - PLUTONIUM, AMERICIUM AND TECHNETIUM", Table 3-1, - p. 45. - - - - - - - The standard entropy was taken from the OECD-NEA - handbook (Guillaumont et al., 2003) "UPDATE ON THE - CHEMICAL THERMODYNAMICS OF URANIUM, NEPTUNIUM, - PLUTONIUM, AMERICIUM AND TECHNETIUM", Table 4-1, - p. 81. - - - - - - - The standard entropy was taken from the OECD-NEA - handbook (Guillaumont et al., 2003) "UPDATE ON THE - CHEMICAL THERMODYNAMICS OF URANIUM, NEPTUNIUM, - PLUTONIUM, AMERICIUM AND TECHNETIUM", Table 5-1, - p. 99. - - - - - - - The entropy is zero so as not to overcount. The 1/2 H2(g) entropy - is handled elsewhere. - - - - - - - - The entropy is zero so as to make the 'dummy' dodecane phase inert. - This phase is used in TBP equilibrium problems as an 'inert' diluent. - The atomicWt is that reported for dodecane. - - - - - - diff --git a/data/xmls/twophase.xml b/data/xmls/twophase.xml deleted file mode 100644 index c93c1ba..0000000 --- a/data/xmls/twophase.xml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - Cl O H C P Nd dummy - - - (HA)2(org) dodecane Nd(H(A)2)3(org) - - - 298.15 - 100000.0 - - (HA)2(org): 0.25 - - - - - - - - - - - - - - - - C:16 H:35 O:3 P:1 - - - 298.14999999999998 - -1302518.58 - 558.9824 - 0.0 - - - - 0.3214 - - - - - - C:48 H:102 O:9 P:3 Nd:1 - - - 298.14999999999998 - - -4704700.167611002 - 1117.965 - 0.0 - - - - 1.0073 - - - - - - - dummy:1 - - - - 298.14999999999998 - 0.0 - 0.0 - 0.0 - - - - 0.227113 - - - - - - - - - - H2O(L) H+ OH- Cl- Nd+++ - - - - 298.15 - 100000.0 - - Cl-: 1.0E-7 - H+: 1.0E-7 - - - - - - - - - - - - 0.177000779, 0.000125778, 0.0, -33.4777082, -0.262214535 - 0.292922504, -0.027938838, 0.0, 3402.47027, 19.7936248 - 0.0, 0.0, 0.0, 0.0, 0.0 - 0.000362, -0.00003036, 0.0, -2.91038E-11, 0.0 - 2 - 12 - - refit of Holmes, H.F., Busey, J.M., Simonson, J.M., Mesmer, R.E., - Archer, D.G., and Wood, R.H., 1987, The enthalpy of dilution of HCl(aq) - to 648 K and 4p MPa. Thermodynamic properties, Journal of Chemical - Thermodynamics, v. 19, p. 863-890. - - - - - - - H2O(L) - - O H Nd Cl P E - - - - - - - - - H:2 O:1 - - - - 7.255750050E+01, -6.624454020E-01, 2.561987460E-03, -4.365919230E-06, - 2.781789810E-09, -4.188654990E+04, -2.882801370E+02 - - - - - - 0.018068 - - - - - - OH- - O:1 H:1 - -1 - - - -37595 - -54977 - -2.56 - - - - 0.12527 - 7.38 - 1.8423 - -27821 - 4.15 - -103460 - 172460 - - - ref:G9 - - - - - - - Cl- - Cl:1 - -1 - - - -31379 - -39933 - 13.56 - - - - 0.4032 - 480.1 - 5.563 - -28470 - -4.4 - -57140 - 145600 - 17.79 - - ref:G9 - - - - H+ - H:1 - +1 - - - 0 - 0 - 0 - - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - ref:G9 - - - - - Nd+++ - Nd:1 - +3 - - - -160600 - -166500 - -49.5 - - - - -0.33707 - -1454.52 - 8.3211 - -21777 - 1.6236 - -118344 - 225500 - - - ref:G9 - - - - - - - - \ No newline at end of file diff --git a/reeps.py b/reeps.py index c4cfcb7..3867044 100644 --- a/reeps.py +++ b/reeps.py @@ -1,6 +1,5 @@ import cantera as ct import pandas as pd -import numpy as np class REEPS: @@ -12,43 +11,43 @@ class REEPS: :param x_guess: (float) guess for multiplier variable :param h_guess: (float) initial guess standard enthalpy (J/kmol) :param phase_names: (list) names of phases in xml file - :param aq_phase_solvent_names: (list) names of solvents in aqueous phase - :param aq_phase_solvent_rhos: (numpy.ndarray) density of solvents in aqueous phase - :param org_phase_solvent_names: (list) names of solvents in organic phase [extractant, diluant] - :param org_phase_solvent_rhos: (numpy.ndarray) density of solvents in organic phase + :param aq_solvent_name: (str) name of aqueous solvent in xml file + :param extractant_name: (str) name of extractant + :param diluant_name: (str) name of diluant + :param aq_solvent_rho: (float) density of solvent (g/L) + :param extractant_rho: (float) density of extractant (g/L) + :param diluant_rho: (float) density of extractant (g/L) + If no density is given, molar volume/molecular weight is used from xml """ def __init__(self, exp_csv_filename, param_xml_file, - x_guess=1, - h_guess=-4856609.0E3, - phase_names=None, - aq_phase_solvent_names=None, - aq_phase_solvent_rhos=None, - org_phase_solvent_names=None, - org_phase_solvent_rhos=None, + x_guess, + h_guess, + phase_names, + aq_solvent_name, + extractant_name, + diluant_name, + aq_solvent_rho=None, + extractant_rho=None, + diluant_rho=None, ): self._exp_csv_filename = exp_csv_filename self._x_guess = x_guess self._h_guess = h_guess - if phase_names is None: - phase_names = ['HCl_electrolyte', 'PC88A_liquid', ] - if aq_phase_solvent_names is None: - aq_phase_solvent_names = ['H2O(L)', ] - if aq_phase_solvent_rhos is None: - aq_phase_solvent_rhos = np.array([1000, ]) - if org_phase_solvent_names is None: - org_phase_solvent_names = ['(HA)2(org_phase)', 'dodecane', ] - if org_phase_solvent_rhos is None: - org_phase_solvent_rhos = np.array([960, 750, ]) - self._aq_phase_solvent_names = aq_phase_solvent_names - self._aq_phase_solvent_rhos = aq_phase_solvent_rhos - self._org_phase_solvent_names = org_phase_solvent_names - self._org_phase_solvent_rhos = org_phase_solvent_rhos + self._aq_solvent_name = aq_solvent_name + self._extractant_name = extractant_name + self._diluant_name = diluant_name + self._aq_solvent_rho = aq_solvent_rho + self._extractant_rho = extractant_rho + self._diluant_rho = diluant_rho self._phases = ct.import_phases(param_xml_file, phase_names) self._exp_df = pd.read_csv(self._exp_csv_filename) + self._in_moles = None + + self.set_in_moles() def get_exp_csv_filename(self) -> str: return self._exp_csv_filename @@ -79,66 +78,108 @@ class REEPS: self._h_guess = h_guess return None - def get_aq_phase_solvent_names(self) -> list: - return self._aq_phase_solvent_names + def get_aq_solvent_name(self) -> str: + return self._aq_solvent_name - def set_aq_phase_solvent_names(self, aq_phase_solvent_names): - self._aq_phase_solvent_names = aq_phase_solvent_names + def set_aq_solvent_name(self, aq_solvent_name): + self._aq_solvent_name = aq_solvent_name return None - def get_aq_phase_solvent_rhos(self) -> list: - return self._aq_phase_solvent_rhos + def get_extractant_name(self) -> str: + return self._extractant_name - def set_aq_phase_solvent_rhos(self, aq_phase_solvent_rhos): - self._aq_phase_solvent_rhos = aq_phase_solvent_rhos + def set_extractant_name(self, extractant_name): + self._extractant_name = extractant_name return None - def get_org_phase_solvent_names(self) -> list: - return self._org_phase_solvent_names + def get_diluant_name(self) -> str: + return self._diluant_name + + def set_diluant_name(self, diluant_name): + self._diluant_name = diluant_name + return None + + def get_aq_solvent_rho(self) -> str: + return self._aq_solvent_rho - def set_org_phase_solvent_names(self, org_phase_solvent_names): - self._org_phase_solvent_names = org_phase_solvent_names + def set_aq_solvent_rho(self, aq_solvent_rho): + self._aq_solvent_rho = aq_solvent_rho return None - def get_org_phase_solvent_rhos(self) -> list: - return self._org_phase_solvent_rhos + def get_extractant_rho(self) -> str: + return self._extractant_rho - def set_org_phase_solvent_rhos(self, org_phase_solvent_rhos): - self._org_phase_solvent_rhos = org_phase_solvent_rhos + def set_extractant_rho(self, extractant_rho): + self._extractant_rho = extractant_rho + return None + + def get_diluant_rho(self) -> str: + return self._diluant_rho + + def set_diluant_rho(self, diluant_rho): + self._diluant_rho = diluant_rho return None def set_in_moles(self): phases_copy = self._phases.copy() exp_df = self._exp_df.copy() - aq_phase_solvent_names = self._aq_phase_solvent_names - aq_phase_solvent_rhos = self._aq_phase_solvent_rhos - org_phase_solvent_names = self._org_phase_solvent_names - org_phase_solvent_rhos = self._org_phase_solvent_rhos + solvent_name = self._aq_solvent_name + extractant_name = self._extractant_name + diluant_name = self._diluant_name + solvent_rho = self._aq_solvent_rho + extractant_rho = self._extractant_rho + diluant_rho = self._diluant_rho mixed = ct.Mixture(phases_copy) - # phase_names = [phase.name for phase in phases_copy] # expected structure [aq_phase, org_phase] - # phase_indices = [mixed.phase_index(phase_name) for phase_name in phase_names] - aq_phase_solvent_mws = [] - for name in aq_phase_solvent_names: - aq_phase_solvent_mws.append(mixed.phase(0).molecular_weights[mixed.phase(0).species_index(name)]) - org_phase_solvent_mws = [] - for name in org_phase_solvent_names: - org_phase_solvent_mws.append(mixed.phase(1).molecular_weights[mixed.phase(1).species_index(name)]) - - in_moles = [] + aq_ind = None + solvent_ind = None + for ind, phase in enumerate(phases_copy): + if solvent_name in phase.species_names: + aq_ind = ind + solvent_ind = phase.species_names.index(solvent_name) + if aq_ind is None: + raise Exception('Solvent "{0}" not found \ + in xml file'.format(solvent_name)) + + if aq_ind == 0: + org_ind = 1 + else: + org_ind = 0 + extractant_ind = phases_copy[org_ind].species_names.index( + extractant_name) + diluant_ind = phases_copy[org_ind].species_names.index(diluant_name) + + mix_aq = mixed.phase(aq_ind) + mix_org = mixed.phase(org_ind) + solvent_mw = mix_aq.molecular_weights[solvent_ind] # g/mol + extractant_mw = mix_org.molecular_weights[extractant_ind] + diluant_mw = mix_org.molecular_weights[diluant_ind] + if solvent_rho is None: + solvent_rho = mix_aq(aq_ind).partial_molar_volumes[ + solvent_ind]/solvent_mw * 1e6 # g/L + self._aq_solvent_rho = solvent_rho + if extractant_rho is None: + extractant_rho = mix_org(org_ind).partial_molar_volumes[ + extractant_ind]/extractant_mw * 1e6 + self._extractant_rho = extractant_rho + if diluant_rho is None: + diluant_rho = mix_org(org_ind).partial_molar_volumes[ + extractant_ind] / extractant_mw * 1e6 + self._diluant_rho = diluant_rho + + in_moles_data = [] feed_vol = 1. # g/L - aq_phase_solvent_moles = feed_vol*aq_phase_solvent_rhos[0] / aq_phase_solvent_mws[0] + aq_phase_solvent_moles = feed_vol * solvent_rho / solvent_mw for row in exp_df.values: - h_plus_moles = feed_vol*row[0] + h_plus_moles = feed_vol * row[0] hydroxide_ions = 0 - rare_earth_moles = feed_vol*row[6] - chlorine_moles = 3*rare_earth_moles + h_plus_moles - extractant_moles = feed_vol*row[3] - extractant_vol = extractant_moles*org_phase_solvent_rhos[0]/org_phase_solvent_mws[0] + rare_earth_moles = feed_vol * row[6] + chlorine_moles = 3 * rare_earth_moles + h_plus_moles + extractant_moles = feed_vol * row[3] + extractant_vol = extractant_moles * extractant_rho / extractant_mw diluant_vol = feed_vol - extractant_vol - diluant_moles= diluant_vol*org_phase_solvent_rhos[1]/org_phase_solvent_mws[1] - complex_moles=0 - + diluant_moles = diluant_vol * diluant_rho / diluant_mw + complex_moles = 0 species_moles = [aq_phase_solvent_moles, h_plus_moles, @@ -149,8 +190,9 @@ class REEPS: diluant_moles, complex_moles, ] - in_moles.append(species_moles) - in_moles_df = pd.DataFrame(in_moles, columns=mixed.species_names) - return in_moles_df - + in_moles_data.append(species_moles) + self._in_moles = pd.DataFrame(in_moles_data, columns=mixed.species_names) + return None + def get_in_moles(self) -> pd.DataFrame: + return self._in_moles diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test1.py b/tests/test1.py deleted file mode 100644 index de76dc4..0000000 --- a/tests/test1.py +++ /dev/null @@ -1,5 +0,0 @@ -import sys -sys.path.append('../') -from reeps import REEPS - -testing= \ No newline at end of file diff --git a/tests/test_reeps.py b/tests/test_reeps.py new file mode 100644 index 0000000..28ea44f --- /dev/null +++ b/tests/test_reeps.py @@ -0,0 +1,10 @@ +import sys + +sys.path.append('../') +from reeps import REEPS +import json + +with open('one_comp_settings.txt') as file: + testing_params = json.load(file) +beaker = REEPS(**testing_params) +print(beaker.get_in_moles()['Nd+++']) \ No newline at end of file