Skip to content

Commit

Permalink
fix readme [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
islent committed Dec 18, 2023
1 parent 41e7e78 commit 89f5359
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ This package is extracted from [AstroNbodySim.jl](https://github.com/JuliaAstroS
### Differencing

Central differencing scheme is defined as

$$\left(\frac{\partial u}{\partial x}\right)_{i, j}=\frac{1}{2 \Delta x}\left(u_{i+1, j}-u_{i-1, j}\right)+O(\Delta x)$$

Suppose we have an 1D data, and $\delta x = 5$:
```julia
julia> d1 = [1,2,1]
Expand Down Expand Up @@ -76,11 +78,16 @@ julia> grad_central(1, 1, 1, d3)
### FDM solver

#### Poisson equation
$$\delta u = f$$
$$\Delta u = f$$

can be discretized to

$$\frac{u_{i+1}-2 u_{i}+u_{i-1}}{\Delta x^{2}}=f_{i}, i = 1, 2, \cdots, N$$

In Dirichlet boundary conditions,
$$\frac{1}{\Delta x^2} \begin{pmatrix}

$$
\frac{1}{\Delta x^2} \begin{pmatrix}
-2 & 1 & 0 & \cdots & \cdots & 0 \\
1 & -2 & 1 & 0 & \cdots & \vdots \\
0 & 1 & -2 & 1 & \cdots & \vdots \\
Expand All @@ -94,9 +101,11 @@ $$\frac{1}{\Delta x^2} \begin{pmatrix}
\end{pmatrix}
= \begin{pmatrix}
f_1 \\ f_2 \\ \vdots \\ \vdots \\ \vdots \\ f_{N-1} \\ f_N
\end{pmatrix}$$
\end{pmatrix}
$$

The Poisson problem is converted to solving a matrix equation

$$\mathbf{A} \cdot \mathbf{u} = \mathbf{f}$$

`PhysicalFDM.jl` is here to provide user-friendly tools to generate `\mathbf{A}` matrix.
Expand Down

0 comments on commit 89f5359

Please sign in to comment.