Skip to content

Commit 6a5730f

Browse files
committed
Linear solver documentation: Add curl-curl, open bc and gmres
1 parent c4fcda1 commit 6a5730f

File tree

2 files changed

+92
-15
lines changed

2 files changed

+92
-15
lines changed

Docs/sphinx_documentation/source/LinearSolvers.rst

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ system using the geometric multigrid method. The constructor of
1414
class of various linear operator
1515
classes, :cpp:`MLABecLaplacian`, :cpp:`MLPoisson`,
1616
:cpp:`MLNodeLaplacian`, etc. We choose the type of linear operator
17-
class according to the type the linear system to solve.
17+
class according to the type the linear system to solve. Examples of the
18+
linear operators include
1819

1920
- :cpp:`MLABecLaplacian` for cell-centered canonical form (equation :eq:`eqn::abeclap`).
2021

@@ -321,7 +322,7 @@ There are many parameters that can be set. Here we discuss some
321322
commonly used ones.
322323

323324
:cpp:`MLLinOp::setVerbose(int)`, :cpp:`MLMG::setVerbose(int)` and
324-
:cpp:`MLMG:setBottomVerbose(int)` control the verbosity of the
325+
:cpp:`MLMG::setBottomVerbose(int)` control the verbosity of the
325326
linear operator, multigrid solver and the bottom solver, respectively.
326327

327328
The multigrid solver is an iterative solver. The maximal number of
@@ -379,7 +380,7 @@ Available choices the bottom solver are
379380

380381
- :cpp:`MLMG::BottomSolver::petsc`: Currently for cell-centered only.
381382

382-
The :cpp:`LPInfo` class can be used control the agglomeration and
383+
The :cpp:`LPInfo` class can be used to control the agglomeration and
383384
consolidation strategy for multigrid coarsening.
384385

385386
- :cpp:`LPInfo::setAgglomeration(bool)` (by default true) can be used
@@ -848,4 +849,76 @@ An example (implemented in the ``MultiComponent`` tutorial) might be:
848849

849850
See ``amrex-tutorials/ExampleCodes/LinearSolvers/MultiComponent`` for a complete working example.
850851

851-
.. solver reuse
852+
853+
Curl-Curl
854+
=========
855+
856+
The curl-curl solver supports solving the linear system arising from the
857+
discretized form of
858+
859+
.. math:: \nabla \times (\alpha \nabla \times \mathbf{E}) + \beta \mathbf{E} = \mathbf{f},
860+
861+
where :math:`\mathbf{E}` and :math:`\mathbf{f}` are defined on grid edges,
862+
:math:`\alpha` is a positive scalar, and :math:`\beta` is a non-negative
863+
scalar (either a constant or a field). An :cpp:`Array` of three
864+
:cpp:`MultiFab`\ s is used to store the components of :math:`\mathbf{E}` and
865+
:math:`\mathbf{f}`. It's the user's responsibility to ensure that the
866+
right-hand-side data are consistent on edges shared by multiple
867+
:cpp:`Box`\ es. If needed, you can call :cpp:`MLCurlCurl::prepareRHS` to
868+
perform this synchronization.
869+
870+
The solver supports 1D, 2D and 3D. Note that even in the 1D and 2D cases,
871+
:math:`\mathbf{E}` still has three components, one for each spatial
872+
direction.
873+
874+
Open Boundary Poisson Solver
875+
============================
876+
877+
To solve Poisson's equation for isolated sources (i.e., no sources outside
878+
the boundary), there are several options. One option is to use :cpp:`MLMG`
879+
and :cpp:`MLPoisson` with Dirichlet boundary conditions. The Dirichlet
880+
boundary values can be computed using the multipole method, as done in the
881+
Castro code (see e.g.,
882+
https://amrex-astro.github.io/Castro/docs/file/Gravity_8H.html#_CPPv49multipole).
883+
Another option is to use the FFT based solver
884+
:cpp:`amrex::FFT::PoissonOpenBC` (see chapter :ref:`Chap:FFT`). A third
885+
option is :cpp:`amrex::OpenBCSolver`, which implements the James's method
886+
("The Solution of Poisson's Equation for Isolated Source
887+
Distributions", R. A. James, 1977, Journal of Computational Physics, 25,
888+
71). Below are some of the member functions of :cpp:`OpenBCSolver`.
889+
890+
.. highlight:: c++
891+
892+
::
893+
894+
OpenBCSolver (const Vector<Geometry>& a_geom,
895+
const Vector<BoxArray>& a_grids,
896+
const Vector<DistributionMapping>& a_dmap,
897+
const LPInfo& a_info = LPInfo());
898+
899+
Real solve (const Vector<MultiFab*>& a_sol,
900+
const Vector<MultiFab const*>& a_rhs,
901+
Real a_tol_rel, Real a_tol_abs);
902+
903+
904+
GMRES
905+
=====
906+
907+
AMReX provides a template implementation of the generalized minimal residual
908+
method (GMRES). The class template parameters are :cpp:`V` for a linear
909+
algebra vector class and :cpp:`M` for a linear operator class. The linear
910+
algebra vector class can contain one or several :cpp:`MultiFab`\ s, or your
911+
own data container. The linear operator class represents a matrix
912+
conceptually. Although it does not need to store the matrix explicitly, it
913+
must be able to apply the matrix vector product for a given vector. It also
914+
must provide some basic operations such as dot product and linear
915+
combination. For the full set of requirements on the operator class, see
916+
https://amrex-codes.github.io/amrex/doxygen/classamrex_1_1GMRES.html#details.
917+
918+
An example of using GMRES combined with a Jacobi preconditioner to solve
919+
Poisson's equation can be found at
920+
https://amrex-codes.github.io/amrex/tutorials_html/LinearSolvers_Tutorial.html.
921+
922+
AMReX also provides :cpp:`GMRESMLMGT`, a class template that solves the
923+
linear system in :cpp:`MLMG` using GMRES with :cpp:`MLMG` itself serving as
924+
the preconditioner.

Docs/sphinx_documentation/source/LinearSolvers_Chapter.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
Linear Solvers
77
==============
88

9-
AMReX supports both single-level solves and composite solves on multiple AMR levels,
10-
with the scalar solution to the linear system defined on either cell centers or nodes.
11-
AMReX also supports solution of linear systems with embedded boundaries.
12-
(See chapter :ref:`Chap:EB` for more details on the embedded boundary representation of
13-
complex geometry.)
14-
15-
The default solution technique is geometric multigrid, but AMReX includes native
16-
BiCGStab solvers for a single level as well as interfaces to the hypre library.
9+
AMReX supports both single-level solves and composite solves on multiple AMR
10+
levels, with the solution to the linear system defined on either cell
11+
centers, edges or nodes. AMReX also supports solution of linear systems
12+
with embedded boundaries. (See chapter :ref:`Chap:EB` for more details on
13+
the embedded boundary representation of complex geometry.) In addition to
14+
the iterative solvers discussed in this chapter, AMReX also supports solving
15+
Poisson equations using Fast Fourier Transform (FFT) (see chapter
16+
:ref:`Chap:FFT` for more information).
17+
18+
The default solution technique is geometric multigrid. AMReX also provides
19+
BiCGStab solvers, GMRES, and interfaces to the hypre and PETSc libraries.
1720

1821
In this Chapter we give an overview of the linear solvers in AMReX
1922
that solve linear systems in the canonical form
@@ -39,11 +42,12 @@ For the nodal solver, :math:`A` and :math:`\alpha` are assumed to be zero,
3942
:math:`\phi` and :math:`f` are nodal,
4043
and :math:`\beta` (which we later refer to as :math:`\sigma`) is cell-centered.
4144

42-
In addition to these solvers, AMReX has support for tensor solves used
43-
to calculate the viscous terms that appear in the compressible Navier-Stokes
45+
In addition to these solvers, AMReX has support for tensor solves used to
46+
calculate the viscous terms that appear in the compressible Navier-Stokes
4447
equations. In these solves, all components of the velocity field are solved
4548
for simultaneously. The tensor solve functionality is only available for
46-
cell-centered velocity.
49+
cell-centered velocity. AMReX also supports the curl-curl operator, with
50+
solutions defined on grid edges.
4751

4852
The tutorials in `Linear Solvers`_ show examples of
4953
using the solvers. The tutorial

0 commit comments

Comments
 (0)