diff --git a/Solver.ipynb b/Solver.ipynb new file mode 100644 index 0000000..59c4a1a --- /dev/null +++ b/Solver.ipynb @@ -0,0 +1,421 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Solver.ipynb", + "provenance": [], + "authorship_tag": "ABX9TyNX03LMpvxnXCSFI8vn/Fzy", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "id": "7_MTdYIe9dDS" + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "import pandas as pd\n", + "from scipy import integrate" + ] + }, + { + "cell_type": "code", + "source": [ + "# 1\n", + "def model1(x,w):\n", + " # константы\n", + " eps_p = 0.15\n", + " eps_c = 0.08\n", + " eps_m = 0.04\n", + " z_0 = 0.98\n", + " z_p = 0.98\n", + " z_c = 0.98\n", + " z_m = 1.03\n", + " z_e = 1.2\n", + "\n", + " # задаем исходные величины\n", + " w_12 = 1276\n", + " Apl = [\n", + " [1,0,0,0,0,0,0],\n", + " [1,np.power((w-eps_p),2),np.power((w-eps_p),6),0,0,0,0],\n", + " [1,np.power((w-eps_c),2),np.power((w-eps_c),6),0,0,0,0],\n", + " [0,0,0,1,(w-eps_c),np.power((w-eps_c),2),np.power((w-eps_c),3)],\n", + " [0,0,0,1,(w-eps_m),np.power((w-eps_m),2),np.power((w-eps_m),3)],\n", + " [0,0,0,1,w,np.power(w,2),np.power(w,3)],\n", + " [0,2*(w-eps_c),6*np.power((w-eps_c),5),0,-1,-2*(w-eps_c),-3*np.power((w-eps_c),2)]\n", + " ]\n", + " Bpl = [z_0,z_p,z_c,z_c,z_m,z_e,0]\n", + " vW = np.matmul(np.linalg.inv(Apl),Bpl)\n", + " f_c = vW[0]+vW[1]*np.power(x,2)+vW[2]*np.power(x,6)\n", + " f_e = vW[3]+vW[4]*x+vW[5]*np.power(x,2)+vW[6]*np.power(x,3)\n", + "\n", + " def kxl(x,w):\n", + " Kxl = 0 \n", + " if (x>=0 and x<=(w-eps_c)):\n", + " Kxl = f_c\n", + " elif (x>=(w-eps_c)and x<=w):\n", + " Kxl = f_e\n", + " return Kxl\n", + " \n", + " Kx_x_w = kxl(x,w) if x >=0 else kxl(-1*x,w)\n", + "\n", + " W_c = w_12 * 0.001\n", + " w_c = 0.5*W_c\n", + " w = w_c\n", + " Apl = [\n", + " [1,0,0,0,0,0,0],\n", + " [1,np.power((w-eps_p),2),np.power((w-eps_p),6),0,0,0,0],\n", + " [1,np.power((w-eps_c),2),np.power((w-eps_c),6),0,0,0,0],\n", + " [0,0,0,1,(w-eps_c),np.power((w-eps_c),2),np.power((w-eps_c),3)],\n", + " [0,0,0,1,(w-eps_m),np.power((w-eps_m),2),np.power((w-eps_m),3)],\n", + " [0,0,0,1,w,np.power(w,2),np.power(w,3)],\n", + " [0,2*(w-eps_c),6*np.power((w-eps_c),5),0,-1,-2*(w-eps_c),-3*np.power((w-eps_c),2)]\n", + " ]\n", + " Bpl = [z_0,z_p,z_c,z_c,z_m,z_e,0]\n", + " vW = np.matmul(np.linalg.inv(Apl),Bpl)\n", + "\n", + " x = abs(x)\n", + " Kxl = 0 \n", + "\n", + " integral_res = 1\n", + " if (x>=0 and x<=(w-eps_c)):\n", + " def integrand(x):\n", + " return vW[0]+vW[1]*x**2+vW[2]*x**6\n", + " integral_res = integrate.quad(integrand, -1*w_c, w_c)[0]\n", + "\n", + " elif (x>=(w-eps_c)and x<=w):\n", + " def integrand(x):\n", + " return vW[3]+vW[4]*x+vW[5]*np.power(x,2)+vW[6]*np.power(x,3)\n", + " integral_res = integrate.quad(integrand, -1*w_c, w_c)[0]\n", + "\n", + " K_pnorm = 1/W_c * integral_res\n", + " K_px = Kx_x_w/K_pnorm\n", + "\n", + " return K_px\n", + "\n", + "model1(5,12)\n", + "\n" + ], + "metadata": { + "id": "6P67VVPC9kKF", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "af688617-90bd-4527-be04-c44c7187a5e1" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1.2504799987185458" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "# 2\n", + "input_params={\n", + " S_x:0.005,\n", + " L_bu:2,\n", + " L_conic:0.93,\n", + " Yu:1.8* 10**11,\n", + " u:0.25,\n", + " D_bu:1.6,\n", + " L_ck:1.8,\n", + " w_12:1276,\n", + " p_12:40\n", + " }\n", + "\n", + "def model2(S_x=0.005,\n", + " L_bu=2,\n", + " L_conic=0.93,\n", + " Yu=1.8* 10**11,\n", + " u=0.25,\n", + " D_bu=1.6,\n", + " L_ck=1.8,\n", + " w_12=1276,\n", + " p_12=40): \n", + "\n", + " aHC = L_bu + L_conic\n", + " Ge = Yu/(2*(1+u))\n", + "\n", + " W_c = w_12*10**(-3)\n", + " def Ybu1W(P):\n", + " return P*W_c**2/(18.8*Yu*D_bu**4)*(12*aHC-8*W_c-6*L_ck-W_c**12/L_ck)\n", + "\n", + " def Ybu2W(P):\n", + " return P*W_c/(Ge*3.14*D_bu**2)*(1-W_c/(2*L_ck))\n", + "\n", + " def YbuW(P):\n", + " return 2*(Ybu1W(P)+Ybu2W(P))\n", + "\n", + " P_c = p_12*10**-4\n", + " MpW=P_c/(YbuW(P_c))\n", + " def yBU(z):\n", + " return YbuW(P_c)*(2*z/W_c)**2\n", + "\n", + " def yBUd(j):\n", + " return yBU(j*S_x)*10**6\n", + "\n", + " N_b = L_bu/2*S_x\n", + " print(N_b)\n", + "\n", + " yBUd_j = [yBUd(j) for j in np.arange(0,N_b,S_x/60)]\n", + " return yBUd_j\n", + "\n", + "model2(*input_params)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "olVDFu-a-gr9", + "outputId": "626548cf-64a8-4c3d-cbba-ceb27da8b460" + }, + "execution_count": 36, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0.005\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[0.0,\n", + " 5.808781820443941e-21,\n", + " 2.3235127281775765e-20,\n", + " 5.2279036383995474e-20,\n", + " 9.294050912710306e-20,\n", + " 1.4521954551109854e-19,\n", + " 2.091161455359819e-19,\n", + " 2.846303092017531e-19,\n", + " 3.7176203650841224e-19,\n", + " 4.705113274559592e-19,\n", + " 5.808781820443942e-19,\n", + " 7.028626002737168e-19,\n", + " 8.364645821439276e-19,\n", + " 9.81684127655026e-19,\n", + " 1.1385212368070124e-18,\n", + " 1.3069759095998868e-18,\n", + " 1.487048146033649e-18,\n", + " 1.678737946108299e-18,\n", + " 1.8820453098238368e-18,\n", + " 2.0969702371802622e-18,\n", + " 2.3235127281775766e-18,\n", + " 2.5616727828157788e-18,\n", + " 2.811450401094867e-18,\n", + " 3.0728455830148453e-18,\n", + " 3.3458583285757104e-18,\n", + " 3.630488637777463e-18,\n", + " 3.926736510620104e-18,\n", + " 4.234601947103632e-18,\n", + " 4.5540849472280496e-18,\n", + " 4.885185510993355e-18,\n", + " 5.227903638399547e-18,\n", + " 5.582239329446627e-18,\n", + " 5.948192584134596e-18,\n", + " 6.325763402463451e-18,\n", + " 6.714951784433196e-18,\n", + " 7.115757730043827e-18,\n", + " 7.528181239295347e-18,\n", + " 7.952222312187756e-18,\n", + " 8.387880948721049e-18,\n", + " 8.835157148895231e-18,\n", + " 9.294050912710307e-18,\n", + " 9.764562240166265e-18,\n", + " 1.0246691131263115e-17,\n", + " 1.074043758600085e-17,\n", + " 1.1245801604379469e-17,\n", + " 1.1762783186398978e-17,\n", + " 1.2291382332059381e-17,\n", + " 1.2831599041360664e-17,\n", + " 1.3383433314302841e-17,\n", + " 1.3946885150885894e-17,\n", + " 1.4521954551109853e-17,\n", + " 1.5108641514974685e-17,\n", + " 1.5706946042480415e-17,\n", + " 1.6316868133627035e-17,\n", + " 1.6938407788414527e-17,\n", + " 1.7571565006842918e-17,\n", + " 1.8216339788912198e-17,\n", + " 1.8872732134622367e-17,\n", + " 1.954074204397342e-17,\n", + " 2.0220369516965356e-17]" + ] + }, + "metadata": {}, + "execution_count": 36 + } + ] + }, + { + "cell_type": "code", + "source": [ + "# 3\n", + "\n", + "def model3(b1=0.7059,b2=-0.6714,b3=0.1946,z=1,sh=2):\n", + " def uTc(x):\n", + " return b1*x+b2*x**2+b3*x**3\n", + " def uBc(x):\n", + " return b1*x+b2*x**2+b3*x**3\n", + " uGc0 = uTc(z+sh)+uBc(z-sh)\n", + " return uGc0\n", + "\n", + "model3()\n", + "\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "gF9n0Pn1AS8C", + "outputId": "6ccfb709-d039-4f9e-872b-1b151b1c5621" + }, + "execution_count": 37, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "-0.24259999999999993" + ] + }, + "metadata": {}, + "execution_count": 37 + } + ] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "yxwlwhgHAc0i" + }, + "execution_count": 14, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "BPxz7PLxBC-C" + }, + "execution_count": 16, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "10ZMV1LIBRQn" + }, + "execution_count": 9, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "ThuA3GZmBtPF" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "5nmE9GK-CRF_" + }, + "execution_count": 9, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "R-71sBDyCvCw" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "z9SkkmL4C1AN" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "NZPFhfgtI9D7" + }, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": { + "id": "i_fXYKRHKMlc" + }, + "execution_count": 9, + "outputs": [] + } + ] +} \ No newline at end of file