From 2b4837e3c6f565a900fbf2374d9a325a90d03cef Mon Sep 17 00:00:00 2001 From: Jonathan Moore Date: Thu, 2 Nov 2023 14:33:26 -0400 Subject: [PATCH] uploading Teamwork version --- BD code v8.ipynb | 25 +-- BlueDrop_TeamWork_v1.ipynb | 308 +++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 21 deletions(-) create mode 100644 BlueDrop_TeamWork_v1.ipynb diff --git a/BD code v8.ipynb b/BD code v8.ipynb index ff1f895..6b2a639 100644 --- a/BD code v8.ipynb +++ b/BD code v8.ipynb @@ -21,24 +21,7 @@ "execution_count": 19, "metadata": {}, "outputs": [], - "source": [ - "import numpy\n", - "import numpy as np\n", - "import pandas as pd\n", - "import matplotlib\n", - "matplotlib.use('TkAgg')\n", - "import matplotlib.pyplot as plt\n", - "from pathlib import Path\n", - "import math\n", - "from math import pi\n", - "from math import sqrt\n", - "import statistics\n", - "import scipy.integrate\n", - "from scipy.signal import find_peaks\n", - "from scipy.signal import argrelmin\n", - "from numpy import trapz\n", - "from scipy.integrate import cumtrapz" - ] + "source": [] }, { "attachments": {}, @@ -103,9 +86,11 @@ " if tiptype == 'c':\n", " for k in range(0,len(d_m)): #Performs the math for the mantle area type\n", " if d_m[k]=length:\n", " r_m.append(4.375)\n", " a_m.append(pi*r_m[k]*(sqrt((r_m[k]**2)+(length**2))))\n", @@ -121,8 +106,6 @@ " a_p.append(pi*(r_p[k])**2)\n", " elif d_p[k]>=length:\n", " r_p.append(4.375)\n", - " #if r_p[k-1] 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 +}