The Poisson's equation problem solved using Fenics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
62 KiB

  1. {
  2. "cells": [
  3. {
  4. "cell_type": "markdown",
  5. "metadata": {},
  6. "source": [
  7. "# Introduction\n",
  8. "The Poisson's equation is a second-order partial differential equation that stats the negative Laplacian $-\\Delta u$ of an unknown field $u=u(x)$ is equal to a given function $f=f(x)$ on a domain $\\Omega \\subset \\mathbb{R}^d$, most probably defined by a set of boundary conditions for the solution $u$ on the boundary $\\partial \\Omega$ of $\\Omega$:\n",
  9. "\n",
  10. "$$-\\Delta u =f \\quad \\text{in } \\Omega\\text{,}$$\n",
  11. "$$u=u_0 \\quad \\text{on } \\Gamma_D \\subset \\partial\\Omega \\text{,}$$"
  12. ]
  13. },
  14. {
  15. "cell_type": "markdown",
  16. "metadata": {},
  17. "source": [
  18. "here the Dirichlet's boundary condition $u=u_0$ signifies a prescribed values for the unknown $u$ on the boundary.\n",
  19. "\n",
  20. "The Poisson's equation is the simplest model for gravity, electromagnetism, heat transfer, among others.\n",
  21. "\n",
  22. "The specific case of $f=0$ and a negative $k$ value, leaves to the Fourier's Law."
  23. ]
  24. },
  25. {
  26. "cell_type": "markdown",
  27. "metadata": {},
  28. "source": [
  29. "## Comparative analysis\n",
  30. "Along this example, the fenics platfomr is used to compare results obtained by solving the heat equation (Laplace equation) in 2-D:\n",
  31. "\n",
  32. "$$\\frac{\\partial^2 T}{\\partial x^2}+ \\frac{\\partial^2 T}{\\partial y^2}=0$$\n",
  33. "\n",
  34. "the problem is defined by the next geometry considerations:\n",
  35. "\n",
  36. "![](physicalproblem.png)"
  37. ]
  38. },
  39. {
  40. "cell_type": "markdown",
  41. "metadata": {},
  42. "source": [
  43. "The resulting contour of temperature, solving using finite diferences, is shown next:\n",
  44. "\n",
  45. "![](resulteq.png)"
  46. ]
  47. },
  48. {
  49. "cell_type": "markdown",
  50. "metadata": {},
  51. "source": [
  52. "# Solving by Finite Element Method with Varational Problem formulation"
  53. ]
  54. },
  55. {
  56. "cell_type": "code",
  57. "execution_count": 2,
  58. "metadata": {},
  59. "outputs": [],
  60. "source": [
  61. "#1 Loading functions and modules\n",
  62. "from fenics import *\n",
  63. "import matplotlib.pyplot as plt"
  64. ]
  65. },
  66. {
  67. "cell_type": "code",
  68. "execution_count": 3,
  69. "metadata": {},
  70. "outputs": [
  71. {
  72. "data": {
  73. "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQgAAAD8CAYAAACLgjpEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJztnXt0lHWa5z9PBRIqgEgSCNcQJRC5hYCAoCDYEVoRETx4CYjx7MxxZ7f7nJk9vWe3154dZ3p25kzvbk/39KxnbMemRbmJCAK2tiJeuNtAuDWXAGKAhJgYRAMBpCHP/lEXK2UKivf3i6Te/D7n5OStt9566ve+VfnkvVR9H1FVHA6HoyUCN3oADoej7eIE4XA4EuIE4XA4EuIE4XA4EuIE4XA4EuIE4XA4EuIE4XA4EuIE4XA4EuIE4XA4EtLhRg+gJXJycjQ/P/9GD8Ph8C07d+6sV9Ue11quTQoiPz+fHTt23OhhOBy+RUSOJ7OcO8RwOBwJcYJwOBwJcYJwOBwJcYJwOBwJcYJwOBwJuaYgRKS/iHwgIgdEZL+I/GV4fpaIrBORI+Hf3RM8viy8zBERKbO9Ag6Ho/VIZg/iMvAjVR0KjAd+ICJDgR8D61V1ELA+fLsZIpIFPAvcAYwDnk0kEofD0fa45ucgVLUGqAlPnxWRg0Bf4CFgSnixhcCHwH+Pe/j3gXWq+gWAiKwD7gOWmgx6z549vPHGGwwfPpysrCyTUgBs2LABgEmTJiEi1urdfffdxrVUlY0bN1qrd+zYMaqqqsjKymL48OHG9SLrescdd5CRkWGtno11tV2vtraWiooK0tPTGT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huAFmPiwnmVj2LY58IrvXr1Yv78+dYkUVRUZE0SYD/jct68edYk0ZYvgQLcc889ViXRnq5u2MT0HMQkoFZVjyS4X4F3RWRnuO+FdXr37t1mJdEan5NoL5IQESeJNoCpIEq5+t7DRFUdDdxPqGVfwvZGIvK0iOwQkR3Xe63eScI7ThLeaQ+S8CwIEekAPAy8mmgZVa0O/64DVhHqz5lo2RdUdYyqjunRo8d1j8dJwjtOEt7xuyRM9iDuBQ6palVLd4pIZxHpGpkm1BPjjwbPd02cJLzjJOEdP0simcY5S4GtQKGIVInIn4Xvepy4wwsR6SMib4Vv5gKbRGQP8Afgd6r6e3tDbxknCe84SXjHr5JI5ipGqar2VtWOqtpPVX8Tnv+Uqj4ft+wpVZ0enj6mqiPDP8NU9R9aZxW+jZOEd5wkvONHSaTkJymTwUnCO04S3vGbJHwrCHCSMMFJwjt+koSvBQFOEiY4SXjHL5LwvSDAScIEJwnv+EES7UIQ4CRhgpOEd1JdEu1GEOAkYYKThHdSWRLtShDgJGGCk4R3UlUS7U4Q0L4l4feMy9aUxK5duzzXgtSURLsUBDSXxP79+42z/GIlUVNTw/nz5z3XipeEKbGS2LZtm3G9WEns3r3buF6sJI4fP85XX33luVa8JC5evGj02sZKYsuWLZ7rRIiVhI1silhJHDlyxLokUjKTMpKwBBin51y50jwuvC3VU9Vmb+5AIGAUCNKW19V2vfa87Z555plrJqIlm0l5zci5tsiQIUM4ePAgAD179uTWW281qrd58+bo9G233fat7EaTerfffrtRfJ2qRv9zNTU1cdddd1kbW7du3RgyZIi1egMHDsTLN3ET1SsuLjaKr4ut19TUxJ133mkkiT179kTDkjMyMhg1apSVsQHk5eXRp08fK/VM3m/xpKQgiouLo4Koq6ujpKSEgQMHeq4nImzatIlgMEhVVRUlJSVGGZcnT57kxIkTiAiff/45paWlRi9a7K5tU1O
  74. "text/plain": [
  75. "<Figure size 432x288 with 1 Axes>"
  76. ]
  77. },
  78. "metadata": {
  79. "needs_background": "light"
  80. },
  81. "output_type": "display_data"
  82. }
  83. ],
  84. "source": [
  85. "#2 Create mesh and define function space\n",
  86. "mesh = RectangleMesh(Point(0,0),Point(20,20),10, 10,'left')\n",
  87. "V = FunctionSpace(mesh, 'Lagrange', 1) #Lagrange are triangular elements\n",
  88. "plot(mesh)\n",
  89. "plt.show()"
  90. ]
  91. },
  92. {
  93. "cell_type": "code",
  94. "execution_count": 4,
  95. "metadata": {},
  96. "outputs": [],
  97. "source": [
  98. "#3 Defining boundary conditions (Dirichlet)\n",
  99. "tol = 1E-14 # tolerance for coordinate comparisons\n",
  100. "#at y=20\n",
  101. "def Dirichlet_boundary1(x, on_boundary):\n",
  102. " return on_boundary and abs(x[1] - 20) < tol\n",
  103. "#at y=0\n",
  104. "def Dirichlet_boundary0(x, on_boundary):\n",
  105. " return on_boundary and abs(x[1] - 0) < tol\n",
  106. "#at x=0\n",
  107. "def Dirichlet_boundarx0(x, on_boundary):\n",
  108. " return on_boundary and abs(x[0] - 0) < tol\n",
  109. "#at x=20\n",
  110. "def Dirichlet_boundarx1(x, on_boundary):\n",
  111. " return on_boundary and abs(x[0] - 20) < tol\n",
  112. "\n",
  113. "bc0 = DirichletBC(V, Constant(0), Dirichlet_boundary0)\n",
  114. "bc1 = DirichletBC(V, Constant(100), Dirichlet_boundary1) #100C\n",
  115. "bc2 = DirichletBC(V, Constant(0), Dirichlet_boundarx0)\n",
  116. "bc3 = DirichletBC(V, Constant(0), Dirichlet_boundarx1)\n",
  117. "bcs = [bc0,bc1, bc2,bc3]"
  118. ]
  119. },
  120. {
  121. "cell_type": "code",
  122. "execution_count": 5,
  123. "metadata": {},
  124. "outputs": [
  125. {
  126. "data": {
  127. "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQsAAAD8CAYAAABgtYFHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi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gYAHw+A5cPSvo6/bYvriMbsm2xy7Knp/oeTdTGccYcroYdrtY8twXFWCc/+IZRtz2zUQbFRel5hiAnrLY/sZBuvtGOPPhXh7djl1a0lTlSIEOP15fgW1vHPz/FTDq02DCEGx5432yvWOc/mAfQ3cHphzXUS+LnFli9eufYJkpTvzqLR7kZ7VdDiZkqhrfoDECv4LL5UPkdlzBHpzFyOHNHQHDDMptBRR2mjE7w4RjcG6lxZ1ZLhsHFTYNT32Auh1977shUT0aFHiGwpq1Lrvmlvh8NOPPhkRmRiTg6GrNzMgsT5AG8l4G4TYmbNfOK5SlzuC5dZQ8nb7NV9vqklhSw5W1vA2BgQ4rXjvM9fd3c+bDvWzZ+yGzF92dchr0zBr2zeYDr/P+L32zOdvdeiQ/74WDvHqlRY2qd+Ut1sujXDjyAofef5st+w6haq3N5kLYr/bSaF7jlNyKFz7HlCrnT++kJDVWbDvTMkwASyo4CW2ZkTbZ8eYBTu1/g9Mf7GPrq4eYtaCzadVKPkWU6x9hzeufcOngy1zYv4+B1z5Hy5VbhlV2/LDyboYshUqDBH5FZ9kYiryJ98VSzKNrKD1zB9TWZqzhGaSAUSdL3g1AYRsUgs9niwQ7HNg+5CFdh3Pqk63OPxjLItTDByoXr+n
  128. "text/plain": [
  129. "<Figure size 432x288 with 1 Axes>"
  130. ]
  131. },
  132. "metadata": {
  133. "needs_background": "light"
  134. },
  135. "output_type": "display_data"
  136. }
  137. ],
  138. "source": [
  139. "#4 Defining variational problem and its solution\n",
  140. "k =1\n",
  141. "u = TrialFunction(V)\n",
  142. "v = TestFunction(V)\n",
  143. "f = Constant(0)\n",
  144. "a = dot(k*grad(u), grad(v))*dx\n",
  145. "L = f*v*dx\n",
  146. "\n",
  147. "# Compute solution\n",
  148. "u = Function(V)\n",
  149. "solve(a == L, u, bcs)\n",
  150. "\n",
  151. "# Plot solution and mesh\n",
  152. "plot(u)\n",
  153. "plot(mesh)\n",
  154. "\n",
  155. "# Save solution to file in VTK format\n",
  156. "vtkfile = File('solution.pvd')\n",
  157. "vtkfile << u"
  158. ]
  159. },
  160. {
  161. "cell_type": "markdown",
  162. "metadata": {},
  163. "source": [
  164. "# Results after editing color-map on paraview\n",
  165. "![](paraview-results.png)"
  166. ]
  167. },
  168. {
  169. "cell_type": "code",
  170. "execution_count": 1,
  171. "metadata": {},
  172. "outputs": [
  173. {
  174. "name": "stdout",
  175. "output_type": "stream",
  176. "text": [
  177. "\u001b[33mWARNING: The directory '/home/fenics/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.\u001b[0m\n",
  178. "\u001b[33mWARNING: The directory '/home/fenics/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.\u001b[0m\n",
  179. "Requirement already satisfied: pandoc in /usr/local/lib/python3.6/dist-packages (1.0.2)\n",
  180. "Requirement already satisfied: ply in /usr/lib/python3/dist-packages (from pandoc) (3.11)\n",
  181. "\u001b[33mWARNING: You are using pip version 19.1, however version 21.0.1 is available.\n",
  182. "You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n"
  183. ]
  184. }
  185. ],
  186. "source": [
  187. "!sudo pip install pandoc"
  188. ]
  189. },
  190. {
  191. "cell_type": "code",
  192. "execution_count": null,
  193. "metadata": {},
  194. "outputs": [],
  195. "source": []
  196. }
  197. ],
  198. "metadata": {
  199. "kernelspec": {
  200. "display_name": "Python 3",
  201. "language": "python",
  202. "name": "python3"
  203. },
  204. "language_info": {
  205. "codemirror_mode": {
  206. "name": "ipython",
  207. "version": 3
  208. },
  209. "file_extension": ".py",
  210. "mimetype": "text/x-python",
  211. "name": "python",
  212. "nbconvert_exporter": "python",
  213. "pygments_lexer": "ipython3",
  214. "version": "3.6.7"
  215. }
  216. },
  217. "nbformat": 4,
  218. "nbformat_minor": 2
  219. }