{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Time update for *Cerjan* damped constant density acoustics with forward approximation for $\\partial_t$\n",
"\n",
"We show a derivation for the time update expression used for the constant density acoustic solver. You can compare the end result of this derivation in the last equation line below with lines 58-59 in the file ```examples/seismic/acoustic/operators.py```."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Table of symbols\n",
"\n",
"| Symbol | Description | Dimensionality | \n",
"| :--- | :--- | :--- |\n",
"| $\\delta t$ | Temporal sampling interval | constant |\n",
"| $m(x,y,z)$ | slowness squared | function of space |\n",
"| $\\eta(x,y,z)$ | Damping coefficient | function of space |\n",
"| $u(t,x,y,z)$ | Pressure wavefield | function of time and space |\n",
"| $q(t,x,y,z)$ | Source term | function of time, localized in space |\n",
"| $\\partial_{t}$ | first derivative wrt $t$ | time |\n",
"| $\\partial_{tt}$ | second derivative wrt $t$ | time |\n",
"| $\\nabla^2$ | Laplacian operator | space |"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## A word about notation \n",
"\n",
"For clarity in the following derivation we will drop the space notatation for certain variables:\n",
"- $m(x,y,z) \\rightarrow m$\n",
"- $\\eta(x,y,z) \\rightarrow \\eta$\n",
"- $u(t,x,y,z) \\rightarrow u(t)$\n",
"- $q(t,x,y,z) \\rightarrow q(t)$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The time update equation\n",
"\n",
"To implement the Devito modeling operator we define the equation used to update the pressure wavefield as a function of time. What follows is a bit of algebra using the wave equation and finite difference approximations to time derivatives to express the pressure wavefield forward in time $u(t+\\delta t)$ as a function of the current $u(t)$ and previous $u(t-\\delta t)$ pressure wavefields.\n",
"\n",
"#### 1. First order numerical derivative (forward):\n",
"The first order accurate forward approximation to the first time derivative involves two wavefields: $u(t-\\delta t)$, and $u(t)$. We can use this expression as is. \n",
"\n",
"$$\n",
"\\partial_{t}\\ u(t) = \\frac{u(t+\\delta t) - u(t)}{\\delta t}\n",
"$$\n",
"
\n",
"\n",
"#### 2. Second order numerical derivative:\n",
"The second order accurate centered approximation to the second time derivative involves three wavefields: $u(t-\\delta t)$, $u(t)$, and $u(t+\\delta t)$. \n",
"\n",
"$$\n",
"\\partial_{tt}\\ u(t) = \\frac{u(t+\\delta t) - 2\\ u(t) + u(t-\\delta t)}{\\delta t^2}\n",
"$$\n",
"
\n",
"\n",
"#### 3. Second order time update:\n",
"In order to advance our finite difference solution in time, we solve for $u(t+\\delta t)$.\n",
"\n",
"$$\n",
"u(t+\\delta t) = \\delta t^2\\ \\partial_{tt}\\ u(t) + 2\\ u(t) - u(t-\\delta t)\n",
"$$\n",
"
\n",
"\n",
"#### 4. Damped wave equation:\n",
"\n",
"Our *Cerjan* (reference below) damped wave equation, which we solve for $\\partial_{tt}$:\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"m\\ \\partial_{tt}\\ u(t) + \\eta\\ \\partial_{t}\\ u(t) &= \\nabla^2 u(t) + q(t) \\\\[10pt]\n",
"\\partial_{tt}\\ u(t) &=\n",
" \\frac{1}{m} \\Bigr[ \\nabla^2 u(t) + q(t) - \\eta\\ \\partial_{t}\\ u(t) \\Bigr]\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"#### 5. Time update:\n",
"Next we plug in the expression for $\\partial_{tt}\\ u$ (from the wave equation) and $\\partial_{t}\\ u$ (from the numerical derivative) into the the time update expression for $u(t+\\delta t)$ from step 3.\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"u(t+\\delta t) &=\n",
" \\frac{\\delta t^2}{m} \\Bigr[ \\nabla^2 u(t) + q(t)\n",
" - \\frac{\\eta}{\\delta t} \\bigr\\{ u(t+\\delta t) - u(t) \\bigr\\} \\Bigr]\n",
" + 2\\ u(t) - u(t-\\delta t)\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"#### 6. Simplify:\n",
"\n",
"Finally we simplify this expression to the form used in the Devito ```Operator```.\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\left(1 + \\frac{\\delta t\\ \\eta}{m}\\right) u(t+\\delta t) &= \n",
" \\frac{\\delta t^2}{m} \\Bigr\\{ \\nabla^2 u(t) + q(t) \\Bigr\\}\n",
" + \\frac{\\delta t\\ \\eta}{m}\\ u(t) + 2\\ u(t) - u(t-\\delta t) \\\\[15pt]\n",
"u(t+\\delta t) &=\n",
" \\left( \\frac{1}{m+\\delta t\\ \\eta} \\right) \\Bigr[\n",
" \\delta t^2 \\Bigr\\{ \\nabla^2 u(t) + q(t) \\Bigr\\}\n",
" + \\delta t\\ \\eta\\ u(t) + m\\ \\left[2\\ u(t) - u(t-\\delta t) \\right]\n",
" \\Bigr]\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"\n",
"#### 7. Compare:\n",
"\n",
"Please compare the last equation above with [lines 58-59 in examples/seismic/acoustic/operators.py](https://github.com/devitocodes/devito/blob/master/examples/seismic/acoustic/operators.py#L58-L59)\n",
"\n",
"```\n",
"eq_time = ((lap + q) * s**2 + s * damp * field +\n",
" m * (2 * field - prev))/(s * damp + m)```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References\n",
"\n",
"- **A nonreflecting boundary condition for discrete acoustic and elastic wave equations** (1985)\n",
"
Charles Cerjan, Dan Kosloft. Ronnie Kosloff, and Moshe Resheq\n",
"
Geophysics, Vol. 50, No. 4\n",
"
https://library.seg.org/doi/pdfplus/10.1190/segam2016-13878451.1"
]
},
{
"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.8.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}