{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "**Hello, freifrau! I am TheInterview, your partial differential equations and simulations expert.**\n", "Let's set up a model and simulation together.\n", "\n", "To get explanations, enter explain . \n", "To see a recap of what we know so far, enter recap . \n", "To interactively visualize the current theory graph, enter tgwiev or tgview mpd. \n", "Otherwise, you can always answer with LaTeX-type input.\n", "\n", "\n", "## Modeling\n", "\n", "\n", "\n", "How many dimensions does your model have?\n", "\n", "\n", "\n", "I am just assuming it's 1, since that is all we can currently handle.\n", "\n", "\n", "\n", "\n", "\n", "\n", "What is the domain in your model? Ω : type ❘ = [?;?], e.g. \\Omega = [0.0;1.0]" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "we will just assume that the variable is called x for now.\n", "\n", "\n", "\n", "Which variable(s) are you looking for? / What are the unknowns in your model? u : Ω ⟶ ??, e.g., u : Ω ⟶ ℝ ?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Ω = [0.0;1.0]\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Ok, t : Ω ⟶ ℝ\n", "\n", "\n", "\n", "Would you like to name additional parameters like constants or functions (that are independent of your unknowns)? c : ℝ = ? or f : Ω ⟶ ℝ = ?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "t : Ω ⟶ ℝ" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Ok, f = [ x : Ω] x\n", "\n", "\n", "\n", "Would you like to declare more parameters?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "f = x" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Ok, κ = [ x : Ω] -5.0\n", "\n", "\n", "\n", "Would you like to declare more parameters?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\\kappa = -5.0" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/markdown": [] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "y" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/markdown": [ "Ok, k = [ x : Ω] x ⋅ x\n", "\n", "\n", "\n", "Would you like to declare more parameters?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "k = x ⋅ x" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "These are the things we know so far about your problem:\n", "\n", "\n", "\n", "\n", "\n", "\n", "domain: {'name': 'Ω', 'theoryname': 'ephdomain', 'axes': OrderedDict([('x', '[0.0;1.0]')]), 'from': '0.0', 'to': '1.0', 'boundary_name': 'Ω', 'viewname': 'ephdomainASmDomain'}\n", "\n", "\n", "\n", "\n", "\n", "\n", "unknowns: OrderedDict([('t', {'theoryname': 't', 'string': 't : Ω ⟶ ℝ', 'type': 'Ω ⟶ ℝ', 'codomain': 'ℝ', 'viewname': 'tASmUnknown'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "parameters: OrderedDict([('f', {'theoryname': 'f', 'string': 'f = x', 'parsestring': 'f = [ x : Ω] x', 'type': '{ : Ω } Ω', 'viewname': 'fASmParameter'}), ('κ', {'theoryname': 'κ', 'string': 'κ = -5.0', 'parsestring': 'κ = [ x : Ω] -5.0', 'type': '{ : Ω } ℝ', 'viewname': 'κASmParameter'}), ('k', {'theoryname': 'k', 'string': 'k = x ⋅ x', 'parsestring': 'k = [ x : Ω] x ⋅ x', 'type': '{ : Ω } ℝ', 'viewname': 'kASmParameter'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "You can inspect the persistently loaded MMT theories under http://localhost:9000\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "recap" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "f = x\n", "κ = -5.0\n", "k = x ⋅ x\n", "\n", "\n", "\n", "Let's talk about your partial differential equation(s). What do they look like? Δu = 0.0, or laplace_operator Ω ℝ u = f ?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/markdown": [ "Ok, \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "These are all the PDEs needed.\n", "Let's discuss your boundary conditions. What do they look like? u(x) = f(x) or u(1.0) = \\alpha ?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Δt = \\kappa" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Ok \n", "\n", "\n", "\n", "These are all the boundary conditions needed.\n", "\n", "\n", "\n", "Do you know something about the operator Δ? Is it e.g. linear, or not elliptic ? \n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "t = f" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "OK!\n", "do you know anything else?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "linear" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "OK!\n", "do you know anything else?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "elliptic" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "\n", "\n", "\n", "These are the things we know so far about your problem:\n", "\n", "\n", "\n", "\n", "\n", "\n", "domain: {'name': 'Ω', 'theoryname': 'ephdomain', 'axes': OrderedDict([('x', '[0.0;1.0]')]), 'from': '0.0', 'to': '1.0', 'boundary_name': 'Ω', 'viewname': 'ephdomainASmDomain'}\n", "\n", "\n", "\n", "\n", "\n", "\n", "unknowns: OrderedDict([('t', {'theoryname': 't', 'string': 't : Ω ⟶ ℝ', 'type': 'Ω ⟶ ℝ', 'codomain': 'ℝ', 'viewname': 'tASmUnknown'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "parameters: OrderedDict([('f', {'theoryname': 'f', 'string': 'f = x', 'parsestring': 'f = [ x : Ω] x', 'type': '{ : Ω } Ω', 'viewname': 'fASmParameter'}), ('κ', {'theoryname': 'κ', 'string': 'κ = -5.0', 'parsestring': 'κ = [ x : Ω] -5.0', 'type': '{ : Ω } ℝ', 'viewname': 'κASmParameter'}), ('k', {'theoryname': 'k', 'string': 'k = x ⋅ x', 'parsestring': 'k = [ x : Ω] x ⋅ x', 'type': '{ : Ω } ℝ', 'viewname': 'kASmParameter'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "pdes: {'pdes': [{'theoryname': 'ephemeral_pde1', 'string': 'Δt = κ', 'lhsstring': 'Δt', 'rhsstring': 'κ', 'rhsstring_expanded': '-5.0', 'viewname': 'ephemeral_pde1ASmPDE', 'op': 'Δ', 'lhsparsestring': ' [ anyt : Ω ⟶ ℝ ] Δ anyt ', 'rhsparsestring': ' κ'}]}\n", "\n", "\n", "\n", "\n", "\n", "\n", "bcs: {'theoryname': 'ephbcs', 'bcs': [{'name': 'bc0', 'string': 't = f', 'lhsstring': 't', 'rhsstring': 'f', 'rhsstring_expanded': 'x', 'type': ('Dirichlet',), 'on': ('x',), 'measure': (2,)}], 'viewname': 'ephbcsASmBCsRequired', 'measure_given': 2}\n", "\n", "\n", "\n", "\n", "\n", "\n", "props: {'theoryname': 'ephBoundaryValueProblem', 'viewname': 'ephBoundaryValueProblemASmEllipticLinearDirichletBoundaryValueProblem', 'ops': [{'name': 'Δ', 'props': ['elliptic'], 'linear': True}]}\n", "\n", "\n", "\n", "\n", "\n", "\n", "sim: {'type': None}\n", "\n", "\n", "\n", "\n", "\n", "\n", "You can inspect the persistently loaded MMT theories under http://localhost:9000\n", "## Solving\n", "\n", "\n", "\n", "Would you like to try and solve the PDE using the Finite Difference Method in ExaStencils? If yes, you can provide a configuration name, or we'll just use your name.\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 14, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "tgview mpd" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "These are the things we know so far about your problem:\n", "\n", "\n", "\n", "\n", "\n", "\n", "domain: {'name': 'Ω', 'theoryname': 'ephdomain', 'axes': OrderedDict([('x', '[0.0;1.0]')]), 'from': '0.0', 'to': '1.0', 'boundary_name': 'Ω', 'viewname': 'ephdomainASmDomain'}\n", "\n", "\n", "\n", "\n", "\n", "\n", "unknowns: OrderedDict([('t', {'theoryname': 't', 'string': 't : Ω ⟶ ℝ', 'type': 'Ω ⟶ ℝ', 'codomain': 'ℝ', 'viewname': 'tASmUnknown'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "parameters: OrderedDict([('f', {'theoryname': 'f', 'string': 'f = x', 'parsestring': 'f = [ x : Ω] x', 'type': '{ : Ω } Ω', 'viewname': 'fASmParameter'}), ('κ', {'theoryname': 'κ', 'string': 'κ = -5.0', 'parsestring': 'κ = [ x : Ω] -5.0', 'type': '{ : Ω } ℝ', 'viewname': 'κASmParameter'}), ('k', {'theoryname': 'k', 'string': 'k = x ⋅ x', 'parsestring': 'k = [ x : Ω] x ⋅ x', 'type': '{ : Ω } ℝ', 'viewname': 'kASmParameter'})])\n", "\n", "\n", "\n", "\n", "\n", "\n", "pdes: {'pdes': [{'theoryname': 'ephemeral_pde1', 'string': 'Δt = κ', 'lhsstring': 'Δt', 'rhsstring': 'κ', 'rhsstring_expanded': '-5.0', 'viewname': 'ephemeral_pde1ASmPDE', 'op': 'Δ', 'lhsparsestring': ' [ anyt : Ω ⟶ ℝ ] Δ anyt ', 'rhsparsestring': ' κ'}]}\n", "\n", "\n", "\n", "\n", "\n", "\n", "bcs: {'theoryname': 'ephbcs', 'bcs': [{'name': 'bc0', 'string': 't = f', 'lhsstring': 't', 'rhsstring': 'f', 'rhsstring_expanded': 'x', 'type': ('Dirichlet',), 'on': ('x',), 'measure': (2,)}], 'viewname': 'ephbcsASmBCsRequired', 'measure_given': 2}\n", "\n", "\n", "\n", "\n", "\n", "\n", "props: {'theoryname': 'ephBoundaryValueProblem', 'viewname': 'ephBoundaryValueProblemASmEllipticLinearDirichletBoundaryValueProblem', 'ops': [{'name': 'Δ', 'props': ['elliptic'], 'linear': True}]}\n", "\n", "\n", "\n", "\n", "\n", "\n", "sim: {'type': None}\n", "\n", "\n", "\n", "\n", "\n", "\n", "You can inspect the persistently loaded MMT theories under http://localhost:9000\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "recap" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/markdown": [] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "tgview" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "TheInterview", "language": "text", "name": "interview" }, "language_info": { "file_extension": ".txt", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/plain", "name": "text" } }, "nbformat": 4, "nbformat_minor": 2 }