paint-brush
Using Python in Geotechnical Engineeringby@kamalsamaila
2,162 reads
2,162 reads

Using Python in Geotechnical Engineering

by Kamal samailaMay 11th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In this article, we are going to learn how to start learning Python programming in the field of geotechnical engineering. We will be validating our hand calculation of bulk unit weight, dry unit weight and effective unit weight of soil using a Python library called Groundhog.
featured image - Using Python in Geotechnical Engineering
Kamal samaila HackerNoon profile picture

In this article, we are going to learn how to start learning Python programming in the field of geotechnical engineering. We will be validating our hand calculation of bulk unit weight, dry unit weight and effective unit weight of soil using a Python library called Groundhog.

What is bulk unit weight

It is defined as the total weight of a soil mass with its natural water content divided by the total volume it occupies. It is also known as the total unit weight.


Formula: Bulk unit weight(γ)=Gsγw(1+w)/1+e

Dry unit weight

It is the unit weight of soil when it is completely in dry state which means no water is present in its pores.


Formula: dry unit weight(γd)=(Gs/1+e)γs





Lets now validate the accuracy of our bulk unit weight, dry unit weight and effective unit weight using Groundhog.

What is Groundhog

Groundhog is a Python library developed with the intention to support students and educators in the field of geotechnical engineering automation. This gives you the power to analyze and validate your geotechnical calculations using Python. Functionality for onshore and offshore geotechnical problems is included.


Let’s put the Groundhog to the test to check the validity of its answers as compared to the result from the example calculation we are using

Step 1: Install the Groundhog library


pip install groundhog


Step 2: Import the functions for computing the bulk unit weight, dry unit weight, and effective unit weight


s import bulkunitweight, dryunitweight_watercontent

Step 3: #Define variables to store the data given from the question


# saturation (S)
S=1

#Weight of sample and container(Weight_sample_container)  in newwton(N)

Weight_sample_container=6

#weight of dr sample and container(weight_dry_container)
weight_dry_container=5


#weight of container(weight_container)

weight_container=1

#specific gravity(Gs)

Gs=2.7

#unit weight of water(Yw) in kN/m3
Yw=9.8

Step 4: computing bulk unit weight and effective unit weight using the bulkunitweight function


# The bulkunitweight function takes saturation(S) and void ratio(e) as positional, specific gravity(Gs) and unitweight keyword argument
# It returns a dictionary of bulkuinitweight and effective unit weight as the answer
bulkunitweight(1, 0.675, specific_gravity=2.7, unitweight_water=9.8)


#output 
{'bulk unit weight [kN/m3]': 19.746268656716417,
 'effective unit weight [kN/m3]': 9.946268656716416}


The bulkunitweight function returns a dictionary containing the bulk unit weight and the effective unit which is consistent with our hand calculation above.

Step 5: Compute the dry unit weight using dryunitweight_watercontent function


#The drunitweight_watercontent function takes watercontent(w) and bulkunitweight as positional argument
#it returns a dictionary of dry unit weight
dryunitweight_watercontent(0.25,19.7)


#output

{'dry unit weight [kN/m3]': 15.76}

Conclusion:

We will be going in-depth and building more useful applications that you will be able to deploy in platforms like Viktor.


Also published here.