Skip to content
Snippets Groups Projects
Commit 8927db13 authored by Matthew Partridge's avatar Matthew Partridge
Browse files

Optimised the python scripts to remove some unnecessary packages

parent 25aec403
No related branches found
No related tags found
No related merge requests found
...@@ -9,9 +9,7 @@ __version__ = "1.0" ...@@ -9,9 +9,7 @@ __version__ = "1.0"
#Packages #Packages
import numpy import numpy
import math from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QPushButton, QLabel, QApplication, QGridLayout, QFileDialog, QLineEdit, QGroupBox, QVBoxLayout)
from scipy import constants
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QPushButton, QLabel, QApplication, QGridLayout, QCheckBox, QRadioButton, QFileDialog, QLineEdit, QSlider, QGroupBox, QVBoxLayout)
from PyQt5.QtGui import (QPixmap, QIntValidator, QDoubleValidator, QPalette) from PyQt5.QtGui import (QPixmap, QIntValidator, QDoubleValidator, QPalette)
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
import sys import sys
...@@ -19,8 +17,9 @@ import GasFill_times ...@@ -19,8 +17,9 @@ import GasFill_times
#fiber variables #fiber variables
dia_tube = 0.02 #(mm) capillary diameter dia_tube = 0.20 #(mm) capillary diameter
len_tube = 2.7 #(m) len_tube = 2.7 #(m)
#gas variables #gas variables
P = 10 #(mbar) average pressure inside capillary P = 10 #(mbar) average pressure inside capillary
mW = 28.97 #(g/mol) mW = 28.97 #(g/mol)
......
...@@ -11,12 +11,12 @@ __version__ = "0.1" ...@@ -11,12 +11,12 @@ __version__ = "0.1"
#Pacakges #Pacakges
import numpy import numpy
import math
import fluids
from scipy import constants
#Gas fill times function
def filltime (dia_tube,len_tube,P,mW,temp,dia_mol): def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
boltzmann = 1.38064852e-23
#varable scale fixing #varable scale fixing
rad_tube = dia_tube/2 #(mm) rad_tube = dia_tube/2 #(mm)
P = P*100 #(PA) average pressure inside capillary P = P*100 #(PA) average pressure inside capillary
...@@ -29,7 +29,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol): ...@@ -29,7 +29,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
mM = mW / 6.02214e23 #(kg) mM = mW / 6.02214e23 #(kg)
#Knudsen number --------------- #Knudsen number ---------------
lamda = constants.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" 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"
#Kn = lamda/(Pav*dia_tube) #from "Flow of gases through tubes and orifices" where lamda = 0.066 for air at 20 deg #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 Kn = lamda/rad_tube #from others
...@@ -37,7 +37,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol): ...@@ -37,7 +37,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
#Diffusion coefficent --------------- #Diffusion coefficent ---------------
mol_vel = numpy.sqrt((8*constants.Boltzmann*temp)/(numpy.pi*mM)) #mean molecular velocity mol_vel = numpy.sqrt((8*boltzmann*temp)/(numpy.pi*mM)) #mean molecular velocity
viscosity = (mol_vel*mM)/(2*numpy.sqrt(2)*numpy.pi*numpy.power(dia_mol,2)) viscosity = (mol_vel*mM)/(2*numpy.sqrt(2)*numpy.pi*numpy.power(dia_mol,2))
print ("Viscosity: "+ str(round(viscosity,3))) print ("Viscosity: "+ str(round(viscosity,3)))
...@@ -47,7 +47,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol): ...@@ -47,7 +47,7 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
#Fill time --------------- #Fill time ---------------
squigle = 2 squigle = 2
Ppercent = 85 #percent ratio Ppercent = 1 #percent ratio
Pred = P/100*Ppercent Pred = P/100*Ppercent
Pratio = P/(P-Pred) 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) t_fill = (numpy.power((squigle*len_tube),2) / (numpy.power(numpy.pi,2)*diff_coeff))*numpy.log((numpy.power(numpy.pi,2)/8)*Pratio)
...@@ -57,17 +57,16 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol): ...@@ -57,17 +57,16 @@ def filltime (dia_tube,len_tube,P,mW,temp,dia_mol):
if __name__ == '__main__': if __name__ == '__main__':
#Variables ---------------
#fiber variables #fiber variables
dia_tube = 0.02 #(mm) capillary diameter dia_tube = 0.0005 #(mm) capillary diameter
len_tube = 2.7 #(m) len_tube = 2 #(m)
#gas variables #gas variables
P = 10 #(mbar) average pressure inside capillary P = 3.5 #(mbar) average pressure inside capillary
mW = 26.04 #(g/mol) mW = 26.04 #(g/mol)
temp = 21 #(degC) Temperature of system temp = 21 #(degC) Temperature of system
dia_mol = 359.99 #(pm) diameter of gas molecule dia_mol = 359.99 #(pm) diameter of gas molecule
# execute only if run as the entry point into the program
filltime(dia_tube,len_tube,P,mW,temp,dia_mol) filltime(dia_tube,len_tube,P,mW,temp,dia_mol)
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment