import math
# Variables
k = 10.**6;
Kag_a = 0.01 #mol/hr. m**3. Pa
fl = 0.98;
Kal = 1.;
HA = 10.**5; # very low solubility
DAl = 10.**-6;
DBl = DAl;
PA = 5*10.**3 #Pa
CB = 100. #mol/m3
b = 2.
a = 20. #m2/m3
# Calculations
Mh = math.sqrt(DAl*k*CB*CB)/Kal;
Ei = 1+(DBl*CB*HA/(b*DAl*PA));
E = 100.
print " Part a"
res_total = (((1/(Kag_a))+(HA/(Kal*a*E))+(HA/(k*CB*CB*fl)))) #Total Resismath.tance
f_gas = (1/(Kag_a))/res_total; #fraction of resismath.tance in gas film
f_liq = (HA/(Kal*a*E))/res_total; #fraction of resismath.tance in liquid film
# Results
print " Fraction of the resistance in the gas film is %f"%(f_gas)
print " Fraction of the resistance in the liquid film is %f"%(f_liq)
print " Part b"
print " The reaction zone is in the liquid film"
print " Part c"
if Ei>5*Mh:
print " We have pseudo 1st order reaction in the film"
rA = PA/(((1/(Kag_a))+(HA/(Kal*a*E))+(HA/(k*CB*CB*fl))));
print " Part d"
print " The rate of reactionmol/m3.hr) is %f"%(rA)