GasFill_times.py 2.35 KB
Newer Older
Matthew Partridge's avatar
Matthew Partridge committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3

"""GasFill_times.py """

__author__  = "Matthew Partridge"
__copyright__   = "Copyright 2018, University of Southampton"
__license__ = "GPL"
__version__ = "0.1"

"""Based on equations from "Analytical modeling of the gas-filling dynamics in photonic crystal fibers"""

#Pacakges
import numpy

15
#Gas fill times function
Matthew Partridge's avatar
Matthew Partridge committed
16
17
def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
	
18
19
	boltzmann = 1.38064852e-23

Matthew Partridge's avatar
Matthew Partridge committed
20
21
22
23
24
25
26
	#varable scale fixing
	rad_tube = dia_tube/2 #(mm)
	P = P*100 #(PA) average pressure inside capillary
	Pav = P * 2/3 #(mbar) average pressure inside capillary
	dia_tube = dia_tube / 1000 #(m)
	rad_tube = rad_tube / 1000 #(m)
	temp = temp + 273.15 #(K)
27
	dia_mol = 359.99 / 1000000000000 #(m)
Matthew Partridge's avatar
Matthew Partridge committed
28
29
30
31
	mW = 26.04 / 1000 #(kg/mol)
	mM = mW / 6.02214e23 #(kg)

	#Knudsen number ---------------
32
	lamda = boltzmann*temp / (numpy.sqrt(2)*numpy.pi*Pav*numpy.power(dia_mol,2)) #from "Analytical modeling of the gas-filling dynamics in photonic crystal fibers"
Matthew Partridge's avatar
Matthew Partridge committed
33
34
35
36
37
38
39

	#Kn = lamda/(Pav*dia_tube) #from "Flow of gases through tubes and orifices" where lamda = 0.066 for air at 20 deg
	Kn = lamda/rad_tube #from others
	print ("Knudsen number: "+str(round(Kn,3))+" ("+("Molecular flow" if Kn > 0.5 else "Knudsen flow" if Kn > 0.01 else "Viscous flow")+")")


	#Diffusion coefficent ---------------
40
	mol_vel =  numpy.sqrt((8*boltzmann*temp)/(numpy.pi*mM)) #mean molecular velocity
Matthew Partridge's avatar
Matthew Partridge committed
41
42
43
44
45
46
47
48
49
	viscosity = (mol_vel*mM)/(2*numpy.sqrt(2)*numpy.pi*numpy.power(dia_mol,2))
	print ("Viscosity: "+ str(round(viscosity,3)))

	ZKn = ((1+2.507/Kn)/(1+3.095/Kn))
	diff_coeff = ((numpy.power(rad_tube,2)*Pav) / (8*viscosity)) + (ZKn * 2/3 * rad_tube * mol_vel)
	print ("Diffusion coefficent: "+ str(round(diff_coeff*10000,3))+ " (cm2/s)")

	#Fill time  ---------------
	squigle = 2
50
	Ppercent = 1 #percent ratio
Matthew Partridge's avatar
Matthew Partridge committed
51
52
53
54
55
56
57
58
59
60
61
	Pred = P/100*Ppercent
	Pratio = P/(P-Pred)
	t_fill = (numpy.power((squigle*len_tube),2) / (numpy.power(numpy.pi,2)*diff_coeff))*numpy.log((numpy.power(numpy.pi,2)/8)*Pratio)

	print ("Fill time: "+str(round(t_fill/60))+" (mins)")
	return t_fill


if __name__ == '__main__':

    #fiber variables
62
63
64
    dia_tube = 0.0005 #(mm) capillary diameter
    len_tube = 2 #(m)
    
Matthew Partridge's avatar
Matthew Partridge committed
65
    #gas variables
66
    P = 3.5 #(mbar) average pressure inside capillary
Matthew Partridge's avatar
Matthew Partridge committed
67
68
    mW = 26.04 #(g/mol)
    temp = 21 #(degC) Temperature of system
69
    dia_mol = 359.99 #(pm) diameter of gas molecule
Matthew Partridge's avatar
Matthew Partridge committed
70
71
72
    
    filltime(dia_tube,len_tube,P,mW,temp,dia_mol)