In [1]:

```
from __future__ import division
from math import sqrt
# Given that
h=15 # Height of spur in cm
l= 50 # Length of cast in cm
w= 25 # weidth of cast in cm
h1= 15 # Height of cast in cm
g= 981 # Acceleration due to gravity in cm/sec**2
Ag= 5 # Cross sectional area of the grate in cm**2
v3= sqrt(2* g * h)
V = l*w*h1
tf1= V/(Ag*v3)
Am = l*w
tf2 = (Am/Ag)*(1/sqrt(2*g))*2*(sqrt(h) - sqrt(h-h1))
print "Filling time for first design = %0.2f sec, \nFilling time for second design = %0.2f sec"%(tf1, tf2)
```

In [2]:

```
from __future__ import division
from math import sqrt, pi
# Given that
h=15 # Height of spur in cm
l= 50 # Length of cast in cm
w= 25 # weidth of cast in cm
h1= 15 # Height of cast in cm
g= 981 # Acceleration due to gravity in cm/sec**2
Ag= 5 # Cross sectional area of the grate in cm**2
Dm = 7800 # Density of molten Fe in Kg/m**3
Neta = 0.00496 # Kinetic viscosity in Kg/m-sec
theta = 90 # Angle in degree
Eq = 25 # (L/D) Equivalent
v3= sqrt(2* g * h)*(10**(-2))
d= sqrt((Ag*4)/(pi))*(10**(-2))
Re = Dm*v3*d/Neta
f = 0.0791*(Re)**(-1/4)
L=0.12 # in meter
Cd= (1+0.45+4*f*((L/d)+Eq))**(-1/2)
v3_ = Cd*v3
Re_ = (v3_/v3)*(Re)
f_ = 0.0791 *(Re_)**(-1/4)
Cd_ = (1+0.46+4*f_*(L/d + Eq))**(-1/2)
v3__ = Cd_*v3
V = l*w*h1
tf= (V/(Ag*v3__))*(10**-2)
print "Filling time for first design = %0.1f sec. "% tf
```

In [3]:

```
from __future__ import division
from math import sqrt, pi
# Given that
Hi=1.2 # Initial height in m
H= 0.05 # Height in m
g= 9.81 # Acceleration due to gravity in m/sec**2
Dm = 2700 # Density of molten metal in Kg/m**3
Neta = 0.00273 # Kinetic viscosity in Kg/m-sec
d= 0.075 # Diameter in m
D = 1 # Internal diameter of ladle in m
v3= sqrt(2* g * Hi)
Re = Dm*v3*d/Neta
ef=0.075
Cd= (1+ef)**(-1/2)
ef_=0.82
Re_ = (2+ef_)**(-1/2)
v3_ = sqrt(2*g*H)
Re_ = Dm*v3_*d/Neta
At = (pi/4)*D**2
An = (pi/4)*d**2
Cd= 0.96
tf= (sqrt(2/g))*(At/An)*(1/Cd)*sqrt(Hi)
m = Dm*An*Cd*sqrt(2*g*Hi)
m_ = Dm*An*Cd*sqrt(2*g*Hi*0.25)
print """Time required to empty the ladle = %0.2f sec,
Discharge rate are -
Initially = %0.2f Kg/sec
When the ladle is 75 percent empty = %0.2f Kg/sec."""%(tf,m,m_)
```

In [4]:

```
from __future__ import division
from math import sqrt, pi
# Given that
thetaF= 1540 # Temperature of mould face in degree centigrade
Theta0 = 28 # Initial temperature of mould in Degree centigrade
L= 272e3 # Latent heat of liquid metal in J/Kg
Dm = 7850 # Density of liquid metal in Kg/m**3
c = 1.17e+3 #Specific heat of sand in J/Kg-K
k = 0.8655 # Conductivity of sand in W/m-K
D= 1600 # Density of sand in Kg/m**3
h = 0.1 # Height in m
b = 10 # Thickness of slab in cm
r =h/2# V/A in meter
lamda = (thetaF - Theta0)*(D*c)/(Dm*L)
Beta1 = 2*lamda/sqrt(pi)
Alpha = k /(D*c)
ts1 = r**2 /((Beta1**2)*Alpha)#In sec
ts1_=ts1/3600 # In hour
from sympy import symbols, solve
Beta= symbols("Beta")
p=Beta**2 - lamda*(2/sqrt(pi))*Beta -lamda/3
Beta2 = solve(p, Beta) # taking +ve value
print "Beta2 = %0.2f" %Beta2[1]
r1 = r/3
ts2 = (r1**2)/((1.75**2)*Alpha) # in sec
ts2_=ts2/3600#in Hour
print "Solidification time for slab-shaped casting = %0.3f hr,\nSolidification time for sphere = %0.3f hr"% (ts1_,ts2_)
# Answer in the textbook are not accurate.
```

In [5]:

```
from __future__ import division
from math import sqrt, pi, exp
# Given that
thetaF= 1540 # Temperature of mould face in degree centigrate
ThetaO = 28 # Initial temperature of mould in Degree centigrate
L= 272e3 # Latent heat of iron in J/Kg
Dm = 7850 # Density of iron in Kg/m**3
Cs = 0.67e+3 #Specific heat of iron in J/Kg-K
C = 0.376e3 #Specific heat of copper in J/Kg-K
Ks = 83 # Conductivity of iron in W/m-K
K = 398 # Conductivity of copper in W/m-K
D= 8960 # Density of copper in Kg/m**3
h = .1 # Height in m
zeta1=0.98#By solving eqauation- zeta*exp(zeta**2)*erf(zeta)=((thetaF-thetaO)*Cs)/(sqrt(pi)*L), zeta = 0.98
AlphaS = Ks /(Dm*Cs)
ts1 = h**2 / (16*(zeta1**2) * AlphaS)#In sec
ts1_=ts1/3600 # In hour
Phi = sqrt((Ks*Dm*Cs)/(K*D*C))
zeta2=0.815#By solving eqauation- zeta*exp(zeta**2)*(erf(zeta)+Phi)=((thetaF-thetaO)*Cs)/(sqrt(pi)*L), zeta = 0.815
ts2 = h**2 / (16*(zeta2**2) * AlphaS)#In sec
ts2_=ts2/3600 # In hour
erf = lambda zeta2:(thetaF-Theta0)*Cs/L/sqrt(pi)
thetaS= thetaF+(thetaF-(L*(sqrt(pi))*zeta2*(exp(zeta2**2))*erf(zeta2))/Cs)
print """Solidification time for slab-shaped casting when the casting is done in a water cooled copper mould = %0.4f hr,
Solidification time for slab-shaped casting when the casting is done in a very thick copper mould = %0.4f hr,
The surface temperature of the mould = %0.1f° C"""% (ts1_,ts2_,thetaS)
```

In [6]:

```
from __future__ import division
from math import sqrt, pi, exp
# Given that
thetaF= 1540 # Temperature of mould face in degree centigrade
thetaO = 28 # Initial temperature of mould in Degree centigrade
L= 272e3 # Latent heat of iron in J/Kg
Dm = 7850 # Density of iron in Kg/m**3
Cs = 0.67e+3 #Specific heat of iron in J/Kg-K
C = 0.376e3 #Specific heat of copper in J/Kg-K
Ks = 83 # Conductivity of iron in W/m-K
K = 398 # Conductivity of copper in W/m-K
D= 8960 # Density of copper in Kg/m**3
h = .1 # Height in m
hF = 1420 # Total heat transfer coefficient across the casting-mould interface in W/m**2-°C
AlphaS = K /(D*C)
thetaS = 982 #In °C as in example 2.6
h1= (1+(sqrt((Ks*Dm*Cs)/(K*D*C))))*hF
a = 1/2 + (sqrt((1/4)+Cs*(thetaF-thetaS)/(3*L)))
delta=h/2
ts = (delta+((h1*delta**2)/(2*Ks)))/((h1*(thetaF-thetaS))/(Dm*L*a)) # in sec
ts_ = ts/3600 # in hours
h2= (1+(sqrt((K*D*C)/(Ks*Dm*Cs))))*hF
gama= ((h2**2)/(K**2))*AlphaS*ts
thetaS_ = thetaO + (thetaS-thetaO)*(1-((exp(gama))*(1-(erf(sqrt(gama))))))
print "Solidification time = %0.4f hr,\nThe surface temperature of the mould = %0.2f ° C"%(ts_,thetaS_)
# The value of the surface temperature of the mould in the book is given as 658.1° C, Which is wrong.
```

In [7]:

```
# Given that
A= 60*7.5 # Cross sectional area in cm**2
v=0.05 # Withdrawal rate in m/sec
t = 0.0125 # Thickness in m
thetaF= 1500 # Temperature of mould face in degree centigrate
thetaP = 1550 #
thetaO = 20 # Initial temperature of mould in Degree centigrate
L= 268e3 # Latent heat of molten metal in J/Kg
Dm = 7680 # Density of molten metal in Kg/m**3
Cs = 0.67e+3 #Specific heat of molten metal in J/Kg-K
Cm = 0.755e3 #Specific heat of mould in J/Kg-K
Ks = 76 # Conductivity of molten metal in W/m-K
hF = 1420 # Heat transfer coefficient at the casting-mould interface in W/m**2-°C
Dtheta = 10 # Maximum temperature of cooling water in ° C
L_ = L+Cm*(thetaP-thetaF)
x=L_ / (Cs*(thetaF-thetaO))
y= hF*t/Ks
print "L_/(Cs(thetaF-thetaO))=%0.2f,\nhF*t/Ks=%0.2f"%(x,y)
z=0.11 # Where z=hF**2 * lm / (v*Ks*Dm*Cs)
lm= (z*v*Ks*Dm*Cs)/(hF**2)
Z=0.28 # Where Z=Q/(lm*(thetaF-thetaO)*sqrt(lm*v*Dm*Cs*Ks))
Q = Z*lm*(thetaF-thetaO)*sqrt(lm*v*Dm*Cs*Ks)
m = Q / (4.2e3*Dtheta)
print "The mould length = %0.2f meter,\nThe cooling water requirement = %0.2f Kg/sec"%(lm,m)
# Answer for The cooling water requirement in the book is given as 5.05 Kg/sec, Which is wrong.
```

In [8]:

```
from math import floor
# Given that
a = 15 # Side of the aluminium cube in cm
Sh = 0.065 # Volume shrinkage of aluminium during solidification
Vc = a**3
Vr = 3*Sh*Vc
h = ((4*Vr)/pi)**(1/3)
Rr = 6/h # Where Rr= (A/V)r
Rc = 6/a # Where Rc = (A/V)c
print "(A/V)r=%f, (A/V)c=%.1f\nHence Rr is greater than Rc"%(Rr,Rc)
dmin = 6/Rc
Vr_ = (pi/4)*dmin**3
print """With minimum value of d Vr=%d cm**3 .
This valume is much more than the minimum Vr necessary.
Let us now consider the top riser when the optimum cylindrical shape is obtained with h=d/2
and again (A/V)r = 6/d. However, with a large top riser,
the cube loses its top surface for the purpose of heat dissipation."""%Vr_
Rc_ = 5/a
dmin_=6/Rc_
print "d should be greater than or equal to %d cm"%dmin_
Vr__ = (pi/4)*dmin_**2 *floor(h)
print "The riser volume with minimum diameter is %d cm**3"%Vr__
```