From 4cfa73b399c12157c3a369463b7c93426f3b2341 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Tue, 29 Jul 2025 13:55:05 -0700 Subject: [PATCH 1/3] add SUNDIALS_HOME to GNUmakefiles --- ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile | 1 + ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile | 1 + 2 files changed, 2 insertions(+) diff --git a/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile b/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile index 4cd9a7b1..c8feaf99 100644 --- a/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile +++ b/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/GNUmakefile @@ -7,6 +7,7 @@ USE_OMP = FALSE COMP = gnu DIM = 3 USE_SUNDIALS = TRUE +SUNDIALS_HOME ?= ../../../../../sundials/instdir include $(AMREX_HOME)/Tools/GNUMake/Make.defs diff --git a/ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile b/ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile index 4cd9a7b1..c8feaf99 100644 --- a/ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile +++ b/ExampleCodes/SUNDIALS/Single-Rate/Exec/GNUmakefile @@ -7,6 +7,7 @@ USE_OMP = FALSE COMP = gnu DIM = 3 USE_SUNDIALS = TRUE +SUNDIALS_HOME ?= ../../../../../sundials/instdir include $(AMREX_HOME)/Tools/GNUMake/Make.defs From 68dcdb50d15df6e5b7b76b7eb288363d037b5503 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Wed, 30 Jul 2025 15:20:50 -0700 Subject: [PATCH 2/3] basic documentation updates for sundials examples --- Docs/source/SUNDIALS_Tutorial.rst | 27 ++++---- .../Reaction-Diffusion/Exec/README_sundials | 66 +------------------ .../SUNDIALS/Single-Rate/Exec/README_sundials | 66 +------------------ 3 files changed, 22 insertions(+), 137 deletions(-) diff --git a/Docs/source/SUNDIALS_Tutorial.rst b/Docs/source/SUNDIALS_Tutorial.rst index 6a43d131..b0e4bc72 100644 --- a/Docs/source/SUNDIALS_Tutorial.rst +++ b/Docs/source/SUNDIALS_Tutorial.rst @@ -4,20 +4,25 @@ SUNDIALS and Time Integrators ============================= -This example code shows how to use the AMReX TimeIntegrator class -with SUNDIALS backend for integration. It also include two example -of AMReX native integrators, Forward Euler, and Explicit Runge Kutta. -Each integration type can be chosen by selecting the corresponding -inputs file: +These example codes demonstrate how to use the AMReX TimeIntegrator class +with SUNDIALS backend for integration. - - ``inputs_forward_euler`` -- Native AMReX Forward Euler integrator +The first example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Single-Rate`` +solves the heat equation: - - ``inputs_rk3`` -- Native AMReX Explicit Runge Kutta +.. math:: \frac{\partial\phi}{\partial t} = \nabla^2\phi. - - ``inputs_sundials_erk`` -- SUNDIALS backend +The inputs file contains a template for single process time integration strategies. + +The second example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Reaction-Diffusion`` +solves the reaction-diffusion equation, where :math:`R` and :math:`D` are +user-supplied reaction and diffusion coefficients: -Both Runge Kutta and SUNDIALS have additional options which can -be set by modifying the inputs file. Please see each respective inputs -file or `AMReX User Guide:Time Integration`_ for more details. +.. math:: \frac{\partial\phi}{\partial t} = D \nabla^2\phi - R \phi. + +The inputs file contains a template for MRI approaches, where the diffusion process +can be treated as a "fast" partition relative to the reaction process. +Please see each respective inputs file or +`AMReX User Guide:Time Integration`_ for more details. .. _`AMReX User Guide:Time Integration`: https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html# diff --git a/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/README_sundials b/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/README_sundials index bf0e47c1..3b6830a6 100644 --- a/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/README_sundials +++ b/ExampleCodes/SUNDIALS/Reaction-Diffusion/Exec/README_sundials @@ -1,64 +1,4 @@ -SUNDIALS installation guide: -https://computing.llnl.gov/projects/sundials/faq#inst +Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html +for SNUDIALS installation, build, and usage instructions. -Installation - -# You need SUNDIALS v7.1.1 or later. -# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download. -# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using ->> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials ->> mv sundials-x.y.z sundials-src - -# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version -# At the same level that amrex is cloned, do: - ->> git clone https://github.com/LLNL/sundials.git ->> mv sundials sundials-src - -# Next - ->> mkdir sundials ->> cd sundials - -###################### -HOST BUILD -###################### - ->> mkdir instdir ->> mkdir builddir ->> cd builddir - ->> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src - -###################### -NVIDIA/CUDA BUILD -###################### - -# Navigate back to the 'sundials' directory and do: - ->> mkdir instdir_cuda ->> mkdir builddir_cuda ->> cd builddir_cuda - ->> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src - -###################### - ->> make -j4 ->> make install - -# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc") - -# If you have a CPU build: - ->> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/ - -# If you have a NVIDIA/CUDA build: - ->> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/ - -# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with: - ->> make -j4 # optional to have 'USE_CUDA=TRUE' as well - -# Refer to inputs to see how to enable different integrators +Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory. diff --git a/ExampleCodes/SUNDIALS/Single-Rate/Exec/README_sundials b/ExampleCodes/SUNDIALS/Single-Rate/Exec/README_sundials index bf0e47c1..3b6830a6 100644 --- a/ExampleCodes/SUNDIALS/Single-Rate/Exec/README_sundials +++ b/ExampleCodes/SUNDIALS/Single-Rate/Exec/README_sundials @@ -1,64 +1,4 @@ -SUNDIALS installation guide: -https://computing.llnl.gov/projects/sundials/faq#inst +Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html +for SNUDIALS installation, build, and usage instructions. -Installation - -# You need SUNDIALS v7.1.1 or later. -# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download. -# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using ->> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials ->> mv sundials-x.y.z sundials-src - -# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version -# At the same level that amrex is cloned, do: - ->> git clone https://github.com/LLNL/sundials.git ->> mv sundials sundials-src - -# Next - ->> mkdir sundials ->> cd sundials - -###################### -HOST BUILD -###################### - ->> mkdir instdir ->> mkdir builddir ->> cd builddir - ->> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src - -###################### -NVIDIA/CUDA BUILD -###################### - -# Navigate back to the 'sundials' directory and do: - ->> mkdir instdir_cuda ->> mkdir builddir_cuda ->> cd builddir_cuda - ->> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src - -###################### - ->> make -j4 ->> make install - -# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc") - -# If you have a CPU build: - ->> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/ - -# If you have a NVIDIA/CUDA build: - ->> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/ - -# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with: - ->> make -j4 # optional to have 'USE_CUDA=TRUE' as well - -# Refer to inputs to see how to enable different integrators +Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory. From 31c96c02027ad5e3f082815915ca06753784dbb6 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Wed, 30 Jul 2025 15:24:03 -0700 Subject: [PATCH 3/3] trailing whitespace fix --- Docs/source/SUNDIALS_Tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/source/SUNDIALS_Tutorial.rst b/Docs/source/SUNDIALS_Tutorial.rst index b0e4bc72..1f8ca4e3 100644 --- a/Docs/source/SUNDIALS_Tutorial.rst +++ b/Docs/source/SUNDIALS_Tutorial.rst @@ -13,7 +13,7 @@ solves the heat equation: .. math:: \frac{\partial\phi}{\partial t} = \nabla^2\phi. The inputs file contains a template for single process time integration strategies. - + The second example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Reaction-Diffusion`` solves the reaction-diffusion equation, where :math:`R` and :math:`D` are user-supplied reaction and diffusion coefficients: