Institute for Physics and Astronomy, University of Potsdam
October 24, 2024
ICF = Inertial Confinement Fusion
Kinetic description
Microscopic properties, it uses the velocity distribution function \(f(\vec{x}, \vec{v}, t)\).
Fluid description
Uses a few macroscopic quantities, averages of the distribution function (mean velocity \(v(\vec{x},t)\), pressure/temperature). Valid for exact or near thermodynamic equilibrium.
Hierarchy of plasma physics models
Range of validity of different plasma codes based on typical magnetospheric parameters: \(n=50cm^{-3}\), \(B=50 nT\), \(T_e=T_i=100 eV\) (Winske and Omidi 1996).
https://xkcd.com/505/
$ jupyter lab
If Jupyter Lab does not exist, run:
$ pip3 install --upgrade pip
$ pip3 install --user jupyterlab numpy scipy matplotlib
$ export PATH=$HOME/.local/bin:$PATH
$ jupyter lab
Perhaps, you want to add the PATH into your ~/.bashrc file to be loaded automatically when you log in.
OR
We want to solve the ordinary differential equation (ODE): \[ \frac{dy}{dt}=f(t,y), \] with the initial conditions \(y(t_0)=y_0\).
\(\Rightarrow\) to find the value of \(y\) at a given \(t_n\): \(y_n:=y(t_n)\) (discretization).
Idea
\[ \frac{dy^{(1)}}{dt}=f^{(1)}\left(t,\{y^{(i)}\} \right)\\ \frac{dy^{(2)}}{dt}=f^{(2)}\left(t,\{y^{(i)}\}\right)\\ \cdots \qquad \cdots \\ \frac{dy^{(N)}}{dt}=f^{(N)}\left(t,\{y^{(i)}\}\right)\\ \]
\[ \] \[ \Leftrightarrow \]
\[ \qquad\frac{d\vec{y}}{dt}=\vec{f}(t,\vec{y})\qquad\qquad\qquad \nonumber\\\ \vec{y}=\begin{pmatrix} y^{(1)} \\ y^{(2)}\\\vdots \\ y^{(N)} \end{pmatrix},\qquad \vec{f}=\begin{pmatrix} f^{(1)}(t,\vec{y})\\ f^{(2)}(t,\vec{y})\\ \vdots \\ f^{(N)}(t,\vec{y}) \end{pmatrix} \qquad(1)\]
Simplest method to solve Equation 1: forward finite difference centered at \((t_i,y_i)\)
(extrapolating the initial slope).
Euler’s method/Forward difference
\[ y_{i+1}=y_i + \Delta t f(t_i,y_i)+\mathcal{O}(\Delta t) \]
Explicit methods
They give \(y_{i+1}\) in terms of already known values of \(y_i\) — e.g., the Euler method.
Implicit methods
They require to solve (invert) another equation (matrix) to obtain \(y_{i+1}\).
All finite difference expressions are based on
Taylor expansion
\[ f_{i+1}=f(x_i + \Delta x)=f_i + \Delta x f'(x_i) + \frac{\Delta x^2}{2!}f''(x_i) + \frac{\Delta x^3} {3!}f'''(x_i)+\cdots \]
Better accuracy can be obtained by considering more points \[ f_{i+1}-f_{i-1}= 2\Delta xf' + \frac{\Delta x^3}{3}f'''+\cdots \]
Central differences or 3 points formula
\[ f'(x_i)=\frac{1}{2\Delta x}\left[f_{i+1}-f_{i-1}\right]+\mathcal{O}(\Delta x^2) \]
And similarly, using \(f_{i+2}-f_{i-2}\),
5 points formula
\[ f'(x_i)=\frac{1}{12\Delta x}\left[f_{i-2}-8f_{i-1}+8f_{i+1}-f_{i+2}\right]+\mathcal{O}(\Delta x^4) \]
By using (only) \(f_{i+1}\) and \(f_{i-1}\), we can get ,
Second order derivatives
\[ f''(x_i)=\frac{f_{i+1} - 2f_i + f_{i-1}}{\Delta x^2}+\mathcal{O}(\Delta x^2) \qquad(2)\]
We can also get this by using 1st-order central differences \[ f''(x_i)=\frac{d}{dx}\left(\frac{df}{dx}\right)=\lim_{\Delta x\to 0}\frac{f'_{i+1/2}-f'_{i-1/2}}{\Delta x}\approx \frac{(f_{i+1}-f_i)/\Delta x-(f_{i}-f_{i-1})/\Delta x}{\Delta x} \]
It is possible to systematically obtain higher order derivatives with arbitrary accuracy. See a list in http://en.wikipedia.org/wiki/Finite_difference_coefficients
For 2D domains (e.g., in PDEs), we can generalize the previous procedure by using, e.g, a five-point stencil \[ \left(\frac{\partial^2 f}{\partial x \partial y}\right)_{i,j}=\frac{\left(\frac{\partial f}{\partial y}\right)_{i+1,j}-\left(\frac{\partial f}{\partial y}\right)_{i-1,j}}{2\Delta x} \approx \frac{f_{i+1,j+1}-f_{i+1,j-1}-f_{i-1,j+1}+f_{i-1,j-1}}{4\Delta x\Delta y} \]
Select a differential method and numerically solve the differential equation \[ \frac{dx}{dt} = f(t) = cos(t) \qquad(3)\] with \(\Delta t = 0.01\), and initial condition x(t=0) = 0, and interval \(t = [0,6\)\(]\).
Compare various methods with analytical solution of Equation 3
Analyze impact of the time step \(\Delta t\) on the quality of the solution
How much run-time differs when changing the size of the time step?
Tip: For timing the computation use “%%timeit
” command at the beginning of the notebook cells.
Analytically prove Equation 2, using the formula for the first derivative
Curves in the space of independent variables of a PDE, along which the PDE has only total differentials.
By integrating along those curves one can find the solutions of such a PDE.
Example: \[ a\frac{\partial u}{\partial t} + b\frac{\partial u}{\partial x} = c \] with solutions \(u=u(x(t),t)\).
Total derivative of \(u\): \[ \frac{du}{dt}=\frac{\partial u}{\partial x}\frac{dx}{dt} + \frac{\partial u}{\partial t} \]
The characteristics are the solutions of: \[ \frac{dx}{dt}=\frac{b}{a},\;\; \frac{du}{dt}=\frac{c}{a} \] which means, for \(u(x_0,0)=u_0\), \[ x = x_0 + \frac{b}{a}t\\ u = u_0 + \frac{c}{a}t\\ \]
The characteristics are the solutions of: \[ \frac{dy}{dx} = \frac{B}{2A}\pm \frac{1}{2A}\sqrt{B^2 - 4AC} \]
This equation is:
It is possible to write such a system of \(n\) PDEs in two dependent variables \(x\) and \(y\) as: \[ \left(\bar{A}^T\frac{dy}{dx} - \bar{B}^T \right)\cdot \vec{L} = 0 \] where \(\vec{L}\) is a vector of dimension \(n\), \(\bar{A}^T\), \(\bar{B}^T\), are \(n\times n\) matrices.
The determinant leads to a \(n\)th order equation for \(dy/dx\), which can be classified as:
The most general form of a linear second order PDE with independent variables \(x,y\) and dependent variable \(f(x,y)\) is: \[ A\frac{\partial^2 f}{\partial x^2} + B\frac{\partial^2 f}{\partial x \partial y} + C\frac{\partial^2 f}{\partial y^2} + D\frac{\partial f}{\partial x} + E\frac{\partial f}{\partial y} + G = 0 \]
\(A,\dots, G\) are constants.
This equation is:
elliptic if \(B^2 - 4AC < 0\)
parabolic if \(B^2 - 4AC = 0\)
hyperbolic if \(B^2 - 4AC > 0\)
\[ A\frac{\partial^2 f}{\partial x^2} + B\frac{\partial^2 f}{\partial x \partial y} + C\frac{\partial^2 f}{\partial y^2} + D\frac{\partial f}{\partial x} + E\frac{\partial f}{\partial y} + G = 0 \]
Characteristics of a hyperbolic wave equation. Left: Domain of dependence. Right: Domain of influence (Jardin (2010)).
Let us define a domain, its boundary \(\partial R\), the coordinates \(n\) (outward normal to the boundary) and \(s\) (along the boundary), and the functions \(f\) and \(g\) on the boundary. The three types of BCs are:
(a) Initial (Cauchy) vs (b) Boundary value problems (Press et al. (2007)). In (a) the arrows indicate time.
Courant-Friedrichs-Lewy
Courant-Friedrichs-Lewy stability condition (CFL, Courant condition): \[ \frac{v\Delta t}{\Delta x}\leq 1 \] Example: 2nd order hyperbolic wave equation (derived from the determinant of a matrix).
CFL condition (Jardin (2010)).
Diffusion equation in 1D \[ \frac{\partial u}{\partial t}= D \frac{\partial^2 u }{\partial x^2} \qquad(10)\] where \(D\) is the diffuction parameter.
This can also be written as a flux-conservative equation, with F=-\(D \frac{\partial u}{\partial x}\).
\(D\geq 1\) in order for Eq. Equation 10 to be stable.
Applying a FTCS scheme we get: \[ \frac{u_j^{n+1} - u_j^{n}}{\Delta t} = D \left(\frac{u_{j+1}^{n} -2u_j^n + u_{j-1}^{n}}{(\Delta x)^2} \right) \qquad(11)\]
The 2nd order finite difference equation for \(j,k\)-element (derived by the Taylor expansion) is: \[ u_{j+1,k} + u_{j-1,k} + u_{j,k+1} + u_{j,k-1} - 4u_{j,k} = \Delta x^2 R_{j,k}. \qquad(15)\] Let the \((N+1)^2\) vector of unknowns be denoted by \(\vec{x}\), which contains \(u_{j,k}\) elements.
The matrix form of Equation 15 is \(\hat{A}\cdot\vec{X}=\vec{b}\)
Sparse matrix \(\hat{A}\):
Schematics of multigrid method