Skip to content

Commit 20cc9b9

Browse files
author
Robert DeJaco
committed
Fix units for molecular diffusivity
- get reasonable results
1 parent 25891d9 commit 20cc9b9

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

examples/methane_hydrogen_porous_media/input.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
void_fraction, ,0.35
2-
d_pore, ,5e-10
2+
d_pore, ,1e-08
33
molecular_weight, ,None
4-
tortuosity, ,2.0
4+
tortuosity, ,1.5
55
R, ,8.314
66
molecular_weight_i, ,
77
,CH4,16.043
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CH4,H2,effective_macropore_i [m^2/s],1.015327e-10
2-
CH4,H2,knudsen_i [m^2/s],5.803363e-10
3-
CH4,H2,molecular_ij [m^2/s],2.220814e-11
4-
H2,CH4,effective_macropore_i [m^2/s],2.862856e-10
5-
H2,CH4,knudsen_i [m^2/s],1.637108e-09
6-
H2,CH4,molecular_ij [m^2/s],2.220814e-11
1+
CH4,H2,effective_macropore_i [m^2/s],1.133559e-07
2+
CH4,H2,knudsen_i [m^2/s],4.893825e-07
3+
CH4,H2,molecular_ij [m^2/s],6.657146e-05
4+
H2,CH4,effective_macropore_i [m^2/s],3.155794e-07
5+
H2,CH4,knudsen_i [m^2/s],1.380530e-06
6+
H2,CH4,molecular_ij [m^2/s],6.657146e-05

examples/methane_hydrogen_porous_media/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def main():
55
from porous_media.parameters import FluidMixture
6-
void_fraction, d_pore, tortuosity = 0.35, 0.5e-9, 2.
6+
void_fraction, d_pore, tortuosity = 0.35, 1.e-8, 1.5
77
names = ['CH4', 'H2'] # must match what in parameter file!
88
molecular_weights = [12.011+1.008*4, 1.008*2]
99
from raw_data.read_data import get_LJ_params, read_csv

porous_media/parameters.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class PureFluid:
66
def __init__(self, void_fraction, d_pore, tortuosity, molecular_weight=None):
77
"""
88
9-
:param molecular_weight: molecular weight [kg/mol] for each component
9+
:param molecular_weight: molecular weight [g/mol] for each component
1010
:param void_fraction: void fraction of porous media
1111
:param d_pore: nominal pore diameter [meters]
1212
:param tortuosity: tortuosity of porous media
@@ -29,7 +29,8 @@ def knudsen(self, T):
2929
:param i: component name
3030
:return: Knudsen diffusivity m^2/s
3131
"""
32-
return self.void_fraction*self.d_pore/self.tortuosity/3.*math.sqrt(8*self.R*T/math.pi/self.molecular_weight)
32+
MW = self.molecular_weight/1000. # convert to kg/mol
33+
return self.void_fraction*self.d_pore/self.tortuosity/3.*math.sqrt(8*self.R*T/math.pi/MW)
3334

3435
def write_params(self, file_name):
3536
with open(file_name, 'w') as f:
@@ -116,34 +117,31 @@ def omega_ij(self, w):
116117
def molecular_ij(self, i, j, T, P):
117118
"""Molecular diffusivites estimated by Chapman-Enskog
118119
120+
Units:
121+
* sqrt term leads to m/s as knudsen
122+
prefactor:
123+
m^3*Pa/mol/K*K/Pa/m/m*mol/molec [=] m
124+
119125
:param i: sorbate i name
120126
:param j: sorbate j name
121127
:param T: temperature in K
122-
:param P: pressure in atm
128+
:param P: pressure in Pa
123129
:return: binary diffusion coefficient (m^2/s)
124130
"""
125131

126-
# convert molecular weights to g/mol to apply formula
127-
M_i = self.molecular_weight_i[i]*1000.
128-
M_j = self.molecular_weight_i[j]*1000.
132+
M_i = self.molecular_weight_i[i]/1000. # convert to kg/mol
133+
M_j = self.molecular_weight_i[j]/1000. # convert to kg/mol
134+
o_ij = self.sigma_ij_rule(i, j)*1e-10
135+
N_av = 6.022e23
129136

130-
return 1.858e-3 * math.sqrt(T*T*T * (1. / M_i + 1. / M_j)) / (
131-
P * self.sigma_ij_rule(i, j) * self.sigma_ij_rule(i, j) *
132-
self.omega_ij(T / self.epsilon_ij_rule(i, j))
133-
)/100./100.
137+
return 3.*self.R*T/P/8/o_ij/o_ij/N_av*math.sqrt(self.R*T/2./math.pi*(1./M_i + 1./M_j))
134138

135-
def effective_macropore_i(self, i, j, temperature, pressure):
139+
def effective_macropore_i(self, *args):
136140
"""
137-
138-
:param temperature: temperature in K
139-
:param pressure: pressure in Pa
140-
:param i: component i name
141-
:param j: other_component name
142141
:return: effective macropore diffusivity m^2/s
143142
"""
144-
P_atm = pressure/101325.
145143
return self.void_fraction/self.tortuosity/(
146-
1. / self.molecular_ij(i, j, temperature, P_atm) + 1. / self.knudsen_i(i, j, temperature, pressure)
144+
1. / self.molecular_ij(*args) + 1. / self.knudsen_i(*args)
147145
)
148146

149147
def write_calculations(self, output_file, temperature, pressure):

0 commit comments

Comments
 (0)