Breaking News

Casagrande Plasticity Chart by Python

 The Casagrande Plasticity Chart is widely used to distinguish between the cohesion silts and clays. A little attempt is to do this chart with codes in python plotting with graphical representation. It's not a great deal. But hope some portions of you will enjoy it! U+1F60E

The Code is as follows:

# Made by Arafat
"""
This program is built to classify Cohesion soil (Silts and Clays)
according to the Casagrande Plasticity Chart.

Module is already set-up to do the Casagrande Plasticity Chart
using the Liquid limit and the Plastic chart of the soil
as well, but the equations of AL and UL won't go beyond Liquid
Limit value. Sorry!
I'm Lazy Dude! U+1F92A .

Visit my blog: arafatopu.blogspot.com

"""
from matplotlib import pyplot as plt
import numpy as np


LL = float(input("Enter the Liquid Limit of the soil, LL: "))
# Liquid Limit of Soil
PL = float(input("Enter the Plastic Limit of the soil, PL: "))
# PLastic Limit of Soil

PI = LL - PL
# Plasticity Index of Soil
l = np.linspace(0, LL , 1000)
X = []
Aline = []
# A-line of the Casagrande Plasticity Chart
Uline = []
# U-line of the Casagrande Plasticity Chart

for LL in l:
AL = 0.73 * (LL - 20)
UL = 0.90 * (LL - 8)
# AL: A line in the Casagrande Plasticity Chart
Aline.append(AL)
X.append(LL)
Uline.append(UL)

if ((PI>=4 and PI <=7) and LL <= 35) and (PI < UL and PI >AL) :
plt.plot(LL,PI,'o', color='red')
print("Inorganic Clay of Low Plasticity \n")
print("Soil Class is: CL-ML \n")
elif (PI <=4 and LL <= 35) and (PI < AL ) :
plt.plot(LL,PI, 'o', color='red')
print("Inorganic Silts of Low Compressibility \n")
print("Soil Class is: ML \n")
elif (PI >=7 and LL <= 35) and (PI < UL and PI >AL) :
plt.plot(LL,PI, 'o', color='red')
print("Inorganic Clay of Low Plasticity \n")
print("Soil Class is: CL \n")
elif (LL > 35 and LL <= 50) and (PI < AL) :
plt.plot(LL,PI, 'o',color='red')
print("Inorganic Silts of Medium Compressibility and Organic Silts \n")
print("Soil Class is: ML \n")
elif (LL > 35 and LL <= 50) and (PI > AL and PI < UL) :
plt.plot(LL,PI, 'o', color='red')
print("Inorganic Clay of Medium Plasticity \n")
print("Soil Class is: CL \n")
elif (LL > 50 ) and (PI < AL) :
plt.plot(LL,PI, 'o', color='red')
print("Inorganic Silts of High Compressibility and Organic Clays \n")
print("Soil Class is: MH \n")
elif (LL > 50) and (PI > AL and PI < UL) :
plt.plot(LL,PI, color='red')
print("Inorganic Clay of High Plasticity \n")
print("Soil Class is: CH \n")
elif (PI > UL) :
plt.plot(LL, PI, 'o', color='red')
print("Cohesionless Soil \n")


plt.plot(X, Aline, c='blue')
plt.plot(X, Uline, c='red')
ax = plt.subplot(1, 1, 1)
ax.plot(LL, PI)
ax.set_ylim(bottom=0.)
plt.plot([0, LL], [0, 0], c='black')
plt.axvline(x=35, linestyle = 'dotted')
plt.axvline(x=50, linestyle = 'dotted')
plt.title("Casagrande Plasticity Chart")
plt.xlabel("Liquid Limit of Soil")
plt.ylabel("Plastic Limit of Soil")
plt.show()

No comments