Skip to content

Commit

Permalink
Merge fixing the 27pt and 9pt stencil solver example documentation
Browse files Browse the repository at this point in the history
Fix some issues with documentation in the 27-pt and 7-pt stencil examples.

Related PR #306
  • Loading branch information
pratikvn authored May 29, 2019
2 parents c6229b8 + 5100011 commit de51ee9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
30 changes: 15 additions & 15 deletions examples/nine-pt-stencil-solver/doc/intro.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@
This example solves a 2D Poisson equation:

$
\Omega = (0,1)^2
\Omega_b = [0,1]^2 (with boundary)
\partial\Omega = \Omega_b \backslash \Omega
u : \Omega_b -> R
u'' = f in \Omega
u = u_D on \partial\Omega
\Omega = (0,1)^2 \\
\Omega_b = [0,1]^2 \text{ (with boundary)} \\
\partial\Omega = \Omega_b \backslash \Omega \\
u : \Omega_b -> R \\
u'' = f \in \Omega \\
u = u_D \in \partial\Omega \\
$

using a finite difference method on an equidistant grid with `K` discretization
points (`K` can be controlled with a command line parameter). The discretization
may be done by any order Taylor polynomial.
For an equidistant grid with K "inner" discretization points (x1,y1), ...,
(xk,y1),(x1,y2), ..., (xk,yk,z1) step size h = 1 / (K + 1) and a stencil \in
\R^{3 x 3}, the formula produces a system of linear equations
For an equidistant grid with K "inner" discretization points $ (x1,y1), ...,
(xk,y1),(x1,y2), ..., (xk,yk,z1) $ step size $h = 1 / (K + 1)$ and a stencil $\in
\R^{3 x 3}$, the formula produces a system of linear equations

\sum_{a,b=-1}^1 stencil(a,b) * u_{(i+a,j+b} = -f_k h^2, on any inner node with
$\sum_{a,b=-1}^1 stencil(a,b) * u_{(i+a,j+b} = -f_k h^2 $, on any inner node with
a neighborhood of inner nodes

On any node, where neighbor is on the border, the neighbor is replaced with a
'-stencil(a,b) * u_{i+a,j+b}' and added to the right hand side vector. For
$-stencil(a,b) * u_{i+a,j+b}$ and added to the right hand side vector. For
example a node with a neighborhood of only edge nodes may look like this

\sum_{a,b=-1}^(1,0) stencil(a,b) * u_{(i+a,j+b} = -f_k h^2 - \sum_{a=-1}^1
stencil(a,1) * * u_{(i+a,j+1}
$\sum_{a,b=-1}^(1,0) stencil(a,b) * u_{(i+a,j+b} = -f_k h^2 - \sum_{a=-1}^1
stencil(a,1) * u_{(i+a,j+1}$

which is then solved using Ginkgo's implementation of the CG method
preconditioned with block-Jacobi. It is also possible to specify on which
executor Ginkgo will solve the system via the command line.
The function `f` is set to `f(x,y) = 6x + 6y` (making the solution `u(x,y) = x^3
+ y^3`), but that can be changed in the `main` function. Also the stencil values
The function `f` is set to $f(x,y) = 6x + 6y$ (making the solution $u(x,y) = x^3
+ y^3$), but that can be changed in the `main` function. Also the stencil values
for the core, the faces, the edge and the corners can be changed when passing
additional parameters.

Expand Down
2 changes: 1 addition & 1 deletion examples/nine-pt-stencil-solver/nine-pt-stencil-solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ On any node, where neighbor is on the border, the neighbor is replaced with a
example a node with a neighborhood of only edge nodes may look like this
\sum_{a,b=-1}^(1,0) stencil(a,b) * u_{(i+a,j+b} = -f_k h^2 - \sum_{a=-1}^1
stencil(a,1) * * u_{(i+a,j+1}
stencil(a,1) * u_{(i+a,j+1}
which is then solved using Ginkgo's implementation of the CG method
preconditioned with block-Jacobi. It is also possible to specify on which
Expand Down
30 changes: 15 additions & 15 deletions examples/twentyseven-pt-stencil-solver/doc/intro.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
This example solves a 3D Poisson equation:

$
\Omega = (0,1)^3
\Omega_b = [0,1]^3 (with boundary)
\partial\Omega = \Omega_b \backslash \Omega
u : \Omega \rightarrow R\\
u'' = f in \Omega\\
u = u_D on \partial\Omega
\Omega = (0,1)^3 \\
\Omega_b = [0,1]^3 \text{ (with boundary)} \\
\partial\Omega = \Omega_b \backslash \Omega \\
u : \Omega \rightarrow R \\
u'' = f \in \Omega \\
u = u_D \in \partial\Omega \\
$

using a finite difference method on an equidistant grid with `K` discretization
points (`K` can be controlled with a command line parameter). The discretization
may be done by any order Taylor polynomial.
For an equidistant grid with K "inner" discretization points (x1,y1,z1), ...,
(xk,y1,z1),(x1,y2,z1), ..., (xk,yk,z1), (x1,y1,z2), ..., (xk,yk,zk), step size h
= 1 / (K + 1) and a stencil \in \R^{3 x 3 x 3}, the formula produces a system of
For an equidistant grid with K "inner" discretization points $(x1,y1,z1), ...,
(xk,y1,z1),(x1,y2,z1), ..., (xk,yk,z1), (x1,y1,z2), ..., (xk,yk,zk)$, step size $h
= 1 / (K + 1)$ and a stencil $\in \R^{3 x 3 x 3}$, the formula produces a system of
linear equations

\sum_{a,b,c=-1}^1 stencil(a,b,c) * u_{(i+a,j+b,k+c} = -f_k h^2, on any inner
$\sum_{a,b,c=-1}^1 stencil(a,b,c) * u_{(i+a,j+b,k+c} = -f_k h^2$, on any inner
node with a neighborhood of inner nodes

On any node, where neighbor is on the border, the neighbor is replaced with a
'-stencil(a,b,c) * u_{i+a,j+b,k+c}' and added to the right hand side vector.
$-stencil(a,b,c) * u_{i+a,j+b,k+c}$ and added to the right hand side vector.
For example a node with a neighborhood of only face nodes may look like this

\sum_{a,b,c=-1}^(1,1,0) stencil(a,b,c) * u_{(i+a,j+b,k+c} = -f_k h^2 -
\sum_{a,b=-1}^(1,1) stencil(a,b,1) * * u_{(i+a,j+b,k+1}
$\sum_{a,b,c=-1}^(1,1,0) stencil(a,b,c) * u_{(i+a,j+b,k+c} = -f_k h^2 -
\sum_{a,b=-1}^(1,1) stencil(a,b,1) * u_{(i+a,j+b,k+1}$

which is then solved using Ginkgo's implementation of the CG method
preconditioned with block-Jacobi. It is also possible to specify on which
executor Ginkgo will solve the system via the command line.
The function `f` is set to `f(x,y,z) = 6x + 6y + 6z` (making the solution
`u(x,y,z) = x^3 + y^3 + z^3`), but that can be changed in the `main` function.
The function `f` is set to $f(x,y,z) = 6x + 6y + 6z$ (making the solution
$u(x,y,z) = x^3 + y^3 + z^3$), but that can be changed in the `main` function.
Also the stencil values for the core, the faces, the edge and the corners can be
changed when passing additional parameters.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ On any node, where neighbor is on the border, the neighbor is replaced with a
For example a node with a neighborhood of only face nodes may look like this
\sum_{a,b,c=-1}^(1,1,0) stencil(a,b,c) * u_{(i+a,j+b,k+c} = -f_k h^2 -
\sum_{a,b=-1}^(1,1) stencil(a,b,1) * * u_{(i+a,j+b,k+1}
\sum_{a,b=-1}^(1,1) stencil(a,b,1) * u_{(i+a,j+b,k+1}
which is then solved using Ginkgo's implementation of the CG method
preconditioned with block-Jacobi. It is also possible to specify on which
Expand Down

0 comments on commit de51ee9

Please sign in to comment.