Skip to content

Instantly share code, notes, and snippets.

View berkdemir's full-sized avatar

Berk Demir berkdemir

View GitHub Profile
@berkdemir
berkdemir / Analysis_Tatone2022_MR_Data.py
Last active February 4, 2022 08:47
Tatone et. al. (2022) Data for MR of Rocks
# Data from Tatone, B. S., Abdelaziz, A., & Grasselli, G. (2022). Novel Mechanical Classification Method of Rock Based on the Uniaxial Compressive Strength and Brazilian Disc Strength. Rock Mechanics and Rock Engineering, 1-5.
import pandas as pd
import seaborn as sns
# Rock Category
rock_type = {"Sedimentary": ["SL", "SSh", "SS", "SC"],
"Metamorphic": ["MG", "MS", "MQ", "MM"],
"Igneous": ["IG", "IF", "ID"]}
ordered_box_list = []
from plxscripting.easy import *
localhostport_i = 10000
password = "123456"
s_i, g_i = new_server("localhost", localhostport_i, password=password)
line_list = [g_i.Line_142_Line_153_1, g_i.Line_142_Line_152_1, g_i.Line_151_1]
# line_list is the list of lines that are to be activated.
# Activate only after the first 4 phases. (Including Initial Phase)
@berkdemir
berkdemir / EffectiveShearWave.py
Last active May 2, 2021 12:56
Effective Shear Wave Velocity calculation and Plaxis-Python code to apply prescribed deformation
def EFS(Ground_Type, PGV, PGV_Red, VS, PI=20, OCR=1, Eff_Pressure=300):
"""
Effective Shear Wave Velocity Using Darendeli (2001) and Schnabel (1973) by Berk Demir / https://github.com/berkdemir
Inputs:
Ground_Type: Either "Soil" or "Rock"
PGV: Peak Ground Velocity (cm/sec)
PGV_Red: PGV reduction ratio with depth
VS: Maximum shear wave velocity (m/s)
PI: Plasticity index in percent. (For Soil only.)
@berkdemir
berkdemir / BDPlaxisPlateForces.py
Last active May 2, 2021 09:40
Plaxis plate list fetcher.
def plate_forces(plate_list, plate_names, phase_list):
"""
Plaxis plate forces fetcher by Berk Demir / https://github.com/berkdemir
Returns (M, N) as a tuple from Plaxis.
"""
select_plate_obj = []
for _, j in enumerate(plate_names):
# In my original code, I offer user the list of plate_names and user select the plates. Returned selected_plate_names is used to enumerate here. This is why code is structured the way it is.
select_plate_obj.append(
plate_list[plate_names.index(j)]
@berkdemir
berkdemir / BDPlaxisGroupForces.py
Last active May 2, 2021 10:04
Plaxis group list fetcher.
def group_forces(plate_list, plate_names, phase_list):
"""
Plaxis group forces fetcher by Berk Demir / https://github.com/berkdemir
Returns (M, N) as a tuple from Plaxis. If no group is defined in the model, it will return None.
"""
select_group_obj = []
for i, j in enumerate(group_names):
# In my original code, I offer user the list of group_names and user select the groups. Returned selected_group_names is used to enumerate here. This is why code is structured the way it is.
select_group_obj.append(
group_list[group_names.index(j)]
@berkdemir
berkdemir / BDHoekBrownParameters.py
Last active March 12, 2021 10:22
Hoek-Brown Parameters in Literature
"""
Hoek-Brown parameters in literature by Berk Demir
This is a simple dictionary called "RockDict" for different rock types and their mi and MR values. Deviations (± from the average) are also stored as miSTD and MRSTD.
Keys: Rock Types.
Sub-dictionary keys:
* "MR": Modulus Ratio - int
* "MRSTD": Deviation of Modulus Ratio - int
* "Type": Rock type - str