Skip to content

Commit 5f5f268

Browse files
authored
Merge pull request #157 from ajnonaka/sundials_updates
Sundials updates
2 parents e57f6b8 + 31c96c0 commit 5f5f268

File tree

5 files changed

+24
-137
lines changed

5 files changed

+24
-137
lines changed

Docs/source/SUNDIALS_Tutorial.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
SUNDIALS and Time Integrators
55
=============================
66

7-
This example code shows how to use the AMReX TimeIntegrator class
8-
with SUNDIALS backend for integration. It also include two example
9-
of AMReX native integrators, Forward Euler, and Explicit Runge Kutta.
10-
Each integration type can be chosen by selecting the corresponding
11-
inputs file:
7+
These example codes demonstrate how to use the AMReX TimeIntegrator class
8+
with SUNDIALS backend for integration.
129

13-
- ``inputs_forward_euler`` -- Native AMReX Forward Euler integrator
10+
The first example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Single-Rate``
11+
solves the heat equation:
1412

15-
- ``inputs_rk3`` -- Native AMReX Explicit Runge Kutta
13+
.. math:: \frac{\partial\phi}{\partial t} = \nabla^2\phi.
1614

17-
- ``inputs_sundials_erk`` -- SUNDIALS backend
15+
The inputs file contains a template for single process time integration strategies.
1816

19-
Both Runge Kutta and SUNDIALS have additional options which can
20-
be set by modifying the inputs file. Please see each respective inputs
21-
file or `AMReX User Guide:Time Integration`_ for more details.
17+
The second example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Reaction-Diffusion``
18+
solves the reaction-diffusion equation, where :math:`R` and :math:`D` are
19+
user-supplied reaction and diffusion coefficients:
20+
21+
.. math:: \frac{\partial\phi}{\partial t} = D \nabla^2\phi - R \phi.
22+
23+
The inputs file contains a template for MRI approaches, where the diffusion process
24+
can be treated as a "fast" partition relative to the reaction process.
25+
Please see each respective inputs file or
26+
`AMReX User Guide:Time Integration`_ for more details.
2227

2328
.. _`AMReX User Guide:Time Integration`: https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html#

ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ USE_OMP = FALSE
77
COMP = gnu
88
DIM = 3
99
USE_SUNDIALS = TRUE
10+
SUNDIALS_HOME ?= ../../../../../sundials/instdir
1011

1112
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
1213

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,4 @@
1-
SUNDIALS installation guide:
2-
https://computing.llnl.gov/projects/sundials/faq#inst
1+
Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html
2+
for SNUDIALS installation, build, and usage instructions.
33

4-
Installation
5-
6-
# You need SUNDIALS v7.1.1 or later.
7-
# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download.
8-
# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using
9-
>> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials
10-
>> mv sundials-x.y.z sundials-src
11-
12-
# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version
13-
# At the same level that amrex is cloned, do:
14-
15-
>> git clone https://github.com/LLNL/sundials.git
16-
>> mv sundials sundials-src
17-
18-
# Next
19-
20-
>> mkdir sundials
21-
>> cd sundials
22-
23-
######################
24-
HOST BUILD
25-
######################
26-
27-
>> mkdir instdir
28-
>> mkdir builddir
29-
>> cd builddir
30-
31-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src
32-
33-
######################
34-
NVIDIA/CUDA BUILD
35-
######################
36-
37-
# Navigate back to the 'sundials' directory and do:
38-
39-
>> mkdir instdir_cuda
40-
>> mkdir builddir_cuda
41-
>> cd builddir_cuda
42-
43-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src
44-
45-
######################
46-
47-
>> make -j4
48-
>> make install
49-
50-
# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc")
51-
52-
# If you have a CPU build:
53-
54-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/
55-
56-
# If you have a NVIDIA/CUDA build:
57-
58-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/
59-
60-
# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with:
61-
62-
>> make -j4 # optional to have 'USE_CUDA=TRUE' as well
63-
64-
# Refer to inputs to see how to enable different integrators
4+
Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory.

ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ USE_OMP = FALSE
77
COMP = gnu
88
DIM = 3
99
USE_SUNDIALS = TRUE
10+
SUNDIALS_HOME ?= ../../../../../sundials/instdir
1011

1112
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
1213

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,4 @@
1-
SUNDIALS installation guide:
2-
https://computing.llnl.gov/projects/sundials/faq#inst
1+
Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html
2+
for SNUDIALS installation, build, and usage instructions.
33

4-
Installation
5-
6-
# You need SUNDIALS v7.1.1 or later.
7-
# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download.
8-
# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using
9-
>> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials
10-
>> mv sundials-x.y.z sundials-src
11-
12-
# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version
13-
# At the same level that amrex is cloned, do:
14-
15-
>> git clone https://github.com/LLNL/sundials.git
16-
>> mv sundials sundials-src
17-
18-
# Next
19-
20-
>> mkdir sundials
21-
>> cd sundials
22-
23-
######################
24-
HOST BUILD
25-
######################
26-
27-
>> mkdir instdir
28-
>> mkdir builddir
29-
>> cd builddir
30-
31-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src
32-
33-
######################
34-
NVIDIA/CUDA BUILD
35-
######################
36-
37-
# Navigate back to the 'sundials' directory and do:
38-
39-
>> mkdir instdir_cuda
40-
>> mkdir builddir_cuda
41-
>> cd builddir_cuda
42-
43-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src
44-
45-
######################
46-
47-
>> make -j4
48-
>> make install
49-
50-
# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc")
51-
52-
# If you have a CPU build:
53-
54-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/
55-
56-
# If you have a NVIDIA/CUDA build:
57-
58-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/
59-
60-
# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with:
61-
62-
>> make -j4 # optional to have 'USE_CUDA=TRUE' as well
63-
64-
# Refer to inputs to see how to enable different integrators
4+
Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory.

0 commit comments

Comments
 (0)