import math
# Variables
l = 1.5*10**-6; #crack length in m
e = 70*10**9; #Young's modulous in N/m**2
y_e = 1.05; #specific surface energy in j/m**2
# Calculations
a_f = math.sqrt((2*y_e*e)/(3.14*l));
a_f1 = a_f*10**-6; #in MPa
r = a_f/e; #ratio
# Results
print "Fracture strength (in MPa) = %.2f"%a_f1
print "Ratio of fracture strength to Youngs modulous = %.2e"%r
import math
#Variables
m_m = 58.71; #molecular weight of ni
m_c = 74.71; #molecular weight of nio
p_m = 8900; #density of ni in kg/m**3
p_c = 7080; #desity of nio in kg/m**3
#Calculations & Reults
x = m_m/p_m; #molar volume of ni in m**3/mol
print "Mc/Pc (in m**3/mol) %.2e m**3/mol"%x
y = m_c/p_c; #molar volume of nio in m**3/mol
print "Mm/Pm (in m**3/mol) %.2e m**3/mol"%y
print " Mc/Pc > Mm/Pm Hence protective layer of NiO will form over Ni ";
import math
# Variables
x1 = 0.1; #in mm
t1 = 25.; #in hours
t2 = 300.; #in hours
# Calculations
x2 = x1*math.sqrt(t2/t1); #in mm
# Results
print "Oxidation loss in 300 hours (in mm) = %.3f mm"%x2
# Variables
p_mg = 1.74; #density of magnesium in gm/cm**3
p_mgo = 3.65; #density of magnesium oxide in gm/cm**3
m_mg = 24.; #mol wt ogf mg
m_mgo = 40.3; #mol wt of mgo
# Calculations
PBR = (m_mgo/p_mgo)/(m_mg/p_mg);
# Results
print "PBR = %.2f"%PBR
print "Since PBR < 1. So porous film will form which will be non protective";
# Variables
m = 0.0243; #one mole of magnesium in kg
# Calculations
c = 2.*96490; #in C
j = 20.*10**-3; #in A/m**2
t = 15.*365*24*3600; #in sec
x = j*t; #in A s
w_mg = m*x/c; #in kg/sqm
# Results
print "Amount of Magnesium needed (in Kg/m**2) = %.2f kg/m**2"%w_mg