openpnm 1.0.0__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. OpenPNM-1.1/MANIFEST.in +2 -0
  2. OpenPNM-1.1/OpenPNM/Algorithms/__FickianDiffusion__.py +67 -0
  3. OpenPNM-1.1/OpenPNM/Algorithms/__FourierConduction__.py +63 -0
  4. OpenPNM-1.1/OpenPNM/Algorithms/__GenericAlgorithm__.py +235 -0
  5. OpenPNM-1.1/OpenPNM/Algorithms/__GenericLinearTransport__.py +641 -0
  6. OpenPNM-1.1/OpenPNM/Algorithms/__InvasionPercolationForImbibition__.py +703 -0
  7. OpenPNM-1.1/OpenPNM/Algorithms/__InvasionPercolationTimed__.py +702 -0
  8. OpenPNM-1.1/OpenPNM/Algorithms/__InvasionPercolation__.py +156 -0
  9. OpenPNM-1.1/OpenPNM/Algorithms/__OhmicConduction__.py +64 -0
  10. OpenPNM-1.1/OpenPNM/Algorithms/__OrdinaryPercolation__.py +402 -0
  11. OpenPNM-1.1/OpenPNM/Algorithms/__StokesFlow__.py +64 -0
  12. OpenPNM-1.1/OpenPNM/Algorithms/__Tortuosity__.py +91 -0
  13. OpenPNM-1.1/OpenPNM/Algorithms/__init__.py +48 -0
  14. OpenPNM-1.1/OpenPNM/Base/__Controller__.py +480 -0
  15. OpenPNM-1.1/OpenPNM/Base/__Core__.py +1522 -0
  16. OpenPNM-1.1/OpenPNM/Base/__ModelsDict__.py +345 -0
  17. OpenPNM-1.1/OpenPNM/Base/__Tools__.py +72 -0
  18. OpenPNM-1.1/OpenPNM/Base/__init__.py +32 -0
  19. OpenPNM-1.1/OpenPNM/Geometry/__Boundary__.py +80 -0
  20. OpenPNM-1.1/OpenPNM/Geometry/__Cube_and_Cuboid__.py +64 -0
  21. OpenPNM-1.1/OpenPNM/Geometry/__GenericGeometry__.py +106 -0
  22. OpenPNM-1.1/OpenPNM/Geometry/__SGL10__.py +67 -0
  23. OpenPNM-1.1/OpenPNM/Geometry/__Stick_and_Ball__.py +68 -0
  24. OpenPNM-1.1/OpenPNM/Geometry/__TestGeometry__.py +51 -0
  25. OpenPNM-1.1/OpenPNM/Geometry/__Toray090__.py +68 -0
  26. OpenPNM-1.1/OpenPNM/Geometry/__Voronoi__.py +98 -0
  27. OpenPNM-1.1/OpenPNM/Geometry/__init__.py +47 -0
  28. OpenPNM-1.1/OpenPNM/Geometry/models/__init__.py +33 -0
  29. OpenPNM-1.1/OpenPNM/Geometry/models/pore_area.py +27 -0
  30. OpenPNM-1.1/OpenPNM/Geometry/models/pore_centroid.py +35 -0
  31. OpenPNM-1.1/OpenPNM/Geometry/models/pore_diameter.py +127 -0
  32. OpenPNM-1.1/OpenPNM/Geometry/models/pore_misc.py +55 -0
  33. OpenPNM-1.1/OpenPNM/Geometry/models/pore_seed.py +212 -0
  34. OpenPNM-1.1/OpenPNM/Geometry/models/pore_surface_area.py +28 -0
  35. OpenPNM-1.1/OpenPNM/Geometry/models/pore_vertices.py +19 -0
  36. OpenPNM-1.1/OpenPNM/Geometry/models/pore_volume.py +133 -0
  37. OpenPNM-1.1/OpenPNM/Geometry/models/throat_area.py +47 -0
  38. OpenPNM-1.1/OpenPNM/Geometry/models/throat_centroid.py +80 -0
  39. OpenPNM-1.1/OpenPNM/Geometry/models/throat_diameter.py +106 -0
  40. OpenPNM-1.1/OpenPNM/Geometry/models/throat_length.py +95 -0
  41. OpenPNM-1.1/OpenPNM/Geometry/models/throat_misc.py +42 -0
  42. OpenPNM-1.1/OpenPNM/Geometry/models/throat_normal.py +31 -0
  43. OpenPNM-1.1/OpenPNM/Geometry/models/throat_offset_vertices.py +191 -0
  44. OpenPNM-1.1/OpenPNM/Geometry/models/throat_perimeter.py +26 -0
  45. OpenPNM-1.1/OpenPNM/Geometry/models/throat_seed.py +12 -0
  46. OpenPNM-1.1/OpenPNM/Geometry/models/throat_shape_factor.py +37 -0
  47. OpenPNM-1.1/OpenPNM/Geometry/models/throat_surface_area.py +44 -0
  48. OpenPNM-1.1/OpenPNM/Geometry/models/throat_vector.py +27 -0
  49. OpenPNM-1.1/OpenPNM/Geometry/models/throat_vertices.py +19 -0
  50. OpenPNM-1.1/OpenPNM/Geometry/models/throat_volume.py +45 -0
  51. OpenPNM-1.1/OpenPNM/Network/__Cubic__.py +316 -0
  52. OpenPNM-1.1/OpenPNM/Network/__DelaunayCubic__.py +127 -0
  53. OpenPNM-1.1/OpenPNM/Network/__Delaunay__.py +600 -0
  54. OpenPNM-1.1/OpenPNM/Network/__GenericNetwork__.py +1184 -0
  55. OpenPNM-1.1/OpenPNM/Network/__MatFile__.py +331 -0
  56. OpenPNM-1.1/OpenPNM/Network/__TestNet__.py +109 -0
  57. OpenPNM-1.1/OpenPNM/Network/__init__.py +40 -0
  58. OpenPNM-1.1/OpenPNM/Network/models/__init__.py +12 -0
  59. OpenPNM-1.1/OpenPNM/Network/models/pore_topology.py +106 -0
  60. OpenPNM-1.1/OpenPNM/Phases/__Air__.py +63 -0
  61. OpenPNM-1.1/OpenPNM/Phases/__GenericPhase__.py +146 -0
  62. OpenPNM-1.1/OpenPNM/Phases/__Mercury__.py +71 -0
  63. OpenPNM-1.1/OpenPNM/Phases/__TestPhase__.py +46 -0
  64. OpenPNM-1.1/OpenPNM/Phases/__Water__.py +56 -0
  65. OpenPNM-1.1/OpenPNM/Phases/__init__.py +38 -0
  66. OpenPNM-1.1/OpenPNM/Phases/models/__init__.py +22 -0
  67. OpenPNM-1.1/OpenPNM/Phases/models/contact_angle.py +34 -0
  68. OpenPNM-1.1/OpenPNM/Phases/models/density.py +81 -0
  69. OpenPNM-1.1/OpenPNM/Phases/models/diffusivity.py +95 -0
  70. OpenPNM-1.1/OpenPNM/Phases/models/electrical_conductivity.py +10 -0
  71. OpenPNM-1.1/OpenPNM/Phases/models/misc.py +125 -0
  72. OpenPNM-1.1/OpenPNM/Phases/models/molar_density.py +69 -0
  73. OpenPNM-1.1/OpenPNM/Phases/models/molar_mass.py +31 -0
  74. OpenPNM-1.1/OpenPNM/Phases/models/surface_tension.py +104 -0
  75. OpenPNM-1.1/OpenPNM/Phases/models/thermal_conductivity.py +98 -0
  76. OpenPNM-1.1/OpenPNM/Phases/models/vapor_pressure.py +69 -0
  77. OpenPNM-1.1/OpenPNM/Phases/models/viscosity.py +103 -0
  78. OpenPNM-1.1/OpenPNM/Physics/__GenericPhysics__.py +111 -0
  79. OpenPNM-1.1/OpenPNM/Physics/__Standard__.py +51 -0
  80. OpenPNM-1.1/OpenPNM/Physics/__TestPhysics__.py +50 -0
  81. OpenPNM-1.1/OpenPNM/Physics/__init__.py +30 -0
  82. OpenPNM-1.1/OpenPNM/Physics/models/__init__.py +18 -0
  83. OpenPNM-1.1/OpenPNM/Physics/models/capillary_pressure.py +122 -0
  84. OpenPNM-1.1/OpenPNM/Physics/models/diffusive_conductance.py +82 -0
  85. OpenPNM-1.1/OpenPNM/Physics/models/electrical_conductance.py +59 -0
  86. OpenPNM-1.1/OpenPNM/Physics/models/generic_source_term.py +564 -0
  87. OpenPNM-1.1/OpenPNM/Physics/models/hydraulic_conductance.py +76 -0
  88. OpenPNM-1.1/OpenPNM/Physics/models/multiphase.py +133 -0
  89. OpenPNM-1.1/OpenPNM/Physics/models/thermal_conductance.py +67 -0
  90. OpenPNM-1.1/OpenPNM/Postprocessing/Graphics.py +251 -0
  91. OpenPNM-1.1/OpenPNM/Postprocessing/Plots.py +369 -0
  92. OpenPNM-1.1/OpenPNM/Postprocessing/__init__.py +10 -0
  93. OpenPNM-1.1/OpenPNM/Utilities/IO.py +277 -0
  94. OpenPNM-1.1/OpenPNM/Utilities/Shortcuts.py +17 -0
  95. OpenPNM-1.1/OpenPNM/Utilities/__init__.py +16 -0
  96. OpenPNM-1.1/OpenPNM/Utilities/misc.py +226 -0
  97. OpenPNM-1.1/OpenPNM/Utilities/transformations.py +1923 -0
  98. OpenPNM-1.1/OpenPNM/Utilities/vertexops.py +824 -0
  99. OpenPNM-1.1/OpenPNM/__init__.py +56 -0
  100. OpenPNM-1.1/OpenPNM.egg-info/PKG-INFO +11 -0
  101. OpenPNM-1.1/OpenPNM.egg-info/SOURCES.txt +107 -0
  102. OpenPNM-1.1/OpenPNM.egg-info/dependency_links.txt +1 -0
  103. OpenPNM-1.1/OpenPNM.egg-info/requires.txt +1 -0
  104. OpenPNM-1.1/OpenPNM.egg-info/top_level.txt +1 -0
  105. OpenPNM-1.1/PKG-INFO +11 -0
  106. OpenPNM-1.1/README.txt +88 -0
  107. OpenPNM-1.1/setup.cfg +7 -0
  108. OpenPNM-1.1/setup.py +39 -0
@@ -0,0 +1,125 @@
1
+ r"""
2
+ ===============================================================================
3
+ Submodule -- miscillaneous
4
+ ===============================================================================
5
+
6
+ Models for applying basic phase properties
7
+
8
+ """
9
+ import scipy as _sp
10
+
11
+ def constant(phase,value,**kwargs):
12
+ r"""
13
+ Assigns specified constant value
14
+ """
15
+ temp = _sp.ones(_sp.shape(phase.pores()))*value
16
+ return temp
17
+
18
+ def random(phase,seed=None,**kwargs):
19
+ r"""
20
+ Assigns specified constant value
21
+ """
22
+ _sp.random.seed(seed)
23
+ value = _sp.random.rand(_sp.shape(phase.pores())[0])
24
+ return value
25
+
26
+ def linear(phase,m,b,poreprop='pore.temperature',**kwargs):
27
+ r"""
28
+ Calculates a property as a linear function of a given property
29
+
30
+ Parameters
31
+ ----------
32
+ m, b: floats
33
+ Slope and intercept of the linear corelation
34
+
35
+ poreprop : string
36
+ The property name of the independent variable or phase property. The
37
+ default is 'pore.temperature'.
38
+
39
+ """
40
+ T = phase[poreprop]
41
+ value = b + m*T
42
+ return value
43
+
44
+ def polynomial(phase,a,poreprop='pore.temperature',**kwargs):
45
+ r"""
46
+ Calculates a property as a polynomial function of a given property
47
+
48
+ Parameters
49
+ ----------
50
+ a: list of floats
51
+ A list containing the polynomial coefficients, where element 0 in the
52
+ list corresponds to a0 and so on. Note that no entries can be skipped
53
+ so 0 coefficients must be sent as 0.
54
+
55
+ poreprop : string
56
+ The property name of the independent variable or phase property. The
57
+ default is 'pore.temperature'.
58
+
59
+ """
60
+ x = phase[poreprop]
61
+ value = 0.0
62
+ for i in range(0,len(a)):
63
+ value += a[i]*x**i
64
+ return value
65
+
66
+ def ideal_mixture(phase,propname,pore_prop=None,composition='pore.mole_fraction',**kwargs):
67
+ r'''
68
+ Calcualtes a given mixture property as the composition weighted average
69
+ of the pure compononent properties
70
+
71
+ Parameters
72
+ ----------
73
+ pore_prop : string
74
+ The name of the property on the pure component
75
+ composition : string, optional (default is 'pore.mole_fraction')
76
+ The name of the pore property where the composition information
77
+ is stored on each pure component
78
+
79
+ Returns
80
+ -------
81
+ The composition weighted average of the given property
82
+
83
+ Notes
84
+ -----
85
+ The average is calculated as follows:
86
+
87
+ .. math::
88
+
89
+ P_{mixture}=\Sigma(x_{i}P_{i})
90
+
91
+ where
92
+
93
+ :math:`P_{mix}` is the average mixture property
94
+
95
+ :math:`x_{i}` is the fractional composition of species *i*
96
+
97
+ :math:`P_{i}` is the property of interest for pure species *i*
98
+
99
+
100
+ '''
101
+ if pore_prop is None:
102
+ pore_prop = propname
103
+ value = _sp.zeros((phase.Np,))
104
+ for comp in phase._phases:
105
+ value= value + comp[pore_prop]*comp[composition]
106
+ return value
107
+
108
+ def mixture_value(phase,propname,**kwargs):
109
+ r'''
110
+ Adopts the specified property value from the parent mixture phase
111
+
112
+ Parameters
113
+ ----------
114
+ propname :
115
+ The propname to which this model is assigned (i.e. 'pore.temperature')
116
+ is automatically passed and used as the property name to fetch from
117
+ the mixture object
118
+
119
+ '''
120
+ mixture = phase._phases[0]
121
+ vals = mixture[propname]
122
+ return vals
123
+
124
+
125
+
@@ -0,0 +1,69 @@
1
+ r"""
2
+ ===============================================================================
3
+ Submodule -- molar_density
4
+ ===============================================================================
5
+
6
+ """
7
+ import scipy as sp
8
+
9
+ def standard(phase,**kwargs):
10
+ r'''
11
+ Calculates the molar density from the molecular with and mass density
12
+ '''
13
+ MW = phase['pore.molecular_weight']
14
+ rho = phase['pore.density']
15
+ value = rho/MW
16
+ return value
17
+
18
+ def ideal_gas(phase,**kwargs):
19
+ r"""
20
+ Uses ideal gas law to calculate the molar density of an ideal gas
21
+
22
+ Parameters
23
+ ----------
24
+ P, T, MW: float, array_like
25
+ P pressure of the gas in [Pa]
26
+ T temperature of the gas in [K]
27
+ MW molecular weight of the gas in [kg/kmole]
28
+
29
+ Returns
30
+ -------
31
+ rho, the density in [mol/m3]
32
+
33
+ """
34
+
35
+ P = phase['pore.pressure']
36
+ T = phase['pore.temperature']
37
+ R = 8.31447
38
+ value = P/(R*T)
39
+ return value
40
+
41
+ def vanderwaals(phase,P,T,Pc,Tc,MW,**kwargs):
42
+ r"""
43
+ Uses Van der Waals equation of state to calculate the density of a real gas
44
+
45
+ Parameters
46
+ ----------
47
+ P, T, Pc, Tc, MW: float, array_like
48
+ P pressure of the gas in [Pa]
49
+ T temperature of the gas in [K]
50
+ Pc critical pressure of the gas in [Pa]
51
+ T critical temperature of the gas in [K]
52
+ MW molecular weight of the gas in [kg/mol]
53
+
54
+ Returns
55
+ -------
56
+ rho, the density in [mol/m3]
57
+
58
+ """
59
+
60
+ P = phase['pore.pressure']
61
+ T = phase['pore.temperature']
62
+ Pc = phase['pore.criticalpressure']
63
+ Tc = phase['pore.criticaltemperature']
64
+ R = 8.314
65
+ a = 27*(R**2)*(Tc**2)/(64*Pc); b = R*Tc/(8*Pc)
66
+ a0 = 1; a1 = -1/b; a2 = (R*T+b*P)/(a*b); a3 = -P/(a*b)
67
+ density = sp.roots([a0, a1, a2, a3])
68
+ value = sp.real(density[2])
69
+ return value
@@ -0,0 +1,31 @@
1
+ r"""
2
+ ===============================================================================
3
+ Submodule -- molar_mass
4
+ ===============================================================================
5
+
6
+ """
7
+ import scipy as sp
8
+
9
+ def mixture(phase,
10
+ molar_mass = 'pore.molar_mass',
11
+ mole_frac = 'pore.mole_fraction',
12
+ **kwargs):
13
+ r"""
14
+ Calculates the average molecular weight of a mixture using mole fraction weighting
15
+
16
+ Parameters
17
+ ----------
18
+ phase : OpenPNM Phase Object
19
+ The phase for which the molar mass is to be calculated. This phase
20
+ must have sub-phases
21
+
22
+ molar_mass : string, optional (default = 'pore.molar_mass')
23
+ The property name for the molar masses of each sub-phase
24
+
25
+ mole_frac : string, optional (default = 'pore.mole_fraction')
26
+ The property name for the mole fraction of each sub-phase
27
+ """
28
+ MW = sp.zeros((phase.Np,))
29
+ for comp in phase._phases:
30
+ MW = MW + comp[molar_mass]*comp[mole_frac]
31
+ return MW
@@ -0,0 +1,104 @@
1
+ r"""
2
+ ===============================================================================
3
+ Submodule -- surface_tension
4
+ ===============================================================================
5
+
6
+ Some text here?
7
+
8
+ """
9
+
10
+ import scipy as sp
11
+
12
+ def water(phase,**kwargs):
13
+ r"""
14
+ Calculates surface tension of pure water or seawater at atmospheric pressure
15
+ using Eq. (28) given by Sharqawy et. al [1]_. Values at temperature higher
16
+ than the normal boiling temperature are calculated at the saturation pressure.
17
+
18
+ Parameters
19
+ ----------
20
+ T, S: strings
21
+ Property names where phase temperature and salinity are located.
22
+
23
+ Returns
24
+ -------
25
+ sigma_sw, the surface tension of seawater in [N/m]
26
+
27
+ Notes
28
+ -----
29
+ T must be in K, and S in g of salt per kg of phase, or ppt (parts per
30
+ thousand)
31
+ VALIDITY: 273 < T < 313 K; 0 < S < 40 g/kg;
32
+ ACCURACY: 0.2 %
33
+
34
+ References
35
+ ----------
36
+ [1] Sharqawy M. H., Lienhard J. H., and Zubair, S. M., Desalination and Water Treatment, 2010.
37
+
38
+ """
39
+ T = phase['pore.temperature']
40
+ try:
41
+ S = phase['pore.salinity']
42
+ except:
43
+ S = 0
44
+ sigma_w = 0.2358*((1-(T/647.096))**1.256)*(1-0.625*(1-(T/647.096)));
45
+ a1 = 2.2637334337E-04; a2 = 9.4579521377E-03; a3 = 3.3104954843E-02
46
+ TC = T-273.15
47
+ sigma_sw = sigma_w*(1+(a1*TC+a2)*sp.log(1+a3*S));
48
+ value = sigma_sw
49
+ return value
50
+
51
+ def eotvos(phase,
52
+ k,
53
+ pore_molar_density='pore.molar_density',
54
+ **kwargs):
55
+ r'''
56
+ Documentation for this method is being updated, we are sorry for the inconvenience.
57
+ '''
58
+ Tc = phase['pore.Tc']
59
+ T = phase['pore.temperature']
60
+ Vm = 1/phase[pore_molar_density]
61
+ value = k*(Tc-T)/(Vm**(2/3))
62
+ return value
63
+
64
+ def guggenheim_katayama(phase,
65
+ K2,
66
+ n,
67
+ **kwargs):
68
+ r'''
69
+ Documentation for this method is being updated, we are sorry for the inconvenience.
70
+ '''
71
+ T = phase['pore.temperature']
72
+ Pc = phase['pore.Pc']
73
+ Tc = phase['pore.Tc']
74
+ sigma_o = K2*Tc**(1/3)*Pc**(2/3)
75
+ value = sigma_o*(1-T/Tc)**n
76
+ return value
77
+
78
+ def brock_bird_scaling(phase,
79
+ sigma_o,
80
+ To,
81
+ **params):
82
+ r"""
83
+ Uses Brock_Bird model to adjust surface tension from it's value at a given
84
+ reference temperature to temperature of interest
85
+
86
+ Parameters
87
+ ----------
88
+ phase : OpenPNM Phase Object
89
+
90
+ sigma_o : float
91
+ Surface tension at reference temperature (N/m)
92
+
93
+ To : float
94
+ Temperature at reference conditions (K)
95
+ """
96
+ Tc = phase['pore.Tc']
97
+ Ti = phase['pore.temperature']
98
+ Tro = To/Tc
99
+ Tri = Ti/Tc
100
+ value = sigma_o*(1-Tri)**(11/9)/(1-Tro)**(11/9)
101
+ return value
102
+
103
+
104
+
@@ -0,0 +1,98 @@
1
+ # -*- coding: utf-8 -*-
2
+ r"""
3
+ ===============================================================================
4
+ Submodule -- thermal_conductance
5
+ ===============================================================================
6
+
7
+ """
8
+ import scipy as sp
9
+
10
+ def water(phase,**kwargs):
11
+ r"""
12
+ Calculates thermal conductivity of pure water or seawater at atmospheric pressure
13
+ using the correlation given in [1]_. Values at temperature higher
14
+ than the normal boiling temperature are calculated at the saturation pressure.
15
+
16
+ Parameters
17
+ ----------
18
+ T, S: strings
19
+ Property names where phase temperature and salinity are located.
20
+
21
+ Returns
22
+ -------
23
+ k_sw, the thermal conductivity of water/seawater in [W/m.K]
24
+
25
+ Notes
26
+ -----
27
+ T must be in K, and S in g of salt per kg of phase, or ppt (parts per
28
+ thousand)
29
+ VALIDITY: 273 < T < 453 K; 0 < S < 160 g/kg;
30
+ ACCURACY: 3 %
31
+
32
+ References
33
+ ----------
34
+ [1] D. T. Jamieson, and J. S. Tudhope, Desalination, 8, 393-401, 1970.
35
+
36
+ """
37
+ T = phase['pore.temperature']
38
+ try:
39
+ S = phase['pore.salinity']
40
+ except:
41
+ S = 0
42
+ T68 = 1.00024*T; # convert from T_90 to T_68"
43
+ SP = S/1.00472; # convert from S to S_P"
44
+ k_sw = 0.001*(10**(sp.log10(240+0.0002*SP)+0.434*(2.3-(343.5+0.037*SP)/T68)*((1-T68/(647.3+0.03*SP)))**(1/3)))
45
+ value = k_sw
46
+ return value
47
+
48
+ def chung(phase,
49
+ Cv,
50
+ MW,
51
+ acentric,
52
+ pore_viscosity='pore.viscosity',
53
+ **kwargs):
54
+ r"""
55
+ Uses Chung et al. model to estimate thermal conductivity for gases with
56
+ low pressure(<10 bar) from first principles at conditions of interest
57
+
58
+ Parameters
59
+ ----------
60
+ Cv : float, array_like
61
+ Heat capacity at constant volume (J/(mol.K))
62
+ MW : float, array_like
63
+ Molecular weight of the component (kg/mol)
64
+ acentric : float, array_like
65
+ Acentric factor of the component
66
+
67
+ """
68
+ R = 8.314
69
+ T = phase['pore.temperature']
70
+ mu = phase[pore_viscosity]
71
+ Tc = phase['pore.Tc']
72
+ Tr = T/Tc
73
+ z = 2.0 + 10.5*Tr**2
74
+ beta = 0.7862 - 0.7109*acentric + 1.3168*acentric**2
75
+ alpha = Cv/R -3/2
76
+ s = 1 + alpha*((0.215+0.28288*alpha-1.061*beta+0.26665*z)/(0.6366+beta*z+1.061*alpha*beta))
77
+ value = 3.75*s*(mu)*R/(MW)
78
+ return value
79
+
80
+ def sato(phase,Tb,MW,**params):
81
+ r"""
82
+ Uses Sato et al. model to estimate thermal conductivity for pure liquids
83
+ from first principles at conditions of interest
84
+
85
+ Parameters
86
+ ----------
87
+ Tb : float, array_like
88
+ Boiling temperature of the component (K)
89
+ MW : float, array_like
90
+ Molecular weight of the component (kg/mol)
91
+
92
+ """
93
+ T = phase['pore.temperature']
94
+ Tc = phase['pore.Tc']
95
+ Tbr = Tb/Tc
96
+ Tr = T/Tc
97
+ value = (1.11/((MW*1e3)**0.5))*(3+20*(1-Tr)**(2/3))/(3+20*(1-Tbr)**(2/3))
98
+ return value
@@ -0,0 +1,69 @@
1
+ # -*- coding: utf-8 -*-
2
+ r"""
3
+ ===============================================================================
4
+ Submodule -- vapor_pressure
5
+ ===============================================================================
6
+
7
+ Methods for predicing the vapor pressure of pure species
8
+
9
+ """
10
+ import scipy as sp
11
+
12
+ def antoine(phase,A,B,C,**kwargs):
13
+ r"""
14
+ Uses Antoine equation [1]_ to estimate vapor pressure of a pure component
15
+
16
+ Parameters
17
+ ----------
18
+ A, B, C : float, array_like
19
+ Antoine vapor pressure coefficients for pure compounds. Note that
20
+ these coefficients should be converted such that the Temperature
21
+ is in [K] and the vapor pressure is in [Pa].
22
+
23
+ [1] Antoine, C. (1888), Vapor Pressure: a new relationship between pressure
24
+ and temperature, Comptes Rendus des Séances de l'Académie des Sciences
25
+ (in French) 107: 681–684, 778–780, 836–837
26
+
27
+ """
28
+ T = phase['pore.temperature']
29
+ value = (10**(A-B/(C+T)))
30
+ return value
31
+
32
+ def water(phase,**kwargs):
33
+ r"""
34
+ Calculates vapor pressure of pure water or seawater given by [1]_ based on
35
+ Raoult's law. The pure water vapor pressure is given by [2]_
36
+
37
+ Parameters
38
+ ----------
39
+ T, S: strings
40
+ Property names where phase temperature and salinity are located.
41
+
42
+ Returns
43
+ -------
44
+ Pv_sw, the vapor pressure of water/seawater in [Pa]
45
+
46
+ Notes
47
+ -----
48
+ T must be in K, and S in g of salt per kg of phase, or ppt (parts per
49
+ thousand)
50
+ VALIDITY: 273 < T < 473 K; 0 < S < 240 g/kg;
51
+ ACCURACY: 0.5 %
52
+
53
+ References
54
+ ----------
55
+ [1] Sharqawy M. H., Lienhard J. H., and Zubair, S. M., Desalination and Water Treatment, 2010.
56
+ [2] ASHRAE handbook: Fundamentals, ASHRAE; 2005.
57
+
58
+ """
59
+ T = phase['pore.temperature']
60
+ try:
61
+ S = phase['pore.salinity']
62
+ except:
63
+ S = 0
64
+ a1=-5.8002206E+03; a2=1.3914993E+00; a3=-4.8640239E-02;
65
+ a4=4.1764768E-05; a5=-1.4452093E-08; a6=6.5459673E+00
66
+ Pv_w = sp.exp((a1/T) + a2 + a3*T + a4*T**2 + a5*T**3 + a6*sp.log(T));
67
+ Pv_sw = Pv_w/(1+0.57357*(S/(1000-S)));
68
+ value = Pv_sw
69
+ return value
@@ -0,0 +1,103 @@
1
+ # -*- coding: utf-8 -*-
2
+ r"""
3
+ ===============================================================================
4
+ Submodule -- viscosity
5
+ ===============================================================================
6
+
7
+ Models for predicting phase viscosity
8
+
9
+ """
10
+ import scipy as sp
11
+
12
+ def water(phase,**kwargs):
13
+ r"""
14
+ Calculates viscosity of pure water or seawater at atmospheric pressure
15
+ using Eq. (22) given by Sharqawy et. al [1]_. Values at temperature higher
16
+ than the normal boiling temperature are calculated at the saturation pressure.
17
+
18
+ Parameters
19
+ ----------
20
+ T, S: strings
21
+ Property names where phase temperature and salinity are located.
22
+
23
+ Returns
24
+ -------
25
+ mu_sw, the viscosity of water/seawater in [kg/m.s]
26
+
27
+ Notes
28
+ -----
29
+ T must be in K, and S in g of salt per kg of phase, or ppt (parts per
30
+ thousand)
31
+ VALIDITY: 273 < T < 453 K; 0 < S < 150 g/kg;
32
+ ACCURACY: 1.5 %
33
+
34
+ References
35
+ ----------
36
+ [1] Sharqawy M. H., Lienhard J. H., and Zubair, S. M., Desalination and Water Treatment, 2010.
37
+
38
+ """
39
+ T = phase['pore.temperature']
40
+ try:
41
+ S = phase['pore.salinity']
42
+ except:
43
+ S = 0
44
+ TC = T-273.15
45
+ S=S/1000;
46
+ a1 = 1.5700386464E-01;a2 = 6.4992620050E+01;a3 = -9.1296496657E+01;a4 = 4.2844324477E-05;
47
+ mu_w = a4 + 1/(a1*(TC+a2)**2+a3)
48
+ a5 = 1.5409136040E+00;a6 = 1.9981117208E-02;a7 = -9.5203865864E-05
49
+ a8 = 7.9739318223E+00;a9 = -7.5614568881E-02;a10 = 4.7237011074E-04
50
+ A = a5 + a6*T + a7*T**2
51
+ B = a8 + a9*T + a10*T**2
52
+ mu_sw = mu_w*(1 + A*S + B*S**2)
53
+ value = mu_sw
54
+ return value
55
+
56
+ def reynolds(phase,uo,b,**kwargs):
57
+ r"""
58
+ Uses exponential model by Reynolds [1]_ for the temperature dependance of
59
+ shear viscosity
60
+
61
+ Parameters
62
+ ----------
63
+ u0, b : float, array_like
64
+ Coefficients of the viscosity exponential model (mu = u0*Exp(-b*T)
65
+ where T is the temperature in Kelvin
66
+
67
+ [1] Reynolds O. (1886). Phil Trans Royal Soc London, v. 177, p.157.
68
+
69
+ """
70
+ T = phase['pore.temperature']
71
+ value = uo*sp.exp(b*T)
72
+ return value
73
+
74
+ def chung(phase,MW='molecular_weight',Tc='critical_temperature',Vc='critical_volume',**kwargs):
75
+ r"""
76
+ Uses Chung et al. [2]_ model to estimate viscosity for gases with low pressure
77
+ (much less than the critical pressure) at conditions of interest
78
+
79
+ Parameters
80
+ ----------
81
+ Vc : float, array_like
82
+ Critical volume of the gas (m3/kmol)
83
+ Tc : float, array_like
84
+ Critical temperature of the gas (K)
85
+ MW : float, array_like
86
+ Molecular weight of the gas (kg/kmol)
87
+
88
+ [2] Chung, T.H., Lee, L.L., and Starling, K.E., Applications of Kinetic Gas
89
+ Theories and Multiparameter Correlation for Prediction of Dilute Gas
90
+ Viscosity and Thermal Conductivity”, Ind. Eng. Chem. Fundam.23:8, 1984.
91
+
92
+ """
93
+ T = phase['pore.temperature']
94
+ MW = phase['pore.'+MW]
95
+ Tc = phase['pore.'+Tc]
96
+ Vc = phase['pore.'+Vc]
97
+ Tr= T/Tc
98
+ Tstar = 1.2593*Tr
99
+ A = 1.161415; B = 0.14874; C = 0.52487; D = 0.77320; E = 2.16178; F = 2.43787
100
+ omega = (A*(Tstar)**(-B)) + C*(sp.exp(-D*Tstar)) + E*(sp.exp(-F*Tstar))
101
+ sigma=0.809*(Vc**(1/3))
102
+ value = 26.69E-9*sp.sqrt(MW*T)/(omega*sigma**2)
103
+ return value