|
|
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "#1 Loading functions and modules\n",
- "from fenics import *\n",
- "import matplotlib.pyplot as plt\n",
- "T = 0.1\n",
- "num_steps = 20\n",
- "dt = T/num_steps\n",
- "rho = 7500\n",
- "Cp = 500\n",
- "k = 50\n",
- "alpha = k/(rho*Cp)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAACgCAYAAAAM9xtHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzsvXl0G9eZJX6LWEiCG0CCxMJ9AcEFZIE7JWs1rcWyLMmSZcuSvMiRJVmy40WxezoTZ+vjOHEnnenTm9uJx2c880t34nYcJUrS09NuO9pFiiLADaRIivtOgAAXECBB1u8P6j1XAQWJluUlCb5zdI4AfgCqLh7qvfru9+5lOI5DKEIRilCEIhRhX/QBhCIUoQhFKL4cEZoQQhGKUIQiFABCE0IoQhGKUITiRoQmhFCEIhShCAWA0IQQilCEIhShuBGhCSEUoQhFKEIBIDQhhCIUoQhFKG5EaEIIRShCEYpQAAhNCKEIRShCEYobIf2iD+CThFqt5jIyMr7owwhFKEIRij+aqK+vn+A4LnEluX9UE0JGRgauXLnyRR9GKEIRilD80QTDML0rzV1RyYhhmK0Mw7QzDNPJMMx/E/l7OMMwP7/x98sMw2Tw/vaXN55vZxhmy43nIhiGqWUYxsowTAvDMN9Z6QGHIhShCEUoPpu45YTAMIwEwD8AuBdAAYBHGIYp8Ev7CoBJjuNyAPwYwA9uvLYAwD4AhQC2AvjHG+/nBXA3x3EsADOArQzDVN+ZUwpFKEIRilDcTqzkDqESQCfHcdc5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text/plain": [
- "<Figure size 432x288 with 1 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "#2 Create mesh and define function space\n",
- "nx = 0.008\n",
- "ny = 0.003\n",
- "mesh = RectangleMesh(Point(0,0),Point(nx,ny),30, 30,'left')\n",
- "V = FunctionSpace(mesh, 'Lagrange', 1) #Lagrange are triangular elements\n",
- "plot(mesh)\n",
- "plt.show()\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [],
- "source": [
- "# Boundary conditions\n",
- "u0 = Constant(100)\n",
- "def boundary(x, on_boundary):\n",
- " return on_boundary\n",
- "\n",
- "bc = DirichletBC(V,u0, boundary)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [],
- "source": [
- "u_n = project(1, V)\n",
- "u = TrialFunction(V)\n",
- "v = TestFunction(V)\n",
- "f = Constant(0.0)\n",
- "F = u*v*dx + alpha*dt*dot(grad(u), grad(v))*dx-u_n*v*dx\n",
- "a, L = lhs(F), rhs(F)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [],
- "source": [
- "vtkfile = File('solution/solution.pvd')\n",
- "u = Function(V)\n",
- "t = 0\n",
- "for n in range(num_steps):\n",
- " t += dt\n",
- " #u0.t = t\n",
- " solve(a == L, u, bc)\n",
- " #c = plot(u,)\n",
- " #plt.colorbar(c)\n",
- " #plt.show()\n",
- " ####\n",
- " vtkfile << (u, t)\n",
- " u_n.assign(u)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "1e-13"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "1E-13"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "100.0"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "1e2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "100.0000000000001"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "1E-13+1e2"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Boundary conditions"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {},
- "outputs": [],
- "source": [
- "#1 Loading functions and modules\n",
- "from fenics import *\n",
- "import matplotlib.pyplot as plt\n",
- "T = 4\n",
- "num_steps = 200\n",
- "dt = T/num_steps\n",
- "rho = 7500\n",
- "Cp = 500\n",
- "k = 50\n",
- "alpha = k/(rho*Cp)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAACgCAYAAAAM9xtHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJztnXtwVOeZp58PXRAIgdAdIYQkJCQEUrcBc4mxjQ0GTEiYZDKBpTKTZL3lqUom2WS3KjXZmTJjT6UymXUlQ9Uk3nGFbCbeSYztxAlDsLmZYAyYq8+R0I07RoAQCIEkLlJL+vaP7j5uSS2pjyyd04L3qaKq+5zTRz9d6O/0873fe5TWGkEQBEEY43YAQRAEITqQAUEQBEEAZEAQBEEQAsiAIAiCIAAyIAiCIAgBZEAQBEEQABkQBEEQhAAyIAiCIAiADAiCIAhCgFi3A9ghLS1N5+XluR1DEARh1HD8+PEbWuv0SI4dVQNCXl4ex44dczuGIAjCqEEpdTHSYyNSRkqp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IqKili7di3PPvssNTU1mKZpVSnl5eXh9Xpdac9dUFDA5z73OVatWkVtbS2maUZFldK0adNYvXp11FUpZWZm9qhSMgyDw4cPc+jQIbKzs61qIKeV0uTJk1mxYgXLli3j7NmzGIbB0aNHXa9Scurv5qEYEEIZN24cjz76KI8++iiNjY2YpklFRQV1dXWu1ywHq5RCJ5hOnz4tVUphiI+Pt650o61Kqay
- "text/plain": [
- "<Figure size 432x288 with 1 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "#2 Create mesh and define function space\n",
- "nx = 0.008\n",
- "ny = 0.003\n",
- "mesh = RectangleMesh(Point(0,0),Point(nx,ny),8, 8,'left')\n",
- "V = FunctionSpace(mesh, 'Lagrange', 1) #Lagrange are triangular elements\n",
- "plot(mesh)\n",
- "plt.show()\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "metadata": {},
- "outputs": [],
- "source": [
- "#Boundary Conditions\n",
- "tol = 1E-14\n",
- "\n",
- "def BC1(x, on_boundary):\n",
- " return on_boundary and abs(x[0]-nx) < tol\n",
- "\n",
- "def BC2(x, on_boundary):\n",
- " return on_boundary and abs(x[0]-0) < tol\n",
- "\n",
- "bc1=DirichletBC(V,Constant(25),BC1)\n",
- "bc2=DirichletBC(V,Constant(800),BC2)\n",
- "bc=(bc1,bc2)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 24,
- "metadata": {},
- "outputs": [],
- "source": [
- "u_n = project(25, V)\n",
- "u = TrialFunction(V)\n",
- "v = TestFunction(V)\n",
- "f = Constant(0.0)\n",
- "F = u*v*dx + alpha*dt*dot(grad(u), grad(v))*dx-u_n*v*dx\n",
- "a, L = lhs(F), rhs(F)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 25,
- "metadata": {},
- "outputs": [],
- "source": [
- "vtkfile = File('solution/solution2.pvd')\n",
- "u = Function(V)\n",
- "t = 0\n",
- "for n in range(num_steps):\n",
- " t += dt\n",
- " #u0.t = t\n",
- " solve(a == L, u, bc)\n",
- " vtkfile << (u, t)\n",
- " #c = plot(u,)\n",
- " #plt.colorbar(c)\n",
- " #plt.show()\n",
- " u_n.assign(u)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "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.6.7"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
|