In [1]:

```
# Variables
# Basis : 1 min
d_w = 1.0 ; # Density of aqueous solution-[g/cubic metre]
d_sol = 0.6 ; # Density of organic solvent-[g/cubic metre]
n_un = 8 ; # Number of unknowns in the given problem
n_ie = 8 ; # Number of independent equations
# Calculation and Results
d_o_f = n_un-n_ie ; # Number of degree of freedom
print 'Number of degree of freedom for the given system is %i .'%d_o_f
# Material balance of Strep.
x = (200*10+10*0-200*0.2)/10; #[g]
print 'Strep per litre of solvent is %.1f g .'%x
cnc = x/(1000*d_sol) ; #[g Strep/g of S]
print 'Strep per gram of solvent is %.4f g Strep/g of S .'%cnc
m_fr = cnc/(1+cnc) ; #Mass fraction
print 'Mass fraction of Strep is %.3f g .'%m_fr
```

In [2]:

```
# Variables
F_O2 = 0.21 ; # fraction of O2 in feed(F)
F_N2 = 0.79 ; # fraction of N2 in feed(F)
P_O2 = 0.25 ; # fraction of O2 in product(P)
P_N2 = 0.75 ; # fraction of N2 in product(P)
F = 100 ; # Feed - [g mol]
w = 0.80 ; # Fraction of waste
W = w*F ; # Waste -[g mol]
# Calculation
# By analysis for degree of freedom , DOF comes to be zero
P = F - W ; # By overall balance - [g mol]
W_O2 = (F_O2*F - P*P_O2)/100 # Fraction of O2 in waste stream by O2 balance
W_N2 = (W - W_O2*100)/100 ; #Fraction of N2 in waste stream
# Results
print 'Composition of Waste Stream'
print ' Component Fraction in waste stream'
print ' O2 %.2f'%W_O2
print ' N2 %.2f'%W_N2
```

In [3]:

```
# Variables
# Basis : 1 hr so F = 1000 kg
F = 1000 ; # feed rate-[kg/hr]
P = F/10.0 ; # product mass flow rate -[kg/hr]
n_un = 9 ; # Number of unknowns in the given problem
n_ie = 9 ; # Number of independent equations
# Calculation and Result
d_o_f = n_un-n_ie ; # Number of degree of freedom
print 'Number of degree of freedom for the given system is %i .'%d_o_f
# Overall mass balance: F = P+B
B = F-P ; # bottom mass flow rate -[kg/hr]
print ' Bottom mass flow rate - %.1f kg '%B
# Composition of bottoms by material balances
m_EtOH = 0.1*F-0.6*P ; # By EtOH balance-[kg]
m_H2O = 0.9*F - 0.4*P ; # By H2O balance-[kg]
total = m_EtOH+m_H2O ; #[kg]
f_EtOH = m_EtOH/total ; # Mass fraction of EtOH
f_H2O = m_H2O/total ; # Mass fraction of H2O
print ' Mass of EtOH in bottom - %.1f kg '%m_EtOH
print ' Mass of H2O in bottom - %.1f kg '%m_H2O
print ' Mass fraction of EtOH in bottom - %.3f '%f_EtOH
print ' Mass fraction of H2O in bottom - %.3f '%f_H2O
```

In [4]:

```
from numpy import matrix
# Variables
# Given
A = 200 ; # Mass of added solution [kg]
P_H2SO4 = .1863 ; #Fraction of H2SO4 in P(Final solution)
P_H2O = .8137 ; #Fraction of H2O in P(Final solution)
A_H2SO4 = .777 ; #Fraction of H2SO4 in A(Added solution)
A_H2O = .223 ; #Fraction of H2O in A(Added solution)
F_H2SO4 = .1243 ; #Fraction of H2SO4 in F(Original solution)
F_H2O = .8757 ; #Fraction of H2O in F(Original solution)
# Calculations
# P - F = A - By overall balance
a = matrix([[P_H2O,-F_H2O],[1,-1]]) ; # Matrix of coefficient
b = matrix([[A*A_H2O],[A]]) ; # Matrix of contants
a = a.I
x = a*b ; # Matrix of solutions- P = x(1) and F = x(2)
#Results
print ' Original solution taken- %.0i kg'%x[1]
print ' Final solution or kilograms of battery acid formed- %.0i kg'%x[0]
```

In [6]:

```
from numpy import matrix
# Variables
# Given
W = 100.0 ; # Water removed - [kg]
A_H2O = 0.80 ; # Fraction of water in A(intial fish cake)
A_BDC = 0.20 ; # Fraction of BDC(bone dry cake) in B(final dry fish cake)
B_H2O = 0.40 ; # Fraction of water in A(intial fish cake)
B_BDC = 0.60 ; # Fraction of BDC(bone dry cake) in B(final dry fish cake)
# Calculations
a = matrix([[A_H2O, -B_H2O],[1, -1]]) ; # Matrix of coefficient
b = matrix([[W],[W]]) ; # Matrix of contants
a = a.I
x = a * b; # Matrix of solutions- A = x(1) and B = x(2)
# Results
print 'Weight of the fish cake originally put into dryer -%.0i kg'%x[0]
```

In [7]:

```
# Variables
# Composition of initial solution at 30 degree C
s_30 = 38.8 ; # solublity of Na2CO3 at 30 degree C, by using the table for solublity of Na2CO3-[g Na2CO3/100 g H2O]
If_Na2CO3 = s_30/(s_30+100) ; # Initial mass fraction of Na2CO3
If_H2O = 1-If_Na2CO3 ; # Initial mass fraction of H2O
# Composition of crystals
# Basis : 1g mol Na2CO3.10H2O
n_mol_Na2CO3 = 1 ; # Number of moles of Na2CO3
n_mol_H2O = 10. ; # Number of moles of H2O
mwt_Na2CO3 = 106. ; # mol. wt of Na2CO3
mwt_H2O = 18. ; # mol. wt of H2O
# Calculation and Results
m_Na2CO3 = mwt_Na2CO3*n_mol_Na2CO3 ; # Mass of Na2CO3
m_H2O = mwt_H2O*n_mol_H2O ; # Mass of H2O
Cf_Na2CO3 = m_Na2CO3/(m_Na2CO3+m_H2O) ; # mass fraction of Na2CO3
Cf_H2O = 1-Cf_Na2CO3 ; # mass fraction of H2O
n_un = 9. ; # Number of unknowns in the given problem
n_ie = 9. ; # Number of independent equations
d_o_f = n_un-n_ie ; # Number of degree of freedom
print 'Number of degree of freedom for the given system is %i .'%d_o_f
# Final composition of tank
#Basis :I = 10000 kg
# Material balance reduces to Accumulation = final -initial = in-out(but in = 0)
I = 10000. ; #initial amount of saturated solution-[kg]
amt_C = 3000. ; # Amount of crystals formed-[kg]
Fm_Na2CO3 = I*If_Na2CO3-amt_C*Cf_Na2CO3 ; # Mass balance of Na2CO3
Fm_H2O = I*If_H2O-amt_C*Cf_H2O ; # Mass balance of H2O
#To find temperature,T
s_T = (Fm_Na2CO3/Fm_H2O)*100 ; # Solublity of Na2CO3 at temperature T
s_20 = 21.5 ; #Solublity of Na2CO3 at temperature 20 degree C ,from given table-[g Na2CO3/100 g H2O]
# Find T by interpolation
T = 30-((s_30-s_T)/(s_30-s_20))*(30-20) ; # Temperature -[degree C]
print ' Temperature to which solution has to be cooled to get 3000 kg crystals is %.0f degree C .'%T
```

In [8]:

```
# Variables
# Write given data
B_in = 1.1 ; # Flow rate in of blood -[L/min]
B_out = 1.2; # Flow rate out of blood -[L/min]
S_in = 1.7; # Flow rate in of solution -[L/min]
# Composition of input blood
B_in_CR = 2.72 ; #[g/L]
B_in_UR = 1.16 ; #[g/L]
B_in_U = 18 ; #[g/L]
B_in_P = 0.77 ; #[g/L]
B_in_K = 5.77 ; #[g/L]
B_in_Na = 13.0 ; #[g/L]
B_in_water = 1100 ; #[mL/min]
# Composition of output blood
B_out_CR = 0.120 ; #[g/L]
B_out_UR = 0.060; #[g/L]
B_out_U = 1.51 ; #[g/L]
B_out_P = 0.040 ; #[g/L]
B_out_K = 0.120 ; #[g/L]
B_out_Na = 3.21 ; #[g/L]
B_out_water = 1200. ; #[mL/min]
# Calculation and Result
n_un = 7. ; # Number of unknowns in the given problem
n_ie = 7. ; # Number of independent equations
d_o_f = n_un-n_ie ; # Number of degree of freedom
print 'Number of degree of freedom for the given system is %i .'%d_o_f
# Water balance in grams, assuming 1 ml is equivalent to 1 g
S_in_water = 1700. ; #[ml/min]
S_out_water = B_in_water+ S_in_water - B_out_water;
S_out = S_out_water/1000. ; #[L/min]
print ' Flow rate of water in output solution is %.2f L/min.'%S_out
# The component balance in grams for CR,UR,U,P,K and Na are
S_out_CR = (B_in*B_in_CR - B_out*B_out_CR)/S_out;
S_out_UR = (B_in*B_in_UR - B_out*B_out_UR)/S_out;
S_out_U = (B_in*B_in_U - B_out*B_out_U)/S_out;
S_out_P = (B_in*B_in_P - B_out*B_out_P)/S_out;
S_out_K = (B_in*B_in_K - B_out*B_out_K)/S_out;
S_out_Na = (B_in*B_in_Na - B_out*B_out_Na)/S_out;
print ' Component Concentration(g/L) in output Dialysis solution '
print ' UR %.2f '%S_out_UR
print ' CR %.2f '%S_out_CR
print ' U %.2f '%S_out_U
print ' P %.2f '%S_out_P
print ' K %.2f '%S_out_K
print ' Na %.2f '%S_out_Na
```

In [ ]:

```
```