{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise 2: Scattering from a pressure-release sphere" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The problem\n", "\n", "In the [first](../tutorials/1_sphere_scatterer_null_field.ipynb) and [second](../tutorials/2_sphere_scatterer_direct.ipynb) tutorials, we looked at two formulations for a rigid scattering problem.\n", "\n", "In this exercise, you will write your own code to solve a pressure-release scattering problem. As in the tutorials, we will use a unit sphere for $\\Omega$, and we define the incident wave by\n", "\n", "$$\n", "p_{\\text{inc}}(\\mathbf x) = \\mathrm{e}^{\\mathrm{i} k x_0}.\n", "$$\n", "\n", "where $\\mathbf x = (x_0, x_1, x_2)$.\n", "\n", "Acoustic waves are governed by the Helmholtz equation:\n", "\n", "$$\n", "\\Delta p_\\text{total} + k^2 p_\\text{total} = 0, \\quad \\text{ in } \\mathbb{R}^3 \\backslash \\Omega,\n", "$$\n", "\n", "where $p_\\text{total}$ is the total pressure. We can split $p_\\text{total}$ into incident and scattered pressures by writing $p_\\text{s}+p_\\text{inc}$. The scattered pressure ($p_\\text{s}$) satisfies the Sommerfeld radiation condition\n", "\n", "$$\n", "\\frac{\\partial p_\\text{s}}{\\partial r}-\\mathrm{i}kp_\\text{s}=o(r^{-1})\n", "$$\n", "\n", "when $r:=|\\mathbf{x}|\\rightarrow\\infty$.\n", "\n", "For our problem, we impose a Dirichlet boundary condition:\n", "\n", "$$\n", "p_\\text{total}=0, \\quad \\text{ on } \\Gamma,\n", "$$\n", "\n", "where $\\Gamma$ is the surface of the sphere $\\Omega$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The formulation\n", "\n", "We use a formulation based on the [direct formulation in the second tutorial](../tutorials/2_sphere_scatterer_direct.ipynb).\n", "\n", "### Representation formula\n", "\n", "For this problem, we use the following representation formula:\n", "\n", "$$\n", "p_\\text{s} = \\mathcal{D}u -\\mathcal{S}\\lambda,\n", "$$\n", "\n", "where $\\mathcal{S}$ is the single layer potential operator; $\\mathcal{D}$ is the double layer potential operator; $u$ is the value (or trace) of $p_\\text{s}$ on the surface $\\Gamma$; and $\\lambda$ is the normal derivative of $p_\\text{s}$ on the surface $\\Gamma$.\n", "\n", "For this problem, our boundary condition tells us that $u=-p_\\text{inc}$ on $\\Gamma$.\n", "\n", "### Boundary integral equation\n", "\n", "For this problem, we want to solve the following boundary integral equation:\n", "\n", "$$\n", "\\mathsf{S}\\lambda = -(\\mathsf{D} - \\tfrac{1}{2}\\mathsf{I})p_\\text{inc},\n", "$$\n", "\n", "where $\\mathsf{S}$ is the single layer boundary operator; $\\mathsf{D}$ is the double layer boundary operator, and $\\mathsf{I}$ is the identity operator." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Solving with Bempp\n", "\n", "Your task is to adapt and combine the two example codes in [first](../tutorials/1_sphere_scatterer_null_field.ipynb) and [second](../tutorials/2_sphere_scatterer_direct.ipynb) tutorials to solve this problem and plot a slice of the solution at $z=0$\n", "\n", "To get you started, I've copies the first few lines (which were the same in both examples) into the cell below." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import bempp.api\n", "from bempp.api.operators.boundary import helmholtz, sparse\n", "from bempp.api.operators.potential import helmholtz as helmholtz_potential\n", "from bempp.api.linalg import gmres\n", "import numpy as np\n", "from matplotlib import pyplot as plt\n", "\n", "k = 8.\n", "\n", "grid = bempp.api.shapes.regular_sphere(3)\n", "\n", "space = bempp.api.function_space(grid, \"DP\", 0)\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## What next?\n", "\n", "After attempting this exercises, you should read [tutorial 3](../tutorials/3_convergence.ipynb)." ] } ], "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.8.10" } }, "nbformat": 4, "nbformat_minor": 4 }