You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/multigrid.rst
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,47 @@
1
1
Multigrid Solvers
2
2
=================
3
3
4
+
pyro solves elliptic problems (like Laplace's equation or Poisson's
5
+
equation) through multigrid. This accelerates the convergence of
6
+
qsimple relaxation by moving the solution down and up through a series
7
+
of grids. Chapter 9 of the `pdf notes <http://open-astrophysics-bookshelf.github.io/numerical_exercises/CompHydroTutorial.pdf>`_ gives an introduction to solving elliptic equations, including multigrid.
8
+
9
+
There are three solvers:
10
+
11
+
* The core solver, provided in the class :func:`MG.CellCenterMG2d <pyro.multigrid.MG.CellCenterMG2d>` solves constant-coefficient Helmholtz problems of the form
12
+
13
+
$$(\alpha - \beta \nabla^2) \phi = f$$
14
+
15
+
* The class :func:`variable_coeff_MG.VarCoeffCCMG2d <pyro.multigrid.variable_coeff_MG.VarCoeffCCMG2d>` solves variable coefficient Poisson problems of the form
16
+
17
+
$$\nabla \cdot (\eta \nabla \phi ) = f`$$
18
+
19
+
This class inherits the core functionality from ``MG.CellCenterMG2d``.
20
+
21
+
* The class :func:`general_MG.GeneralMG2d <pyro.multigrid.general_MG.GeneralMG2d>` solves a general elliptic
Copy file name to clipboardExpand all lines: docs/source/multigrid_basics.rst
+14-42Lines changed: 14 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,9 @@
1
-
Multigrid Class Overview
2
-
========================
1
+
Simple Multigrid Examples
2
+
=========================
3
3
4
-
pyro solves elliptic problems (like Laplace's equation or Poisson's
5
-
equation) through multigrid. This accelerates the convergence of
6
-
simple relaxation by moving the solution down and up through a series
7
-
of grids. Chapter 9 of the `pdf notes <http://open-astrophysics-bookshelf.github.io/numerical_exercises/CompHydroTutorial.pdf>`_ gives an introduction to solving elliptic equations, including multigrid.
8
4
9
-
There are three solvers:
10
-
11
-
* The core solver, provided in the class :func:`MG.CellCenterMG2d <pyro.multigrid.MG.CellCenterMG2d>` solves constant-coefficient Helmholtz problems of the form
12
-
:math:`(\alpha - \beta\nabla^2) \phi = f`
13
-
14
-
* The class :func:`variable_coeff_MG.VarCoeffCCMG2d <pyro.multigrid.variable_coeff_MG.VarCoeffCCMG2d>` solves variable coefficient Poisson problems of the form
15
-
:math:`\nabla\cdot (\eta\nabla\phi ) = f`. This class inherits the core functionality from ``MG.CellCenterMG2d``.
16
-
17
-
* The class :func:`general_MG.GeneralMG2d <pyro.multigrid.general_MG.GeneralMG2d>` solves a general elliptic
18
-
equation of the form :math:`\alpha\phi + \nabla\cdot ( \beta
19
-
\nabla\phi) + \gamma\cdot\nabla\phi = f`. This class inherits
20
-
the core functionality from :func:`MG.CellCenterMG2d <pyro.multigrid.MG.CellCenterMG2d>`.
21
-
22
-
This solver is the only one to support inhomogeneous boundary
23
-
conditions.
24
-
25
-
We simply use V-cycles in our implementation, and restrict ourselves
26
-
to square grids with zoning a power of 2.
27
-
28
-
The multigrid solver is not controlled through ``pyro_sim.py`` since
29
-
there is no time-dependence in pure elliptic problems. Instead, there
30
-
are a few scripts in the multigrid/ subdirectory that demonstrate its
31
-
use.
32
-
33
-
Simple Examples
34
-
---------------
35
-
36
-
multigrid test
37
-
^^^^^^^^^^^^^^
5
+
Known Solution
6
+
--------------
38
7
39
8
A basic multigrid test is run as (using a path relative to the root of the
40
9
``pyro2`` repository):
@@ -43,7 +12,7 @@ A basic multigrid test is run as (using a path relative to the root of the
43
12
44
13
./pyro/multigrid/examples/mg_test_simple.py
45
14
46
-
The ``mg_test_simple.py`` script solves a Poisson equation with a
15
+
The `mg_test_simple.py<https://github.com/python-hydro/pyro2/blob/main/pyro/multigrid/examples/mg_test_simple.py>`_ script solves a Poisson equation with a
47
16
known analytic solution. This particular example comes from the text
48
17
`A Multigrid Tutorial, 2nd Ed.`, by Briggs. The example is:
49
18
@@ -88,23 +57,25 @@ You can run this example locally by running the ``mg_vis.py`` script:
88
57
89
58
./pyro/multigrid/examples/mg_vis.py
90
59
91
-
projection
92
-
^^^^^^^^^^
60
+
Projection
61
+
----------
93
62
94
63
Another example uses multigrid to extract the divergence free part of a velocity
95
-
field. This is run as:
64
+
field. The script to run this is `project_periodic.py <https://github.com/python-hydro/pyro2/blob/main/pyro/multigrid/examples/project_periodic.py>`_. This is run as:
96
65
97
66
.. prompt:: bash
98
67
99
68
./pyro/multigrid/examples/project_periodic.py
100
69
101
-
Given a vector field, :math:`U`, we can decompose it into a divergence free part, :math:`U_d`, and the gradient of a scalar, :math:`\phi`:
70
+
Given a vector field, :math:`U`, we can decompose it into a divergence
71
+
free part, :math:`U_d`, and the gradient of a scalar, :math:`\phi`:
102
72
103
73
.. math::
104
74
105
75
U = U_d + \nabla\phi
106
76
107
-
We can project out the divergence free part by taking the divergence, leading to an elliptic equation:
77
+
We can project out the divergence free part by taking the divergence,
78
+
leading to an elliptic equation:
108
79
109
80
.. math::
110
81
@@ -120,6 +91,7 @@ results are shown below:
120
91
:align:center
121
92
122
93
123
-
Left is the original u velocity, middle is the modified field after adding the gradient of the scalar, and right is the recovered field.
94
+
Left is the original u velocity, middle is the modified field after
95
+
adding the gradient of the scalar, and right is the recovered field.
0 commit comments