forked from eghummel/BD-Code-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
312 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,308 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy\n", | ||
"import numpy as np\n", | ||
"from numpy import trapz\n", | ||
"\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"import matplotlib\n", | ||
"\n", | ||
"# Uses tinker as the backend for matplotlib (Not really sure what this is doing)\n", | ||
"matplotlib.use('TkAgg')\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"from pathlib import Path\n", | ||
"\n", | ||
"import math\n", | ||
"from math import pi\n", | ||
"from math import sqrt\n", | ||
"\n", | ||
"import statistics\n", | ||
"\n", | ||
"import scipy.integrate\n", | ||
"from scipy.signal import find_peaks\n", | ||
"from scipy.signal import argrelmin\n", | ||
"from scipy.integrate import cumtrapz" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "SyntaxError", | ||
"evalue": "non-default argument follows default argument (1948369725.py, line 88)", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;36m Cell \u001b[1;32mIn[1], line 88\u001b[1;36m\u001b[0m\n\u001b[1;33m areaCalcType, tipType):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m non-default argument follows default argument\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"def calcCylinderSurfaceArea(radius, height):\n", | ||
" # Calculates the Surface area of a cylinder\n", | ||
" # Inputs:\n", | ||
" # radius: Radius of the cylinder\n", | ||
" # height of the cylinder\n", | ||
"\n", | ||
" baseArea = np.pi * radius**2 # Surface area of the base of the cylinder\n", | ||
" sideArea = 2 * np.pi * radius * height # Surface area on the side of the cylinder\n", | ||
" totalSurfaceArea = baseArea + sideArea\n", | ||
" return totalSurfaceArea\n", | ||
"\n", | ||
"def calcConeLateralSurfaceArea(radius, height):\n", | ||
" # Calculates the lateral surface of a cone (Doesn't calc the surface area of the base of the cone)\n", | ||
" # Inputs:\n", | ||
" # radius: radius of the base of the cone\n", | ||
" # height: height of the cone (measured normal to the base)\n", | ||
" # sideSlope: Side slope of the cone\n", | ||
"\n", | ||
" return np.pi * radius * np.sqrt(height**2 + radius**2)\n", | ||
"\n", | ||
"def calcCircleArea(radius):\n", | ||
" # Calc the area of a circle\n", | ||
" # Input:\n", | ||
" # radius: radius of the circle\n", | ||
" return np.pi * radius**2\n", | ||
"\n", | ||
"def calcFFPConeContactArea(penetrationDepth, maxLength, baseRadius, coneTipRadius, coneTipHeight, areaCalcType):\n", | ||
" # Function calculates the contact area for the cone top of the FFP\n", | ||
"\n", | ||
" # penetrationDepth: Array of penetration depth values\n", | ||
" # maxLength: Max length before the lateral area of the FFP is considered\n", | ||
" # baseRadius: Radius of the Cone at the base (Circular side)\n", | ||
" # coneTipRadius: Radius of the cone tip (is not zero)\n", | ||
" # coneTipHeight: Height of the cone when measured normal to the circular base\n", | ||
" # areaCalcType: Selection of mantle or projected\n", | ||
"\n", | ||
" # Init array to store area\n", | ||
" area = np.ones(len(penetrationDepth))\n", | ||
"\n", | ||
" # Calc cone side slope\n", | ||
" coneSideSlope = (baseRadius-coneTipRadius)/coneTipHeight\n", | ||
"\n", | ||
" for i, depth in enumerate(penetrationDepth):\n", | ||
" \n", | ||
" # if the depth is greater than the maxLength of the cone\n", | ||
" if depth > maxLength:\n", | ||
" # decrease the depth used in the calculation to the maxLength\n", | ||
" depth = maxLength\n", | ||
" \n", | ||
" # Calc the radius\n", | ||
" radius = coneTipRadius + depth * coneSideSlope\n", | ||
"\n", | ||
" # Check area selection\n", | ||
" if areaCalcType == \"mantle\":\n", | ||
" # if selected calc mantle area (Same as surface area without the base of cone)\n", | ||
" area[i] = calcConeLateralSurfaceArea(radius, depth)\n", | ||
"\n", | ||
" elif areaCalcType == \"projected\":\n", | ||
" # if selected calc projected area\n", | ||
" area[i] = calcCircleArea(radius)\n", | ||
"\n", | ||
" else: \n", | ||
" return ValueError(\"areaCalcType must be mantle or projected. Currently is: {}\".format(areaCalcType))\n", | ||
"\n", | ||
" return area\n", | ||
"\n", | ||
"def calcFFPBluntContactArea(penetrationDepth, maxLength, baseRadius, areaCalcType):\n", | ||
"\n", | ||
" # init array to store area calcs\n", | ||
" area = np.zeros(len(penetrationDepth))\n", | ||
"\n", | ||
" for i, depth in enumerate(penetrationDepth):\n", | ||
" # if the depth is greater than the maxLength of the blunt cylinder\n", | ||
" if depth > maxLength:\n", | ||
" # decrease the depth used in the calculation to the maxLength\n", | ||
" depth = maxLength\n", | ||
" \n", | ||
" # radius is constant for cylinder\n", | ||
" radius = baseRadius\n", | ||
"\n", | ||
" # Check area selection\n", | ||
" if areaCalcType == \"mantle\":\n", | ||
" # if selected calc mantle area (Surface Area of a cylinder)\n", | ||
" area[i] = calcCylinderSurfaceArea(radius, depth)\n", | ||
"\n", | ||
" elif areaCalcType == \"projected\":\n", | ||
" # if selected calc projected area\n", | ||
" area[i] = calcCircleArea(radius)\n", | ||
"\n", | ||
" else: \n", | ||
" return ValueError(\"areaCalcType must be mantle or projected. Currently is: {}\".format(areaCalcType))\n", | ||
" \n", | ||
" # Might need to convert this to m^2\n", | ||
" return area\n", | ||
"\n", | ||
"def calcFFPContactArea(penetrationDepth, maxLength, areaCalcType, tipType, baseRadius = 4.375, coneTipRadius = 0.22, coneTipHeight = 7.55,):\n", | ||
" # Function calls the required functions to calculate the generated area for a cone\n", | ||
" # Inputs:\n", | ||
" # penetrationDepth: Array of depths the FFP has penetrated, [m]\n", | ||
" # maxLength: max length of penetration before radius become constant, [cm]\n", | ||
" # baseRadius: Base radius of the cone and blunt tip, [cm]\n", | ||
" # coneTipRadius: Tip radius of the cone??, [cm]\n", | ||
" # coneTipHeight: height of the cone, [cm]\n", | ||
" # areaCalcType: \"mantle or projected\"\n", | ||
" # tipType: blunt or cone tip type \n", | ||
" \n", | ||
" # Convert penetration depth to centimeters [cm]\n", | ||
" penetrationDepth = penetrationDepth * 100 #[cm]\n", | ||
"\n", | ||
" # Calc area for cone tip\n", | ||
" if tipType == \"cone\":\n", | ||
" area = calcFFPConeContactArea(penetrationDepth, maxLength, baseRadius, coneTipRadius, coneTipHeight, areaCalcType)\n", | ||
"\n", | ||
" # Calc area for blunt tip\n", | ||
" elif tipType == \"blunt\":\n", | ||
" area = calcFFPBluntContactArea(penetrationDepth, maxLength, baseRadius, areaCalcType)\n", | ||
" \n", | ||
" # Convert to m^2\n", | ||
" return area/1e4 #[m^2]\n", | ||
" \n", | ||
"def calcDynamicBearingCapacity(acceleration, massFFP, contactArea, rho_w = 1020, volumeFFP = 0.002473, waterDrop = True ):\n", | ||
" # Function calculates the dynamic bearing capacity of the soil\n", | ||
"\n", | ||
" # Inputs\n", | ||
" # dropType (S: \"air\" or \"water\" drop\n", | ||
" # accleration: deaccleration array\n", | ||
" # massFFP: Mass of the Free Fall Penetrometer (FFP)\n", | ||
" # contactArea: Array of contact areas between the FFP and the soil\n", | ||
" # rho_w: Density of water\n", | ||
" # volumeFFP: Volume of the FFP\n", | ||
"\n", | ||
" if waterDrop:\n", | ||
"\n", | ||
" # Calc mass of water displaced by the FFP\n", | ||
" displacedWaterMass = rho_w * volumeFFP\n", | ||
"\n", | ||
" # Calc Buoyant mass of the FFP\n", | ||
" buoyantMass = massFFP - displacedWaterMass\n", | ||
"\n", | ||
" # Calc impact force\n", | ||
" force = buoyantMass * acceleration\n", | ||
"\n", | ||
" # Check for air drop\n", | ||
" elif not waterDrop:\n", | ||
" force = massFFP * acceleration\n", | ||
"\n", | ||
" # Dynamic bearing capacity\n", | ||
" qDyn = force/contactArea\n", | ||
"\n", | ||
" return qDyn\n", | ||
"\n", | ||
"def calcQuasiStaticBearingCapacity(velocity, strainrateCorrectionType, qDyn, K_Factor = 0.1, refVelocity = 0.02, BrilliCoeff = 0.31):\n", | ||
" # Function calculates the quasi-static bearing capacity value\n", | ||
" # velocity: Array of FFP velocity values [m/s]\n", | ||
" # K_Factors: Array of K factors to be used\n", | ||
"\n", | ||
" # Local Variables: \n", | ||
" # f_SR: Strain Rate factor\n", | ||
" # maxVelocity: Max velocity of the descent\n", | ||
"\n", | ||
" maxVelocity = np.max(velocity)\n", | ||
"\n", | ||
" if strainrateCorrectionType == \"log\":\n", | ||
" f_SR = 1 + K_Factor * np.log10(velocity/refVelocity)\n", | ||
"\n", | ||
" elif strainrateCorrectionType == \"Brilli\":\n", | ||
" # Strain rate correction factor following Brilli et al. (20??) Commonly used for air drops\n", | ||
" f_SR = 1 + BrilliCoeff * maxVelocity * np.log10(velocity/refVelocity)\n", | ||
"\n", | ||
" elif strainrateCorrectionType == \"invHyperSin\":\n", | ||
" # Inv hyperbolic sin correction factor following Stephan (2015) and Randolph (2004)\n", | ||
" f_SR = 1 + K_Factor/np.log(10) * np.arcsinh(velocity/refVelocity)\n", | ||
"\n", | ||
" else:\n", | ||
" ValueError(\"strainrateCorrectionType must be one of the folliwng: log, Brilli, invHyperSin.\")\n", | ||
"\n", | ||
" # calc Quasi Static Bearing capacity value\n", | ||
" qsbc = qDyn/f_SR\n", | ||
" return qsbc\n", | ||
"\n", | ||
"FFP_Properties =\n", | ||
" \n", | ||
"def integrateFunc(x, func, order = 1):\n", | ||
" # x: Dependent Variable that the derivative should be taken with respect to\n", | ||
" # func: function that the derivative is being taken of\n", | ||
" # order: the order of the integral that should be taken\n", | ||
"\n", | ||
" pass\n", | ||
"\n", | ||
"def calcDerivative(x, func, order = 1, type = \"forward\"):\n", | ||
" # x: Dependent Variable that the derivative should be taken with respect to\n", | ||
" # func: function that the derivative is being taken of\n", | ||
" # order: the order of the derivative that should be taken. 1 for first derivative, 2 for second...\n", | ||
" # Type of derivative that should be taken (forward, backwards, central)\n", | ||
"\n", | ||
" pass\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
" " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"10000.0" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"100**2\n", | ||
"1e4" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def tipProperties(tipType):\n", | ||
" if tipType == \"cone\":\n", | ||
" mass = 7.71 # [kg]\n", | ||
" length = 8.48 - 0.93 #[cm], originally 7.87, 7.57 fors perfect 60 deg, 8.48 measured - .93 measured 90 deg\n", | ||
" if tipType == \"\"" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "PFFP_FieldWork", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |