From c00777ad4452af310396031f894809845de49d2f Mon Sep 17 00:00:00 2001 From: yohanesnuwara <51282928+yohanesnuwara@users.noreply.github.com> Date: Wed, 11 Mar 2020 13:41:38 +0700 Subject: [PATCH] Created using Colaboratory --- .../fd_linearflow_exercises.ipynb | 192 ++++++++++++++---- 1 file changed, 157 insertions(+), 35 deletions(-) diff --git a/Reservoir Simulation Ertekin/Unit 5 Finite-Difference Approximation to Linear-Flow Equations/fd_linearflow_exercises.ipynb b/Reservoir Simulation Ertekin/Unit 5 Finite-Difference Approximation to Linear-Flow Equations/fd_linearflow_exercises.ipynb index f964d0a..e62ade8 100644 --- a/Reservoir Simulation Ertekin/Unit 5 Finite-Difference Approximation to Linear-Flow Equations/fd_linearflow_exercises.ipynb +++ b/Reservoir Simulation Ertekin/Unit 5 Finite-Difference Approximation to Linear-Flow Equations/fd_linearflow_exercises.ipynb @@ -6,7 +6,7 @@ "name": "fd_linearflow_exercises.ipynb", "provenance": [], "collapsed_sections": [], - "authorship_tag": "ABX9TyMbK4NO9NJwkoDqYQLv99Zn", + "authorship_tag": "ABX9TyNv55IEhouwh+vmA29mqwrO", "include_colab_link": true }, "kernelspec": { @@ -55,27 +55,27 @@ "metadata": { "id": "h-VEl8b-RsXR", "colab_type": "code", + "outputId": "c19b78b6-2ce9-440c-a4b8-10148c249c73", "colab": { "base_uri": "https://localhost:8080/", "height": 134 - }, - "outputId": "ec09952d-ef7d-458b-e201-1d3776a577ea" + } }, "source": [ "!git clone https://github.com/yohanesnuwara/reservoir-engineering" ], - "execution_count": 16, + "execution_count": 2, "outputs": [ { "output_type": "stream", "text": [ "Cloning into 'reservoir-engineering'...\n", - "remote: Enumerating objects: 32, done.\u001b[K\n", - "remote: Counting objects: 100% (32/32), done.\u001b[K\n", - "remote: Compressing objects: 100% (31/31), done.\u001b[K\n", - "remote: Total 941 (delta 15), reused 0 (delta 0), pack-reused 909\u001b[K\n", - "Receiving objects: 100% (941/941), 12.23 MiB | 39.52 MiB/s, done.\n", - "Resolving deltas: 100% (410/410), done.\n" + "remote: Enumerating objects: 37, done.\u001b[K\n", + "remote: Counting objects: 100% (37/37), done.\u001b[K\n", + "remote: Compressing objects: 100% (36/36), done.\u001b[K\n", + "remote: Total 946 (delta 19), reused 0 (delta 0), pack-reused 909\u001b[K\n", + "Receiving objects: 100% (946/946), 12.24 MiB | 34.53 MiB/s, done.\n", + "Resolving deltas: 100% (414/414), done.\n" ], "name": "stdout" } @@ -110,11 +110,11 @@ "metadata": { "id": "dDU0d5NiKC9Q", "colab_type": "code", + "outputId": "3d72eb2b-2d08-4fbd-de1f-cab17d5b4f62", "colab": { "base_uri": "https://localhost:8080/", "height": 33 - }, - "outputId": "f0677107-59f9-437f-8feb-e0a14aa8e375" + } }, "source": [ "\"Task. determine pressure distribution during first year of production with timestep 10 days\"\n", @@ -142,7 +142,7 @@ "factor = (alpha * B * delta_t) / (Vb * poro * c)\n", "factor" ], - "execution_count": 10, + "execution_count": 3, "outputs": [ { "output_type": "execute_result", @@ -154,7 +154,7 @@ "metadata": { "tags": [] }, - "execution_count": 10 + "execution_count": 3 } ] }, @@ -163,11 +163,11 @@ "metadata": { "id": "Jj6EB0KKOAvj", "colab_type": "code", + "outputId": "fe210f7b-753d-4b50-92f5-8140b78f69f2", "colab": { "base_uri": "https://localhost:8080/", "height": 33 - }, - "outputId": "15ab2546-a8f8-4494-ae30-e182d6dccb2e" + } }, "source": [ "# calculate transmissibility of coupling cells\n", @@ -177,7 +177,7 @@ "T_min_half = T_plus_half\n", "T_min_half, T_plus_half" ], - "execution_count": 11, + "execution_count": 4, "outputs": [ { "output_type": "execute_result", @@ -189,7 +189,7 @@ "metadata": { "tags": [] }, - "execution_count": 11 + "execution_count": 4 } ] }, @@ -198,11 +198,11 @@ "metadata": { "id": "H7aGA6dQO7P4", "colab_type": "code", + "outputId": "cab54e73-3519-4dad-ff91-c8ee78da49cc", "colab": { "base_uri": "https://localhost:8080/", "height": 100 - }, - "outputId": "fd8750c1-f90c-4636-e526-a5ea180601a2" + } }, "source": [ "q = np.full(ngrid-1, T_min_half)\n", @@ -215,7 +215,7 @@ "print(\"At grid 3, the coupling transmissibility coeffs are:\", Ti_min_halves[2], \"for T_min_half and:\", Ti_plus_halves[2], \"for T_plus_half.\")\n", "print(\"At grid 5, the coupling transmissibility coeffs are:\", Ti_min_halves[4], \"for T_min_half and:\", Ti_plus_halves[4], \"for T_plus_half.\")" ], - "execution_count": 12, + "execution_count": 5, "outputs": [ { "output_type": "stream", @@ -248,11 +248,11 @@ "metadata": { "id": "RObLbHw8PYb5", "colab_type": "code", + "outputId": "25e2d6aa-4c7e-4f0c-d95d-b90f7e1a342d", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 - }, - "outputId": "48b977b3-a6ea-426b-8cf2-49d19884b27e" + } }, "source": [ "pi = np.full(ngrid, p_initial) # array of pressure in each grid [6000, 6000, 6000, 6000, 6000]\n", @@ -291,7 +291,7 @@ "df = pd.DataFrame(pd.np.column_stack([time, df]), columns=['time', 'grid 1', 'grid 2', 'grid 3', 'grid 4', 'grid 5', 'grid6'])\n", "df" ], - "execution_count": 14, + "execution_count": 7, "outputs": [ { "output_type": "execute_result", @@ -734,7 +734,7 @@ "metadata": { "tags": [] }, - "execution_count": 14 + "execution_count": 7 } ] }, @@ -753,11 +753,11 @@ "metadata": { "id": "WwMtG3j1Q5zL", "colab_type": "code", + "outputId": "5705e4da-6c2e-4928-a00a-57686bf8d334", "colab": { "base_uri": "https://localhost:8080/", "height": 33 - }, - "outputId": "82f9e5bb-1525-479f-b0b3-ceb3319c58e2" + } }, "source": [ "# known\n", @@ -783,7 +783,7 @@ "factor = (Vb * poro * c) / (alpha * B * delta_t)\n", "factor" ], - "execution_count": 15, + "execution_count": 8, "outputs": [ { "output_type": "execute_result", @@ -795,7 +795,7 @@ "metadata": { "tags": [] }, - "execution_count": 15 + "execution_count": 8 } ] }, @@ -804,11 +804,11 @@ "metadata": { "id": "4fS6_fx1RiUy", "colab_type": "code", + "outputId": "301d06e4-6444-4181-81bc-f07b00d8e1d0", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 - }, - "outputId": "23945c65-3f3e-4f7a-fb84-8035277ace35" + } }, "source": [ "import sys, os\n", @@ -848,7 +848,7 @@ "df = pd.DataFrame(pd.np.column_stack([time, df]), columns=['time', 'grid 1', 'grid 2', 'grid 3', 'grid 4', 'grid 5', 'grid 6'])\n", "df" ], - "execution_count": 17, + "execution_count": 9, "outputs": [ { "output_type": "execute_result", @@ -1291,7 +1291,7 @@ "metadata": { "tags": [] }, - "execution_count": 17 + "execution_count": 9 } ] }, @@ -1322,12 +1322,26 @@ "![Example 5 8](https://user-images.githubusercontent.com/51282928/75949840-09e36380-5eda-11ea-824c-dd5c9ac6f6d5.PNG)" ] }, + { + "cell_type": "markdown", + "metadata": { + "id": "u3EvE2R_ZOV1", + "colab_type": "text" + }, + "source": [ + "### Explicit, timestep 10 days" + ] + }, { "cell_type": "code", "metadata": { "id": "9FxpnIDVXJLR", "colab_type": "code", - "colab": {} + "colab": { + "base_uri": "https://localhost:8080/", + "height": 33 + }, + "outputId": "94113a68-ed53-4774-bdfa-ebc3326fd2fc" }, "source": [ "# known\n", @@ -1337,7 +1351,7 @@ "delta_z = 75\n", "ngrid = 5\n", "grid_loc = 4 # grid location where production well is located\n", - "B = 1 # phase FVF, assumed constant over pressure, rb/stb\n", + "\n", "c = 3.5E-06 # phase compressibility, psi^-1\n", "k_x = 15 # perm in x direction, md\n", "poro = 0.18\n", @@ -1355,6 +1369,114 @@ "factor = (alpha * B * delta_t) / (Vb * poro * c)\n", "factor" ], + "execution_count": 16, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1.1883597883597885" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 16 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "xl2FnDINmFyd", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 100 + }, + "outputId": "d6a4d8e1-989c-44a3-e238-18cf74409a17" + }, + "source": [ + "# for the first timestep\n", + "\n", + "pi = np.full(ngrid, 6000) # array of pressure in each grid [6000, 6000, 6000, 6000, 6000]\n", + "# p_new = pi\n", + "p_new = [6000, 5900, 5800, 5700, 6000]\n", + "\n", + "minus_q = 0 # no flow at left boundary\n", + "plus_q = 0.15 # 0.15 psi/ft at right boundary\n", + "\n", + "B_arr = []\n", + "for j, obj in enumerate(pi):\n", + " delta_p = p_new[j] - pi[j]\n", + " B = 1 / (1 + (c * (delta_p)))\n", + " B_arr.append(float(B))\n", + "\n", + "Ti_min_halves = []\n", + "Ti_plus_halves = []\n", + "\n", + "for k, obj in enumerate(B_arr):\n", + " # calculate transmissibility of coupling cells\n", + " beta = 1.127 # transmissibility conversion factor, is a constant\n", + " if k == 0:\n", + " T_min_half = 0 \n", + " if k > 0:\n", + " minus_B = B_arr[k-1]\n", + " T_min_half = beta * ((Ax * k_x) / (mu * minus_B * delta_x))\n", + " if k < (len(pi) - 1):\n", + " plus_B = B_arr[k+1]\n", + " T_plus_half = beta * ((Ax * k_x) / (mu * plus_B * delta_x))\n", + " if k == (len(pi) - 1):\n", + " T_plus_half = 0\n", + "\n", + " Ti_min_halves.append(float(T_min_half))\n", + " Ti_plus_halves.append(float(T_plus_half))\n", + "\n", + "print(Ti_plus_halves)\n", + "print(Ti_min_halves)\n", + "print(\"At grid 1, the coupling transmissibility coeffs are:\", Ti_min_halves[0], \"for T_min_half and:\", Ti_plus_halves[0], \"for T_plus_half.\")\n", + "print(\"At grid 3, the coupling transmissibility coeffs are:\", Ti_min_halves[2], \"for T_min_half and:\", Ti_plus_halves[2], \"for T_plus_half.\")\n", + "print(\"At grid 5, the coupling transmissibility coeffs are:\", Ti_min_halves[4], \"for T_min_half and:\", Ti_plus_halves[4], \"for T_plus_half.\")" + ], + "execution_count": 66, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[0.12674312437500002, 0.12669874874999998, 0.12665437312499997, 0.1267875, 0.0]\n", + "[0.0, 0.1267875, 0.12674312437500002, 0.12669874874999998, 0.12665437312499997]\n", + "At grid 1, the coupling transmissibility coeffs are: 0.0 for T_min_half and: 0.12674312437500002 for T_plus_half.\n", + "At grid 3, the coupling transmissibility coeffs are: 0.12674312437500002 for T_min_half and: 0.12665437312499997 for T_plus_half.\n", + "At grid 5, the coupling transmissibility coeffs are: 0.12665437312499997 for T_min_half and: 0.0 for T_plus_half.\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "DiKe4rHDrCAd", + "colab_type": "code", + "colab": {} + }, + "source": [ + "pi_initial = np.full(ngrid, 6000) # array of pressure in each grid [6000, 6000, 6000, 6000, 6000]\n", + "time = np.arange(10, 370, delta_t)\n", + "\n", + "pi_arr = []\n", + "min_arr = []\n", + "plus_arr = []\n", + "\n", + "delta_p = []\n", + "\n", + "for m in range(len(time)):\n", + " B_arr = []\n", + " for j, obj in enumerate(pi):\n", + " delta_p = p_new[j] - pi[j]\n", + " B = 1 / (1 + (c * (delta_p)))\n", + " B_arr.append(float(B))" + ], "execution_count": 0, "outputs": [] }