From 0cd9adc397cfa7a71e8696b46105dfd8a758edce Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 6 Nov 2023 13:24:59 -0800 Subject: [PATCH] Maintenance: Remove F77 interface examples (#367) Remove F77 interface examples from `develop` branch. Once this PR is merged, a new `archive` branch can be created for easy reference until #302 is merged and the `archive` branch can be deleted. --------- Co-authored-by: Cody Balos --- doc/arkode/examples/source/index.rst | 68 +- doc/cvode/Makefile | 4 +- doc/cvode/cv_ex_codes.tex | 16 +- doc/cvode/cv_ex_intro.tex | 50 +- doc/cvode/cv_examples.tex | 4 +- doc/ida/Makefile | 4 +- doc/ida/ida_ex_codes.tex | 14 +- doc/ida/ida_ex_intro.tex | 40 +- doc/ida/ida_examples.tex | 4 +- doc/kinsol/Makefile | 6 +- doc/kinsol/kin_ex_codes.tex | 16 +- doc/kinsol/kin_ex_intro.tex | 29 +- doc/kinsol/kin_examples.tex | 4 +- examples/arkode/F77_parallel/CMakeLists.txt | 143 -- examples/arkode/F77_parallel/README | 47 - .../arkode/F77_parallel/fark_diag_kry_bbd_p.f | 373 ------ .../F77_parallel/fark_diag_kry_bbd_p.out | 87 -- .../arkode/F77_parallel/fark_diag_non_p.f | 231 ---- .../arkode/F77_parallel/fark_diag_non_p.out | 34 - examples/arkode/F77_serial/CMakeLists.txt | 294 ----- examples/arkode/F77_serial/README | 47 - .../arkode/F77_serial/fark_diurnal_kry_bp.f | 413 ------ .../arkode/F77_serial/fark_diurnal_kry_bp.out | 73 -- .../arkode/F77_serial/fark_roberts_dnsL.f | 329 ----- .../arkode/F77_serial/fark_roberts_dnsL.out | 34 - examples/arkode/F90_parallel/CMakeLists.txt | 145 -- examples/arkode/F90_parallel/README | 52 - examples/arkode/F90_parallel/fark_heat2D.f90 | 871 ------------- examples/arkode/F90_parallel/fark_heat2D.out | 49 - examples/arkode/F90_parallel/plot_heat2D.py | 134 -- examples/arkode/F90_serial/CMakeLists.txt | 300 ----- examples/arkode/F90_serial/README | 48 - examples/arkode/F90_serial/ark_bruss.f90 | 304 ----- examples/arkode/F90_serial/ark_bruss.out | 25 - .../arkode/F90_serial/ark_bruss1D_FEM_klu.f90 | 1161 ----------------- .../arkode/F90_serial/ark_bruss1D_FEM_klu.out | 59 - .../F90_serial/plot_brusselator1D_FEM.py | 73 -- examples/arkode/F90_serial/plot_sol.py | 55 - examples/cvode/fcmix_parallel/CMakeLists.txt | 140 -- examples/cvode/fcmix_parallel/README | 48 - .../cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f | 336 ----- .../fcmix_parallel/fcvDiag_kry_bbd_p.out | 76 -- examples/cvode/fcmix_parallel/fcvDiag_kry_p.f | 376 ------ .../cvode/fcmix_parallel/fcvDiag_kry_p.out | 65 - examples/cvode/fcmix_parallel/fcvDiag_non_p.f | 217 --- .../cvode/fcmix_parallel/fcvDiag_non_p.out | 31 - examples/cvode/fcmix_serial/CMakeLists.txt | 288 ---- examples/cvode/fcmix_serial/README | 52 - examples/cvode/fcmix_serial/fcvAdvDiff_bnd.f | 316 ----- .../cvode/fcmix_serial/fcvAdvDiff_bnd.out | 24 - examples/cvode/fcmix_serial/fcvDiurnal_kry.f | 1028 --------------- .../cvode/fcmix_serial/fcvDiurnal_kry.out | 63 - .../cvode/fcmix_serial/fcvDiurnal_kry_bp.f | 374 ------ .../cvode/fcmix_serial/fcvDiurnal_kry_bp.out | 68 - examples/cvode/fcmix_serial/fcvRoberts_dns.f | 270 ---- .../cvode/fcmix_serial/fcvRoberts_dns.out | 32 - examples/cvode/fcmix_serial/fcvRoberts_dnsL.f | 273 ---- .../cvode/fcmix_serial/fcvRoberts_dnsL.out | 32 - .../fcmix_serial/fcvRoberts_dns_constraints.f | 288 ---- .../fcvRoberts_dns_constraints.out | 32 - examples/cvode/fcmix_serial/fcvRoberts_klu.f | 345 ----- .../cvode/fcmix_serial/fcvRoberts_klu.out | 32 - examples/cvode/fcmix_serial/fcvRoberts_sps.f | 355 ----- .../cvode/fcmix_serial/fcvRoberts_sps.out | 32 - examples/ida/fcmix_openmp/CMakeLists.txt | 118 -- examples/ida/fcmix_openmp/README | 46 - .../ida/fcmix_openmp/fidaRoberts_dns_openmp.f | 306 ----- .../fcmix_openmp/fidaRoberts_dns_openmp.out | 34 - examples/ida/fcmix_parallel/CMakeLists.txt | 131 -- examples/ida/fcmix_parallel/README | 46 - .../ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f | 849 ------------ .../fcmix_parallel/fidaHeat2D_kry_bbd_p.out | 65 - examples/ida/fcmix_pthreads/CMakeLists.txt | 123 -- examples/ida/fcmix_pthreads/README | 47 - .../fcmix_pthreads/fidaRoberts_dns_pthreads.f | 306 ----- .../fidaRoberts_dns_pthreads.out | 34 - examples/ida/fcmix_serial/CMakeLists.txt | 115 -- examples/ida/fcmix_serial/README | 46 - examples/ida/fcmix_serial/fidaRoberts_dns.f | 303 ----- examples/ida/fcmix_serial/fidaRoberts_dns.out | 34 - examples/kinsol/fcmix_parallel/CMakeLists.txt | 132 -- examples/kinsol/fcmix_parallel/README | 46 - .../kinsol/fcmix_parallel/fkinDiagon_kry_p.f | 344 ----- .../fcmix_parallel/fkinDiagon_kry_p.out | 24 - examples/kinsol/fcmix_serial/CMakeLists.txt | 117 -- examples/kinsol/fcmix_serial/README | 46 - examples/kinsol/fcmix_serial/fkinDiagon_kry.f | 273 ---- .../kinsol/fcmix_serial/fkinDiagon_kry.out | 53 - .../templates/cmakelists_parallel_F90_ex.in | 108 -- .../templates/cmakelists_serial_F90_ex.in | 288 ---- examples/templates/makefile_serial_F90_ex.in | 110 -- 91 files changed, 130 insertions(+), 14847 deletions(-) delete mode 100644 examples/arkode/F77_parallel/CMakeLists.txt delete mode 100644 examples/arkode/F77_parallel/README delete mode 100644 examples/arkode/F77_parallel/fark_diag_kry_bbd_p.f delete mode 100644 examples/arkode/F77_parallel/fark_diag_kry_bbd_p.out delete mode 100644 examples/arkode/F77_parallel/fark_diag_non_p.f delete mode 100644 examples/arkode/F77_parallel/fark_diag_non_p.out delete mode 100644 examples/arkode/F77_serial/CMakeLists.txt delete mode 100644 examples/arkode/F77_serial/README delete mode 100644 examples/arkode/F77_serial/fark_diurnal_kry_bp.f delete mode 100644 examples/arkode/F77_serial/fark_diurnal_kry_bp.out delete mode 100644 examples/arkode/F77_serial/fark_roberts_dnsL.f delete mode 100644 examples/arkode/F77_serial/fark_roberts_dnsL.out delete mode 100644 examples/arkode/F90_parallel/CMakeLists.txt delete mode 100644 examples/arkode/F90_parallel/README delete mode 100644 examples/arkode/F90_parallel/fark_heat2D.f90 delete mode 100644 examples/arkode/F90_parallel/fark_heat2D.out delete mode 100755 examples/arkode/F90_parallel/plot_heat2D.py delete mode 100644 examples/arkode/F90_serial/CMakeLists.txt delete mode 100644 examples/arkode/F90_serial/README delete mode 100644 examples/arkode/F90_serial/ark_bruss.f90 delete mode 100644 examples/arkode/F90_serial/ark_bruss.out delete mode 100644 examples/arkode/F90_serial/ark_bruss1D_FEM_klu.f90 delete mode 100644 examples/arkode/F90_serial/ark_bruss1D_FEM_klu.out delete mode 100755 examples/arkode/F90_serial/plot_brusselator1D_FEM.py delete mode 100755 examples/arkode/F90_serial/plot_sol.py delete mode 100644 examples/cvode/fcmix_parallel/CMakeLists.txt delete mode 100644 examples/cvode/fcmix_parallel/README delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.out delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_kry_p.f delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_kry_p.out delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_non_p.f delete mode 100644 examples/cvode/fcmix_parallel/fcvDiag_non_p.out delete mode 100644 examples/cvode/fcmix_serial/CMakeLists.txt delete mode 100644 examples/cvode/fcmix_serial/README delete mode 100644 examples/cvode/fcmix_serial/fcvAdvDiff_bnd.f delete mode 100644 examples/cvode/fcmix_serial/fcvAdvDiff_bnd.out delete mode 100644 examples/cvode/fcmix_serial/fcvDiurnal_kry.f delete mode 100644 examples/cvode/fcmix_serial/fcvDiurnal_kry.out delete mode 100644 examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.f delete mode 100644 examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.out delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dns.f delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dns.out delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dnsL.f delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dnsL.out delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.f delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.out delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_klu.f delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_klu.out delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_sps.f delete mode 100644 examples/cvode/fcmix_serial/fcvRoberts_sps.out delete mode 100644 examples/ida/fcmix_openmp/CMakeLists.txt delete mode 100644 examples/ida/fcmix_openmp/README delete mode 100644 examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.f delete mode 100644 examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.out delete mode 100644 examples/ida/fcmix_parallel/CMakeLists.txt delete mode 100644 examples/ida/fcmix_parallel/README delete mode 100644 examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f delete mode 100644 examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.out delete mode 100644 examples/ida/fcmix_pthreads/CMakeLists.txt delete mode 100644 examples/ida/fcmix_pthreads/README delete mode 100644 examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.f delete mode 100644 examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.out delete mode 100644 examples/ida/fcmix_serial/CMakeLists.txt delete mode 100644 examples/ida/fcmix_serial/README delete mode 100644 examples/ida/fcmix_serial/fidaRoberts_dns.f delete mode 100644 examples/ida/fcmix_serial/fidaRoberts_dns.out delete mode 100644 examples/kinsol/fcmix_parallel/CMakeLists.txt delete mode 100644 examples/kinsol/fcmix_parallel/README delete mode 100644 examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f delete mode 100644 examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.out delete mode 100644 examples/kinsol/fcmix_serial/CMakeLists.txt delete mode 100644 examples/kinsol/fcmix_serial/README delete mode 100644 examples/kinsol/fcmix_serial/fkinDiagon_kry.f delete mode 100644 examples/kinsol/fcmix_serial/fkinDiagon_kry.out delete mode 100644 examples/templates/cmakelists_parallel_F90_ex.in delete mode 100644 examples/templates/cmakelists_serial_F90_ex.in delete mode 100644 examples/templates/makefile_serial_F90_ex.in diff --git a/doc/arkode/examples/source/index.rst b/doc/arkode/examples/source/index.rst index d5970d14d8..c98fa9dcc4 100644 --- a/doc/arkode/examples/source/index.rst +++ b/doc/arkode/examples/source/index.rst @@ -45,7 +45,7 @@ B598130 from `Lawrence Livermore National Laboratory Along with the ARKode solver, we have created a suite of example problems demonstrating its usage on applications written in C, C++ and -Fortran 77 and Fortran 90. These examples demonstrate a large variety +Fortran. These examples demonstrate a large variety of ARKode solver options, including explicit, implicit and ImEx solvers, root-finding, Newton and fixed-point nonlinear solvers, direct and iterative linear solvers, adaptive resize capabilities, and @@ -60,8 +60,7 @@ The following tables summarize the salient features of each of the example problems in this document. Each example is designed to be relatively self-contained, so that you need only study and/or emulate the problem that is most closely related to your own. We group these -examples according to programming language (C, C++, Fortran 77, -Fortran 90). +examples according to programming language (C, C++, Fortran). ARKode example problems written in C are summarized in the table @@ -106,35 +105,36 @@ Problem Integrator Nonlinear Linear Size Extras ======================= ========== =========== ====== ============= ================================= -ARKode example problems written in Fortran 77 are summarized in the table -below, and are further described in the chapters :ref:`serial_f77` and -:ref:`parallel_f77`. +.. + ARKode example problems written in Fortran 77 are summarized in the table + below, and are further described in the chapters :ref:`serial_f77` and + :ref:`parallel_f77`. -.. cssclass:: table-bordered + .. cssclass:: table-bordered -========================== ========== =========== ====== ============= ================================= -Problem Integrator Nonlinear Linear Size Extras -========================== ========== =========== ====== ============= ================================= -:ref:`fark_diurnal_kry_bp` DIRK Newton SPGMR 10 banded preconditioner -:ref:`fark_roberts_dnsL` DIRK Newton Dense 3 LAPACK dense solver, rootfinding -:ref:`fark_diag_kry_bbd_p` DIRK Newton SPGMR 10*NProcs parallel BBD preconditioner -:ref:`fark_diag_non_p` ERK N.A. N.A. 10*NProcs parallel -========================== ========== =========== ====== ============= ================================= + ========================== ========== =========== ====== ============= ================================= + Problem Integrator Nonlinear Linear Size Extras + ========================== ========== =========== ====== ============= ================================= + :ref:`fark_diurnal_kry_bp` DIRK Newton SPGMR 10 banded preconditioner + :ref:`fark_roberts_dnsL` DIRK Newton Dense 3 LAPACK dense solver, rootfinding + :ref:`fark_diag_kry_bbd_p` DIRK Newton SPGMR 10*NProcs parallel BBD preconditioner + :ref:`fark_diag_non_p` ERK N.A. N.A. 10*NProcs parallel + ========================== ========== =========== ====== ============= ================================= -ARKode example problems written in Fortran 90 are summarized in the table -below, and are further described in the chapters :ref:`serial_f90` and -:ref:`parallel_f90`. + ARKode example problems written in Fortran 90 are summarized in the table + below, and are further described in the chapters :ref:`serial_f90` and + :ref:`parallel_f90`. -.. cssclass:: table-bordered + .. cssclass:: table-bordered -========================== ========== ========= ====== ============= =============================================== -Problem Integrator Nonlinear Linear Size Extras -========================== ========== ========= ====== ============= =============================================== -:ref:`ark_bruss` ARK Newton Dense 3 -:ref:`ark_bruss1D_FEM_klu` DIRK Newton KLU 3N finite-element, :math:`M\ne I`, sparse matrices -:ref:`fark_heat2D` DIRK Newton PCG :math:`nx*ny` parallel -========================== ========== ========= ====== ============= =============================================== + ========================== ========== ========= ====== ============= =============================================== + Problem Integrator Nonlinear Linear Size Extras + ========================== ========== ========= ====== ============= =============================================== + :ref:`ark_bruss` ARK Newton Dense 3 + :ref:`ark_bruss1D_FEM_klu` DIRK Newton KLU 3N finite-element, :math:`M\ne I`, sparse matrices + :ref:`fark_heat2D` DIRK Newton PCG :math:`nx*ny` parallel + ========================== ========== ========= ====== ============= =============================================== @@ -154,14 +154,14 @@ Problem Integrator Nonlinear Linear Size Extras c_parhyp cpp_serial cpp_parallel - f77_serial - f77_parallel - f90_serial - f90_parallel - References - + References +.. + Remove F77 interface examples + f77_serial + f77_parallel + f90_serial + f90_parallel + .. only:: html * :ref:`search` - - diff --git a/doc/cvode/Makefile b/doc/cvode/Makefile index b91bc99ff1..00a00a83c0 100644 --- a/doc/cvode/Makefile +++ b/doc/cvode/Makefile @@ -22,7 +22,9 @@ cv_ex_intro.tex \ cv_ex_serial.tex \ cv_ex_parallel.tex \ cv_ex_parhyp.tex \ -cv_ex_fortran.tex \ cv_ex_tests.tex +# Remove F77 example text +# cv_ex_fortran.tex \ + include ../Makefile.in diff --git a/doc/cvode/cv_ex_codes.tex b/doc/cvode/cv_ex_codes.tex index d30aabcd91..7b3af9d9ae 100644 --- a/doc/cvode/cv_ex_codes.tex +++ b/doc/cvode/cv_ex_codes.tex @@ -30,14 +30,12 @@ \section{Listing of cvDiurnal\_kry\_bbd\_p.c}\label{s:cvDiurnal_bbd_p_c} %% Fortran examples -\lstset{language=[77]Fortran} - -\newpage -\section{Listing of fcvDiurnal\_kry.f}\label{s:fcvDiurnal_f} -\includeCode{../../examples/cvode/fcmix_serial/fcvDiurnal_kry.f} - -\newpage -\section{Listing of fcvDiag\_kry\_bbd\_p.f}\label{s:fcvDiag_bbd_p_f} -\includeCode{../../examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f} +%% \lstset{language=[77]Fortran} +%% \newpage +%% \section{Listing of fcvDiurnal\_kry.f}\label{s:fcvDiurnal_f} +%% \includeCode{../../examples/cvode/fcmix_serial/fcvDiurnal_kry.f} +%% \newpage +%% \section{Listing of fcvDiag\_kry\_bbd\_p.f}\label{s:fcvDiag_bbd_p_f} +%% \includeCode{../../examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f} diff --git a/doc/cvode/cv_ex_intro.tex b/doc/cvode/cv_ex_intro.tex index f06936ff22..e761486efd 100644 --- a/doc/cvode/cv_ex_intro.tex +++ b/doc/cvode/cv_ex_intro.tex @@ -7,9 +7,9 @@ \section{Introduction}\label{s:ex_intro} listings, on the example programs supplied with the {\cvode} distribution package. -The {\cvode} distribution contains examples of six types: serial -{\CC} examples, parallel {\CC} examples, serial and parallel {\F} -examples, an OpenMP example, and a {\hypre} example. +The {\cvode} distribution contains examples of the following types: serial +{\CC} examples, parallel {\CC} examples, an OpenMP example, and a {\hypre} +example. %% With the exception of ''demo''-type example files, the names of all the examples distributed with {\sundials} are of the form \verb![slv][PbName]_[ls]_[prec]_[p]!, @@ -159,28 +159,28 @@ \section{Introduction}\label{s:ex_intro} \id{cvAdvDiff\_non\_p} but with {\hypre} vectors instead of {\sundials} parallel vectors. -\vspace{0.2in}\noindent -As part of the {\fcvode} module, in the directories -{\em srcdir}\id{/examples/cvode/fcmix\_serial} and -{\em srcdir}\id{/examples/cvode/fcmix\_parallel}, are the following examples for -the {\F}-{\CC} interface. The first five of these are serial, while -the last three are parallel. -\begin{itemize} -\item \id{fcvRoberts\_dns} is a serial chemical kinetics example (\id{BDF}/{\sunlinsoldense}) - with rootfinding. -\item \id{fcvRoberts\_dns\_constraints} is the same as \id{fcvRoberts\_dns} but - but imposes the constraint $u \geq 0.0$ for all components. -\item \id{fcvRoberts\_dnsL} is the same as \id{fcvRoberts\_dns} but uses the Lapack - implementation of {\sunlinsollapdense}. -\item \id{fcvAdvDiff\_bnd} is a serial advection-diffusion example (\id{BDF}/{\sunlinsolband}). -\item \id{fcvDiurnal\_kry} is a serial kinetics-transport example (\id{BDF}/{\sunlinsolspgmr}). -\item \id{fcvDiurnal\_kry\_bp} is the \id{fcvDiurnal\_kry} example with {\fcvbp}. -\item \id{fcvDiag\_non\_p} is a nonstiff parallel diagonal ODE example - (\id{ADAMS}/\id{FIXEDPOINT}). -\item \id{fcvDiag\_kry\_p} is a stiff parallel diagonal ODE example (\id{BDF}/{\sunlinsolspgmr}). -\item \id{fcvDiag\_kry\_bbd\_p} is the same as the \id{fcvDiag\_kry\_p} example - but using the {\fcvbbd} module. -\end{itemize} +%% \vspace{0.2in}\noindent +%% As part of the {\fcvode} module, in the directories +%% {\em srcdir}\id{/examples/cvode/fcmix\_serial} and +%% {\em srcdir}\id{/examples/cvode/fcmix\_parallel}, are the following examples for +%% the {\F}-{\CC} interface. The first five of these are serial, while +%% the last three are parallel. +%% \begin{itemize} +%% \item \id{fcvRoberts\_dns} is a serial chemical kinetics example (\id{BDF}/{\sunlinsoldense}) +%% with rootfinding. +%% \item \id{fcvRoberts\_dns\_constraints} is the same as \id{fcvRoberts\_dns} but +%% but imposes the constraint $u \geq 0.0$ for all components. +%% \item \id{fcvRoberts\_dnsL} is the same as \id{fcvRoberts\_dns} but uses the Lapack +%% implementation of {\sunlinsollapdense}. +%% \item \id{fcvAdvDiff\_bnd} is a serial advection-diffusion example (\id{BDF}/{\sunlinsolband}). +%% \item \id{fcvDiurnal\_kry} is a serial kinetics-transport example (\id{BDF}/{\sunlinsolspgmr}). +%% \item \id{fcvDiurnal\_kry\_bp} is the \id{fcvDiurnal\_kry} example with {\fcvbp}. +%% \item \id{fcvDiag\_non\_p} is a nonstiff parallel diagonal ODE example +%% (\id{ADAMS}/\id{FIXEDPOINT}). +%% \item \id{fcvDiag\_kry\_p} is a stiff parallel diagonal ODE example (\id{BDF}/{\sunlinsolspgmr}). +%% \item \id{fcvDiag\_kry\_bbd\_p} is the same as the \id{fcvDiag\_kry\_p} example +%% but using the {\fcvbbd} module. +%% \end{itemize} \vspace{0.2in}\noindent In the following sections, we give detailed descriptions of some (but diff --git a/doc/cvode/cv_examples.tex b/doc/cvode/cv_examples.tex index 0ba4e68c28..51800eb32f 100644 --- a/doc/cvode/cv_examples.tex +++ b/doc/cvode/cv_examples.tex @@ -5,7 +5,7 @@ \externaldocument{install} \externaldocument{cv_math} \externaldocument{cv_usage} -\externaldocument{cv_fcmix} +%\externaldocument{cv_fcmix} \externaldocument{cv_nvec} \externaldocument{cv_sunmat} \externaldocument{cv_sunlinsol} @@ -40,7 +40,7 @@ \include{cv_ex_parhyp} \include{cv_ex_cuda} \include{cv_ex_raja} -\include{cv_ex_fortran} +%\include{cv_ex_fortran} \include{cv_ex_tests} %=============================================================== % References diff --git a/doc/ida/Makefile b/doc/ida/Makefile index add4d56563..ca2372cfd2 100644 --- a/doc/ida/Makefile +++ b/doc/ida/Makefile @@ -23,7 +23,9 @@ ida_ex_serial.tex \ ida_ex_parallel.tex \ ida_ex_petsc.tex \ ida_ex_trilinos.tex \ -ida_ex_fortran.tex \ ida_ex_codes.tex +# Remove F77 example text +# ida_ex_fortran.tex \ + include ../Makefile.in diff --git a/doc/ida/ida_ex_codes.tex b/doc/ida/ida_ex_codes.tex index dcafb9e401..3cced710d2 100644 --- a/doc/ida/ida_ex_codes.tex +++ b/doc/ida/ida_ex_codes.tex @@ -26,12 +26,12 @@ \section{Listing of idaFoodWeb\_kry\_bbd\_p.c}\label{s:idaFoodWeb_bbd_p_c} %% Fortran examples -\lstset{language=[77]Fortran} +%% \lstset{language=[77]Fortran} -\newpage -\section{Listing of fidaRoberts\_dns.f}\label{s:fidaRoberts_f} -\includeCode{../../examples/ida/fcmix_serial/fidaRoberts_dns.f} +%% \newpage +%% \section{Listing of fidaRoberts\_dns.f}\label{s:fidaRoberts_f} +%% \includeCode{../../examples/ida/fcmix_serial/fidaRoberts_dns.f} -\newpage -\section{Listing of fidaHeat2D\_kry\_bbd\_p.f}\label{s:fidaHeat2D_bbd_p} -\includeCode{../../examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f} +%% \newpage +%% \section{Listing of fidaHeat2D\_kry\_bbd\_p.f}\label{s:fidaHeat2D_bbd_p} +%% \includeCode{../../examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f} diff --git a/doc/ida/ida_ex_intro.tex b/doc/ida/ida_ex_intro.tex index 2d6acd24f3..5eab9b0a02 100644 --- a/doc/ida/ida_ex_intro.tex +++ b/doc/ida/ida_ex_intro.tex @@ -7,9 +7,9 @@ \section{Introduction}\label{s:ex_intro} listings, on the example programs supplied with the {\ida} distribution package. -The {\ida} distribution contains examples of four types: serial -{\CC} examples, parallel {\CC} examples, {\F} examples, -{\petsc} examples, and {\trilinos} examples. +The {\ida} distribution contains examples of the following types: serial +{\CC} examples, parallel {\CC} examples, {\petsc} examples, and {\trilinos} +examples. %% With the exception of ``demo''-type example files, the names of all the examples distributed with {\sundials} are of the form \verb![slv][PbName]_[ls]_[prec]_[p]!, @@ -131,27 +131,27 @@ \section{Introduction}\label{s:ex_intro} \end{itemize} -\vspace{0.2in}\noindent -As part of the {\fida} module, in the four subdirectories \id{fcmix\_serial}, -\id{fcmix\_parallel}, \id{fcmix\_openmp}, and \id{fcmix\_pthreads}, -within the directory {\em srcdir}\id{/examples/ida}, -are the following four examples for the {\F}-{\CC} interface: -% -\begin{itemize} -\item \id{fidaRoberts\_dns} is a serial chemical kinetics example ({\dense}) - with rootfinding, equivalent to \id{idaRoberts\_dns}. +%% As part of the {\fida} module, in the subdirectories \id{fcmix\_serial}, +%% \id{fcmix\_parallel}, \id{fcmix\_openmp}, and \id{fcmix\_pthreads}, +%% within the directory {\em srcdir}\id{/examples/ida}, +%% are the following four examples for the {\F}-{\CC} interface: +%% % +%% \begin{itemize} +%% \item \id{fidaRoberts\_dns} is a serial chemical kinetics example ({\dense}) +%% with rootfinding, equivalent to \id{idaRoberts\_dns}. -\item \id{fidaHeat2D\_kry\_bbd\_p} is a parallel example ({\spgmr}/{\idabbdpre}) - equivalent to the example \id{idaHeat2D\_kry\_bbd\_p}. +%% \item \id{fidaHeat2D\_kry\_bbd\_p} is a parallel example ({\spgmr}/{\idabbdpre}) +%% equivalent to the example \id{idaHeat2D\_kry\_bbd\_p}. -\item \id{fidaRoberts\_dns\_openmp} is the same as \id{fidaRoberts\_dns} but - uses the NVECTOR module NVECTOR\_OPENMP. +%% \item \id{fidaRoberts\_dns\_openmp} is the same as \id{fidaRoberts\_dns} but +%% uses the NVECTOR module NVECTOR\_OPENMP. -\item \id{fidaRoberts\_dns\_pthreads} is the same as \id{fidaRoberts\_dns} but - uses the NVECTOR module NVECTOR\_PTHREADS. +%% \item \id{fidaRoberts\_dns\_pthreads} is the same as \id{fidaRoberts\_dns} but +%% uses the NVECTOR module NVECTOR\_PTHREADS. -\end{itemize} -\ +%% \end{itemize} +%% \ +\vspace{0.2in}\noindent Finally, in the subdirectory \id{petsc} of \id{examples/ida} are the following examples: \begin{itemize} diff --git a/doc/ida/ida_examples.tex b/doc/ida/ida_examples.tex index b45aa69fa3..8d93c17d7a 100644 --- a/doc/ida/ida_examples.tex +++ b/doc/ida/ida_examples.tex @@ -5,7 +5,7 @@ \externaldocument{install} \externaldocument{ida_math} \externaldocument{ida_usage} -\externaldocument{ida_fcmix} +%\externaldocument{ida_fcmix} \externaldocument{ida_nvec} \externaldocument{ida_sunmat} \externaldocument{ida_sunlinsol} @@ -39,7 +39,7 @@ \include{ida_ex_parallel} \include{ida_ex_petsc} \include{ida_ex_trilinos} -\include{ida_ex_fortran} +%\include{ida_ex_fortran} %=============================================================== % References \bibliographystyle{plain} diff --git a/doc/kinsol/Makefile b/doc/kinsol/Makefile index 25f4b6e915..9b7a3db8f2 100644 --- a/doc/kinsol/Makefile +++ b/doc/kinsol/Makefile @@ -20,7 +20,9 @@ EX_FILES = \ ${EXAMPLES}.tex \ kin_ex_intro.tex \ kin_ex_c.tex \ -kin_ex_cxx.tex \ -kin_ex_fortran.tex +kin_ex_cxx.tex + +# Remove F77 examples +# kin_ex_fortran.tex include ../Makefile.in diff --git a/doc/kinsol/kin_ex_codes.tex b/doc/kinsol/kin_ex_codes.tex index d97169529e..79a7ff35ac 100644 --- a/doc/kinsol/kin_ex_codes.tex +++ b/doc/kinsol/kin_ex_codes.tex @@ -16,14 +16,12 @@ \section{Listing of kinFoodWeb\_kry\_bbd\_p.c}\label{s:kinFoodWeb_kry_bbd_p_c} %% Fortran examples -\lstset{language=[77]Fortran} - -\newpage -\section{Listing of fkinDiagon\_kry.f}\label{s:fkinDiagon_kry_f} -\includeCode{../../examples/kinsol/fcmix_serial/fkinDiagon_kry.f} - -\newpage -\section{Listing of fkinDiagon\_kry\_p.f}\label{s:fkinDiagon_kry_p_f} -\includeCode{../../examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f} +%% \lstset{language=[77]Fortran} +%% \newpage +%% \section{Listing of fkinDiagon\_kry.f}\label{s:fkinDiagon_kry_f} +%% \includeCode{../../examples/kinsol/fcmix_serial/fkinDiagon_kry.f} +%% \newpage +%% \section{Listing of fkinDiagon\_kry\_p.f}\label{s:fkinDiagon_kry_p_f} +%% \includeCode{../../examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f} diff --git a/doc/kinsol/kin_ex_intro.tex b/doc/kinsol/kin_ex_intro.tex index 89818128d8..f2f3a1be28 100644 --- a/doc/kinsol/kin_ex_intro.tex +++ b/doc/kinsol/kin_ex_intro.tex @@ -7,9 +7,8 @@ \section{Introduction}\label{s:ex_intro} listings, on the example programs supplied with the {\kinsol} distribution package. -The {\kinsol} distribution contains examples of types: serial -{\CC} examples, parallel {\CC} examples, serial and parallel {\F} -examples, and an OpenMP example. +The {\kinsol} distribution contains examples of the following types: serial +{\CC} examples, parallel {\CC} examples, and an OpenMP example. %% With the exception of ''demo''-type example files, the names of all the examples distributed with {\sundials} are of the form @@ -92,18 +91,18 @@ \section{Introduction}\label{s:ex_intro} using the {\kinbbdpre} module. \end{itemize} -\vspace{0.2in}\noindent -As part of the {\fkinsol} module, in the directories -{\em srcdir}\id{/examples/kinsol/fcmix\_serial} and -{\em srcdir}\id{/examples/kinsol/fcmix\_parallel}, respectively, are the -following examples for the {\F}-{\CC} interface: -\begin{itemize} -\item \id{fkinDiagon\_kry} - is a serial example, which solves a nonlinear system of the form - $u_i^2 = i^2$ using an approximate diagonal preconditioner. -\item \id{fkinDiagon\_kry\_p} - is a parallel implementation of \id{fkinDiagon\_kry}. -\end{itemize} +%% \vspace{0.2in}\noindent +%% As part of the {\fkinsol} module, in the directories +%% {\em srcdir}\id{/examples/kinsol/fcmix\_serial} and +%% {\em srcdir}\id{/examples/kinsol/fcmix\_parallel}, respectively, are the +%% following examples for the {\F}-{\CC} interface: +%% \begin{itemize} +%% \item \id{fkinDiagon\_kry} +%% is a serial example, which solves a nonlinear system of the form +%% $u_i^2 = i^2$ using an approximate diagonal preconditioner. +%% \item \id{fkinDiagon\_kry\_p} +%% is a parallel implementation of \id{fkinDiagon\_kry}. +%% \end{itemize} \vspace{0.2in}\noindent Supplied in directory {\em srcdir}\id{/examples/kinsol/C\_openmp} diff --git a/doc/kinsol/kin_examples.tex b/doc/kinsol/kin_examples.tex index 399a5a723e..6b9fa022ce 100644 --- a/doc/kinsol/kin_examples.tex +++ b/doc/kinsol/kin_examples.tex @@ -5,7 +5,7 @@ \externaldocument{install} \externaldocument{kin_math} \externaldocument{kin_use} -\externaldocument{kin_fcmix} +%\externaldocument{kin_fcmix} \externaldocument{kin_nvec} \externaldocument{kin_sunmat} \externaldocument{kin_sunlinsol} @@ -35,7 +35,7 @@ %=============================================================== \include{kin_ex_intro} \include{kin_ex_c} -\include{kin_ex_fortran} +%\include{kin_ex_fortran} \include{kin_ex_cxx} %=============================================================== % References diff --git a/examples/arkode/F77_parallel/CMakeLists.txt b/examples/arkode/F77_parallel/CMakeLists.txt deleted file mode 100644 index b0bc877a68..0000000000 --- a/examples/arkode/F77_parallel/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FARKODE parallel examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FARKODE_examples - "fark_diag_non_p\;1\;4\;develop" - "fark_diag_kry_bbd_p\;1\;4\;develop" - ) - -# Auxiliary files to install -set(ARKODE_extras - ) - -if(MPI_Fortran_COMPILER) - # use MPI wrapper as the compiler - set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) -else() - # add MPI_INCLUDE_PATH to include directories - include_directories(${MPI_INCLUDE_PATH}) -endif() - -# Specify libraries to link against -set(ARKODE_LIB sundials_arkode) -set(NVECP_LIB sundials_nvecparallel) -set(FNVECP_LIB sundials_fnvecparallel) - -# Only static FCMIX libraries are available -set(FARKODE_LIB sundials_farkode${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FARKODE_LIB} ${ARKODE_LIB} ${FNVECP_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each ARKODE example -foreach(example_tuple ${FARKODE_examples}) - - list(GET example_tuple 0 example) - list(GET example_tuple 1 number_of_nodes) - list(GET example_tuple 2 number_of_tasks) - list(GET example_tuple 3 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - MPI_NPROCS ${number_of_tasks} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - if(NOT MPI_Fortran_COMPILER) - target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES}) - endif() - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_parallel) - endif() - -endforeach(example_tuple ${FARKODE_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_parallel) - - # Install the extra files - foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_parallel) - endforeach() - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "ARKODE") - set(SOLVER_LIB "sundials_arkode") - set(SOLVER_FLIB "sundials_farkode") - - examples2string(FARKODE_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F77_parallel/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F77_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_parallel - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F77_parallel/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F77_parallel/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_parallel - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(arkode F77_parallel) - -endif() diff --git a/examples/arkode/F77_parallel/README b/examples/arkode/F77_parallel/README deleted file mode 100644 index 59f1612df4..0000000000 --- a/examples/arkode/F77_parallel/README +++ /dev/null @@ -1,47 +0,0 @@ -List of parallel ARKode F77 examples - - fark_diag_non_p : diagonal ODE example - non-stiff case (ERK) - fark_diag_kry_bbd_p : diagonal ODE example - stiff case (DIRK/SPGMR/FARKBBD) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.f b/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.f deleted file mode 100644 index c4f50a8a80..0000000000 --- a/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.f +++ /dev/null @@ -1,373 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C Diagonal ODE example. Stiff case, with diagonal preconditioner. -C Uses FARKODE interfaces and FARKBBD interfaces. -C Solves problem twice -- with left and right preconditioning. -C -C Note that this problem should only work with SUNDIALS configured -C to use 'realtype' as 'double' and 'sunindextype' as '64bit' -C ---------------------------------------------------------------- -C -C Include MPI-Fortran header file for MPI_COMM_WORLD, MPI types. - - IMPLICIT NONE -C - INCLUDE "mpif.h" -C - INTEGER*8 NLOCAL - PARAMETER (NLOCAL=10) -C - INTEGER*4 NOUT, MYPE, IER, NPES, METH, IATOL, ITASK, IPRE, IGS - INTEGER*4 LLENRW, LLENIW, LNST, LNST_ATT, LNFE, LNFI, LNSETUP - INTEGER*4 LNETF, LNNI, LNCF, LLENRWLS, LLENIWLS, LNPE, LNPS, LNLI - INTEGER*4 LNCFL, JOUT - INTEGER*8 NEQ, I, IPAR(3), IOUT(35), MUDQ, MLDQ, MU, ML, NST - INTEGER*8 NST_ATT, NFE, NFI, NPSET, NPE, NPS, NNI, NLI, NCFN, NCFL - INTEGER*8 NETF, LENRW, LENIW, LENRWLS, LENIWLS, LENRWBBD, LENIWBBD - INTEGER*8 NGEBBD - DOUBLE PRECISION Y(1024), ROUT(6), RPAR(1) - DOUBLE PRECISION ALPHA, TOUT, ERMAX, AVDIM - DOUBLE PRECISION ATOL, ERRI, RTOL, GERMAX, DTOUT, T -C - DATA ATOL/1.0D-10/, RTOL/1.0D-5/, DTOUT/0.1D0/, NOUT/10/ - DATA LLENRW/1/, LLENIW/2/, LNST/3/, LNST_ATT/6/, LNFE/7/, LNFI/8/, - 1 LNSETUP/9/, LNETF/10/, LNNI/11/, LNCF/12/, LLENRWLS/14/, - 1 LLENIWLS/15/, LNPE/21/, LNPS/22/, LNLI/23/, LNCFL/24/ -C -C Get NPES and MYPE. Requires initialization of MPI. - CALL MPI_INIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,5) IER - 5 FORMAT(///' MPI_ERROR: MPI_INIT returned IER = ', I5) - STOP - ENDIF - CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPES, IER) - IF (IER .NE. 0) THEN - WRITE(6,6) IER - 6 FORMAT(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - CALL MPI_COMM_RANK(MPI_COMM_WORLD, MYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,7) IER - 7 FORMAT(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Set input arguments. - NEQ = NPES * NLOCAL - T = 0.0D0 - METH = 0 - IATOL = 1 - ITASK = 1 - IPRE = 1 - IGS = 1 -C Set parameter alpha - ALPHA = 10.0D0 -C -C Load IPAR and RPAR - IPAR(1) = NLOCAL - IPAR(2) = MYPE - IPAR(3) = NEQ - RPAR(1) = ALPHA -C - DO I = 1, NLOCAL - Y(I) = 1.0D0 - ENDDO -C - IF (MYPE .EQ. 0) THEN - WRITE(6,15) NEQ, NLOCAL, ALPHA, RTOL, ATOL, NPES - 15 FORMAT('Diagonal test problem:'// - & ' NEQ = ', I3, / - & ' NLOCAL = ', I3, / - & ' parameter alpha = ', F8.3/ - & ' ydot_i = -alpha*i * y_i (i = 1,...,NEQ)'/ - & ' RTOL, ATOL = ', 2E10.1/ - & ' Method is DIRK/NEWTON/SPGMR'/ - & ' Precond is band-block-diagonal, using ARKBBDPRE' - & /' Number of processors = ', I3/) - ENDIF -C - CALL FNVINITP(MPI_COMM_WORLD, 4, NLOCAL, NEQ, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITP returned IER = ', I5) - CALL MPI_FINALIZE(IER) - STOP - ENDIF -C -C initialize SPGMR linear solver module - call FSUNSPGMRINIT(4, IPRE, 0, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - call FSUNSPGMRSETGSTYPE(4, IGS, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FARKMALLOC(T, Y, METH, IATOL, RTOL, ATOL, - & IOUT, ROUT, IPAR, RPAR, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FARKMALLOC returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C attach linear solver module to ARKLs interface - CALL FARKLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FARKLSINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C initialize BBD preconditioner (build diagonal preconditioner) - MUDQ = 0 - MLDQ = 0 - MU = 0 - ML = 0 - CALL FARKBBDINIT(NLOCAL, MUDQ, MLDQ, MU, ML, 0.0D0, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FARKBBDINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IF (MYPE .EQ. 0) WRITE(6,38) - 38 FORMAT(/'Preconditioning on left'/) -C -C Looping point for cases IPRE = 1 and 2. -C - 40 CONTINUE -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 60 JOUT = 1, NOUT -C - CALL FARKODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,45) T, IOUT(LNST), IOUT(LNST_ATT), - & IOUT(LNFE), IOUT(LNFI) - 45 FORMAT(' t = ', E10.2, 5X, 'no. steps = ', I5, - & ' no. attempts = ', I5,' no. fe-s = ', I5, - & ' no. fi-s = ', I5) -C - IF (IER .NE. 0) THEN - WRITE(6,50) IER, IOUT(16) - 50 FORMAT(///' SUNDIALS_ERROR: FARKODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 60 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 65 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - ERMAX = MAX(ERMAX, ABS(ERRI)) - 65 CONTINUE -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - & 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,70) IER - 70 FORMAT(///' MPI_ERROR: MPI_REDUCE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,75) GERMAX - 75 FORMAT(/'Max. absolute error is', E10.2/) -C -C Print final statistics. - IF (MYPE .EQ. 0) THEN - NST = IOUT(LNST) - NST_ATT = IOUT(LNST_ATT) - NFE = IOUT(LNFE) - NFI = IOUT(LNFI) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - LENRW = IOUT(LLENRW) - LENIW = IOUT(LLENIW) - LENRWLS = IOUT(LLENRWLS) - LENIWLS = IOUT(LLENIWLS) - WRITE(6,80) NST, NST_ATT, NFE, NFI, NPSET, NPE, NPS, NNI, NLI, - & AVDIM, NCFN, NCFL, NETF, LENRW, LENIW, LENRWLS, LENIWLS - 80 FORMAT(/'Final statistics:'// - & ' number of steps = ', I5/ - & ' number of steps att. = ', I5/ - & ' number of fe evals. = ', I5/ - & ' number of fi evals. = ', I5/ - & ' number of prec. setups = ', I5/ - & ' number of prec. evals. = ', I5/ - & ' number of prec. solves = ', I5/ - & ' number of nonl. iters. = ', I5/ - & ' number of lin. iters. = ', I5/ - & ' average Krylov subspace dimension (NLI/NNI) = ',F8.4/ - & ' number of conv. failures.. nonlinear = ', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3/ - & ' main solver real/int workspace sizes = ',2I5/ - & ' linear solver real/int workspace sizes = ',2I5) - CALL FARKBBDOPT(LENRWBBD, LENIWBBD, NGEBBD) - WRITE(6,82) LENRWBBD, LENIWBBD, NGEBBD - 82 FORMAT('In ARKBBDPRE:'/ - & ' real/int local workspace = ', 2I5/ - & ' number of g evals. = ', I5) - ENDIF -C -C If IPRE = 1, re-initialize T, Y, and the solver, and loop for -C case IPRE = 2. Otherwise jump to final block. - IF (IPRE .EQ. 2) GO TO 99 -C - T = 0.0D0 - DO I = 1, NLOCAL - Y(I) = 1.0D0 - ENDDO -C - CALL FARKREINIT(T, Y, METH, IATOL, RTOL, ATOL, IER) - IF (IER .NE. 0) THEN - WRITE(6,91) IER - 91 FORMAT(///' SUNDIALS_ERROR: FARKREINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IPRE = 2 -C - CALL FARKBBDREINIT(MUDQ, MLDQ, 0.0D0, IER) - IF (IER .NE. 0) THEN - WRITE(6,92) IER - 92 FORMAT(///' SUNDIALS_ERROR: FARKBBDREINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FSUNSPGMRSETPRECTYPE(4, IPRE, IER) - IF (IER .NE. 0) THEN - WRITE(6,93) IER - 93 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETPRECTYPE IER =',I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IF (MYPE .EQ. 0) WRITE(6,95) - 95 FORMAT(//60('-')///'Preconditioning on right'/) - GO TO 40 -C -C Free the memory and finalize MPI. - 99 CALL FARKFREE - CALL MPI_FINALIZE(IER) -C - STOP - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKIFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fi - IMPLICIT NONE -C - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - INTEGER*8 MYPE, I, NLOCAL - DOUBLE PRECISION ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = -ALPHA * (MYPE * NLOCAL + I) * Y(I) - ENDDO -C - IER = 0 -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKEFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fe - IMPLICIT NONE -C - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - INTEGER*8 I, NLOCAL -C - NLOCAL = IPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = 0.D0 - ENDDO -C - IER = 0 -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKGLOCFN(NLOC, T, YLOC, GLOC, IPAR, RPAR, IER) -C Routine to define local approximate function g, here the same as fi. - IMPLICIT NONE -C - INTEGER*8 NLOC, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, YLOC(*), GLOC(*), RPAR(*) -C - CALL FARKIFUN(T, YLOC, GLOC, IPAR, RPAR, IER) -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKCOMMFN(NLOC, T, YLOC, IPAR, RPAR, IER) -C Routine to perform communication required for evaluation of g. - INTEGER*8 NLOC, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, YLOC(*), RPAR(*) - IER = 0 - RETURN - END diff --git a/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.out b/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.out deleted file mode 100644 index 88991b3bf9..0000000000 --- a/examples/arkode/F77_parallel/fark_diag_kry_bbd_p.out +++ /dev/null @@ -1,87 +0,0 @@ -Diagonal test problem: - - NEQ = 40 - NLOCAL = 10 - parameter alpha = 10.000 - ydot_i = -alpha*i * y_i (i = 1,...,NEQ) - RTOL, ATOL = 0.1E-04 0.1E-09 - Method is DIRK/NEWTON/SPGMR - Precond is band-block-diagonal, using ARKBBDPRE - Number of processors = 4 - - -Preconditioning on left - - t = 0.10E+00 no. steps = 173 no. attempts = 173 no. fe-s = 0 no. fi-s = 1846 - t = 0.20E+00 no. steps = 221 no. attempts = 221 no. fe-s = 0 no. fi-s = 2362 - t = 0.30E+00 no. steps = 248 no. attempts = 248 no. fe-s = 0 no. fi-s = 2650 - t = 0.40E+00 no. steps = 266 no. attempts = 266 no. fe-s = 0 no. fi-s = 2848 - t = 0.50E+00 no. steps = 281 no. attempts = 281 no. fe-s = 0 no. fi-s = 3007 - t = 0.60E+00 no. steps = 291 no. attempts = 291 no. fe-s = 0 no. fi-s = 3116 - t = 0.70E+00 no. steps = 300 no. attempts = 300 no. fe-s = 0 no. fi-s = 3215 - t = 0.80E+00 no. steps = 306 no. attempts = 306 no. fe-s = 0 no. fi-s = 3275 - t = 0.90E+00 no. steps = 312 no. attempts = 312 no. fe-s = 0 no. fi-s = 3335 - t = 0.10E+01 no. steps = 319 no. attempts = 319 no. fe-s = 0 no. fi-s = 3410 - -Max. absolute error is 0.76E-10 - - -Final statistics: - - number of steps = 319 - number of steps att. = 319 - number of fe evals. = 0 - number of fi evals. = 3410 - number of prec. setups = 25 - number of prec. evals. = 6 - number of prec. solves = 3380 - number of nonl. iters. = 1812 - number of lin. iters. = 1785 - average Krylov subspace dimension (NLI/NNI) = 0.9851 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 0 - main solver real/int workspace sizes = 861 265 - linear solver real/int workspace sizes = 535 126 -In ARKBBDPRE: - real/int local workspace = 160 72 - number of g evals. = 12 - - ------------------------------------------------------------- - - -Preconditioning on right - - t = 0.10E+00 no. steps = 173 no. attempts = 173 no. fe-s = 0 no. fi-s = 1846 - t = 0.20E+00 no. steps = 221 no. attempts = 221 no. fe-s = 0 no. fi-s = 2362 - t = 0.30E+00 no. steps = 248 no. attempts = 248 no. fe-s = 0 no. fi-s = 2650 - t = 0.40E+00 no. steps = 266 no. attempts = 266 no. fe-s = 0 no. fi-s = 2848 - t = 0.50E+00 no. steps = 281 no. attempts = 281 no. fe-s = 0 no. fi-s = 3007 - t = 0.60E+00 no. steps = 291 no. attempts = 291 no. fe-s = 0 no. fi-s = 3116 - t = 0.70E+00 no. steps = 300 no. attempts = 300 no. fe-s = 0 no. fi-s = 3215 - t = 0.80E+00 no. steps = 306 no. attempts = 306 no. fe-s = 0 no. fi-s = 3275 - t = 0.90E+00 no. steps = 312 no. attempts = 312 no. fe-s = 0 no. fi-s = 3335 - t = 0.10E+01 no. steps = 319 no. attempts = 319 no. fe-s = 0 no. fi-s = 3410 - -Max. absolute error is 0.76E-10 - - -Final statistics: - - number of steps = 319 - number of steps att. = 319 - number of fe evals. = 0 - number of fi evals. = 3410 - number of prec. setups = 25 - number of prec. evals. = 6 - number of prec. solves = 3380 - number of nonl. iters. = 1812 - number of lin. iters. = 1785 - average Krylov subspace dimension (NLI/NNI) = 0.9851 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 0 - main solver real/int workspace sizes = 861 270 - linear solver real/int workspace sizes = 535 126 -In ARKBBDPRE: - real/int local workspace = 160 72 - number of g evals. = 12 diff --git a/examples/arkode/F77_parallel/fark_diag_non_p.f b/examples/arkode/F77_parallel/fark_diag_non_p.f deleted file mode 100644 index 22f5fbfada..0000000000 --- a/examples/arkode/F77_parallel/fark_diag_non_p.f +++ /dev/null @@ -1,231 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C Diagonal ODE example. Nonstiff case: alpha = 10/NEQ. -C ---------------------------------------------------------------- -C -C Include MPI-Fortran header file for MPI_COMM_WORLD, MPI types. -C - IMPLICIT NONE -C - INCLUDE "mpif.h" - INTEGER*8 NLOCAL - PARAMETER (NLOCAL=2) -C - INTEGER*4 IER, MYPE, NPES, NOUT, LNST, LNST_ATT, LNFE, LNFI, LNNI - INTEGER*4 LNCF, LNETF, METH, IATOL, ITASK, JOUT - INTEGER*8 NEQ, I, NST, NST_ATT, NFE, NFI, NNI, NCFN, NETF - INTEGER*8 IOUT(35), IPAR(2) - DOUBLE PRECISION Y(128), ROUT(6), RPAR(1) - DOUBLE PRECISION ATOL, RTOL, DTOUT, T, ALPHA, TOUT - DOUBLE PRECISION ERMAX, ERRI, GERMAX -C - DATA ATOL/1.0D-10/, RTOL/1.0D-5/, DTOUT/0.1D0/, NOUT/10/ - DATA LNST/3/, LNST_ATT/6/, LNFE/7/, LNFI/8/, LNNI/11/, LNCF/12/, - 1 LNETF/10/ -C -C Get NPES and MYPE. Requires initialization of MPI. - CALL MPI_INIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,5) IER - 5 FORMAT(///' MPI_ERROR: MPI_INIT returned IER = ', I5) - STOP - ENDIF - CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPES, IER) - IF (IER .NE. 0) THEN - WRITE(6,6) IER - 6 FORMAT(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - CALL MPI_COMM_RANK(MPI_COMM_WORLD, MYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,7) IER - 7 FORMAT(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Set input arguments. - NEQ = NPES * NLOCAL - T = 0.0D0 - METH = 1 - IATOL = 1 - ITASK = 1 -c Set parameter ALPHA - ALPHA = 10.0D0 / NEQ -C -C Load IPAR and RPAR - IPAR(1) = NLOCAL - IPAR(2) = MYPE - RPAR(1) = ALPHA -C - DO 10 I = 1, NLOCAL - 10 Y(I) = 1.0D0 -C - IF (MYPE .EQ. 0) THEN - WRITE(6,11) NEQ, NLOCAL, ALPHA - 11 FORMAT('Diagonal test problem:'//' NEQ = ', I3, / - 1 ' NLOCAL = ', I3, / - 2 ' parameter alpha = ', F8.3) - WRITE(6,12) - 12 FORMAT(' ydot_i = -alpha*i * y_i (i = 1,...,NEQ)') - WRITE(6,13) RTOL, ATOL - 13 FORMAT(' RTOL, ATOL = ', 2E10.1) - WRITE(6,14) - 14 FORMAT(' Method is ERK') - WRITE(6,15) NPES - 15 FORMAT(' Number of processors = ', I3//) - ENDIF -C - CALL FNVINITP(MPI_COMM_WORLD, 4, NLOCAL, NEQ, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITP returned IER = ', I5) - CALL MPI_FINALIZE(IER) - STOP - ENDIF -C - CALL FARKMALLOC(T, Y, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FARKMALLOC returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 70 JOUT = 1, NOUT -C - CALL FARKODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,40) T, IOUT(LNST), IOUT(LNST_ATT), - & IOUT(LNFE), IOUT(LNFI) - 40 FORMAT(' t = ', D10.2, 5X, 'steps = ', I5, - & ' (attempted = ', I5, '), fe = ', I5, - & ' fi = ', I5) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(16) - 60 FORMAT(///' SUNDIALS_ERROR: FARKODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 70 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 75 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - ERMAX = MAX(ERMAX, ABS(ERRI)) - 75 CONTINUE -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - 1 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' MPI_ERROR: MPI_REDUCE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,85) GERMAX - 85 FORMAT(/'Max. absolute error is ', E10.2/) -C -C Print final statistics. - NST = IOUT(LNST) - NST_ATT = IOUT(LNST_ATT) - NFE = IOUT(LNFE) - NFI = IOUT(LNFI) - NNI = IOUT(LNNI) - NCFN = IOUT(LNCF) - NETF = IOUT(LNETF) - IF (MYPE .EQ. 0) WRITE (6,90) NST, NST_ATT, NFE, NFI, NNI, NCFN, - & NETF - 90 FORMAT(/'Final statistics:'// - & ' number of steps = ', I5/ - & ' number of step attempts = ', I5/ - & ' number of fe evals. = ', I5/ - & ' number of fi evals. = ', I5/ - & ' number of nonlinear iters. = ', I5/ - & ' number of nonlinear conv. failures = ', I3/ - & ' number of error test failures = ', I3) -C -C Free the memory and finalize MPI. - CALL FARKFREE - CALL MPI_FINALIZE(IER) - IF (IER .NE. 0) THEN - WRITE(6,95) IER - 95 FORMAT(///' MPI_ERROR: MPI_FINALIZE returned IER = ', I5) - STOP - ENDIF -C - STOP - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKIFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fi -C - IMPLICIT NONE -C - INTEGER*4 IER - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - INTEGER*8 NLOCAL, I -C - NLOCAL = IPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = 0.D0 - ENDDO -C - IER = 0 -C - RETURN - END -C ------------------------------------------------------------------------ -C - SUBROUTINE FARKEFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fe -C - IMPLICIT NONE -C - INTEGER*4 IER - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - INTEGER*8 MYPE - INTEGER*8 NLOCAL, I - DOUBLE PRECISION ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = -ALPHA * (MYPE * NLOCAL + I) * Y(I) - ENDDO -C - IER = 0 -C - RETURN - END diff --git a/examples/arkode/F77_parallel/fark_diag_non_p.out b/examples/arkode/F77_parallel/fark_diag_non_p.out deleted file mode 100644 index ea79d61fe3..0000000000 --- a/examples/arkode/F77_parallel/fark_diag_non_p.out +++ /dev/null @@ -1,34 +0,0 @@ -Diagonal test problem: - - NEQ = 8 - NLOCAL = 2 - parameter alpha = 1.250 - ydot_i = -alpha*i * y_i (i = 1,...,NEQ) - RTOL, ATOL = 0.1E-04 0.1E-09 - Method is ERK - Number of processors = 4 - - - t = 0.10D+00 steps = 12 (attempted = 12), fe = 75 fi = 0 - t = 0.20D+00 steps = 21 (attempted = 21), fe = 129 fi = 0 - t = 0.30D+00 steps = 31 (attempted = 31), fe = 189 fi = 0 - t = 0.40D+00 steps = 40 (attempted = 40), fe = 243 fi = 0 - t = 0.50D+00 steps = 50 (attempted = 50), fe = 303 fi = 0 - t = 0.60D+00 steps = 59 (attempted = 59), fe = 357 fi = 0 - t = 0.70D+00 steps = 69 (attempted = 69), fe = 417 fi = 0 - t = 0.80D+00 steps = 78 (attempted = 78), fe = 471 fi = 0 - t = 0.90D+00 steps = 88 (attempted = 88), fe = 531 fi = 0 - t = 0.10D+01 steps = 97 (attempted = 97), fe = 585 fi = 0 - -Max. absolute error is 0.22E-08 - - -Final statistics: - - number of steps = 97 - number of step attempts = 97 - number of fe evals. = 585 - number of fi evals. = 0 - number of nonlinear iters. = 0 - number of nonlinear conv. failures = 0 - number of error test failures = 0 diff --git a/examples/arkode/F77_serial/CMakeLists.txt b/examples/arkode/F77_serial/CMakeLists.txt deleted file mode 100644 index 674e4e85ae..0000000000 --- a/examples/arkode/F77_serial/CMakeLists.txt +++ /dev/null @@ -1,294 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# David J. Gardner @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FARKODE F77 serial examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FARKODE_examples - "fark_diurnal_kry_bp\;develop" - ) - -# Examples using LAPACK linear solvers -set(FARKODE_examples_BL - "fark_roberts_dnsL\;develop" - ) - -# Add sparse solvers examples for 64-bit indextype configurations only, -# not compatible with 32-bit indextype -if(SUNDIALS_INDEX_SIZE MATCHES "64") - - # Examples using KLU linear solver - set(FARKODE_examples_KLU - ) - - # Examples using SuperLU_MT linear solver - set(FARKODE_examples_SUPERLUMT - ) - -endif() - -# Auxiliary files to install -set(ARKODE_extras - ) - -# Specify libraries to link against -set(ARKODE_LIB sundials_arkode) -set(NVECS_LIB sundials_nvecserial) -set(FNVECS_LIB sundials_fnvecserial) - -# Only static FCMIX libraries are available -set(FARKODE_LIB sundials_farkode${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FARKODE_LIB} ${ARKODE_LIB} ${FNVECS_LIB} ${NVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each FARKODE example -foreach(example_tuple ${FARKODE_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - endif() - -endforeach(example_tuple ${FARKODE_examples}) - - -# Add the build and install targets for each LAPACK example (if needed) -if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - - # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense - sundials_fsunlinsollapackband - sundials_fsunlinsollapackdense) - - # LAPACK libraries - list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) - - foreach(example_tuple ${FARKODE_examples_BL}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_BL}) - -endif() - - -# Add the build and install targets for each KLU example (if needed) -if(BUILD_SUNLINSOL_KLU) - - # Sundials KLU linear solver module - set(SUNLINSOLKLU_LIBS - sundials_sunlinsolklu - sundials_fsunlinsolklu) - - # KLU libraries - list(APPEND SUNLINSOLKLU_LIBS) - - foreach(example_tuple ${FARKODE_examples_KLU}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_KLU}) - -endif() - - -# Add the build and install targets for each SuperLU_MT example (if needed) -if(BUILD_SUNLINSOL_SUPERLUMT) - - # Sundials SuperLU_MT linear solver module - set(SUNLINSOLSLUMT_LIBS - sundials_sunlinsolsuperlumt - sundials_fsunlinsolsuperlumt) - - # SuperLU_MT libraries - list(APPEND SUNLINSOLSLUMT_LIBS ${SUPERLUMT_LIBRARIES}) - - foreach(example_tuple ${FARKODE_examples_SUPERLUMT}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_SUPERLUMT}) - -endif() - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - - # Install the extra files - foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial) - endforeach() - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "ARKODE") - set(SOLVER_LIB "sundials_arkode") - set(SOLVER_FLIB "sundials_farkode") - - examples2string(FARKODE_examples EXAMPLES) - - if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - examples2string(FARKODE_examples_BL EXAMPLES_BL) - else() - set(EXAMPLES_BL "") - endif() - - if(BUILD_SUNLINSOL_KLU) - examples2string(FARKODE_examples_KLU EXAMPLES_KLU) - else() - set(EXAMPLES_KLU "") - endif() - - if(BUILD_SUNLINSOL_SUPERLUMT) - examples2string(FARKODE_examples_SUPERLUMT EXAMPLES_SLUMT) - else() - set(EXAMPLES_SLUMT "") - endif() - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F77_serial/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F77_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F77_serial/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F77_serial/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F77_serial - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(arkode F77_serial) - -endif() diff --git a/examples/arkode/F77_serial/README b/examples/arkode/F77_serial/README deleted file mode 100644 index 37cc60c260..0000000000 --- a/examples/arkode/F77_serial/README +++ /dev/null @@ -1,47 +0,0 @@ -List of serial ARKODE F77 examples - - fark_diurnal_kry_bp : kinetics-transport example (DIRK/SPGMR/FARKBP) - fark_roberts_dnsL : chemical kinetics example (DIRK/DENSE lapack) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/arkode/F77_serial/fark_diurnal_kry_bp.f b/examples/arkode/F77_serial/fark_diurnal_kry_bp.f deleted file mode 100644 index 11725b79e6..0000000000 --- a/examples/arkode/F77_serial/fark_diurnal_kry_bp.f +++ /dev/null @@ -1,413 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C FARKODE Example Problem: 2D kinetics-transport, -C precond. Krylov solver. -C -C An ODE system is generated from the following 2-species diurnal -C kinetics advection-diffusion PDE system in 2 space dimensions: -C -C dc(i)/dt = Kh*(d/dx)**2 c(i) + V*dc(i)/dx + (d/dy)(Kv(y)*dc(i)/dy) -C + Ri(c1,c2,t) for i = 1,2, where -C R1(c1,c2,t) = -q1*c1*c3 - q2*c1*c2 + 2*q3(t)*c3 + q4(t)*c2 , -C R2(c1,c2,t) = q1*c1*c3 - q2*c1*c2 - q4(t)*c2 , -C Kv(y) = Kv0*exp(y/5) , -C Kh, V, Kv0, q1, q2, and c3 are constants, and q3(t) and q4(t) -C vary diurnally. -C -C The problem is posed on the square -C 0 .le. x .le. 20, 30 .le. y .le. 50 (all in km), -C with homogeneous Neumann boundary conditions, and for time t in -C 0 .le. t .le. 86400 sec (1 day). -C -C The PDE system is treated by central differences on a uniform -C 10 x 10 mesh, with simple polynomial initial profiles. -C The problem is solved with ARKODE, with the DIRK/GMRES method and -C using the FARKBP banded preconditioner. -C -C Note that this problem should only work with SUNDIALS configured -C to use 'realtype' as 'double' and 'sunindextype' as '64bit' -C -C The second and third dimensions of U here must match the values of -C MX and MY, for consistency with the output statements below. -C ---------------------------------------------------------------- -C - IMPLICIT NONE - INTEGER*4 MX, MY - PARAMETER (MX=10, MY=10) - INTEGER*8 NEQ - PARAMETER (NEQ=2*MX*MY) -C - INTEGER*4 LNST, LNST_ATT, LNFE, LNFI, LNSETUP, LNNI, LNCF, LNPE - INTEGER*4 LNLI, LNPS, LNCFL, LH, LNETF, LLENRW, LLENIW, LLENRWLS - INTEGER*4 LLENIWLS, METH, IATOL, ITASK, IER, MAXL, JPRETYPE - INTEGER*4 IGSTYPE, JOUT - INTEGER*8 IOUT(35), IPAR(4), NST, NST_ATT, NFE, NFI, NPSET, NPE - INTEGER*8 NPS, NNI, NLI, NCFN, NCFL, NETF, MU, ML, LENRW, LENIW - INTEGER*8 LENRWLS, LENIWLS, LENRWBP, LENIWBP, NFEBP, MXSTEPS - DOUBLE PRECISION ATOL, AVDIM, DELT, FLOOR, RTOL, T, TOUT, TWOHR - DOUBLE PRECISION ROUT(6), U(2,MX,MY), RPAR(12) -C - DATA TWOHR/7200.0D0/, RTOL/1.0D-5/, FLOOR/100.0D0/, - 1 JPRETYPE/1/, IGSTYPE/1/, MAXL/0/, DELT/0.0D0/, MXSTEPS/10000/ - DATA LLENRW/1/, LLENIW/2/, LNST/3/, LNST_ATT/6/, LNFE/7/, LNFI/8/, - 1 LNETF/10/, LNCF/12/, LNNI/11/, LNSETUP/9/, LLENRWLS/14/, - 1 LLENIWLS/15/, LNPE/21/, LNLI/23/, LNPS/22/, LNCFL/24/ - DATA LH/2/ -C -C Load IPAR, RPAR, and initial values - CALL INITKX(MX, MY, U, IPAR, RPAR) -C -C Set other input arguments. - T = 0.0D0 - METH = 0 - IATOL = 1 - ATOL = RTOL * FLOOR - ITASK = 1 -C - WRITE(6,10) NEQ - 10 FORMAT('Krylov example problem:'// - 1 ' Kinetics-transport, NEQ = ', I4/) -C -C Initialize vector specification - CALL FNVINITS(4, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF -C -C initialize SPGMR linear solver module - call FSUNSPGMRINIT(4, JPRETYPE, MAXL, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - STOP - ENDIF - call FSUNSPGMRSETGSTYPE(4, IGSTYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - STOP - ENDIF -C -C Initialize ARKODE - CALL FARKMALLOC(T, U, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FARKMALLOC returned IER = ', I5) - STOP - ENDIF -C - CALL FARKSETIIN('MAX_NSTEPS', MXSTEPS, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FARKSETIIN returned IER = ', I5) - STOP - ENDIF -C -C attach matrix and linear solver modules to ARKLs interface - CALL FARKLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FARKLSINIT returned IER = ',I5) - CALL FARKFREE - STOP - ENDIF -C -C Initialize band preconditioner - MU = 2 - ML = 2 - CALL FARKBPINIT(NEQ, MU, ML, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FARKBPINIT returned IER = ', I5) - CALL FARKFREE - STOP - ENDIF -C -C Loop over output points, call FARKODE, print sample solution values. - TOUT = TWOHR - DO 70 JOUT = 1, 12 -C - CALL FARKODE(TOUT, T, U, ITASK, IER) -C - WRITE(6,50) T, IOUT(LNST), IOUT(LNST_ATT), ROUT(LH) - 50 FORMAT(/' t = ', E14.6, 5X, 'no. steps = ', I5, - 1 ' no. att. steps = ', I5, ' stepsize = ', E14.6) - WRITE(6,55) U(1,1,1), U(1,5,5), U(1,10,10), - 1 U(2,1,1), U(2,5,5), U(2,10,10) - 55 FORMAT(' c1 (bot.left/middle/top rt.) = ', 3E14.6/ - 1 ' c2 (bot.left/middle/top rt.) = ', 3E14.6) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(16) - 60 FORMAT(///' SUNDIALS_ERROR: FARKODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FARKFREE - STOP - ENDIF -C - TOUT = TOUT + TWOHR - 70 CONTINUE - -C Print final statistics. - NST = IOUT(LNST) - NST_ATT = IOUT(LNST_ATT) - NFE = IOUT(LNFE) - NFI = IOUT(LNFI) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - LENRW = IOUT(LLENRW) - LENIW = IOUT(LLENIW) - LENRWLS = IOUT(LLENRWLS) - LENIWLS = IOUT(LLENIWLS) - WRITE(6,80) NST, NST_ATT, NFE, NFI, NPSET, NPE, NPS, NNI, NLI, - 1 AVDIM, NCFN, NCFL, NETF, LENRW, LENIW, LENRWLS, LENIWLS - 80 FORMAT(//'Final statistics:'// - & ' number of steps = ', I6/ - & ' number of step att. = ', I6/ - & ' number of fe evals. = ', I6/ - & ' number of fi evals. = ', I6/ - & ' number of prec. setups = ', I6/ - & ' number of prec. evals. = ', I6/ - & ' number of prec. solves = ', I6/ - & ' number of nonl. iters. = ', I6/ - & ' number of lin. iters. = ', I6/ - & ' average Krylov subspace dimension (NLI/NNI) = ', E14.6/ - & ' number of conv. failures.. nonlinear =', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3/ - & ' main solver real/int workspace sizes = ',2I5/ - & ' linear solver real/int workspace sizes = ',2I5) - CALL FARKBPOPT(LENRWBP, LENIWBP, NFEBP) - WRITE(6,82) LENRWBP, LENIWBP, NFEBP - 82 FORMAT('In ARKBANDPRE:'/ - & ' real/int workspace sizes = ', 2I5/ - & ' number of f evaluations = ', I5) -C - CALL FARKFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE INITKX(MX, MY, U0, IPAR, RPAR) -C Routine to set problem constants and initial values -C - IMPLICIT NONE -C - INTEGER*4 MX, MY - INTEGER*8 IPAR(*), NEQ - DOUBLE PRECISION RPAR(*) -C - INTEGER*8 MM, JY, JX - DOUBLE PRECISION U0 - DIMENSION U0(2,MX,MY) - DOUBLE PRECISION Q1, Q2, Q3, Q4, A3, A4, OM, C3, DY, HDCO - DOUBLE PRECISION VDCO, HACO, X, Y - DOUBLE PRECISION CX, CY, DKH, DKV0, DX, HALFDA, PI, VEL -C - DATA DKH/4.0D-6/, VEL/0.001D0/, DKV0/1.0D-8/, HALFDA/4.32D4/, - 1 PI/3.1415926535898D0/ -C -C Problem constants - MM = MX * MY - NEQ = 2 * MM - Q1 = 1.63D-16 - Q2 = 4.66D-16 - Q3 = 0.D0 - Q4 = 0.D0 - A3 = 22.62D0 - A4 = 7.601D0 - OM = PI / HALFDA - C3 = 3.7D16 - DX = 20.0D0 / (MX - 1.0D0) - DY = 20.0D0 / (MY - 1.0D0) - HDCO = DKH / DX**2 - HACO = VEL / (2.0D0 * DX) - VDCO = (1.0D0 / DY**2) * DKV0 -C Load constants in IPAR and RPAR - IPAR(1) = MX - IPAR(2) = MY - IPAR(3) = MM - IPAR(4) = NEQ -C - RPAR(1) = Q1 - RPAR(2) = Q2 - RPAR(3) = Q3 - RPAR(4) = Q4 - RPAR(5) = A3 - RPAR(6) = A4 - RPAR(7) = OM - RPAR(8) = C3 - RPAR(9) = DY - RPAR(10) = HDCO - RPAR(11) = VDCO - RPAR(12) = HACO -C -C Set initial profiles. - DO 20 JY = 1, MY - Y = 30.0D0 + (JY - 1.0D0) * DY - CY = (0.1D0 * (Y - 40.0D0))**2 - CY = 1.0D0 - CY + 0.5D0 * CY**2 - DO 10 JX = 1, MX - X = (JX - 1.0D0) * DX - CX = (0.1D0 * (X - 10.0D0))**2 - CX = 1.0D0 - CX + 0.5D0 * CX**2 - U0(1,JX,JY) = 1.0D6 * CX * CY - U0(2,JX,JY) = 1.0D12 * CX * CY - 10 CONTINUE - 20 CONTINUE -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKIFUN(T, U, UDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fi - IMPLICIT NONE -C - INTEGER*4 IER - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, U(2,*), UDOT(2,*), RPAR(*) -C - INTEGER*4 ILEFT, IRIGHT - INTEGER*8 MX, MY, MM, JY, JX, IBLOK0, IDN, IUP, IBLOK - DOUBLE PRECISION Q1,Q2,Q3,Q4, A3, A4, OM, C3, DY, HDCO, VDCO, HACO - DOUBLE PRECISION C1, C2, C1DN, C2DN, C1UP, C2UP, C1LT, C2LT - DOUBLE PRECISION C1RT, C2RT, CYDN, CYUP, HORD1, HORD2, HORAD1 - DOUBLE PRECISION HORAD2, QQ1, QQ2, QQ3, QQ4, RKIN1, RKIN2, S - DOUBLE PRECISION VERTD1, VERTD2, YDN, YUP -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - MM = IPAR(3) -C - Q1 = RPAR(1) - Q2 = RPAR(2) - Q3 = RPAR(3) - Q4 = RPAR(4) - A3 = RPAR(5) - A4 = RPAR(6) - OM = RPAR(7) - C3 = RPAR(8) - DY = RPAR(9) - HDCO = RPAR(10) - VDCO = RPAR(11) - HACO = RPAR(12) -C -C Set diurnal rate coefficients. - S = SIN(OM * T) - IF (S .GT. 0.0D0) THEN - Q3 = EXP(-A3 / S) - Q4 = EXP(-A4 / S) - ELSE - Q3 = 0.0D0 - Q4 = 0.0D0 - ENDIF -C -C Loop over all grid points. - DO 20 JY = 1, MY - YDN = 30.0D0 + (JY - 1.5D0) * DY - YUP = YDN + DY - CYDN = VDCO * EXP(0.2D0 * YDN) - CYUP = VDCO * EXP(0.2D0 * YUP) - IBLOK0 = (JY - 1) * MX - IDN = -MX - IF (JY .EQ. 1) IDN = MX - IUP = MX - IF (JY .EQ. MY) IUP = -MX - DO 10 JX = 1, MX - IBLOK = IBLOK0 + JX - C1 = U(1,IBLOK) - C2 = U(2,IBLOK) -C Set kinetic rate terms. - QQ1 = Q1 * C1 * C3 - QQ2 = Q2 * C1 * C2 - QQ3 = Q3 * C3 - QQ4 = Q4 * C2 - RKIN1 = -QQ1 - QQ2 + 2.0D0 * QQ3 + QQ4 - RKIN2 = QQ1 - QQ2 - QQ4 -C Set vertical diffusion terms. - C1DN = U(1,IBLOK + IDN) - C2DN = U(2,IBLOK + IDN) - C1UP = U(1,IBLOK + IUP) - C2UP = U(2,IBLOK + IUP) - VERTD1 = CYUP * (C1UP - C1) - CYDN * (C1 - C1DN) - VERTD2 = CYUP * (C2UP - C2) - CYDN * (C2 - C2DN) -C Set horizontal diffusion and advection terms. - ILEFT = -1 - IF (JX .EQ. 1) ILEFT = 1 - IRIGHT = 1 - IF (JX .EQ. MX) IRIGHT = -1 - C1LT = U(1,IBLOK + ILEFT) - C2LT = U(2,IBLOK + ILEFT) - C1RT = U(1,IBLOK + IRIGHT) - C2RT = U(2,IBLOK + IRIGHT) - HORD1 = HDCO * (C1RT - 2.0D0 * C1 + C1LT) - HORD2 = HDCO * (C2RT - 2.0D0 * C2 + C2LT) - HORAD1 = HACO * (C1RT - C1LT) - HORAD2 = HACO * (C2RT - C2LT) -C Load all terms into UDOT. - UDOT(1,IBLOK) = VERTD1 + HORD1 + HORAD1 + RKIN1 - UDOT(2,IBLOK) = VERTD2 + HORD2 + HORAD2 + RKIN2 - 10 CONTINUE - 20 CONTINUE -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKEFUN(T, U, UDOT, IPAR, RPAR, IER) -C Routine for right-hand side function fe - IMPLICIT NONE -C - INTEGER*4 IER - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, U(2,*), UDOT(2,*), RPAR(*) -C - INTEGER*8 MX, MY, JY, JX, IBLOK0, IBLOK -C -C Extract constants from IPAR - MX = IPAR(1) - MY = IPAR(2) -C -C Loop over all grid points, setting UDOT to zero - DO 20 JY = 1, MY - IBLOK0 = (JY - 1) * MX - DO 10 JX = 1, MX - IBLOK = IBLOK0 + JX - UDOT(1,IBLOK) = 0.D0 - UDOT(2,IBLOK) = 0.D0 - 10 CONTINUE - 20 CONTINUE -C - IER = 0 -C - RETURN - END diff --git a/examples/arkode/F77_serial/fark_diurnal_kry_bp.out b/examples/arkode/F77_serial/fark_diurnal_kry_bp.out deleted file mode 100644 index dd807ac51b..0000000000 --- a/examples/arkode/F77_serial/fark_diurnal_kry_bp.out +++ /dev/null @@ -1,73 +0,0 @@ -Krylov example problem: - - Kinetics-transport, NEQ = 200 - - - t = 0.720000E+04 no. steps = 987 no. att. steps = 989 stepsize = 0.306506E+01 - c1 (bot.left/middle/top rt.) = 0.104683E+05 0.296369E+05 0.111853E+05 - c2 (bot.left/middle/top rt.) = 0.252673E+12 0.715366E+12 0.269977E+12 - - t = 0.144000E+05 no. steps = 2737 no. att. steps = 2739 stepsize = 0.689853E+01 - c1 (bot.left/middle/top rt.) = 0.665902E+07 0.531590E+07 0.730081E+07 - c2 (bot.left/middle/top rt.) = 0.258191E+12 0.205675E+12 0.283286E+12 - - t = 0.216000E+05 no. steps = 3539 no. att. steps = 3541 stepsize = 0.104022E+02 - c1 (bot.left/middle/top rt.) = 0.266497E+08 0.103652E+08 0.293077E+08 - c2 (bot.left/middle/top rt.) = 0.299279E+12 0.102829E+12 0.331344E+12 - - t = 0.288000E+05 no. steps = 4697 no. att. steps = 4722 stepsize = 0.477171E+01 - c1 (bot.left/middle/top rt.) = 0.870214E+07 0.129200E+08 0.965006E+07 - c2 (bot.left/middle/top rt.) = 0.338037E+12 0.502942E+12 0.375097E+12 - - t = 0.360000E+05 no. steps = 5937 no. att. steps = 5962 stepsize = 0.255709E+01 - c1 (bot.left/middle/top rt.) = 0.140404E+05 0.202886E+05 0.156091E+05 - c2 (bot.left/middle/top rt.) = 0.338679E+12 0.489399E+12 0.376518E+12 - - t = 0.432000E+05 no. steps = 7127 no. att. steps = 7152 stepsize = 0.283066E+03 - c1 (bot.left/middle/top rt.) = 0.537446E-07 -0.895486E-05 0.770364E-06 - c2 (bot.left/middle/top rt.) = 0.338234E+12 0.135516E+12 0.380354E+12 - - t = 0.504000E+05 no. steps = 7153 no. att. steps = 7179 stepsize = 0.409586E+03 - c1 (bot.left/middle/top rt.) = 0.943663E-06 -0.118550E-03 0.177095E-04 - c2 (bot.left/middle/top rt.) = 0.335818E+12 0.493035E+12 0.386446E+12 - - t = 0.576000E+05 no. steps = 7171 no. att. steps = 7198 stepsize = 0.290889E+03 - c1 (bot.left/middle/top rt.) = -0.560472E-07 0.428395E-05 0.972997E-07 - c2 (bot.left/middle/top rt.) = 0.332033E+12 0.964976E+12 0.390901E+12 - - t = 0.648000E+05 no. steps = 7185 no. att. steps = 7212 stepsize = 0.645241E+03 - c1 (bot.left/middle/top rt.) = 0.188431E-15 -0.337015E-12 0.808647E-11 - c2 (bot.left/middle/top rt.) = 0.331304E+12 0.892178E+12 0.396344E+12 - - t = 0.720000E+05 no. steps = 7196 no. att. steps = 7223 stepsize = 0.645241E+03 - c1 (bot.left/middle/top rt.) = 0.494923E-16 0.207489E-11 -0.201885E-12 - c2 (bot.left/middle/top rt.) = 0.332974E+12 0.618628E+12 0.403886E+12 - - t = 0.792000E+05 no. steps = 7207 no. att. steps = 7234 stepsize = 0.645241E+03 - c1 (bot.left/middle/top rt.) = 0.656506E-16 -0.343161E-11 -0.863757E-11 - c2 (bot.left/middle/top rt.) = 0.333443E+12 0.666905E+12 0.412027E+12 - - t = 0.864000E+05 no. steps = 7218 no. att. steps = 7245 stepsize = 0.645241E+03 - c1 (bot.left/middle/top rt.) = 0.577960E-15 0.707844E-12 0.151082E-11 - c2 (bot.left/middle/top rt.) = 0.335180E+12 0.910620E+12 0.416253E+12 - - -Final statistics: - - number of steps = 7218 - number of step att. = 7245 - number of fe evals. = 0 - number of fi evals. = 75812 - number of prec. setups = 441 - number of prec. evals. = 120 - number of prec. solves = 110062 - number of nonl. iters. = 39584 - number of lin. iters. = 73470 - average Krylov subspace dimension (NLI/NNI) = 0.185605E+01 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 27 - main solver real/int workspace sizes = 3701 131 - linear solver real/int workspace sizes = 2455 42 -In ARKBANDPRE: - real/int workspace sizes = 2800 622 - number of f evaluations = 600 diff --git a/examples/arkode/F77_serial/fark_roberts_dnsL.f b/examples/arkode/F77_serial/fark_roberts_dnsL.f deleted file mode 100644 index 1dd337dbe7..0000000000 --- a/examples/arkode/F77_serial/fark_roberts_dnsL.f +++ /dev/null @@ -1,329 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C FARKODE Example Problem: Robertson kinetics, Lapack linear solver -C with dense user Jacobian. -C -C The following is a simple example problem, with the coding -C needed for its solution by ARKODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C employ the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with ARKODE, using the Fortran/C interface routine -C package. This solution uses the DIRK method and a user-supplied -C Jacobian routine, and prints results at t = .4, 4., ..., 4.e10. -C It uses ITOL = 2 and ATOL much smaller for y2 than y1 or y3 -C because y2 has much smaller values. At the end of the run, -C various counters of interest are printed. -C -C Note that this problem should only work with SUNDIALS configured -C to use 'realtype' as 'double' and 'sunindextype' as '32bit' -C ---------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNST_ATT, LNFE, LNFI, LNSETUP, LNNI, LNCF - INTEGER*4 LNETF, LNJE, LNGE, METH, ITOL, ITASK, JOUT, NOUT - INTEGER*4 IERROOT, INFO(2) - INTEGER*4 I - INTEGER*8 NEQ, IOUT(35), IPAR, MXSTEPS, MXNLI, PRED, MXETF - DOUBLE PRECISION RTOL, T, T0, TOUT, H0, NLCONV - DOUBLE PRECISION Y(3), ATOL(3), ROUT(6), RPAR -C - DATA LNST/3/, LNST_ATT/6/, LNFE/7/, LNFI/8/, LNETF/10/, LNCF/12/, - 1 LNNI/11/, LNSETUP/9/, LNGE/13/, LNJE/18/ -C - NEQ = 3 - MXSTEPS = 10000 - MXNLI = 8 - PRED = 1 - MXETF = 20 - T0 = 0.0D0 - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 - METH = 0 - ITOL = 2 - RTOL = 1.0D-4 - ATOL(1) = 1.0D-8 - ATOL(2) = 1.0D-11 - ATOL(3) = 1.0D-8 - H0 = 1.0D-4 * RTOL - NLCONV = 1.0D-7 - TOUT = 0.4D0 - ITASK = 1 - JOUT = 0 - NOUT = 12 -C - WRITE(6,10) NEQ - 10 FORMAT('Dense example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) -C - CALL FNVINITS(4, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF -C -C initialize dense matrix module - call FSUNDENSEMATINIT(4, NEQ, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNDENSEMATINIT IER = ', I5) - STOP - ENDIF -C -C initialize LAPACK dense linear solver module - call FSUNLAPACKDENSEINIT(4, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNLAPACKDENSEINIT IER = ', I5) - STOP - ENDIF -C - CALL FARKMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FARKMALLOC returned IER = ', I5) - STOP - ENDIF -C - CALL FARKSETRIN('INIT_STEP', H0, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FARKSETRIN returned IER = ', I5) - STOP - ENDIF -C - CALL FARKSETRIN('NLCONV_COEF', NLCONV, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - STOP - ENDIF -C - CALL FARKSETIIN('MAX_NSTEPS', MXSTEPS, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FARKSETIIN returned IER = ', I5) - STOP - ENDIF -C - CALL FARKSETIIN('MAX_NITERS', MXNLI, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - STOP - ENDIF -C - CALL FARKSETIIN('PREDICT_METHOD', PRED, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - STOP - ENDIF -C - CALL FARKSETIIN('MAX_ERRFAIL', MXETF, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - STOP - ENDIF -c - CALL FARKROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,38) IER - 38 FORMAT(///' SUNDIALS_ERROR: FARKROOTINIT returned IER = ', I5) - CALL FARKFREE - STOP - ENDIF -C -C attach matrix and linear solver modules to ARKLs interface - CALL FARKLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FARKLSINIT returned IER = ',I5) - CALL FARKFREE - STOP - ENDIF -C - CALL FARKDENSESETJAC(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FARKDENSESETJAC returned IER = ',I5) - CALL FARKFREE - STOP - ENDIF -C - DO WHILE(JOUT .LT. NOUT) -C - CALL FARKODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,50) T, Y(1), Y(2), Y(3) - 50 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,60) IER, IOUT(16) - 60 FORMAT(///' SUNDIALS_ERROR: FARKODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FARKROOTFREE - CALL FARKFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FARKROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,65) IERROOT - 65 FORMAT(///' SUNDIALS_ERROR: FARKROOTINFO returned IER = ', - 1 I5) - CALL FARKROOTFREE - CALL FARKFREE - STOP - ENDIF - WRITE(6,70) (INFO(I), I = 1, 2) - 70 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO -C - CALL FARKDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' SUNDIALS_ERROR: FARKDKY returned IER = ', I4) - CALL FARKROOTFREE - CALL FARKFREE - STOP - ENDIF - WRITE(6,85) Y(1), Y(2), Y(3) - 85 FORMAT(/'Final value of ydot = ', 3E14.6) -C - WRITE(6,90) IOUT(LNST), IOUT(LNST_ATT), IOUT(LNFE), IOUT(LNFI), - 1 IOUT(LNJE), IOUT(LNSETUP), IOUT(LNNI), IOUT(LNCF), - 2 IOUT(LNETF), IOUT(LNGE) - 90 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ', attempted = ', I4/ - 2 ' No. fe-s = ', I4, ', No. fi-s = ',I5/ - 3 ' No. J-s = ', I4, ', No. LU-s = ', I4/ - 4 ' No. nonlinear iterations = ', I5/ - 5 ' No. nonlinear convergence failures = ', I4/ - 6 ' No. error test failures = ', I4/ - 7 ' No. root function evals = ', I4) -C - CALL FARKROOTFREE - CALL FARKFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKIFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function, fi - IMPLICIT NONE -C - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKEFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function, fe - IMPLICIT NONE -C - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = 0.D0 - YDOT(3) = 0.D0 - YDOT(2) = 0.D0 -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FARKDJAC(N, T, Y, FY, JAC, H, IPAR, RPAR, - 1 V1, V2, V3, IER) -C Fortran routine for dense user-supplied Jacobian. - IMPLICIT NONE -C - INTEGER*4 IER, N - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, Y(*), FY(*), JAC(N,*), H, RPAR(*) - DOUBLE PRECISION V1(*), V2(*), V3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JAC(1,1) = -0.04D0 - JAC(1,2) = 1.0D4 * Y3 - JAC(1,3) = 1.0D4 * Y2 - JAC(2,1) = 0.04D0 - JAC(2,2) = -1.0D4 * Y3 - 6.0D7 * Y2 - JAC(2,3) = -1.0D4 * Y2 - JAC(3,3) = 0.0D0 - JAC(3,2) = 6.0D7 * Y2 - JAC(3,3) = 0.0D0 -C - IER = 0 -C - RETURN - END diff --git a/examples/arkode/F77_serial/fark_roberts_dnsL.out b/examples/arkode/F77_serial/fark_roberts_dnsL.out deleted file mode 100644 index 9d9525afe6..0000000000 --- a/examples/arkode/F77_serial/fark_roberts_dnsL.out +++ /dev/null @@ -1,34 +0,0 @@ -Dense example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2640E+00 y = 0.989965E+00 0.347057E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985172E+00 0.338640E-04 0.147940E-01 -At t = 0.4000E+01 y = 0.905519E+00 0.224048E-04 0.944589E-01 -At t = 0.4000E+02 y = 0.715827E+00 0.918557E-05 0.284164E+00 -At t = 0.4000E+03 y = 0.450519E+00 0.322290E-05 0.549478E+00 -At t = 0.4000E+04 y = 0.183202E+00 0.894236E-06 0.816797E+00 -At t = 0.4000E+05 y = 0.389834E-01 0.162176E-06 0.961016E+00 -At t = 0.4000E+06 y = 0.493820E-02 0.198485E-07 0.995062E+00 -At t = 0.4000E+07 y = 0.516810E-03 0.206832E-08 0.999483E+00 -At t = 0.2080E+08 y = 0.100000E-03 0.399393E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.520314E-04 0.208160E-09 0.999948E+00 -At t = 0.4000E+09 y = 0.520776E-05 0.204359E-10 0.999995E+00 -At t = 0.4000E+10 y = 0.520930E-06 0.207751E-11 0.999999E+00 -At t = 0.4000E+11 y = 0.520789E-07 -0.201843E-12 0.100000E+01 - -Final value of ydot = -0.129983E-17 -0.281328E-22 0.129985E-17 - - -Final statistics: - - No. steps = 996, attempted = 1227 - No. fe-s = 0, No. fi-s = 34120 - No. J-s = 68, No. LU-s = 597 - No. nonlinear iterations = 28031 - No. nonlinear convergence failures = 17 - No. error test failures = 214 - No. root function evals = 1026 diff --git a/examples/arkode/F90_parallel/CMakeLists.txt b/examples/arkode/F90_parallel/CMakeLists.txt deleted file mode 100644 index a4d890237b..0000000000 --- a/examples/arkode/F90_parallel/CMakeLists.txt +++ /dev/null @@ -1,145 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the ARKODE parallel F90 examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -if(SUNDIALS_PRECISION MATCHES "double") - # The fark_heat2D only supports double precision - set(FARKODE_examples - "fark_heat2D\;1\;2\;develop" - ) - # Auxiliary files to install - set(FARKODE_extras - plot_heat2D.py - ) -endif() - -if(MPI_Fortran_COMPILER) - # use MPI wrapper as the compiler - set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) -else() - # add MPI_INCLUDE_PATH to include directories - include_directories(${MPI_INCLUDE_PATH}) -endif() - -# Specify libraries to link against -set(ARKODE_LIB sundials_arkode) -set(NVECP_LIB sundials_nvecparallel) -set(FNVECP_LIB sundials_fnvecparallel) - -# Only static FCMIX libraries are available -set(FARKODE_LIB sundials_farkode${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FARKODE_LIB} ${ARKODE_LIB} ${FNVECP_LIB} ${NVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - -# Add the build and install targets for each ARKODE example -foreach(example_tuple ${FARKODE_examples}) - - list(GET example_tuple 0 example) - list(GET example_tuple 1 number_of_nodes) - list(GET example_tuple 2 number_of_tasks) - list(GET example_tuple 3 example_type) - - # example source files - add_executable(${example} ${example}.f90) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - # add example to regression tests - sundials_add_test(${example} ${example} - MPI_NPROCS ${number_of_tasks} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - if(NOT MPI_Fortran_COMPILER) - target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES}) - endif() - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_parallel) - endif() - -endforeach(example_tuple ${FARKODE_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_parallel) - - # Install the extra files - foreach(extrafile ${FARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_parallel) - endforeach() - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "ARKODE") - set(SOLVER_LIB "sundials_arkode") - set(SOLVER_FLIB "sundials_farkode") - - examples2string(FARKODE_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F90_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F90_parallel/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F90_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_parallel - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F90_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F90_parallel/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F90_parallel/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_parallel - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(arkode F90_parallel) - -endif() diff --git a/examples/arkode/F90_parallel/README b/examples/arkode/F90_parallel/README deleted file mode 100644 index 388b44115e..0000000000 --- a/examples/arkode/F90_parallel/README +++ /dev/null @@ -1,52 +0,0 @@ -List of parallel ARKODE F90 examples - - fark_heat2D : 2-D diffusion (PCG with Jacobi preconditioner) - -Sample results: - - The example output was produced by running with 2 MPI processes: - - mpiexec -n 2 ./fark_heat2D - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/arkode/F90_parallel/fark_heat2D.f90 b/examples/arkode/F90_parallel/fark_heat2D.f90 deleted file mode 100644 index 78b7ed0cf6..0000000000 --- a/examples/arkode/F90_parallel/fark_heat2D.f90 +++ /dev/null @@ -1,871 +0,0 @@ -!----------------------------------------------------------------- -! Programmer(s): Daniel R. Reynolds @ SMU -!----------------------------------------------------------------- -! SUNDIALS Copyright Start -! Copyright (c) 2002-2023, Lawrence Livermore National Security -! and Southern Methodist University. -! All rights reserved. -! -! See the top-level LICENSE and NOTICE files for details. -! -! SPDX-License-Identifier: BSD-3-Clause -! SUNDIALS Copyright End -!----------------------------------------------------------------- -! Example problem: -! -! The following test simulates a simple anisotropic 2D heat -! equation, -! u_t = kx*u_xx + ky*u_yy + h, -! for t in [0, 10], (x,y) in [0, 1]^2, with initial conditions -! u(0,x,y) = 0, -! stationary boundary conditions, i.e. -! u_t(t,0,y) = u_t(t,1,y) = u_t(t,x,0) = u_t(t,x,1) = 0, -! and a heat source of the form -! h(x,y) = sin(pi*x)*sin(2*pi*y). -! -! Under this setup, the problem has an analytical solution: -! u(t,x,y) = a(t)*sin(pi*x)*sin(2*pi*y), where -! a(t) = (1 - exp(-(kx+4*ky)*pi^2*t)) / ((kx+4*ky)*pi^2). -! -! The spatial derivatives are computed using second-order -! centered differences, with the data distributed over nx*ny -! points on a uniform spatial grid. -! -! The spatial grid parameters nx and ny, the parameters kx and ky, -! as well as the desired relative and absolute solver tolerances, -! are provided in the input file input_heat2D.txt. -! -! This program solves the problem with a DIRK method. This -! employs a Newton iteration with the PCG iterative linear solver, -! which itself uses a Jacobi preconditioner. The example uses the -! built-in finite-difference Jacobian-vector product routine, but -! supplies both the RHS and preconditioner setup/solve functions. -! -! 20 outputs are printed at equal intervals, and run statistics -! are printed at the end. -!----------------------------------------------------------------- - -!----------------------------------------------------------------- -! Main driver program -!----------------------------------------------------------------- -module UserData - !--------------------------------------------------------------- - ! Description: - ! Module containing problem-defining parameters, as well as - ! data buffers for MPI exchanges with neighboring processes. - ! Also contains routines to: - ! (a) initialize the module - ! (b) perform exchanges - ! (c) free module data. - !--------------------------------------------------------------- - implicit none - include "sundials/sundials_fconfig.h" - save - - integer*8 :: nx ! global number of x grid points - integer*8 :: ny ! global number of y grid points - integer*8 :: is ! global x indices of this subdomain - integer*8 :: ie - integer*8 :: js ! global y indices of this subdomain - integer*8 :: je - integer*8 :: nxl ! local number of x grid points - integer*8 :: nyl ! local number of y grid points - real*8 :: dx ! x-directional mesh spacing - real*8 :: dy ! y-directional mesh spacing - real*8 :: kx ! x-directional diffusion coefficient - real*8 :: ky ! y-directional diffusion coefficient - real(kind=REALTYPE), dimension(:,:), allocatable :: h ! heat source vector - real(kind=REALTYPE), dimension(:,:), allocatable :: d ! inverse of Jacobian diagonal - integer :: comm ! communicator object - integer :: myid ! MPI process ID - integer :: nprocs ! total number of MPI processes - logical :: HaveNbor(2,2) ! flags denoting neighbor on boundary - real(kind=REALTYPE), dimension(:), allocatable :: Erecv ! receive buffers for neighbor exchange - real(kind=REALTYPE), dimension(:), allocatable :: Wrecv - real(kind=REALTYPE), dimension(:), allocatable :: Nrecv - real(kind=REALTYPE), dimension(:), allocatable :: Srecv - real(kind=REALTYPE), dimension(:), allocatable :: Esend ! send buffers for neighbor exchange - real(kind=REALTYPE), dimension(:), allocatable :: Wsend - real(kind=REALTYPE), dimension(:), allocatable :: Nsend - real(kind=REALTYPE), dimension(:), allocatable :: Ssend - -contains - - !--------------------------------------------------------------- - ! Initialize memory allocated within Userdata (set to defaults) - !--------------------------------------------------------------- - subroutine InitUserData() - implicit none - include "mpif.h" - nx = 0 - ny = 0 - is = 0 - ie = 0 - js = 0 - je = 0 - nxl = 0 - nyl = 0 - dx = 0.d0 - dy = 0.d0 - kx = 0.d0 - ky = 0.d0 - if (allocated(h)) deallocate(h) - if (allocated(d)) deallocate(d) - comm = MPI_COMM_WORLD - myid = 0 - nprocs = 0 - HaveNbor = .false. - if (allocated(Erecv)) deallocate(Erecv) - if (allocated(Wrecv)) deallocate(Wrecv) - if (allocated(Nrecv)) deallocate(Nrecv) - if (allocated(Srecv)) deallocate(Srecv) - if (allocated(Esend)) deallocate(Esend) - if (allocated(Wsend)) deallocate(Wsend) - if (allocated(Nsend)) deallocate(Nsend) - if (allocated(Ssend)) deallocate(Ssend) - end subroutine InitUserData - !--------------------------------------------------------------- - - - !--------------------------------------------------------------- - ! Set up parallel decomposition - !--------------------------------------------------------------- - subroutine SetupDecomp(ierr) - ! declarations - implicit none - include "mpif.h" - integer, intent(out) :: ierr - integer :: dims(2), periods(2), coords(2) - - ! internals - - ! check that this has not been called before - if (allocated(h) .or. allocated(d)) then - write(0,*) "SetupDecomp warning: parallel decomposition already set up" - ierr = 1 - return - end if - - ! get suggested parallel decomposition - dims = (/0, 0/) - call MPI_Comm_size(MPI_COMM_WORLD, nprocs, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Comm_size = " , ierr - return - end if - call MPI_Dims_create(nprocs, 2, dims, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Dims_create = " , ierr - return - end if - - ! set up 2D Cartesian communicator - periods = (/0, 0/) - call MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, 0, comm, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_create = " , ierr - return - end if - call MPI_Comm_rank(comm, myid, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Comm_rank = " , ierr - return - end if - - ! determine local extents - call MPI_Cart_get(comm, 2, dims, periods, coords, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_get = " , ierr - return - end if - is = nx*coords(1)/dims(1) + 1 - ie = nx*(coords(1)+1)/dims(1) - js = ny*coords(2)/dims(2) + 1 - je = ny*(coords(2)+1)/dims(2) - nxl = ie-is+1 - nyl = je-js+1 - - ! determine if I have neighbors, and allocate exchange buffers - HaveNbor(1,1) = (is /= 1) - HaveNbor(1,2) = (ie /= nx) - HaveNbor(2,1) = (js /= 1) - HaveNbor(2,2) = (je /= ny) - if (HaveNbor(1,1)) then - allocate(Wrecv(nyl)) - allocate(Wsend(nyl)) - endif - if (HaveNbor(1,2)) then - allocate(Erecv(nyl)) - allocate(Esend(nyl)) - endif - if (HaveNbor(2,1)) then - allocate(Srecv(nxl)) - allocate(Ssend(nxl)) - endif - if (HaveNbor(2,2)) then - allocate(Nrecv(nxl)) - allocate(Nsend(nxl)) - endif - - ! allocate temporary vectors - allocate(h(nxl,nyl)) ! Create vector for heat source - allocate(d(nxl,nyl)) ! Create vector for Jacobian diagonal - - ierr = 0 ! return with success flag - return - end subroutine SetupDecomp - !--------------------------------------------------------------- - - - !--------------------------------------------------------------- - ! Perform neighbor exchange - !--------------------------------------------------------------- - subroutine Exchange(y, ierr) - ! declarations - implicit none - include "mpif.h" - real(kind=REALTYPE), intent(in) :: y(nxl,nyl) - integer, intent(out) :: ierr - integer :: reqSW, reqSE, reqSS, reqSN, reqRW, reqRE, reqRS, reqRN; - integer :: stat(MPI_STATUS_SIZE) - integer*8 :: i - integer :: ipW, ipE, ipS, ipN - integer :: coords(2), dims(2), periods(2), nbcoords(2) - - ! internals - - ! MPI neighborhood information - call MPI_Cart_get(comm, 2, dims, periods, coords, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_get = ", ierr - return - endif - if (HaveNbor(1,1)) then - nbcoords = (/ coords(1)-1, coords(2) /) - call MPI_Cart_rank(comm, nbcoords, ipW, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_rank = ", ierr - return - endif - endif - if (HaveNbor(1,2)) then - nbcoords = (/ coords(1)+1, coords(2) /) - call MPI_Cart_rank(comm, nbcoords, ipE, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_rank = ", ierr - return - endif - endif - if (HaveNbor(2,1)) then - nbcoords = (/ coords(1), coords(2)-1 /) - call MPI_Cart_rank(comm, nbcoords, ipS, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_rank = ", ierr - return - endif - endif - if (HaveNbor(2,2)) then - nbcoords = (/ coords(1), coords(2)+1 /) - call MPI_Cart_rank(comm, nbcoords, ipN, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Cart_rank = ", ierr - return - endif - endif - - ! open Irecv buffers - if (HaveNbor(1,1)) then - call MPI_Irecv(Wrecv, nyl, MPI_DOUBLE_PRECISION, ipW, & - MPI_ANY_TAG, comm, reqRW, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Irecv = ", ierr - return - endif - endif - if (HaveNbor(1,2)) then - call MPI_Irecv(Erecv, nyl, MPI_DOUBLE_PRECISION, ipE, & - MPI_ANY_TAG, comm, reqRE, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Irecv = ", ierr - return - endif - endif - if (HaveNbor(2,1)) then - call MPI_Irecv(Srecv, nxl, MPI_DOUBLE_PRECISION, ipS, & - MPI_ANY_TAG, comm, reqRS, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Irecv = ", ierr - return - endif - endif - if (HaveNbor(2,2)) then - call MPI_Irecv(Nrecv, nxl, MPI_DOUBLE_PRECISION, ipN, & - MPI_ANY_TAG, comm, reqRN, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Irecv = ", ierr - return - endif - endif - - ! send data - if (HaveNbor(1,1)) then - do i=1,nyl - Wsend(i) = y(1,i) - enddo - call MPI_Isend(Wsend, nyl, MPI_DOUBLE_PRECISION, ipW, 0, & - comm, reqSW, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Isend = ", ierr - return - endif - endif - if (HaveNbor(1,2)) then - do i=1,nyl - Esend(i) = y(nxl,i) - enddo - call MPI_Isend(Esend, nyl, MPI_DOUBLE_PRECISION, ipE, 1, & - comm, reqSE, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Isend = ", ierr - return - endif - endif - if (HaveNbor(2,1)) then - do i=1,nxl - Ssend(i) = y(i,1) - enddo - call MPI_Isend(Ssend, nxl, MPI_DOUBLE_PRECISION, ipS, 2, & - comm, reqSS, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Isend = ", ierr - return - endif - endif - if (HaveNbor(2,2)) then - do i=1,nxl - Nsend(i) = y(i,nyl) - enddo - call MPI_Isend(Nsend, nxl, MPI_DOUBLE_PRECISION, ipN, 3, & - comm, reqSN, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Isend = ", ierr - return - endif - endif - - ! wait for messages to finish - if (HaveNbor(1,1)) then - call MPI_Wait(reqRW, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - call MPI_Wait(reqSW, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - endif - if (HaveNbor(1,2)) then - call MPI_Wait(reqRE, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - call MPI_Wait(reqSE, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - endif - if (HaveNbor(2,1)) then - call MPI_Wait(reqRS, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - call MPI_Wait(reqSS, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - endif - if (HaveNbor(2,2)) then - call MPI_Wait(reqRN, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - call MPI_Wait(reqSN, stat, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Wait = ", ierr - return - endif - endif - - ierr = 0 ! return with success flag - return - end subroutine Exchange - !--------------------------------------------------------------- - - - !--------------------------------------------------------------- - ! Free memory allocated within Userdata - !--------------------------------------------------------------- - subroutine FreeUserData(ierr) - implicit none - integer, intent(out) :: ierr - if (allocated(h)) deallocate(h) - if (allocated(d)) deallocate(d) - if (allocated(Wrecv)) deallocate(Wrecv) - if (allocated(Wsend)) deallocate(Wsend) - if (allocated(Erecv)) deallocate(Erecv) - if (allocated(Esend)) deallocate(Esend) - if (allocated(Srecv)) deallocate(Srecv) - if (allocated(Ssend)) deallocate(Ssend) - if (allocated(Nrecv)) deallocate(Nrecv) - if (allocated(Nsend)) deallocate(Nsend) - ierr = 0 ! return with success flag - return - end subroutine FreeUserData - !--------------------------------------------------------------- - - - !--------------------------------------------------------------- - ! RMS norm function for parallel array data - !--------------------------------------------------------------- - subroutine PRMS(y,yrms,ierr) - ! declarations - implicit none - include "mpif.h" - integer, intent(out) :: ierr - real(kind=REALTYPE), intent(in) :: y(nxl,nyl) - real(kind=REALTYPE), intent(out) :: yrms - real(kind=REALTYPE) :: lsum, gsum - - ! internals - lsum = sum(y**2) - call MPI_Allreduce(lsum, gsum, 1, MPI_DOUBLE_PRECISION, & - MPI_SUM, comm, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Allreduce = ", ierr - call MPI_Finalize(ierr) - endif - yrms = sqrt(gsum/nx/ny) - - ierr = 0 ! return with success flag - return - end subroutine PRMS - !--------------------------------------------------------------- - -end module UserData -!----------------------------------------------------------------- - - -!----------------------------------------------------------------- -! Main driver program -!----------------------------------------------------------------- -program driver - - ! inclusions - use UserData - implicit none - include "mpif.h" - - ! Declarations - ! general problem parameters - real*8, parameter :: pi = 3.1415926535897932d0 - integer, parameter :: Nt = 20 ! total number of output times - integer*8, parameter :: nx_ = 60 ! spatial mesh size - integer*8, parameter :: ny_ = 120 - integer, parameter :: PCGpretype = 1 ! enable preconditioner - integer, parameter :: PCGmaxl = 20 ! max num. PCG iterations - real(kind=REALTYPE), parameter :: T0 = 0.d0 ! initial time - real(kind=REALTYPE), parameter :: Tf = 0.3d0 ! final time - real(kind=REALTYPE), parameter :: rtol = 1.d-5 ! relative and absolute tolerances - real(kind=REALTYPE), parameter :: atol = 1.d-10 - real(kind=REALTYPE), parameter :: kx_ = 0.5d0 ! heat conductivity coefficients - real(kind=REALTYPE), parameter :: ky_ = 0.75d0 - real(kind=REALTYPE), parameter :: nlscoef = 1.d-7 ! nonlinear solver tolerance factor - - ! solution vector and other local variables - real(kind=REALTYPE), allocatable :: y(:,:) - real(kind=REALTYPE) :: rout(6), rpar, t, dTout, tout, urms - integer*8 :: iout(35), ipar, N, Ntot, i, j - integer :: flag, ioutput - logical :: outproc - character*100 :: outname - - ! initialize MPI - call MPI_Init(flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Init = ", flag - stop - end if - call MPI_Comm_rank(MPI_COMM_WORLD, myid, flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in MPI_Comm_rank = ", flag - call MPI_Finalize(flag) - end if - - ! Initialize UserData module - call InitUserData() - nx = nx_ - ny = ny_ - kx = kx_ - ky = ky_ - dx = 1.d0/(nx-1) ! x mesh spacing - dy = 1.d0/(ny-1) ! x mesh spacing - - ! Set up parallel decomposition (computes local mesh sizes) - call SetupDecomp(flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in SetupDecomp = ", flag - call MPI_Finalize(flag) - end if - - ! Initial problem output - outproc = (myid == 0) - if (outproc) then - write(6,*) " " - write(6,*) "2D Heat PDE test problem:"; - write(6,'(A,i4)') " nprocs = " , nprocs - write(6,'(A,i4)') " nx = ", nx - write(6,'(A,i4)') " ny = ", ny - write(6,'(A,f5.2)') " kx = ", kx - write(6,'(A,f5.2)') " ky = ", ky - write(6,'(A,es9.2)') " rtol = ", rtol - write(6,'(A,es9.2)') " atol = ", atol - write(6,'(A,i4)') " nxl (proc 0) = ", nxl - write(6,'(A,i4)') " nyl (proc 0) = ", nyl - write(6,*) " " - endif - - ! Initialize data structures - N = nxl*nyl - Ntot = nx*ny - call FNVInitP(comm, 4, N, Ntot, flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in FNVInitP = ", flag - call MPI_Finalize(flag) - end if - allocate(y(nxl,nyl)) ! Create parallel vector for solution - y = 0.d0 ! Set initial conditions - - ! initialize PCG linear solver module - call FSunPCGInit(4, PCGpretype, PCGmaxl, flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in FSunPCGInit = ", flag - call MPI_Finalize(flag) - end if - - ! Create the solver memory to use DIRK integrator, scalar tolerances - call FARKMalloc(T0, y, 0, 1, rtol, atol, iout, rout, ipar, rpar, flag) - if (flag /= MPI_SUCCESS) then - write(0,*) "Error in FARKMalloc = ", flag - call MPI_Finalize(flag) - end if - - ! fill in the heat source array - do j=1,nyl - do i=1,nxl - h(i,j) = sin(pi*(is+i-2)*dx) * sin(2.d0*pi*(js+j-2)*dy) - enddo - enddo - - ! set integrator options - call FARKSetRin("NLCONV_COEF", nlscoef, flag) - if (flag < 0) then - write(0,*) "Error in FARKSetRin = ", flag - call MPI_Finalize(flag) - end if - call FARKSetIin("PREDICT_METHOD", 1_8, flag) - if (flag < 0) then - write(0,*) "Error in FARKSetIin = ", flag - call MPI_Finalize(flag) - end if - - - ! attach linear solver module to ARKLs interface - call FARKLsInit(flag) - if (flag < 0) then - write(0,*) "Error in FARKLsInit = ", flag - call MPI_Finalize(flag) - end if - call FARKLsSetPrec(1, flag) ! Signal user-supplied preconditioner - if (flag < 0) then - write(0,*) "Error in FARKLsSetPrec = ", flag - call MPI_Finalize(flag) - end if - - ! specify that the problem is linearly implicit, but that Jacobian does not depend on time - call FARKSetIin("LINEAR", 0_8, flag) - if (flag < 0) then - write(0,*) "Error in FARKSetIin = ", flag - call MPI_Finalize(flag) - end if - - ! Each processor outputs subdomain information - write(outname,'(16Hheat2d_subdomain,f4.3,4H.txt)') myid/1000.0 - open(100, file=outname) - write(100,'(6(i9,1x))') nx, ny, is, ie, js, je - close(100) - - ! Open output streams for results, access data array - write(outname,'(6Hheat2d,f4.3,4H.txt)') myid/1000.0 - open(101, file=outname) - - ! Output initial condition to disk - do j=1,nyl - do i=1,nxl - write(101,'(es25.16)',advance='no') y(i,j) - enddo - enddo - write(101,*) " " - - ! Main time-stepping loop: calls ARKode to perform the integration, then - ! prints results. Stops when the final time has been reached - t = T0 - dTout = (Tf-T0)/Nt - tout = T0+dTout - call PRMS(y, urms, flag) - if (outproc) then - write(6,*) " t ||u||_rms" - write(6,*) " ----------------------" - write(6,'(2(2x,f10.6))') t, urms - endif - do ioutput=1,Nt - - call FARKode(tout, t, y, 1, flag) ! call integrator - if (flag < 0) then - write(0,*) "Error in FARKode = ", flag - exit - end if - - call PRMS(y, urms, flag) - if (outproc) & - write(6,'(2(2x,f10.6))') t, urms ! print solution stats - if (flag >= 0) then ! successful solve: update output time - tout = min(tout + dTout, Tf) - else ! unsuccessful solve: break - if (outproc) & - write(0,*) "Solver failure, stopping integration" - exit - endif - - ! output results to disk - do j=1,nyl - do i=1,nxl - write(101,'(es25.16)',advance='no') y(i,j) - enddo - enddo - write(101,*) " " - - enddo - if (outproc) then - write(6,*) " ----------------------" - endif - close(101) - - ! Print some final statistics - if (outproc) then - write(6,*) " " - write(6,*) "Final Solver Statistics:" - write(6,'(2(A,i6),A)') " Internal solver steps = ", iout(3), & - " (attempted = ", iout(6), ")" - write(6,'(A,i6,A,i6)') " Total RHS evals: Fe = ", iout(7), ", Fi = ", iout(8) - write(6,'(A,i6)') " Total linear solver setups = ", iout(9) - write(6,'(A,i6)') " Total linear iterations = ", iout(23) - write(6,'(A,i6)') " Total number of Jacobian-vector products = ", iout(20) - write(6,'(A,i6)') " Total number of Preconditioner setups = ", iout(21) - write(6,'(A,i6)') " Total number of Preconditioner solves = ", iout(22) - write(6,'(A,i6)') " Total number of linear solver convergence failures = ", & - iout(24) - write(6,'(A,i6)') " Total number of Newton iterations = ", iout(11) - write(6,'(A,i6)') " Total number of nonlinear solver convergence failures = ", & - iout(12) - write(6,'(A,i6)') " Total number of error test failures = ", iout(10) - endif - - ! Clean up and return with successful completion - if (allocated(y)) deallocate(y) ! free solution - call FreeUserData(flag) ! free user data - call FARKFree() ! free integrator memory - call MPI_Barrier(comm, flag) - call MPI_Finalize(flag) ! Finalize MPI - -end program driver -!----------------------------------------------------------------- - - - -!----------------------------------------------------------------- -! Functions called by the solver -!----------------------------------------------------------------- - - -subroutine farkifun(t, y, ydot, ipar, rpar, ierr) -!----------------------------------------------------------------- -! f routine to compute the ODE RHS function f(t,y). -!----------------------------------------------------------------- - ! declarations - use UserData - implicit none - include "mpif.h" - real(kind=REALTYPE), intent(in) :: t, rpar - real(kind=REALTYPE), intent(in) :: y(nxl,nyl) - real(kind=REALTYPE), intent(out) :: ydot(nxl,nyl) - integer*8, intent(in) :: ipar - real(kind=REALTYPE) :: c1, c2, c3 - integer, intent(out) :: ierr - integer*8 :: i, j - - ! internals - - ! Initialize ydot to zero - ydot = 0.d0 - - ! Exchange boundary data with neighbors - call Exchange(y, ierr) - if (ierr /= MPI_SUCCESS) then - write(0,*) "Error in Exchange = " , ierr - return - end if - - ! iterate over subdomain interior, computing approximation to RHS - c1 = kx/dx/dx - c2 = ky/dy/dy - c3 = -2.d0*(c1 + c2) - do j=2,nyl-1 - do i=2,nxl-1 - ydot(i,j) = c1*(y(i-1,j)+y(i+1,j)) + c2*(y(i,j-1)+y(i,j+1)) + c3*y(i,j) - enddo - enddo - - ! iterate over subdomain boundaries (if not at overall domain boundary) - if (HaveNbor(1,1)) then ! West face - i=1 - do j=2,nyl-1 - ydot(i,j) = c1*(Wrecv(j)+y(i+1,j)) + c2*(y(i,j-1)+y(i,j+1)) + c3*y(i,j) - enddo - endif - if (HaveNbor(1,2)) then ! East face - i=nxl - do j=2,nyl-1 - ydot(i,j) = c1*(y(i-1,j)+Erecv(j)) + c2*(y(i,j-1)+y(i,j+1)) + c3*y(i,j) - enddo - endif - if (HaveNbor(2,1)) then ! South face - j=1 - do i=2,nxl-1 - ydot(i,j) = c1*(y(i-1,j)+y(i+1,j)) + c2*(Srecv(i)+y(i,j+1)) + c3*y(i,j) - enddo - endif - if (HaveNbor(2,2)) then ! West face - j=nyl - do i=2,nxl-1 - ydot(i,j) = c1*(y(i-1,j)+y(i+1,j)) + c2*(y(i,j-1)+Nrecv(i)) + c3*y(i,j) - enddo - endif - if (HaveNbor(1,1) .and. HaveNbor(2,1)) then ! South-West corner - i=1 - j=1 - ydot(i,j) = c1*(Wrecv(j)+y(i+1,j)) + c2*(Srecv(i)+y(i,j+1)) + c3*y(i,j) - endif - if (HaveNbor(1,1) .and. HaveNbor(2,2)) then ! North-West corner - i=1 - j=nyl - ydot(i,j) = c1*(Wrecv(j)+y(i+1,j)) + c2*(y(i,j-1)+Nrecv(i)) + c3*y(i,j) - endif - if (HaveNbor(1,2) .and. HaveNbor(2,1)) then ! South-East corner - i=nxl - j=1 - ydot(i,j) = c1*(y(i-1,j)+Erecv(j)) + c2*(Srecv(i)+y(i,j+1)) + c3*y(i,j) - endif - if (HaveNbor(1,2) .and. HaveNbor(2,2)) then ! North-East corner - i=nxl - j=nyl - ydot(i,j) = c1*(y(i-1,j)+Erecv(j)) + c2*(y(i,j-1)+Nrecv(i)) + c3*y(i,j) - endif - - ydot = ydot + h ! add in heat source - - ierr = 0 ! Return with success - return -end subroutine farkifun -!----------------------------------------------------------------- - - -subroutine farkefun(t, y, ydot, ipar, rpar, ierr) -!----------------------------------------------------------------- -! Explicit portion of f routine (empty) -!----------------------------------------------------------------- - ! declarations - use UserData - implicit none - real(kind=REALTYPE), intent(in) :: t, rpar - integer*8, intent(in) :: ipar - real(kind=REALTYPE), intent(in) :: y(nxl,nyl) - real(kind=REALTYPE), intent(out) :: ydot(nxl,nyl) - integer, intent(out) :: ierr - - ! internals - - ! Initialize ydot to zero and return with success - ydot = 0.d0 - ierr = 0 - return -end subroutine farkefun -!----------------------------------------------------------------- - - -subroutine farkpset(t, y, fy, jok, jcur, gamma, hcur, ipar, & - rpar, ierr) -!----------------------------------------------------------------- -! Preconditioner setup routine (fills inverse of Jacobian diagonal) -!----------------------------------------------------------------- - ! declarations - use UserData - implicit none - real(kind=REALTYPE), intent(in) :: t, gamma, hcur, rpar - real(kind=REALTYPE), intent(in) :: y(nxl,nyl), fy(nxl,nyl) - integer*8, intent(in) :: ipar - integer, intent(in) :: jok - integer, intent(out) :: jcur, ierr - real(kind=REALTYPE) :: c - - ! internals - c = 1.d0 + gamma*2.d0*(kx/dx/dx + ky/dy/dy) - - ! set all entries of d to the inverse of the diagonal values in interior - ! (since boundary RHS is 0, set boundary diagonals to the same) - d = 1.d0/c - - jcur = 1 ! update jcur flag - ierr = 0 ! Return with success - return -end subroutine farkpset - - -subroutine farkpsol(t, y, fy, r, z, gamma, delta, lr, & - ipar, rpar, ierr) -!----------------------------------------------------------------- -! Preconditioner solve routine -!----------------------------------------------------------------- - ! declarations - use UserData - implicit none - real(kind=REALTYPE), intent(in) :: t, gamma, delta, rpar - integer*8, intent(in) :: ipar - real(kind=REALTYPE), intent(in) :: y(nxl,nyl), fy(nxl,nyl), r(nxl,nyl) - real(kind=REALTYPE), intent(out) :: z(nxl,nyl) - integer, intent(in) :: lr - integer, intent(out) :: ierr - - ! internals - z = r*d ! perform Jacobi iteration (whole array operation) - ierr = 0 ! Return with success - return -end subroutine farkpsol -!----------------------------------------------------------------- - diff --git a/examples/arkode/F90_parallel/fark_heat2D.out b/examples/arkode/F90_parallel/fark_heat2D.out deleted file mode 100644 index 66a8223921..0000000000 --- a/examples/arkode/F90_parallel/fark_heat2D.out +++ /dev/null @@ -1,49 +0,0 @@ - - 2D Heat PDE test problem: - nprocs = 2 - nx = 60 - ny = 120 - kx = 0.50 - ky = 0.75 - rtol = 1.00E-05 - atol = 1.00E-10 - nxl (proc 0) = 30 - nyl (proc 0) = 120 - - t ||u||_rms - ---------------------- - 0.000000 0.000000 - 0.015000 0.005780 - 0.030000 0.009224 - 0.045000 0.011275 - 0.060000 0.012497 - 0.075000 0.013224 - 0.090000 0.013658 - 0.105000 0.013916 - 0.120000 0.014070 - 0.135000 0.014162 - 0.150000 0.014216 - 0.165000 0.014249 - 0.180000 0.014268 - 0.195000 0.014280 - 0.210000 0.014287 - 0.225000 0.014291 - 0.240000 0.014293 - 0.255000 0.014295 - 0.270000 0.014295 - 0.285000 0.014296 - 0.300000 0.014296 - ---------------------- - - Final Solver Statistics: - Internal solver steps = 57 (attempted = 59) - Total RHS evals: Fe = 0, Fi = 594 - Total linear solver setups = 20 - Total linear iterations = 5177 - Total number of Jacobian-vector products = 5177 - Total number of Preconditioner setups = 20 - Total number of Preconditioner solves = 5424 - Total number of linear solver convergence failures = 247 - Total number of Newton iterations = 295 - Total number of nonlinear solver convergence failures = 0 - Total number of error test failures = 2 diff --git a/examples/arkode/F90_parallel/plot_heat2D.py b/examples/arkode/F90_parallel/plot_heat2D.py deleted file mode 100755 index 70c3e1adb1..0000000000 --- a/examples/arkode/F90_parallel/plot_heat2D.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python -# ---------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# ---------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ---------------------------------------------------------------- -# matplotlib-based plotting script for heat2D.cpp example - -# imports -import sys -import numpy as np -from pylab import * -from mpl_toolkits.mplot3d import Axes3D -from matplotlib import cm -import matplotlib.pyplot as plt - -# determine the number of MPI processes used -nprocs=1 -for i in range(1000): - sname = 'heat2d_subdomain.' + repr(i).zfill(3) + '.txt' - try: - f = open(sname,'r') - f.close() - except IOError: - nprocs = i - break - -# load subdomain information, store in table -subdomains = np.zeros((nprocs,4), dtype=np.int) -for i in range(nprocs): - sname = 'heat2d_subdomain.' + repr(i).zfill(3) + '.txt' - subd = np.loadtxt(sname, dtype=np.int) - if (i == 0): - nx = subd[0] - ny = subd[1] - else: - if ((subd[0] != nx) or (subd[1] != ny)): - sys.exit("error: subdomain files incompatible (clean up and re-run test)") - subdomains[i,:] = subd[2:6] - -# load first processor's data, and determine total number of time steps -data = np.loadtxt('heat2d.000.txt', dtype=np.double) -nt = np.shape(data)[0] - -# create empty array for all solution data -results = np.zeros((nt,ny,nx)) - -# insert first processor's data into results array -istart = subdomains[0,0]-1 -iend = subdomains[0,1]-1 -jstart = subdomains[0,2]-1 -jend = subdomains[0,3]-1 -nxl = iend-istart+1 -nyl = jend-jstart+1 -for i in range(nt): - results[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,:], (nyl,nxl)) - -# iterate over remaining data files, inserting into output -if (nprocs > 1): - for isub in range(1,nprocs): - data = np.loadtxt('heat2d.' + repr(isub).zfill(3) + '.txt', dtype=np.double) - # check that subdomain has correct number of time steps - if (np.shape(data)[0] != nt): - sys.exit('error: subdomain ' + isub + ' has an incorrect number of time steps') - istart = subdomains[isub,0]-1 - iend = subdomains[isub,1]-1 - jstart = subdomains[isub,2]-1 - jend = subdomains[isub,3]-1 - nxl = iend-istart+1 - nyl = jend-jstart+1 - for i in range(nt): - results[i,jstart:jend+1,istart:iend+1] = np.reshape(data[i,:], (nyl,nxl)) - -# determine extents of plots -maxtemp = 1.1*results.max() -mintemp = 0.9*results.min() - -# generate plots of results -kx = 0.5 -ky = 0.75 -kprod = (kx+4.0*ky)*np.pi**2 -dt = 0.015 -for tstep in range(nt): - - # set string constants for output plots, current time, mesh size - pname = 'heat2d_surf.' + repr(tstep).zfill(3) + '.png' - cname = 'heat2d_err.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) - nxstr = repr(nx) - nystr = repr(ny) - - # set x and y meshgrid objects - xspan = np.linspace(0.0, 1.0, nx) - yspan = np.linspace(0.0, 1.0, ny) - X,Y = np.meshgrid(xspan,yspan) - - # plot current solution as a surface, and save to disk - fig = plt.figure(1) - ax = fig.add_subplot(111, projection='3d') - ax.plot_surface(X, Y, results[tstep,:,:], rstride=1, cstride=1, - cmap=cm.jet, linewidth=0, antialiased=True, shade=True) - ax.set_xlabel('x') - ax.set_ylabel('y') - ax.set_zlim((mintemp, maxtemp)) - ax.view_init(20,45) - title('u(x,y) at output ' + tstr + ', mesh = ' + nxstr + 'x' + nystr) - savefig(pname) - plt.close() - - # plot error in current solution (as a contour, and save to disk) - t = tstep*dt; - at = (1.0 - np.exp(-t*kprod))/kprod - utrue = at*np.sin(np.pi*X)*np.sin(2.0*np.pi*Y); - uerr = np.abs(utrue - results[tstep,:,:]) - plt.contourf(xspan,yspan,uerr,15, cmap=plt.cm.jet) - plt.colorbar() - plt.xlabel('x') - plt.ylabel('y') - plt.title('Error at output ' + tstr + ', mesh = ' + nxstr + 'x' + nystr) - plt.savefig(cname) - plt.close() - - - - -##### end of script ##### diff --git a/examples/arkode/F90_serial/CMakeLists.txt b/examples/arkode/F90_serial/CMakeLists.txt deleted file mode 100644 index a58ee78fbf..0000000000 --- a/examples/arkode/F90_serial/CMakeLists.txt +++ /dev/null @@ -1,300 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# David J. Gardner @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FARKODE F90 serial examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FARKODE_examples - "ark_bruss\;develop" - ) - -# Examples using LAPACK linear solvers -set(FARKODE_examples_BL - ) - -# Add sparse solvers examples for 64-bit indextype configurations only, -# not compatible with 32-bit indextype -if(SUNDIALS_INDEX_SIZE MATCHES "64") - - # Examples using KLU linear solver - set(FARKODE_examples_KLU - "ark_bruss1D_FEM_klu\;develop" - ) - - # Examples using SuperLU_MT linear solver - set(FARKODE_examples_SUPERLUMT - ) - -endif() - -# Auxiliary files to install -set(ARKODE_extras - plot_sol.py - plot_brusselator1D_FEM.py - ) - -# Specify libraries to link against -set(ARKODE_LIB sundials_arkode) -set(NVECS_LIB sundials_nvecserial) -set(FNVECS_LIB sundials_fnvecserial) - -# Only static FCMIX libraries are available -set(FARKODE_LIB sundials_farkode${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FARKODE_LIB} ${ARKODE_LIB} ${FNVECS_LIB} ${NVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each example -foreach(example_tuple ${FARKODE_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f90) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - endif() - -endforeach(example_tuple ${FARKODE_examples}) - - -# Add the build and install targets for each LAPACK example (if needed) -if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - - # Sundials LAPACK linear solver modules - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense - sundials_fsunlinsollapackband - sundials_fsunlinsollapackdense) - - # LAPACK libraries - list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) - - foreach(example_tuple ${FARKODE_examples_BL}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f90) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_BL}) - -endif() - - -# Add the build and install targets for each KLU example (if needed) -if(BUILD_SUNLINSOL_KLU) - - # Sundials KLU linear solver module - set(SUNLINSOLKLU_LIBS - sundials_sunlinsolklu - sundials_fsunlinsolklu) - - # KLU libraries - list(APPEND SUNLINSOLKLU_LIBS) - - foreach(example_tuple ${FARKODE_examples_KLU}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f90) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_KLU}) - -endif() - - -# Add the build and install targets for each SuperLU_MT example (if needed) -if(BUILD_SUNLINSOL_SUPERLUMT) - - # Sundials SuperLU_MT linear solver module - set(SUNLINSOLSLUMT_LIBS - sundials_sunlinsolsuperlumt - sundials_fsunlinsolsuperlumt) - - # SuperLU_MT libraries - list(APPEND SUNLINSOLSLUMT_LIBS ${SUPERLUMT_LIBRARIES}) - - foreach(example_tuple ${FARKODE_examples_SUPERLUMT}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f90) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f90 ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - endif() - - endforeach(example_tuple ${FARKODE_examples_SUPERLUMT}) - -endif() - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - - # Install the extra files - foreach(extrafile ${ARKODE_extras}) - install(FILES ${extrafile} DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial) - endforeach() - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "ARKODE") - set(SOLVER_LIB "sundials_arkode") - set(SOLVER_FLIB "sundials_farkode") - - examples2string(FARKODE_examples EXAMPLES) - - if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - examples2string(FARKODE_examples_BL EXAMPLES_BL) - else() - set(EXAMPLES_BL "") - endif() - - if(BUILD_SUNLINSOL_KLU) - examples2string(FARKODE_examples_KLU EXAMPLES_KLU) - else() - set(EXAMPLES_KLU "") - endif() - - if(BUILD_SUNLINSOL_SUPERLUMT) - examples2string(FARKODE_examples_SUPERLUMT EXAMPLES_SLUMT) - else() - set(EXAMPLES_SLUMT "") - endif() - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F90_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F90_serial/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F90_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F90_ex.in - ${PROJECT_BINARY_DIR}/examples/arkode/F90_serial/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/arkode/F90_serial/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/arkode/F90_serial - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(arkode F90_serial) - -endif() diff --git a/examples/arkode/F90_serial/README b/examples/arkode/F90_serial/README deleted file mode 100644 index 6f9fa7bb57..0000000000 --- a/examples/arkode/F90_serial/README +++ /dev/null @@ -1,48 +0,0 @@ -List of serial ARKODE F90 examples - - ark_bruss : chemical kinetics example (DIRK/DENSE) - ark_bruss1D_FEM_klu : stiff chemical kinetics PDE, with FEM - spatial discretization and CSR Jacobian (DIRK/KLU) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/arkode/F90_serial/ark_bruss.f90 b/examples/arkode/F90_serial/ark_bruss.f90 deleted file mode 100644 index a5e989745d..0000000000 --- a/examples/arkode/F90_serial/ark_bruss.f90 +++ /dev/null @@ -1,304 +0,0 @@ -!----------------------------------------------------------------- -! Programmer(s): Daniel R. Reynolds @ SMU -!----------------------------------------------------------------- -! SUNDIALS Copyright Start -! Copyright (c) 2002-2023, Lawrence Livermore National Security -! and Southern Methodist University. -! All rights reserved. -! -! See the top-level LICENSE and NOTICE files for details. -! -! SPDX-License-Identifier: BSD-3-Clause -! SUNDIALS Copyright End -!----------------------------------------------------------------- -! Example problem: -! -! The following test simulates a brusselator problem from chemical -! kinetics. This is an ODE system with 3 components, Y = [u,v,w], -! satisfying the equations, -! du/dt = a - (w+1)*u + v*u^2 -! dv/dt = w*u - v*u^2 -! dw/dt = (b-w)/ep - w*u -! for t in the interval [0.0, 10.0], with initial conditions -! Y0 = [u0,v0,w0]. We use the initial conditions and parameters -! u0=3.9, v0=1.1, w0=2.8, a=1.2, b=2.5, ep=1.0e-5 -! Here, all three solution components exhibit a rapid transient -! change during the first 0.2 time units, followed by a slow and -! smooth evolution. -! -! This program solves a the Fortran ODE test problem using the -! FARKODE interface for the ARKode ODE solver module. -! -! This program uses the IMEX ARK solver; here the -! implicit systems are solved with a modified Newton iteration -! with the SUNDENSE linear solver. The Jacobian routine and -! right-hand side routines are supplied. -! -! Output is printed 10 times throughout the defined time interval. -! Run statistics (optional outputs) are printed at the end. -!----------------------------------------------------------------- - -!----------------------------------------------------------------- -! Main driver program -!----------------------------------------------------------------- -program driver - ! Declarations - implicit none - include "sundials/sundials_fconfig.h" - - ! general problem variables - integer*8, parameter :: NEQ=3 - real(kind=REALTYPE), parameter :: T0=0.d0, Tf=10.d0 - real(kind=REALTYPE) :: dTout, Tout, Tcur, rtol, atol, rout(6) - integer :: it, Nt, ier - integer*8 :: iout(35) - real(kind=REALTYPE), dimension(NEQ) :: y - - ! real/integer parameters to pass through to supplied functions - ! ipar(1) -> unused - ! rpar(1) -> "a" parameter - ! rpar(2) -> "b" parameter - ! rpar(3) -> "ep" parameter - integer*8 :: ipar - real(kind=REALTYPE) :: rpar(3) - - ! solver parameters - integer :: adapt_method - integer*8 :: order - real(kind=REALTYPE) :: nlscoef, adapt_params - - !----------------------- - ! set some solver parameters - order = 3 ! 3rd order method - adapt_method = 0 ! PID-controller - nlscoef = 1.d-2 ! Newton solver tolerance coefficient - - ! time-stepping information - dTout = (Tf-T0)/10.d0 ! output time interval - Nt = Tf/dTout + 0.5 ! number of outputs - - ! set initial conditions, problem parameters - y(1) = 3.9d0 ! u0 - y(2) = 1.1d0 ! v0 - y(3) = 2.8d0 ! w0 - rpar(1) = 1.2d0 ! a - rpar(2) = 2.5d0 ! b - rpar(3) = 1.d-5 ! ep - - ! set tolerances according to problem specifications - atol = 1.d-10 - rtol = 1.d-6 - - ! initialize vector module - call FNVInitS(4, NEQ, ier) - if (ier < 0) then - write(0,*) 'Error in FNVInitS = ',ier - stop - endif - - ! initialize dense matrix and dense linear solver modules - call FSunDenseMatInit(4, NEQ, NEQ, ier) - call FSunDenseLinSolInit(4, ier) - - ! initialize ARKode solver to use IMEX integrator, scalar tolerances - call FARKMalloc(T0, y, 2, 1, rtol, atol, & - iout, rout, ipar, rpar, ier) - if (ier < 0) then - write(0,*) 'Error in FARKMalloc = ',ier - stop - endif - - ! set integrator options - call FARKSetIin('ORDER', order, ier) - if (ier < 0) then - write(0,*) 'Error in FARKSetIin = ',ier - stop - endif - call FARKSetRin('NLCONV_COEF', nlscoef, ier) - if (ier < 0) then - write(0,*) 'Error in FARKSetIin = ',ier - stop - endif - adapt_params = 0.d0 - call FARKSetAdaptivityMethod(adapt_method, 1, 0, adapt_params, ier) - if (ier < 0) then - write(0,*) 'Error in FARKSetAdaptMethod = ',ier - stop - endif - - ! attach matrix and linear solver modules to ARKLs interface - call FARKLsInit(ier) - if (ier < 0) then - write(0,*) 'Error in FARKLsInit = ',ier - stop - endif - - ! notify ARKLs module of user-supplied Jacobian construction routine - call FARKDenseSetJac(1, ier) - if (ier < 0) then - write(0,*) 'Error in FARKDenseSetJac = ',ier - stop - endif - - ! Open output stream for results, output comment line - open(100, file='solution.txt') - write(100,*) '# t u v w' - - ! output initial condition to disk - write(100,'(3x,4(es23.16,1x))') T0, y - - ! loop over time outputs - Tout = T0 - Tcur = T0 - print *, ' t u v w' - print *, ' ----------------------------------------------------' - print '(3x,4(es12.5,1x))', Tcur, y - do it = 1,Nt - - Tout = min(Tout + dTout, Tf) ! set next output time - call FARKode(Tout, Tcur, y, 1, ier) ! call solver - if (ier < 0) then - print *, 'Error at step ',it,', FARKode return flag =',ier - exit - end if - - ! output current solution - print '(3x,4(es12.5,1x))', Tcur, y - write(100,'(3x,4(es23.16,1x))') Tcur, y - - end do - print *, ' ----------------------------------------------------' - close(100) - - ! output solver statistics - print *, ' ' - print *, 'Final Solver Statistics:' - print '(2(A,i7),A)', ' Internal solver steps =', iout(3), & - ' (attempted =', iout(6), ')' - print '(2(A,i7))', ' Total RHS evals: Fe =', iout(7), & - ', Fi =', iout(8) - print '(A,i7)', ' Total linear solver setups =', iout(9) - print '(A,i7)', ' Total RHS evals for setting up the linear system =', iout(17) - print '(A,i7)', ' Total number of Jacobian evaluations =', iout(18) - print '(A,i7)', ' Total number of Newton iterations =', iout(11) - print '(A,i7)', ' Total number of nonlinear solver convergence failures =', iout(12) - print '(A,i7)', ' Total number of error test failures =', iout(10) - print *, ' ' - - ! clean up - call FARKFree() - -end program driver -!----------------------------------------------------------------- - -!----------------------------------------------------------------- -! Required subroutines for FARKODE interface -!----------------------------------------------------------------- - -subroutine farkifun(t, y, ydot, ipar, rpar, ier) -!----------------------------------------------------------------- -! Implicit portion of the right-hand side of the ODE system -!----------------------------------------------------------------- - - ! Declarations - implicit none - include "sundials/sundials_fconfig.h" - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, rpar(3) - integer*8, intent(in) :: ipar(1) - real(kind=REALTYPE), intent(in) :: y(3) - real(kind=REALTYPE), intent(out) :: ydot(3) - integer, intent(out) :: ier - - ! temporary variables - real*8 :: u, v, w, a, b, ep - - ! set temporary values - a = rpar(1) - b = rpar(2) - ep = rpar(3) - u = y(1) - v = y(2) - w = y(3) - - ! fill implicit RHS, set success flag - ydot(1) = 0.d0 - ydot(2) = 0.d0 - ydot(3) = (b-w)/ep - ier = 0 - -end subroutine farkifun -!----------------------------------------------------------------- - -subroutine farkefun(t, y, ydot, ipar, rpar, ier) -!----------------------------------------------------------------- -! Explicit portion of the right-hand side of the ODE system -!----------------------------------------------------------------- - - ! Declarations - implicit none - include "sundials/sundials_fconfig.h" - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, rpar(3) - integer*8, intent(in) :: ipar(1) - real(kind=REALTYPE), intent(in) :: y(3) - real(kind=REALTYPE), intent(out) :: ydot(3) - integer, intent(out) :: ier - - ! temporary variables - real*8 :: u, v, w, a, b, ep - - ! set temporary values - a = rpar(1) - b = rpar(2) - ep = rpar(3) - u = y(1) - v = y(2) - w = y(3) - - ! fill explicit RHS, set success flag - ydot(1) = a - (w+1.d0)*u + v*u*u - ydot(2) = w*u - v*u*u - ydot(3) = -w*u - ier = 0 - -end subroutine farkefun -!----------------------------------------------------------------- - -subroutine farkdjac(neq,t,y,fy,DJac,h,ipar,rpar,wk1,wk2,wk3,ier) -!----------------------------------------------------------------- -! Jacobian computation routine -!----------------------------------------------------------------- - - ! Declarations - implicit none - include "sundials/sundials_fconfig.h" - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, h, rpar(3) - integer*8, intent(in) :: ipar(1) - integer*8, intent(in) :: neq - integer, intent(out) :: ier - real(kind=REALTYPE), intent(in), dimension(neq) :: y, fy, wk1, wk2, wk3 - real(kind=REALTYPE), intent(out) :: DJac(neq,neq) - - ! temporary variables - real*8 :: u, v, w, a, b, ep - - ! set temporary values - a = rpar(1) - b = rpar(2) - ep = rpar(3) - u = y(1) - v = y(2) - w = y(3) - - ! fill implicit Jacobian, set success flag - DJac = 0.d0 - DJac(3,3) = -1.d0/ep - ier = 0 - -end subroutine farkdjac -!----------------------------------------------------------------- diff --git a/examples/arkode/F90_serial/ark_bruss.out b/examples/arkode/F90_serial/ark_bruss.out deleted file mode 100644 index cc65b446ea..0000000000 --- a/examples/arkode/F90_serial/ark_bruss.out +++ /dev/null @@ -1,25 +0,0 @@ - t u v w - ---------------------------------------------------- - 0.00000E+00 3.90000E+00 1.10000E+00 2.80000E+00 - 1.00000E+00 2.07527E+00 1.05960E+00 2.49993E+00 - 2.00000E+00 1.10046E+00 1.72361E+00 2.49996E+00 - 3.00000E+00 7.89620E-01 2.32667E+00 2.50000E+00 - 4.00000E+00 8.11773E-01 2.72558E+00 2.49996E+00 - 5.00000E+00 1.18700E+00 2.59554E+00 2.49998E+00 - 6.00000E+00 1.88731E+00 1.49410E+00 2.49996E+00 - 7.00000E+00 1.32327E+00 1.61902E+00 2.50001E+00 - 8.00000E+00 9.21787E-01 2.13022E+00 2.50000E+00 - 9.00000E+00 8.49543E-01 2.53947E+00 2.49995E+00 - 1.00000E+01 1.06497E+00 2.59595E+00 2.49994E+00 - ---------------------------------------------------- - - Final Solver Statistics: - Internal solver steps = 905 (attempted = 934) - Total RHS evals: Fe = 3739, Fi = 7529 - Total linear solver setups = 158 - Total RHS evals for setting up the linear system = 0 - Total number of Jacobian evaluations = 28 - Total number of Newton iterations = 3790 - Total number of nonlinear solver convergence failures = 0 - Total number of error test failures = 29 - diff --git a/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.f90 b/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.f90 deleted file mode 100644 index 2c54b42ec7..0000000000 --- a/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.f90 +++ /dev/null @@ -1,1161 +0,0 @@ -!----------------------------------------------------------------- -! Programmer(s): Daniel R. Reynolds @ SMU -!----------------------------------------------------------------- -! SUNDIALS Copyright Start -! Copyright (c) 2002-2023, Lawrence Livermore National Security -! and Southern Methodist University. -! All rights reserved. -! -! See the top-level LICENSE and NOTICE files for details. -! -! SPDX-License-Identifier: BSD-3-Clause -! SUNDIALS Copyright End -!----------------------------------------------------------------- -! Example problem: -! -! The following test simulates a brusselator problem from chemical -! kinetics. This is a PDE system with 3 components, Y = [u,v,w], -! satisfying the equations, -! du/dt = du*u_xx + a - (w+1)*u + v*u^2 -! dv/dt = dv*v_xx + w*u - v*u^2 -! dw/dt = dw*w_xx + (b-w)/ep - w*u -! for t in the interval [0, 10], x in [0, 10], with initial -! conditions -! u(0,x) = a + 0.1*sin(pi*x), -! v(0,x) = b/a + 0.1*sin(pi*x), -! w(0,x) = b + 0.1*sin(pi*x), -! and with stationary boundary conditions, i.e. -! u_t(t,0) = u_t(t,1) = 0, -! v_t(t,0) = v_t(t,1) = 0, -! w_t(t,0) = w_t(t,1) = 0. -! -! Here, we use a piecewise linear Galerkin finite element -! discretization in space, where all element-wise integrals are -! computed using 3-node Gaussian quadrature (since we will have -! quartic polynomials in the reaction terms for the u_t and v_t -! equations (including the test function)). The time derivative -! terms in this system will include a mass matrix, giving rise to -! an ODE system of the form -! M y_t = L y + R(y), -! where M is the 3x3 block mass matrix for each component, L is -! the 3x3 block Laplace operator for each component, and R(y) is -! comprised of the nonlinear reaction terms for each component. -! Since it it highly inefficient to rewrite this system as -! y_t = M^{-1}(L y + R(y)), -! we solve this system using FARKODE, with a user-supplied mass -! matrix. We therefore provide functions to evaluate the ODE RHS -! f(t,y) = L y + R(y), -! its Jacobian -! J(t,y) = L + dR/dy, -! and the mass matrix, M. -! -! We use N=201 spatial nodes, with parameters -! a=0.6, b=2.0, du=0.025, dv=0.025, dw=0.025, ep=1.d-5 -! -! This program solves the problem with the DIRK method, using a -! Newton iteration with the SUNKLU sparse linear solvers for both -! the system and mass matrices. These matrices are stored in -! compressed-sparse-row format. -! -! Output is printed 10 times throughout the defined time interval. -! Run statistics (optional outputs) are printed at the end. -!----------------------------------------------------------------- - - -! user data structure -module UserData - implicit none - include "sundials/sundials_fconfig.h" - save - - integer*8 :: N ! number of intervals - real*8, allocatable :: x(:) ! mesh node locations - real*8 :: a ! constant forcing on u - real*8 :: b ! steady-state value of w - real*8 :: du ! diffusion coeff for u - real*8 :: dv ! diffusion coeff for v - real*8 :: dw ! diffusion coeff for w - real*8 :: ep ! stiffness parameter - -contains - - ! function that maps 2D data into 1D address space - ! (0-based since CSR matrix will be sent to C solver) - integer(kind=8) function idx(ix,ivar) - integer :: ivar, ix - idx = 3*(ix-1) + ivar - 1 - end function idx - -end module UserData - - -! finite element basis functions -module FEM - -contains - - ! left/right basis functions - double precision function ChiL(xl,xr,x) - double precision :: xl, xr, x - ChiL = (xr-x)/(xr-xl) - end function ChiL - - double precision function ChiR(xl,xr,x) - double precision :: xl, xr, x - ChiR = (x-xl)/(xr-xl) - end function ChiR - - ! derivatives of left/right basis functions - double precision function ChiL_x(xl,xr) - double precision :: xl, xr - ChiL_x = 1.d0/(xl-xr) - end function ChiL_X - - double precision function ChiR_x(xl,xr) - double precision :: xl, xr - ChiR_x = 1.d0/(xr-xl) - end function ChiR_x - - ! FEM output evaluation routines: value and derivative - double precision function Eval(ul,ur,xl,xr,x) - double precision :: ul, ur, xl, xr, x - Eval = ul*ChiL(xl,xr,x) + ur*ChiR(xl,xr,x) - end function Eval - - double precision function Eval_x(ul,ur,xl,xr) - double precision :: ul, ur, xl, xr - Eval_x = ul*ChiL_x(xl,xr) + ur*ChiR_x(xl,xr) - end function Eval_x - -end module FEM - - -! quadrature data -module Quadrature - -contains - - ! nodes - double precision function X1(xl,xr) - double precision :: xl, xr - X1 = 0.5d0*(xl+xr) - 0.5d0*(xr-xl)*0.774596669241483377035853079956d0 - end function X1 - - double precision function X2(xl,xr) - double precision :: xl, xr - X2 = 0.5d0*(xl+xr) - end function X2 - - double precision function X3(xl,xr) - double precision :: xl, xr - X3 = 0.5d0*(xl+xr) + 0.5d0*(xr-xl)*0.774596669241483377035853079956d0 - end function X3 - - ! quadrature - double precision function Quad(f1,f2,f3,xl,xr) - real*8 :: f1, f2, f3, xl, xr - real*8, parameter :: wt1=0.55555555555555555555555555555556d0 - real*8, parameter :: wt2=0.88888888888888888888888888888889d0 - real*8, parameter :: wt3=0.55555555555555555555555555555556d0 - Quad = 0.5d0*(xr-xl)*(wt1*f1 + wt2*f2 + wt3*f3) - end function Quad - -end module Quadrature -!----------------------------------------------------------------- - - - - -!----------------------------------------------------------------- -! Main driver program -!----------------------------------------------------------------- -program driver - - ! inclusions - use UserData - implicit none - - ! Declarations - ! general problem variables - real(kind=REALTYPE), parameter :: T0=0.d0, Tf=10.d0 - real(kind=REALTYPE) :: rtol, atol, rout(6), Tout, Tcur - real*8 :: dTout, pi, h, z - integer :: i, it, Nt, ier, ordering, sparsetype, time_dep - integer*8 :: iout(35), NEQ, nnz, Iinput - real(kind=REALTYPE), allocatable :: y(:,:), umask(:,:) - real(kind=REALTYPE), allocatable :: vmask(:,:), wmask(:,:) - - ! dummy real/integer parameters to pass through to supplied functions - integer*8 :: ipar - real(kind=REALTYPE) :: rpar - - !----------------------- - - ! set problem parameters (in UserData structure) - N = 201 ! number of intervals - a = 0.6d0 ! constant forcing on u - b = 2.d0 ! steady-state value of w - du = 2.5d-2 ! diffusion coeff for u - dv = 2.5d-2 ! diffusion coeff for v - dw = 2.5d-2 ! diffusion coeff for w - ep = 1.d-5 ! stiffness parameter - - ! set overall problem size, allocate solution/mask/temporary arrays - NEQ = 3*N - allocate(y(3,N), umask(3,N), vmask(3,N), wmask(3,N)) - - ! allocate and set up spatial mesh; this [arbitrarily] clusters - ! more intervals near the end points of the interval - allocate(x(N)) ! mesh node locations - pi = 4.d0*atan(1.d0) - h = 10.d0/(N-1) - do i=1,N - z = -5.d0 + h*(i-1) - x(i) = 0.5d0/atan(5.d0)*atan(z) + 0.5d0 - enddo - - ! output mesh to disk - open(200, file='bruss_FEM_mesh.txt') - do i=1,N - write(200,*) x(i) - enddo - close(200) - - ! time-stepping information - dTout = (Tf-T0)/10.d0 - Nt = Tf/dTout + 0.5 - - ! set initial conditions - do i=1,N - y(1,i) = a + 0.1d0*sin(pi*x(i)) ! u0 - y(2,i) = b/a + 0.1d0*sin(pi*x(i)) ! v0 - y(3,i) = b + 0.1d0*sin(pi*x(i)) ! w0 - enddo - - ! set mask values for each solution component - umask = 0.d0 - vmask = 0.d0 - wmask = 0.d0 - do i=1,N - umask(1,i) = 1.d0 - vmask(2,i) = 1.d0 - wmask(3,i) = 1.d0 - enddo - - ! set tolerances according to problem specifications - atol = 1.d-11 - rtol = 1.d-6 - - ! initialize vector module - call FNVInitS(4, NEQ, ier) - - ! initialize system and mass matrix modules - nnz = 15*NEQ ! integer number of nonzeros - ordering = 0 ! AMD - sparsetype = 1 ! CSR - call FSunSparseMatInit(4, NEQ, NEQ, nnz, sparsetype, ier) - call FSunSparseMassMatInit(NEQ, NEQ, nnz, sparsetype, ier) - - ! initialize KLU system and mass solvers - call FSunKLUInit(4, ier) - call FSunMassKLUInit(ier) - - ! initialize ARKode solver - ipar = 0 - rpar = 0.0 - iout = 0 - rout = 0.0 - call FARKMalloc(T0, y, 0, 1, rtol, atol, & - iout, rout, ipar, rpar, ier) - - ! set optional inputs - Iinput = 1 - call FARKSetIin('IMPLICIT', Iinput, ier) - Iinput = 1000 - call FARKSetIin('MAX_NSTEPS', Iinput, ier) - call FARKSetResTolerance(1, atol, ier) - - ! attach matrix and linear solver objects to ARKLs interfaces - time_dep = 0 - call FARKLsInit(ier) - call FARKSparseSetJac(ier) - call FARKLsMassInit(time_dep, ier) - call FARKSparseSetMass(ier) - - ! Open output stream for results - open(501, file='bruss_FEM_u.txt') - open(502, file='bruss_FEM_v.txt') - open(503, file='bruss_FEM_w.txt') - - ! output initial condition to disk - write(501,*) ( y(1,i), i=1,N ) - write(502,*) ( y(2,i), i=1,N ) - write(503,*) ( y(3,i), i=1,N ) - - ! output solver parameters to screen - call FARKWriteParameters(ier) - - ! loop over time outputs - Tout = T0 - Tcur = T0 - print *, ' t ||u||_rms ||v||_rms ||w||_rms' - print *, ' ----------------------------------------------------' - print '(3x,4(es12.5,1x))', Tcur, sqrt(sum(y*y*umask)/N), & - sqrt(sum(y*y*vmask)/N), sqrt(sum(y*y*wmask)/N) - do it = 1,Nt - - ! set next output time - Tout = min(Tout + dTout, Tf) - - ! set next output time - call FARKSetRin('STOP_TIME', Tout, ier) - - ! call solver - call FARKode(Tout, Tcur, y, 1, ier) - if (ier < 0) then - write(0,*) 'Solver failure, stopping integration' - stop - end if - - ! output current solution information - print '(3x,4(es12.5,1x))', Tcur, sqrt(sum(y*y*umask)/N), & - sqrt(sum(y*y*vmask)/N), sqrt(sum(y*y*wmask)/N) - - ! output current results to disk - write(501,*) ( y(1,i), i=1,N ) - write(502,*) ( y(2,i), i=1,N ) - write(503,*) ( y(3,i), i=1,N ) - - end do - print *, ' ----------------------------------------------------' - - ! close solution output files - close(501) - close(502) - close(503) - - ! output solver statistics - print *, ' ' - print *, 'Final Solver Statistics:' - print *, ' Internal solver steps = ', iout(3),' (attempted =', iout(6), ')' - print *, ' Total RHS evals: Fe = ', iout(7),' Fi = ', iout(8) - print *, ' Total linear solver setups = ', iout(9) - print *, ' Total RHS evals for setting up the linear system = ', iout(17) - print *, ' Total number of Jacobian evaluations = ', iout(18) - print *, ' Total number of nonlinear iterations = ', iout(11) - print *, ' Total number of nonlinear solver convergence failures = ',iout(12) - print *, ' Total number of error test failures = ', iout(10) - print *, ' Total number of mass matrix evaluations = ', iout(28) - print *, ' ' - - ! clean up - deallocate(y, umask, vmask, wmask, x) - call FARKFree() - -end program driver -!----------------------------------------------------------------- - - - - -!----------------------------------------------------------------- -! User-supplied subroutines for FARKODE interface -!----------------------------------------------------------------- - - -subroutine FARKIFun(t, y, ydot, ipar, rpar, ier) -!----------------------------------------------------------------- -! Right-hand side of the ODE system -!----------------------------------------------------------------- - use UserData - use FEM - use Quadrature - - ! Declarations - implicit none - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, rpar(1) - integer*8, intent(in) :: ipar(1) - integer, intent(out) :: ier - real(kind=REALTYPE), intent(in) :: y(3,N) - real(kind=REALTYPE), intent(out) :: ydot(3,N) - - ! Local data - integer :: ix - logical :: left, right - real*8 :: ul, ur, vl, vr, wl, wr, xl, xr, u, v, w, f1, f2, f3 - - ! clear out rhs - ydot = 0.d0 - - ! iterate over intervals, filling in rhs function - do ix=1,N-1 - - ! set booleans to determine whether equations exist on the left/right */ - left = .true. - right = .true. - if (ix==1) left = .false. - if (ix==(N-1)) right = .false. - - ! set nodal value shortcuts (interval index aligns with left node) - ul = y(1,ix) - vl = y(2,ix) - wl = y(3,ix) - ur = y(1,ix+1) - vr = y(2,ix+1) - wr = y(3,ix+1) - - ! set mesh shortcuts - xl = x(ix) - xr = x(ix+1) - - ! left test function - if (left) then - - ! u -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = (a - (w+1.d0)*u + v*u*u) * ChiL(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = (a - (w+1.d0)*u + v*u*u) * ChiL(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = (a - (w+1.d0)*u + v*u*u) * ChiL(xl,xr,X3(xl,xr)) - ydot(1,ix) = ydot(1,ix) + Quad(f1,f2,f3,xl,xr) - - ! u -- diffusion - f1 = -du * Eval_x(ul,ur,xl,xr) * ChiL_x(xl,xr) - ydot(1,ix) = ydot(1,ix) + Quad(f1,f1,f1,xl,xr) - - ! v -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = (w*u - v*u*u) * ChiL(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = (w*u - v*u*u) * ChiL(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = (w*u - v*u*u) * ChiL(xl,xr,X3(xl,xr)) - ydot(2,ix) = ydot(2,ix) + Quad(f1,f2,f3,xl,xr) - - ! v -- diffusion - f1 = -dv * Eval_x(vl,vr,xl,xr) * ChiL_x(xl,xr) - ydot(2,ix) = ydot(2,ix) + Quad(f1,f1,f1,xl,xr) - - ! w -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = ((b-w)/ep - w*u) * ChiL(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = ((b-w)/ep - w*u) * ChiL(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = ((b-w)/ep - w*u) * ChiL(xl,xr,X3(xl,xr)) - ydot(3,ix) = ydot(3,ix) + Quad(f1,f2,f3,xl,xr) - - ! w -- diffusion - f1 = -dw * Eval_x(wl,wr,xl,xr) * ChiL_x(xl,xr) - ydot(3,ix) = ydot(3,ix) + Quad(f1,f1,f1,xl,xr) - - end if - - ! right test function - if (right) then - - ! u -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = (a - (w+1.d0)*u + v*u*u) * ChiR(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = (a - (w+1.d0)*u + v*u*u) * ChiR(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = (a - (w+1.d0)*u + v*u*u) * ChiR(xl,xr,X3(xl,xr)) - ydot(1,ix+1) = ydot(1,ix+1) + Quad(f1,f2,f3,xl,xr) - - ! u -- diffusion - f1 = -du * Eval_x(ul,ur,xl,xr) * ChiR_x(xl,xr) - ydot(1,ix+1) = ydot(1,ix+1) + Quad(f1,f1,f1,xl,xr) - - ! v -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = (w*u - v*u*u) * ChiR(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = (w*u - v*u*u) * ChiR(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = (w*u - v*u*u) * ChiR(xl,xr,X3(xl,xr)) - ydot(2,ix+1) = ydot(2,ix+1) + Quad(f1,f2,f3,xl,xr) - - ! v -- diffusion - f1 = -dv * Eval_x(vl,vr,xl,xr) * ChiR_x(xl,xr) - ydot(2,ix+1) = ydot(2,ix+1) + Quad(f1,f1,f1,xl,xr) - - ! w -- reaction - u = Eval(ul, ur, xl, xr, X1(xl,xr)) - v = Eval(vl, vr, xl, xr, X1(xl,xr)) - w = Eval(wl, wr, xl, xr, X1(xl,xr)) - f1 = ((b-w)/ep - w*u) * ChiR(xl,xr,X1(xl,xr)) - u = Eval(ul, ur, xl, xr, X2(xl,xr)) - v = Eval(vl, vr, xl, xr, X2(xl,xr)) - w = Eval(wl, wr, xl, xr, X2(xl,xr)) - f2 = ((b-w)/ep - w*u) * ChiR(xl,xr,X2(xl,xr)) - u = Eval(ul, ur, xl, xr, X3(xl,xr)) - v = Eval(vl, vr, xl, xr, X3(xl,xr)) - w = Eval(wl, wr, xl, xr, X3(xl,xr)) - f3 = ((b-w)/ep - w*u) * ChiR(xl,xr,X3(xl,xr)) - ydot(3,ix+1) = ydot(3,ix+1) + Quad(f1,f2,f3,xl,xr) - - ! w -- diffusion - f1 = -dw * Eval_x(wl,wr,xl,xr) * ChiR_x(xl,xr) - ydot(3,ix+1) = ydot(3,ix+1) + Quad(f1,f1,f1,xl,xr) - - endif - - enddo - ier = 0 - - return - -end subroutine farkifun -!----------------------------------------------------------------- - - - -subroutine farkefun(t, y, ydot, ipar, rpar, ier) -!----------------------------------------------------------------- -! (unused) Explicit portion of the ODE right-hand function -!----------------------------------------------------------------- - use UserData - - ! Declarations - implicit none - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, rpar(1) - integer*8, intent(in) :: ipar(1) - real(kind=REALTYPE), intent(in) :: y(3,N) - real(kind=REALTYPE), intent(out) :: ydot(3,N) - integer, intent(out) :: ier - - ! return with success (since fully implicit) - ydot = 0.d0 - ier = 0 - -end subroutine farkefun -!----------------------------------------------------------------- - - - -subroutine farkspjac(t, y, fy, neq, nnz, Jdata, Jcolvals, & - Jrowptrs, h, ipar, rpar, wk1, wk2, wk3, ier) -!----------------------------------------------------------------- -! Jacobian computation routine -- CSR format -!----------------------------------------------------------------- - use UserData - use Quadrature - use FEM - - ! Declarations - implicit none - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, h, rpar(1) - real(kind=REALTYPE), intent(in), dimension(3,N) :: y, fy, wk1, wk2, wk3 - real(kind=REALTYPE), intent(out) :: Jdata(nnz) - integer*8, intent(in) :: ipar(1), neq, nnz - integer(kind=SUNINDEXTYPE), intent(out) :: Jcolvals(nnz) - integer(kind=SUNINDEXTYPE), intent(out) :: Jrowptrs(neq+1) - integer, intent(out) :: ier - - ! Local data - integer :: ix, nz, Nint - real*8 :: ul, uc, ur, vl, vc, vr, wl, wc, wr, xl, xc, xr - real*8 :: u1, u2, u3, v1, v2, v3, w1, w2, w3 - real*8 :: f1, f2, f3, df1, df2, df3, dQdf1, dQdf2, dQdf3 - real*8 :: ChiL1, ChiL2, ChiL3, ChiR1, ChiR2, ChiR3 - real*8, dimension(3,-1:1) :: Ju, Jv, Jw - - ! check that vector/matrix dimensions match up - if ((3*N /= neq) .or. (nnz < 27*(N-2))) then - ier = 1 - return - endif - - ! set integer*4 version of N for call to idx() - Nint = N - - ! clear out Jacobian matrix data - Jdata = 0.d0 - nz = 0 - - ! Dirichlet boundary at left - Jrowptrs(idx(1,1)+1) = nz - Jrowptrs(idx(1,2)+1) = nz - Jrowptrs(idx(1,3)+1) = nz - - ! iterate through nodes, filling in matrix by rows - do ix=2,N-1 - - ! set nodal value shortcuts (interval index aligns with left node) - xl = x(ix-1) - ul = y(1,ix-1) - vl = y(2,ix-1) - wl = y(3,ix-1) - xc = x(ix) - uc = y(1,ix) - vc = y(2,ix) - wc = y(3,ix) - xr = x(ix+1) - ur = y(1,ix+1) - vr = y(2,ix+1) - wr = y(3,ix+1) - - ! compute entries of all Jacobian rows at node ix - Ju = 0.d0 - Jv = 0.d0 - Jw = 0.d0 - - ! first compute dependence on values to left and center - - ! evaluate relevant variables in left subinterval - u1 = Eval(ul, uc, xl, xc, X1(xl,xc)) - v1 = Eval(vl, vc, xl, xc, X1(xl,xc)) - w1 = Eval(wl, wc, xl, xc, X1(xl,xc)) - u2 = Eval(ul, uc, xl, xc, X2(xl,xc)) - v2 = Eval(vl, vc, xl, xc, X2(xl,xc)) - w2 = Eval(wl, wc, xl, xc, X2(xl,xc)) - u3 = Eval(ul, uc, xl, xc, X3(xl,xc)) - v3 = Eval(vl, vc, xl, xc, X3(xl,xc)) - w3 = Eval(wl, wc, xl, xc, X3(xl,xc)) - - dQdf1 = Quad(1.d0, 0.d0, 0.d0, xl, xc) - dQdf2 = Quad(0.d0, 1.d0, 0.d0, xl, xc) - dQdf3 = Quad(0.d0, 0.d0, 1.d0, xl, xc) - - ChiL1 = ChiL(xl, xc, X1(xl,xc)) - ChiL2 = ChiL(xl, xc, X2(xl,xc)) - ChiL3 = ChiL(xl, xc, X3(xl,xc)) - ChiR1 = ChiR(xl, xc, X1(xl,xc)) - ChiR2 = ChiR(xl, xc, X2(xl,xc)) - ChiR3 = ChiR(xl, xc, X3(xl,xc)) - - - ! compute diffusion Jacobian components - - ! L_u = -du * u_x * ChiR_x - ! dL_u/dul - Ju(1,-1) = (-du) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiL_x(xl,xc) * ChiR_x(xl,xc) - ! dL_u/duc - Ju(1,0) = (-du) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiR_x(xl,xc) * ChiR_x(xl,xc) - - ! L_v = -dv * v_x * ChiR_x - ! dL_v/dvl - Jv(2,-1) = (-dv) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiL_x(xl,xc) * ChiR_x(xl,xc) - ! dL_v/dvc - Jv(2,0) = (-dv) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiR_x(xl,xc) * ChiR_x(xl,xc) - - ! L_w = -dw * w_x * ChiR_x - ! dL_w/dwl - Jw(3,-1) = (-dw) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiL_x(xl,xc) * ChiR_x(xl,xc) - ! dL_w/dwc - Jw(3,0) = (-dw) * Quad(1.d0,1.d0,1.d0,xl,xc) * ChiR_x(xl,xc) * ChiR_x(xl,xc) - - - ! compute reaction Jacobian components - - ! R_u = (a - (w+1.d0)*u + v*u*u) - ! dR_u/dul - df1 = (-(w1+1.d0) + 2.d0*v1*u1) * ChiL1 * ChiR1 - df2 = (-(w2+1.d0) + 2.d0*v2*u2) * ChiL2 * ChiR2 - df3 = (-(w3+1.d0) + 2.d0*v3*u3) * ChiL3 * ChiR3 - Ju(1,-1) = Ju(1,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/duc - df1 = (-(w1+1.d0) + 2.d0*v1*u1) * ChiR1 * ChiR1 - df2 = (-(w2+1.d0) + 2.d0*v2*u2) * ChiR2 * ChiR2 - df3 = (-(w3+1.d0) + 2.d0*v3*u3) * ChiR3 * ChiR3 - Ju(1,0) = Ju(1,0)+ dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dvl - df1 = (u1*u1) * ChiL1 * ChiR1 - df2 = (u2*u2) * ChiL2 * ChiR2 - df3 = (u3*u3) * ChiL3 * ChiR3 - Ju(2,-1) = Ju(2,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dvc - df1 = (u1*u1) * ChiR1 * ChiR1 - df2 = (u2*u2) * ChiR2 * ChiR2 - df3 = (u3*u3) * ChiR3 * ChiR3 - Ju(2,0) = Ju(2,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dwl - df1 = (-u1) * ChiL1 * ChiR1 - df2 = (-u2) * ChiL2 * ChiR2 - df3 = (-u3) * ChiL3 * ChiR3 - Ju(3,-1) = Ju(3,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dwc - df1 = (-u1) * ChiR1 * ChiR1 - df2 = (-u2) * ChiR2 * ChiR2 - df3 = (-u3) * ChiR3 * ChiR3 - Ju(3,0) = Ju(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! R_v = (w*u - v*u*u) - ! dR_v/dul - df1 = (w1 - 2.d0*v1*u1) * ChiL1 * ChiR1 - df2 = (w2 - 2.d0*v2*u2) * ChiL2 * ChiR2 - df3 = (w3 - 2.d0*v3*u3) * ChiL3 * ChiR3 - Jv(1,-1) = Jv(1,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/duc - df1 = (w1 - 2.d0*v1*u1) * ChiR1 * ChiR1 - df2 = (w2 - 2.d0*v2*u2) * ChiR2 * ChiR2 - df3 = (w3 - 2.d0*v3*u3) * ChiR3 * ChiR3 - Jv(1,0) = Jv(1,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dvl - df1 = (-u1*u1) * ChiL1 * ChiR1 - df2 = (-u2*u2) * ChiL2 * ChiR2 - df3 = (-u3*u3) * ChiL3 * ChiR3 - Jv(2,-1) = Jv(2,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dvc - df1 = (-u1*u1) * ChiR1 * ChiR1 - df2 = (-u2*u2) * ChiR2 * ChiR2 - df3 = (-u3*u3) * ChiR3 * ChiR3 - Jv(2,0) = Jv(2,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dwl - df1 = (u1) * ChiL1 * ChiR1 - df2 = (u2) * ChiL2 * ChiR2 - df3 = (u3) * ChiL3 * ChiR3 - Jv(3,-1) = Jv(3,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dwc - df1 = (u1) * ChiR1 * ChiR1 - df2 = (u2) * ChiR2 * ChiR2 - df3 = (u3) * ChiR3 * ChiR3 - Jv(3,0) = Jv(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! R_w = ((b-w)/ep - w*u) - ! dR_w/dul - df1 = (-w1) * ChiL1 * ChiR1 - df2 = (-w2) * ChiL2 * ChiR2 - df3 = (-w3) * ChiL3 * ChiR3 - Jw(1,-1) = Jw(1,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/duc - df1 = (-w1) * ChiR1 * ChiR1 - df2 = (-w2) * ChiR2 * ChiR2 - df3 = (-w3) * ChiR3 * ChiR3 - Jw(1,0) = Jw(1,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/dwl - df1 = (-1.d0/ep - u1) * ChiL1 * ChiR1 - df2 = (-1.d0/ep - u2) * ChiL2 * ChiR2 - df3 = (-1.d0/ep - u3) * ChiL3 * ChiR3 - Jw(3,-1) = Jw(3,-1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/dwc - df1 = (-1.d0/ep - u1) * ChiR1 * ChiR1 - df2 = (-1.d0/ep - u2) * ChiR2 * ChiR2 - df3 = (-1.d0/ep - u3) * ChiR3 * ChiR3 - Jw(3,0) = Jw(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! second compute dependence on values to center and right - - ! evaluate relevant variables in right subinterval - u1 = Eval(uc, ur, xc, xr, X1(xc,xr)) - v1 = Eval(vc, vr, xc, xr, X1(xc,xr)) - w1 = Eval(wc, wr, xc, xr, X1(xc,xr)) - u2 = Eval(uc, ur, xc, xr, X2(xc,xr)) - v2 = Eval(vc, vr, xc, xr, X2(xc,xr)) - w2 = Eval(wc, wr, xc, xr, X2(xc,xr)) - u3 = Eval(uc, ur, xc, xr, X3(xc,xr)) - v3 = Eval(vc, vr, xc, xr, X3(xc,xr)) - w3 = Eval(wc, wr, xc, xr, X3(xc,xr)) - - dQdf1 = Quad(1.d0, 0.d0, 0.d0, xc, xr) - dQdf2 = Quad(0.d0, 1.d0, 0.d0, xc, xr) - dQdf3 = Quad(0.d0, 0.d0, 1.d0, xc, xr) - - ChiL1 = ChiL(xc, xr, X1(xc,xr)) - ChiL2 = ChiL(xc, xr, X2(xc,xr)) - ChiL3 = ChiL(xc, xr, X3(xc,xr)) - ChiR1 = ChiR(xc, xr, X1(xc,xr)) - ChiR2 = ChiR(xc, xr, X2(xc,xr)) - ChiR3 = ChiR(xc, xr, X3(xc,xr)) - - - ! compute diffusion Jacobian components - - ! L_u = -du * u_x * ChiL_x - ! dL_u/duc - Ju(1,0) = Ju(1,0) + (-du) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiL_x(xc,xr) - - ! dL_u/dur - Ju(1,1) = Ju(1,1) + (-du) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiR_x(xc,xr) - - ! L_v = -dv * v_x * ChiL_x - ! dL_v/dvc - Jv(2,0) = Jv(2,0) + (-dv) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiL_x(xc,xr) - - ! dL_v/dvr - Jv(2,1) = Jv(2,1) + (-dv) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiR_x(xc,xr) - - ! L_w = -dw * w_x * ChiL_x - ! dL_w/dwc - Jw(3,0) = Jw(3,0) + (-dw) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiL_x(xc,xr) - - ! dL_w/dwr - Jw(3,1) = Jw(3,1) + (-dw) * Quad(1.d0,1.d0,1.d0,xc,xr) * ChiL_x(xc,xr) * ChiR_x(xc,xr) - - - ! compute reaction Jacobian components - - ! R_u = (a - (w+1.d0)*u + v*u*u) - ! dR_u/duc - df1 = (-(w1+1.d0) + 2.d0*v1*u1) * ChiL1 * ChiL1 - df2 = (-(w2+1.d0) + 2.d0*v2*u2) * ChiL2 * ChiL2 - df3 = (-(w3+1.d0) + 2.d0*v3*u3) * ChiL3 * ChiL3 - Ju(1,0) = Ju(1,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dur - df1 = (-(w1+1.d0) + 2.d0*v1*u1) * ChiL1 * ChiR1 - df2 = (-(w2+1.d0) + 2.d0*v2*u2) * ChiL2 * ChiR2 - df3 = (-(w3+1.d0) + 2.d0*v3*u3) * ChiL3 * ChiR3 - Ju(1,1) = Ju(1,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dvc - df1 = (u1*u1) * ChiL1 * ChiL1 - df2 = (u2*u2) * ChiL2 * ChiL2 - df3 = (u3*u3) * ChiL3 * ChiL3 - Ju(2,0) = Ju(2,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dvr - df1 = (u1*u1) * ChiL1 * ChiR1 - df2 = (u2*u2) * ChiL2 * ChiR2 - df3 = (u3*u3) * ChiL3 * ChiR3 - Ju(2,1) = Ju(2,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dwc - df1 = (-u1) * ChiL1 * ChiL1 - df2 = (-u2) * ChiL2 * ChiL2 - df3 = (-u3) * ChiL3 * ChiL3 - Ju(3,0) = Ju(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_u/dwr - df1 = (-u1) * ChiL1 * ChiR1 - df2 = (-u2) * ChiL2 * ChiR2 - df3 = (-u3) * ChiL3 * ChiR3 - Ju(3,1) = Ju(3,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! R_v = (w*u - v*u*u) - ! dR_v/duc - df1 = (w1 - 2.d0*v1*u1) * ChiL1 * ChiL1 - df2 = (w2 - 2.d0*v2*u2) * ChiL2 * ChiL2 - df3 = (w3 - 2.d0*v3*u3) * ChiL3 * ChiL3 - Jv(1,0) = Jv(1,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dur - df1 = (w1 - 2.d0*v1*u1) * ChiL1 * ChiR1 - df2 = (w2 - 2.d0*v2*u2) * ChiL2 * ChiR2 - df3 = (w3 - 2.d0*v3*u3) * ChiL3 * ChiR3 - Jv(1,1) = Jv(1,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dvc - df1 = (-u1*u1) * ChiL1 * ChiL1 - df2 = (-u2*u2) * ChiL2 * ChiL2 - df3 = (-u3*u3) * ChiL3 * ChiL3 - Jv(2,0) = Jv(2,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dvr - df1 = (-u1*u1) * ChiL1 * ChiR1 - df2 = (-u2*u2) * ChiL2 * ChiR2 - df3 = (-u3*u3) * ChiL3 * ChiR3 - Jv(2,1) = Jv(2,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dwc - df1 = (u1) * ChiL1 * ChiL1 - df2 = (u2) * ChiL2 * ChiL2 - df3 = (u3) * ChiL3 * ChiL3 - Jv(3,0) = Jv(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_v/dwr - df1 = (u1) * ChiL1 * ChiR1 - df2 = (u2) * ChiL2 * ChiR2 - df3 = (u3) * ChiL3 * ChiR3 - Jv(3,1) = Jv(3,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! R_w = ((b-w)/ep - w*u) - ! dR_w/duc - df1 = (-w1) * ChiL1 * ChiL1 - df2 = (-w2) * ChiL2 * ChiL2 - df3 = (-w3) * ChiL3 * ChiL3 - Jw(1,0) = Jw(1,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/dur - df1 = (-w1) * ChiL1 * ChiR1 - df2 = (-w2) * ChiL2 * ChiR2 - df3 = (-w3) * ChiL3 * ChiR3 - Jw(1,1) = Jw(1,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/dwc - df1 = (-1.d0/ep - u1) * ChiL1 * ChiL1 - df2 = (-1.d0/ep - u2) * ChiL2 * ChiL2 - df3 = (-1.d0/ep - u3) * ChiL3 * ChiL3 - Jw(3,0) = Jw(3,0) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - ! dR_w/dwr - df1 = (-1.d0/ep - u1) * ChiL1 * ChiR1 - df2 = (-1.d0/ep - u2) * ChiL2 * ChiR2 - df3 = (-1.d0/ep - u3) * ChiL3 * ChiR3 - Jw(3,1) = Jw(3,1) + dQdf1*df1 + dQdf2*df2 + dQdf3*df3 - - - ! insert Jacobian entries into CSR matrix structure - - ! Ju row - Jrowptrs(idx(ix,1)+1) = nz - - Jdata(nz+1:nz+3) = (/ Ju(1,-1), Ju(2,-1), Ju(3,-1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix-1,1), idx(ix-1,2), idx(ix-1,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Ju(1,0), Ju(2,0), Ju(3,0) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix,1), idx(ix,2), idx(ix,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Ju(1,1), Ju(2,1), Ju(3,1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix+1,1), idx(ix+1,2), idx(ix+1,3) /) - nz = nz+3 - - ! Jv row - Jrowptrs(idx(ix,2)+1) = nz - - Jdata(nz+1:nz+3) = (/ Jv(1,-1), Jv(2,-1), Jv(3,-1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix-1,1), idx(ix-1,2), idx(ix-1,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Jv(1,0), Jv(2,0), Jv(3,0) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix,1), idx(ix,2), idx(ix,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Jv(1,1), Jv(2,1), Jv(3,1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix+1,1), idx(ix+1,2), idx(ix+1,3) /) - nz = nz+3 - - ! Jw row - Jrowptrs(idx(ix,3)+1) = nz - - Jdata(nz+1:nz+3) = (/ Jw(1,-1), Jw(2,-1), Jw(3,-1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix-1,1), idx(ix-1,2), idx(ix-1,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Jw(1,0), Jw(2,0), Jw(3,0) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix,1), idx(ix,2), idx(ix,3) /) - nz = nz+3 - - Jdata(nz+1:nz+3) = (/ Jw(1,1), Jw(2,1), Jw(3,1) /) - Jcolvals(nz+1:nz+3) = (/ idx(ix+1,1), idx(ix+1,2), idx(ix+1,3) /) - nz = nz+3 - - enddo - - ! Dirichlet boundary at right - Jrowptrs(idx(Nint,1)+1) = nz - Jrowptrs(idx(Nint,2)+1) = nz - Jrowptrs(idx(Nint,3)+1) = nz - - ! signal end of data in CSR matrix - Jrowptrs(idx(Nint,3)+2) = nz - - ier = 0 - return - -end subroutine farkspjac -!----------------------------------------------------------------- - - - -subroutine farkspmass(t, neq, nnz, Mdata, Mcolvals, Mrowptrs, & - ipar, rpar, wk1, wk2, wk3, ier) -!----------------------------------------------------------------- -! Mass matrix computation routine -!----------------------------------------------------------------- - use UserData - use Quadrature - use FEM - - ! Declarations - implicit none - - ! Arguments - real(kind=REALTYPE), intent(in) :: t, rpar(1) - real(kind=REALTYPE), intent(in), dimension(3,N) :: wk1, wk2, wk3 - real(kind=REALTYPE), intent(out) :: Mdata(nnz) - integer*8, intent(in) :: ipar(1), neq, nnz - integer(kind=SUNINDEXTYPE), intent(out) :: Mcolvals(nnz) - integer(kind=SUNINDEXTYPE), intent(out) :: Mrowptrs(neq+1) - integer, intent(out) :: ier - - ! Local data - integer :: ix, nz, Nint - real*8 :: xl, xc, xr, Ml, Mc, Mr, ChiL1, ChiL2, ChiL3, ChiR1, ChiR2, ChiR3 - logical :: left, right - - ! check that vector/matrix dimensions match up - if ((3*N /= neq) .or. (nnz /= 15*neq)) then - ier = 1 - return - endif - - ! set integer*4 version of N for call to idx() - Nint = N - - ! clear out Jacobian matrix data - Mdata = 0.d0 - nz = 0 - - ! iterate through nodes, filling in matrix by rows - do ix=1,N - - ! set booleans to determine whether intervals exist on the left/right */ - left = .true. - right = .true. - if (ix==1) left = .false. - if (ix==N) right = .false. - - ! set nodal value shortcuts (interval index aligns with left node) - if (left) then - xl = x(ix-1) - endif - xc = x(ix) - if (right) then - xr = x(ix+1) - endif - - ! compute entries of all mass matrix rows at node ix - Ml = 0.d0 - Mc = 0.d0 - Mr = 0.d0 - - ! first compute dependence on values to left and center - if (left) then - - ChiL1 = ChiL(xl, xc, X1(xl,xc)) - ChiL2 = ChiL(xl, xc, X2(xl,xc)) - ChiL3 = ChiL(xl, xc, X3(xl,xc)) - ChiR1 = ChiR(xl, xc, X1(xl,xc)) - ChiR2 = ChiR(xl, xc, X2(xl,xc)) - ChiR3 = ChiR(xl, xc, X3(xl,xc)) - - Ml = Ml + Quad(ChiL1*ChiR1, ChiL2*ChiR2, ChiL3*ChiR3, xl, xc) - Mc = Mc + Quad(ChiR1*ChiR1, ChiR2*ChiR2, ChiR3*ChiR3, xl, xc) - - endif - - ! second compute dependence on values to center and right - if (right) then - - ChiL1 = ChiL(xc, xr, X1(xc,xr)) - ChiL2 = ChiL(xc, xr, X2(xc,xr)) - ChiL3 = ChiL(xc, xr, X3(xc,xr)) - ChiR1 = ChiR(xc, xr, X1(xc,xr)) - ChiR2 = ChiR(xc, xr, X2(xc,xr)) - ChiR3 = ChiR(xc, xr, X3(xc,xr)) - - Mc = Mc + Quad(ChiL1*ChiL1, ChiL2*ChiL2, ChiL3*ChiL3, xc, xr) - Mr = Mr + Quad(ChiL1*ChiR1, ChiL2*ChiR2, ChiL3*ChiR3, xc, xr) - - endif - - - ! insert mass matrix entries into CSR matrix structure - - ! u row - Mrowptrs(idx(ix,1)+1) = nz - if (left) then - nz = nz+1 - Mdata(nz) = Ml - Mcolvals(nz) = idx(ix-1,1) - endif - nz = nz+1 - Mdata(nz) = Mc - Mcolvals(nz) = idx(ix,1) - if (right) then - nz = nz+1 - Mdata(nz) = Mr - Mcolvals(nz) = idx(ix+1,1) - endif - - ! v row - Mrowptrs(idx(ix,2)+1) = nz - if (left) then - nz = nz+1 - Mdata(nz) = Ml - Mcolvals(nz) = idx(ix-1,2) - endif - nz = nz+1 - Mdata(nz) = Mc - Mcolvals(nz) = idx(ix,2) - if (right) then - nz = nz+1 - Mdata(nz) = Mr - Mcolvals(nz) = idx(ix+1,2) - endif - - ! w row - Mrowptrs(idx(ix,3)+1) = nz - if (left) then - nz = nz+1 - Mdata(nz) = Ml - Mcolvals(nz) = idx(ix-1,3) - endif - nz = nz+1 - Mdata(nz) = Mc - Mcolvals(nz) = idx(ix,3) - if (right) then - nz = nz+1 - Mdata(nz) = Mr - Mcolvals(nz) = idx(ix+1,3) - endif - - enddo - - ! signal end of data in CSR matrix - Mrowptrs(idx(Nint,3)+2) = nz - - ier = 0 - return - -end subroutine farkspmass -!----------------------------------------------------------------- diff --git a/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.out b/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.out deleted file mode 100644 index e3ad641b77..0000000000 --- a/examples/arkode/F90_serial/ark_bruss1D_FEM_klu.out +++ /dev/null @@ -1,59 +0,0 @@ -ARKode solver parameters: - Solver relative tolerance = 1e-06 - Solver absolute tolerance = 1e-11 - Absolute residual tolerance = 1e-11 - - Maximum step increase (first step) = 10000 - Step reduction factor on multiple error fails = 0.3 - Minimum error fails before above factor is used = 2 - Step reduction factor on nonlinear convergence failure = 0.25 - Explicit safety factor = 0.5 - Time step adaptivity method 0 - Safety factor = 0.96 - Bias factor = 1.5 - Growth factor = 20 - Step growth lower bound = 1 - Step growth upper bound = 1.5 - k1 = 0.58 - k2 = 0.21 - k3 = 0.1 - Default explicit stability function - Maximum number of error test failures = 7 - Maximum number of convergence test failures = 10 -ARKStep time step module parameters: - Method order 4 - Implicit integrator - Implicit predictor method = 0 - Implicit solver tolerance coefficient = 0.1 - Maximum number of nonlinear corrections = 3 - Nonlinear convergence rate constant = 0.3 - Nonlinear divergence tolerance = 2.3 - Gamma factor LSetup tolerance = 0.2 - Number of steps between LSetup calls = 20 - - t ||u||_rms ||v||_rms ||w||_rms - ---------------------------------------------------- - 0.00000E+00 6.32978E-01 3.36571E+00 2.03247E+00 - 1.00000E+00 6.97285E-01 3.23962E+00 1.99999E+00 - 2.00000E+00 7.89501E-01 3.05139E+00 1.99999E+00 - 3.00000E+00 7.83681E-01 2.93001E+00 1.99999E+00 - 4.00000E+00 6.48122E-01 3.00833E+00 1.99999E+00 - 5.00000E+00 5.52223E-01 3.17028E+00 1.99999E+00 - 6.00000E+00 5.22111E-01 3.30889E+00 1.99999E+00 - 7.00000E+00 5.20869E-01 3.40614E+00 1.99999E+00 - 8.00000E+00 5.30276E-01 3.46669E+00 1.99999E+00 - 9.00000E+00 5.45196E-01 3.49456E+00 1.99999E+00 - 1.00000E+01 5.65426E-01 3.49094E+00 1.99999E+00 - ---------------------------------------------------- - - Final Solver Statistics: - Internal solver steps = 104 (attempted = 104 ) - Total RHS evals: Fe = 0 Fi = 1732 - Total linear solver setups = 48 - Total RHS evals for setting up the linear system = 0 - Total number of Jacobian evaluations = 11 - Total number of nonlinear iterations = 1209 - Total number of nonlinear solver convergence failures = 0 - Total number of error test failures = 0 - Total number of mass matrix evaluations = 1 - diff --git a/examples/arkode/F90_serial/plot_brusselator1D_FEM.py b/examples/arkode/F90_serial/plot_brusselator1D_FEM.py deleted file mode 100755 index 19be9cbdda..0000000000 --- a/examples/arkode/F90_serial/plot_brusselator1D_FEM.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# ------------------------------------------------------------ -# Programmer(s): Daniel R. Reynolds @ SMU -# ------------------------------------------------------------ -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ------------------------------------------------------------ -# matplotlib-based plotting script for brusselator1D.c example - -# imports -import sys -import pylab as plt -import numpy as np - -# load mesh data file -mesh = np.loadtxt('bruss_FEM_mesh.txt', dtype=np.double) - -# load solution data files -udata = np.loadtxt('bruss_FEM_u.txt', dtype=np.double) -vdata = np.loadtxt('bruss_FEM_v.txt', dtype=np.double) -wdata = np.loadtxt('bruss_FEM_w.txt', dtype=np.double) - -# determine number of time steps, mesh size -nt,nx = np.shape(udata) - -# determine min/max values -umin = 0.9*udata.min() -umax = 1.1*udata.max() -vmin = 0.9*vdata.min() -vmax = 1.1*vdata.max() -wmin = 0.9*wdata.min() -wmax = 1.1*wdata.max() -minval = np.array([umin, vmin, wmin]).min() -maxval = np.array([umax, vmax, wmax]).max() - -# plot the mesh -plt.figure(1) -plt.plot(mesh,0.0*mesh,'o') -plt.xlabel('x') -plt.title('FEM mesh') -plt.savefig('brusselator1D_FEM_mesh.png') - -# generate plots of results -for tstep in range(nt): - - # set string constants for output plots, current time, mesh size - pname = 'brusselator1D_FEM.' + repr(tstep).zfill(3) + '.png' - tstr = repr(tstep) - nxstr = repr(nx) - - # plot current solution and save to disk - plt.figure(1) - plt.plot(mesh,udata[tstep,:],label="u") - plt.plot(mesh,vdata[tstep,:],label="v") - plt.plot(mesh,wdata[tstep,:],label="w") - plt.xlabel('x') - plt.ylabel('solution') - plt.title('Solutions at output ' + tstr + ', mesh = ' + nxstr) - plt.axis((0.0, 1.0, minval, maxval)) - plt.grid() - plt.legend(loc='upper right', shadow=True) - plt.savefig(pname) - plt.close() - - -##### end of script ##### diff --git a/examples/arkode/F90_serial/plot_sol.py b/examples/arkode/F90_serial/plot_sol.py deleted file mode 100755 index 1175383218..0000000000 --- a/examples/arkode/F90_serial/plot_sol.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# ---------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# ---------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ---------------------------------------------------------------- -# matplotlib-based plotting script for ODE examples - -# imports -import sys -import pylab as plt -import numpy as np - -# load solution data file -data = np.loadtxt('solution.txt', dtype=np.double) - -# determine number of time steps, number of fields -nt,nv = np.shape(data) - -# extract time array -times = data[:,0] - -# parse comment line to determine solution names -f = open('solution.txt', 'r') -commentline = f.readline() -commentsplit = commentline.split() -names = commentsplit[2:] - -# create plot -plt.figure() - -# add curves to figure -for i in range(nv-1): - plt.plot(times,data[:,i+1],label=names[i]) -plt.xlabel('t') -if (nv > 2): - plt.ylabel('solutions') -else: - plt.ylabel('solution') -plt.legend(loc='upper right', shadow=True) -plt.grid() -plt.savefig('solution.png') - - - - -##### end of script ##### diff --git a/examples/cvode/fcmix_parallel/CMakeLists.txt b/examples/cvode/fcmix_parallel/CMakeLists.txt deleted file mode 100644 index f99db2eee2..0000000000 --- a/examples/cvode/fcmix_parallel/CMakeLists.txt +++ /dev/null @@ -1,140 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FCVODE parallel examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FCVODE_examples - "fcvDiag_non_p\;1\;2\;develop" - "fcvDiag_kry_bbd_p\;1\;2\;develop" - "fcvDiag_kry_p\;1\;2\;develop" - ) - -if(MPI_Fortran_COMPILER) - # use MPI wrapper as the compiler - set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) -else() - # add MPI_INCLUDE_PATH to include directories - include_directories(${MPI_INCLUDE_PATH}) -endif() - -# Specify libraries to link againstx -set(FNVECP_LIB sundials_fnvecparallel) - -# Only static FCMIX libraries are available -set(FCVODE_LIB sundials_fcvode${_STATIC_LIB_SUFFIX}) - -if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - list(APPEND FCVODE_LIB sundials_cvode_fused_stubs) -endif() - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FCVODE_LIB} ${FNVECP_LIB}) - -# Add the build and install targets for each example -foreach(example_tuple ${FCVODE_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 number_of_nodes) - list(GET example_tuple 2 number_of_tasks) - list(GET example_tuple 3 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - MPI_NPROCS ${number_of_tasks} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${EXE_EXTRA_LINK_LIBS}) - - if(NOT MPI_Fortran_COMPILER) - target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES}) - endif() - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_parallel) - endif() - -endforeach(example_tuple ${FCVODE_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_parallel) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "CVODE") - set(SOLVER_LIB "sundials_cvode") - set(SOLVER_FLIB "sundials_fcvode") - if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - set(LIBS "-lsundials_cvode_fused_stubs ${LIBS}") - endif() - - examples2string(FCVODE_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_parallel/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_parallel - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_parallel/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_parallel/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_parallel - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(cvode fcmix_parallel) - -endif() diff --git a/examples/cvode/fcmix_parallel/README b/examples/cvode/fcmix_parallel/README deleted file mode 100644 index 14e08e7c87..0000000000 --- a/examples/cvode/fcmix_parallel/README +++ /dev/null @@ -1,48 +0,0 @@ -List of parallel CVODE FCMIX examples - - fcvDiag_non_p : diagonal ODE example - non-stiff case (ADAMS/FIXEDPOINT) - fcvDiag_kry_bbd_p : diagonal ODE example - stiff case (BDF/SPGMR/FCVBBD) - fcvDiag_kry_p : diagonal ODE example - stiff case (BDF/SPGMR) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f b/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f deleted file mode 100644 index c4ea341376..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.f +++ /dev/null @@ -1,336 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C Diagonal ODE example. Stiff case, with diagonal preconditioner. -C Uses FCVODE interfaces and FCVBBD interfaces. -C Solves problem twice -- with left and right preconditioning. -C -------------------------------------------------------------------- -C -C Include MPI-Fortran header file for MPI_COMM_WORLD, MPI types. - - IMPLICIT NONE -C - INCLUDE "mpif.h" -C -C The following declaration specification should match C type long int. - INTEGER*8 NLOCAL, NEQ, I, IOUT(25), IPAR(2), MUDQ, MLDQ, MU, ML - PARAMETER (NLOCAL=10) -C - INTEGER*4 NOUT, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNPE - INTEGER*4 LNLI, LNPS, LNCFL, MYPE, IER, NPES, METH - INTEGER*4 LLENRW, LLENIW, LLENRWLS, LLENIWLS - INTEGER*4 IATOL, ITASK, IPRE, IGS, JOUT -C The following declaration specification should match C type long int. - INTEGER*8 LENRWBBD, LENIWBBD, NGEBBD - INTEGER*8 NST, NFE, NPSET, NPE, NPS, NNI, NLI, NCFN, NCFL, NETF - INTEGER*8 LENRW, LENIW, LENRWLS, LENIWLS - DOUBLE PRECISION Y(1024), ROUT(10), RPAR(1) - DOUBLE PRECISION ALPHA, TOUT, ERMAX, AVDIM - DOUBLE PRECISION ATOL, ERRI, RTOL, GERMAX, DTOUT, T -C - DATA ATOL/1.0D-10/, RTOL/1.0D-5/, DTOUT/0.1D0/, NOUT/10/ - DATA LLENRW/1/, LLENIW/2/, LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, - 1 LNNI/7/, LNSETUP/8/, LLENRWLS/13/, LLENIWLS/14/, - 1 LNPE/20/, LNLI/22/, LNPS/21/, LNCFL/23/ -C -C Get NPES and MYPE. Requires initialization of MPI. - CALL MPI_INIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,5) IER - 5 FORMAT(///' MPI_ERROR: MPI_INIT returned IER = ', I5) - STOP - ENDIF - CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPES, IER) - IF (IER .NE. 0) THEN - WRITE(6,6) IER - 6 FORMAT(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - CALL MPI_COMM_RANK(MPI_COMM_WORLD, MYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,7) IER - 7 FORMAT(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Set input arguments. - NEQ = NPES * NLOCAL - T = 0.0D0 - METH = 2 - IATOL = 1 - ITASK = 1 - IPRE = 1 - IGS = 1 -C Set parameter alpha - ALPHA = 10.0D0 -C -C Load IPAR and RPAR - IPAR(1) = NLOCAL - IPAR(2) = MYPE - RPAR(1) = ALPHA -C - DO I = 1, NLOCAL - Y(I) = 1.0D0 - ENDDO -C - IF (MYPE .EQ. 0) THEN - WRITE(6,15) NEQ, ALPHA, RTOL, ATOL, NPES - 15 FORMAT('Diagonal test problem:'//' NEQ = ', I3, / - & ' parameter alpha = ', F8.3/ - & ' ydot_i = -alpha*i * y_i (i = 1,...,NEQ)'/ - & ' RTOL, ATOL = ', 2E10.1/ - & ' Method is BDF/NEWTON/SPGMR'/ - & ' Preconditioner is band-block-diagonal, using CVBBDPRE' - & /' Number of processors = ', I3/) - ENDIF -C - CALL FNVINITP(MPI_COMM_WORLD, 1, NLOCAL, NEQ, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITP returned IER = ', I5) - CALL MPI_FINALIZE(IER) - STOP - ENDIF -C -C initialize SPGMR linear solver module - call FSUNSPGMRINIT(1, IPRE, 0, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - call FSUNSPGMRSETGSTYPE(1, IGS, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FCVMALLOC(T, Y, METH, IATOL, RTOL, ATOL, - & IOUT, ROUT, IPAR, RPAR, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C attach linear solver module to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - MUDQ = 0 - MLDQ = 0 - MU = 0 - ML = 0 - CALL FCVBBDINIT(NLOCAL, MUDQ, MLDQ, MU, ML, 0.0D0, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVBBDINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IF (MYPE .EQ. 0) WRITE(6,38) - 38 FORMAT(/'Preconditioning on left'/) -C -C Looping point for cases IPRE = 1 and 2. -C - 40 CONTINUE -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 60 JOUT = 1, NOUT -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,45) T, IOUT(LNST), IOUT(LNFE) - 45 FORMAT(' t = ', E10.2, 5X, 'no. steps = ', I5, - & ' no. f-s = ', I5) -C - IF (IER .NE. 0) THEN - WRITE(6,50) IER, IOUT(15) - 50 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 60 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 65 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - ERMAX = MAX(ERMAX, ABS(ERRI)) - 65 CONTINUE -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - & 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,70) IER - 70 FORMAT(///' MPI_ERROR: MPI_REDUCE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,75) GERMAX - 75 FORMAT(/'Max. absolute error is', E10.2/) -C -C Print final statistics. - IF (MYPE .EQ. 0) THEN - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - LENRW = IOUT(LLENRW) - LENIW = IOUT(LLENIW) - LENRWLS = IOUT(LLENRWLS) - LENIWLS = IOUT(LLENIWLS) - WRITE(6,80) NST, NFE, NPSET, NPE, NPS, NNI, NLI, AVDIM, NCFN, - & NCFL, NETF, LENRW, LENIW, LENRWLS, LENIWLS - 80 FORMAT(/'Final statistics:'// - & ' number of steps = ', I5, 4X, - & ' number of f evals. = ', I5/ - & ' number of prec. setups = ', I5/ - & ' number of prec. evals. = ', I5, 4X, - & ' number of prec. solves = ', I5/ - & ' number of nonl. iters. = ', I5, 4X, - & ' number of lin. iters. = ', I5/ - & ' average Krylov subspace dimension (NLI/NNI) = ',F8.4/ - & ' number of conv. failures.. nonlinear = ', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3/ - & ' main solver real/int workspace sizes = ',2I5/ - & ' linear solver real/int workspace sizes = ',2I5) - CALL FCVBBDOPT(LENRWBBD, LENIWBBD, NGEBBD) - WRITE(6,82) LENRWBBD, LENIWBBD, NGEBBD - 82 FORMAT('In CVBBDPRE:'/ - & ' real/int local workspace = ', 2I5/ - & ' number of g evals. = ', I5) - ENDIF -C -C If IPRE = 1, re-initialize T, Y, and the solver, and loop for -C case IPRE = 2. Otherwise jump to final block. - IF (IPRE .EQ. 2) GO TO 99 -C - T = 0.0D0 - DO I = 1, NLOCAL - Y(I) = 1.0D0 - ENDDO -C - CALL FCVREINIT(T, Y, IATOL, RTOL, ATOL, IER) - IF (IER .NE. 0) THEN - WRITE(6,91) IER - 91 FORMAT(///' SUNDIALS_ERROR: FCVREINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IPRE = 2 -C - CALL FCVBBDREINIT(MUDQ, MLDQ, 0.0D0, IER) - IF (IER .NE. 0) THEN - WRITE(6,92) IER - 92 FORMAT(///' SUNDIALS_ERROR: FCVBBDREINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FSUNSPGMRSETPRECTYPE(1, IPRE, IER) - IF (IER .NE. 0) THEN - WRITE(6,93) IER - 93 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETPRECTYPE IER = ',I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - IF (MYPE .EQ. 0) WRITE(6,95) - 95 FORMAT(//60('-')///'Preconditioning on right'/) - GO TO 40 -C -C Free the memory and finalize MPI. - 99 CALL FCVFREE - CALL MPI_FINALIZE(IER) -C - STOP - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function f - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*), MYPE, I, NLOCAL - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) - DOUBLE PRECISION ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = -ALPHA * (MYPE * NLOCAL + I) * Y(I) - ENDDO -C - IER = 0 -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVGLOCFN(NLOC, T, YLOC, GLOC, IPAR, RPAR, IER) -C Routine to define local approximate function g, here the same as f. - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 NLOC, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, YLOC(*), GLOC(*), RPAR(*) -C - CALL FCVFUN(T, YLOC, GLOC, IPAR, RPAR, IER) -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVCOMMFN(NLOC, T, YLOC, IPAR, RPAR, IER) -C Routine to perform communication required for evaluation of g. - INTEGER*8 NLOC, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, YLOC(*), RPAR(*) - IER = 0 - RETURN - END diff --git a/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.out b/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.out deleted file mode 100644 index fd707e5064..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_kry_bbd_p.out +++ /dev/null @@ -1,76 +0,0 @@ -Diagonal test problem: - - NEQ = 20 - parameter alpha = 10.000 - ydot_i = -alpha*i * y_i (i = 1,...,NEQ) - RTOL, ATOL = 0.1E-04 0.1E-09 - Method is BDF/NEWTON/SPGMR - Preconditioner is band-block-diagonal, using CVBBDPRE - Number of processors = 2 - - -Preconditioning on left - - t = 0.10E+00 no. steps = 174 no. f-s = 213 - t = 0.20E+00 no. steps = 222 no. f-s = 262 - t = 0.30E+00 no. steps = 247 no. f-s = 288 - t = 0.40E+00 no. steps = 265 no. f-s = 307 - t = 0.50E+00 no. steps = 278 no. f-s = 321 - t = 0.60E+00 no. steps = 290 no. f-s = 333 - t = 0.70E+00 no. steps = 300 no. f-s = 344 - t = 0.80E+00 no. steps = 307 no. f-s = 351 - t = 0.90E+00 no. steps = 312 no. f-s = 357 - t = 0.10E+01 no. steps = 317 no. f-s = 362 - -Max. absolute error is 0.90E-08 - - -Final statistics: - - number of steps = 317 number of f evals. = 362 - number of prec. setups = 33 - number of prec. evals. = 6 number of prec. solves = 644 - number of nonl. iters. = 359 number of lin. iters. = 322 - average Krylov subspace dimension (NLI/NNI) = 0.8969 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 5 - main solver real/int workspace sizes = 349 92 - linear solver real/int workspace sizes = 294 78 -In CVBBDPRE: - real/int local workspace = 100 60 - number of g evals. = 12 - - ------------------------------------------------------------- - - -Preconditioning on right - - t = 0.10E+00 no. steps = 174 no. f-s = 213 - t = 0.20E+00 no. steps = 222 no. f-s = 262 - t = 0.30E+00 no. steps = 247 no. f-s = 288 - t = 0.40E+00 no. steps = 265 no. f-s = 307 - t = 0.50E+00 no. steps = 278 no. f-s = 321 - t = 0.60E+00 no. steps = 290 no. f-s = 333 - t = 0.70E+00 no. steps = 300 no. f-s = 344 - t = 0.80E+00 no. steps = 307 no. f-s = 351 - t = 0.90E+00 no. steps = 312 no. f-s = 357 - t = 0.10E+01 no. steps = 317 no. f-s = 362 - -Max. absolute error is 0.90E-08 - - -Final statistics: - - number of steps = 317 number of f evals. = 362 - number of prec. setups = 33 - number of prec. evals. = 6 number of prec. solves = 644 - number of nonl. iters. = 359 number of lin. iters. = 322 - average Krylov subspace dimension (NLI/NNI) = 0.8969 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 5 - main solver real/int workspace sizes = 349 92 - linear solver real/int workspace sizes = 294 78 -In CVBBDPRE: - real/int local workspace = 100 60 - number of g evals. = 12 diff --git a/examples/cvode/fcmix_parallel/fcvDiag_kry_p.f b/examples/cvode/fcmix_parallel/fcvDiag_kry_p.f deleted file mode 100644 index fa9ac18023..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_kry_p.f +++ /dev/null @@ -1,376 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C Diagonal ODE example. Stiff case, with BDF/SPGMR, diagonal -C preconditioner. Solved with preconditioning on left, then with -C preconditioning on right. -C -------------------------------------------------------------------- -C -C Include MPI-Fortran header file for MPI_COMM_WORLD, MPI types. - - IMPLICIT NONE -C - INCLUDE "mpif.h" -C -C The following declaration specification should match C type long int. - INTEGER*8 NLOCAL, NEQ, I, IOUT(25), IPAR(2) - PARAMETER (NLOCAL=10) -C - INTEGER*4 LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNPE, LNLI, LNPS - INTEGER*4 LNCFL, NOUT, MYPE, NPES, IER, METH, IATOL - INTEGER*4 ITASK, IPRE, IGS, JOUT - INTEGER*8 NST, NFE, NPSET, NPE, NPS, NNI, NLI - INTEGER*8 NCFL, NETF, NCFN - DOUBLE PRECISION Y(1024), ROUT(10), RPAR(1) - DOUBLE PRECISION ATOL, DTOUT, T, ALPHA, RTOL, TOUT, ERMAX, ERRI - DOUBLE PRECISION GERMAX, AVDIM -C - DATA ATOL/1.0D-10/, RTOL/1.0D-5/, DTOUT/0.1D0/, NOUT/10/ - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNPE/20/, LNLI/22/, LNPS/21/, LNCFL/23/ -C -C Get NPES and MYPE. Requires initialization of MPI. - CALL MPI_INIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,5) IER - 5 FORMAT(///' MPI_ERROR: MPI_INIT returned IER = ', I5) - STOP - ENDIF - CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPES, IER) - IF (IER .NE. 0) THEN - WRITE(6,6) IER - 6 FORMAT(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - CALL MPI_COMM_RANK(MPI_COMM_WORLD, MYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,7) IER - 7 FORMAT(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Set input arguments. - NEQ = NPES * NLOCAL - T = 0.0D0 - METH = 2 - IATOL = 1 - ITASK = 1 - IPRE = 1 - IGS = 1 -C Set parameter alpha - ALPHA = 10.0D0 -C -C Load IPAR and RPAR - IPAR(1) = NLOCAL - IPAR(2) = MYPE - RPAR(1) = ALPHA -C -C Do remaining initializations for first case: IPRE = 1 (prec. on left). -C - DO 10 I = 1, NLOCAL - 10 Y(I) = 1.0D0 -C - IF (MYPE .EQ. 0) THEN - WRITE(6,11) NEQ, ALPHA - 11 FORMAT('Diagonal test problem:'//' NEQ = ', I3, - 1 ' parameter alpha = ', F8.3) - WRITE(6,12) - 12 FORMAT(' ydot_i = -alpha*i * y_i (i = 1,...,NEQ)') - WRITE(6,13) RTOL, ATOL - 13 FORMAT(' RTOL, ATOL = ', 2E10.1) - WRITE(6,14) - 14 FORMAT(' Method is BDF/NEWTON/SPGMR'/ - 1 ' Diagonal preconditioner uses approximate Jacobian') - WRITE(6,15) NPES - 15 FORMAT(' Number of processors = ', I3) - WRITE(6,16) - 16 FORMAT(//'Preconditioning on left'/) - ENDIF -C - CALL FNVINITP(MPI_COMM_WORLD, 1, NLOCAL, NEQ, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITP returned IER = ', I5) - CALL MPI_FINALIZE(IER) - STOP - ENDIF -C -C initialize SPGMR linear solver module - call FSUNSPGMRINIT(1, IPRE, 0, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - call FSUNSPGMRSETGSTYPE(1, IGS, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FCVMALLOC(T, Y, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C attach linear solver module to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C attach preconditioner to CVLs interface - CALL FCVLSSETPREC(1, IER) -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 70 JOUT = 1, NOUT -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,40) T, IOUT(LNST), IOUT(LNFE) - 40 FORMAT(' t = ', E10.2, 5X, 'no. steps = ', I5, - & ' no. f-s = ', I5) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 70 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 75 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - 75 ERMAX = MAX(ERMAX, ABS(ERRI)) -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - 1 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' MPI_ERROR: MPI_REDUCE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,85) GERMAX - 85 FORMAT(/'Max. absolute error is ', E10.2/) -C -C Print final statistics. - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - IF (MYPE .EQ. 0) - 1 WRITE (6,90) NST, NFE, NPSET, NPE, NPS, NNI, NLI, AVDIM, NCFN, - & NCFL, NETF - 90 FORMAT(/'Final statistics:'// - & ' number of steps = ', I5, 5X, - & 'number of f evals. =', I5/ - & ' number of prec. setups = ', I5/ - & ' number of prec. evals. = ', I5, 5X, - & 'number of prec. solves = ', I5/ - & ' number of nonl. iters. = ', I5, 5X, - & 'number of lin. iters. = ', I5/ - & ' average Krylov subspace dimension (NLI/NNI) = ', F8.4/ - & ' number of conv. failures.. nonlinear = ', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3) -C -C Re-initialize to run second case: IPRE = 2 (prec. on right). - IPRE = 2 - T = 0.0D0 - DO 110 I = 1, NLOCAL - 110 Y(I) = 1.0D0 -C - IF (MYPE .EQ. 0) WRITE(6,111) - 111 FORMAT(//60('-')///'Preconditioning on right'/) -C - CALL FCVREINIT(T, Y, IATOL, RTOL, ATOL, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,130) IER - 130 FORMAT(///' SUNDIALS_ERROR: FCVREINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - CALL FSUNSPGMRSETPRECTYPE(1, IPRE, IER) - IF (IER .NE. 0) THEN - WRITE(6,140) IER - 140 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETPRECTYPE IER = ',I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 170 JOUT = 1, NOUT -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,40) T, IOUT(LNST), IOUT(LNFE) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 170 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 175 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - 175 ERMAX = MAX(ERMAX, ABS(ERRI)) -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - 1 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,85) GERMAX -C -C Print final statistics. - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - IF (MYPE .EQ. 0) - 1 WRITE (6,90) NST, NFE, NPSET, NPE, NPS, NNI, NLI, AVDIM, NCFN, - & NCFL, NETF -C -C Free the memory and finalize MPI. - CALL FCVFREE - CALL MPI_FINALIZE(IER) - IF (IER .NE. 0) THEN - WRITE(6,195) IER - 195 FORMAT(///' MPI_ERROR: MPI_FINALIZE returned IER = ', I5) - STOP - ENDIF -C - STOP - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function f - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*), MYPE, I, NLOCAL - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) - DOUBLE PRECISION ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = -ALPHA * (MYPE * NLOCAL + I) * Y(I) - ENDDO -C - IER = 0 -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVPSOL(T, Y, FY, R, Z, GAMMA, DELTA, LR, - & IPAR, RPAR, IER) -C Routine to solve preconditioner linear system -C This routine uses a diagonal preconditioner P = I - gamma*J, -C where J is a diagonal approximation to the true Jacobian, given by: -C J = diag(0, 0, 0, -4*alpha, ..., -N*alpha). -C The vector r is copied to z, and the inverse of P (restricted to the -C local vector segment) is applied to the vector z. - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*), NLOCAL, I, MYPE, ISTART, IBASE - INTEGER*4 IER, LR - DOUBLE PRECISION T, Y(*), FY(*), R(*), Z(*) - DOUBLE PRECISION GAMMA, DELTA, RPAR(*) - DOUBLE PRECISION PSUBI, ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - Z(I) = R(I) - ENDDO -C - IBASE = MYPE * NLOCAL - ISTART = MAX(1, 4 - IBASE) - DO I = ISTART, NLOCAL - PSUBI = 1.0D0 + GAMMA * ALPHA * (IBASE + I) - Z(I) = Z(I) / PSUBI - ENDDO -C - RETURN - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVPSET(T, Y, FY, JOK, JCUR, GAMMA, H, - & IPAR, RPAR, IER) -C Empty subroutine. Not needed for the preconditioner, but required -C by the FCVODE module. - INTEGER*4 IER, JOK, JCUR - DOUBLE PRECISION T, Y(*), FY(*), GAMMA, H -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - DOUBLE PRECISION RPAR(*) - - IER = 0 - RETURN - END diff --git a/examples/cvode/fcmix_parallel/fcvDiag_kry_p.out b/examples/cvode/fcmix_parallel/fcvDiag_kry_p.out deleted file mode 100644 index 342ab32155..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_kry_p.out +++ /dev/null @@ -1,65 +0,0 @@ -Diagonal test problem: - - NEQ = 20 parameter alpha = 10.000 - ydot_i = -alpha*i * y_i (i = 1,...,NEQ) - RTOL, ATOL = 0.1E-04 0.1E-09 - Method is BDF/NEWTON/SPGMR - Diagonal preconditioner uses approximate Jacobian - Number of processors = 2 - - -Preconditioning on left - - t = 0.10E+00 no. steps = 174 no. f-s = 213 - t = 0.20E+00 no. steps = 222 no. f-s = 262 - t = 0.30E+00 no. steps = 247 no. f-s = 288 - t = 0.40E+00 no. steps = 265 no. f-s = 307 - t = 0.50E+00 no. steps = 279 no. f-s = 322 - t = 0.60E+00 no. steps = 290 no. f-s = 333 - t = 0.70E+00 no. steps = 300 no. f-s = 344 - t = 0.80E+00 no. steps = 307 no. f-s = 351 - t = 0.90E+00 no. steps = 312 no. f-s = 357 - t = 0.10E+01 no. steps = 317 no. f-s = 362 - -Max. absolute error is 0.76E-08 - - -Final statistics: - - number of steps = 317 number of f evals. = 362 - number of prec. setups = 33 - number of prec. evals. = 6 number of prec. solves = 649 - number of nonl. iters. = 359 number of lin. iters. = 327 - average Krylov subspace dimension (NLI/NNI) = 0.9109 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 5 - - ------------------------------------------------------------- - - -Preconditioning on right - - t = 0.10E+00 no. steps = 174 no. f-s = 213 - t = 0.20E+00 no. steps = 222 no. f-s = 262 - t = 0.30E+00 no. steps = 247 no. f-s = 288 - t = 0.40E+00 no. steps = 265 no. f-s = 307 - t = 0.50E+00 no. steps = 279 no. f-s = 322 - t = 0.60E+00 no. steps = 290 no. f-s = 333 - t = 0.70E+00 no. steps = 300 no. f-s = 344 - t = 0.80E+00 no. steps = 307 no. f-s = 351 - t = 0.90E+00 no. steps = 312 no. f-s = 357 - t = 0.10E+01 no. steps = 317 no. f-s = 362 - -Max. absolute error is 0.77E-08 - - -Final statistics: - - number of steps = 317 number of f evals. = 362 - number of prec. setups = 33 - number of prec. evals. = 6 number of prec. solves = 649 - number of nonl. iters. = 359 number of lin. iters. = 327 - average Krylov subspace dimension (NLI/NNI) = 0.9109 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 5 diff --git a/examples/cvode/fcmix_parallel/fcvDiag_non_p.f b/examples/cvode/fcmix_parallel/fcvDiag_non_p.f deleted file mode 100644 index 95e7432dc5..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_non_p.f +++ /dev/null @@ -1,217 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C Diagonal ODE example. Nonstiff case: alpha = 10/NEQ. -C -------------------------------------------------------------------- -C -C Include MPI-Fortran header file for MPI_COMM_WORLD, MPI types. -C - IMPLICIT NONE -C - INCLUDE "mpif.h" -C -C The following declaration specification should match C type long int. - INTEGER*8 NLOCAL, NEQ, I, IOUT(25), IPAR(2) - PARAMETER (NLOCAL=2) -C - INTEGER*4 IER, MYPE, NPES, NOUT, LNST, LNFE, LNNI, LNCF, LNETF - INTEGER*4 METH, IATOL, ITASK, JOUT - INTEGER*8 NST, NFE, NNI, NCFN, NETF - DOUBLE PRECISION Y(128), ROUT(10), RPAR(1) - DOUBLE PRECISION ATOL, RTOL, DTOUT, T, ALPHA, TOUT - DOUBLE PRECISION ERMAX, ERRI, GERMAX -C - DATA ATOL/1.0D-10/, RTOL/1.0D-5/, DTOUT/0.1D0/, NOUT/10/ - DATA LNST/3/, LNFE/4/, LNNI/7/, LNCF/6/, LNETF/5/ -C -C Get NPES and MYPE. Requires initialization of MPI. - CALL MPI_INIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,5) IER - 5 FORMAT(///' MPI_ERROR: MPI_INIT returned IER = ', I5) - STOP - ENDIF - CALL MPI_COMM_SIZE(MPI_COMM_WORLD, NPES, IER) - IF (IER .NE. 0) THEN - WRITE(6,6) IER - 6 FORMAT(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - CALL MPI_COMM_RANK(MPI_COMM_WORLD, MYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,7) IER - 7 FORMAT(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Set input arguments. - NEQ = NPES * NLOCAL - T = 0.0D0 - METH = 1 - IATOL = 1 - ITASK = 1 -c Set parameter ALPHA - ALPHA = 10.0D0 / NEQ -C -C Load IPAR and RPAR - IPAR(1) = NLOCAL - IPAR(2) = MYPE - RPAR(1) = ALPHA -C - DO 10 I = 1, NLOCAL - 10 Y(I) = 1.0D0 -C - IF (MYPE .EQ. 0) THEN - WRITE(6,11) NEQ, ALPHA - 11 FORMAT('Diagonal test problem:'//' NEQ = ', I3, / - 1 ' parameter alpha = ', F8.3) - WRITE(6,12) - 12 FORMAT(' ydot_i = -alpha*i * y_i (i = 1,...,NEQ)') - WRITE(6,13) RTOL, ATOL - 13 FORMAT(' RTOL, ATOL = ', 2E10.1) - WRITE(6,14) - 14 FORMAT(' Method is ADAMS/FIXEDPOINT') - WRITE(6,15) NPES - 15 FORMAT(' Number of processors = ', I3//) - ENDIF -C - CALL FNVINITP(MPI_COMM_WORLD, 1, NLOCAL, NEQ, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITP returned IER = ', I5) - CALL MPI_FINALIZE(IER) - STOP - ENDIF -C - CALL FCVMALLOC(T, Y, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Create Fixed Point Solver - CALL FSUNFIXEDPOINTINIT(1, 0, IER) -C - IF (IER .NE. 0) THEN - WRITE(6,31) IER - 31 FORMAT( - 1 ///' SUNDIALS_ERROR: FSUNFIXEDPOINTINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Attach Fixed Point Solver - CALL FCVNLSINIT(IER) -C - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FCVNLSINIT returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C -C Loop through tout values, call solver, print output, test for failure. - TOUT = DTOUT - DO 70 JOUT = 1, NOUT -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - IF (MYPE .EQ. 0) WRITE(6,40) T, IOUT(LNST), IOUT(LNFE) - 40 FORMAT(' t = ', D10.2, 5X, 'no. steps = ', I5, - & ' no. f-s = ', I5) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 70 CONTINUE -C -C Get max. absolute error in the local vector. - ERMAX = 0.0D0 - DO 75 I = 1, NLOCAL - ERRI = Y(I) - EXP(-ALPHA * (MYPE * NLOCAL + I) * T) - ERMAX = MAX(ERMAX, ABS(ERRI)) - 75 CONTINUE -C Get global max. error from MPI_REDUCE call. - CALL MPI_REDUCE(ERMAX, GERMAX, 1, MPI_DOUBLE_PRECISION, MPI_MAX, - 1 0, MPI_COMM_WORLD, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' MPI_ERROR: MPI_REDUCE returned IER = ', I5) - CALL MPI_ABORT(MPI_COMM_WORLD, 1, IER) - STOP - ENDIF - IF (MYPE .EQ. 0) WRITE(6,85) GERMAX - 85 FORMAT(/'Max. absolute error is ', E10.2/) -C -C Print final statistics. - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NNI = IOUT(LNNI) - NCFN = IOUT(LNCF) - NETF = IOUT(LNETF) - IF (MYPE .EQ. 0) WRITE (6,90) NST, NFE, NNI, NCFN, NETF - 90 FORMAT(/'Final statistics:'// - & ' number of steps = ', I5, 5X, /, - & ' number of f evals. = ', I5/ - & ' number of nonlinear iters. = ', I5/ - & ' number of nonlinear conv. failures = ', I3/ - & ' number of error test failures = ', I3) -C -C Free the memory and finalize MPI. - CALL FCVFREE - CALL MPI_FINALIZE(IER) - IF (IER .NE. 0) THEN - WRITE(6,95) IER - 95 FORMAT(///' MPI_ERROR: MPI_FINALIZE returned IER = ', I5) - STOP - ENDIF -C - STOP - END -C -C ------------------------------------------------------------------------ -C - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Routine for right-hand side function f -C - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*), MYPE, I, NLOCAL - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) - DOUBLE PRECISION ALPHA -C - NLOCAL = IPAR(1) - MYPE = IPAR(2) - ALPHA = RPAR(1) -C - DO I = 1, NLOCAL - YDOT(I) = -ALPHA * (MYPE * NLOCAL + I) * Y(I) - ENDDO -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_parallel/fcvDiag_non_p.out b/examples/cvode/fcmix_parallel/fcvDiag_non_p.out deleted file mode 100644 index 9215a2b642..0000000000 --- a/examples/cvode/fcmix_parallel/fcvDiag_non_p.out +++ /dev/null @@ -1,31 +0,0 @@ -Diagonal test problem: - - NEQ = 4 - parameter alpha = 2.500 - ydot_i = -alpha*i * y_i (i = 1,...,NEQ) - RTOL, ATOL = 0.1E-04 0.1E-09 - Method is ADAMS/FIXEDPOINT - Number of processors = 2 - - - t = 0.10D+00 no. steps = 15 no. f-s = 32 - t = 0.20D+00 no. steps = 22 no. f-s = 39 - t = 0.30D+00 no. steps = 30 no. f-s = 47 - t = 0.40D+00 no. steps = 38 no. f-s = 55 - t = 0.50D+00 no. steps = 46 no. f-s = 63 - t = 0.60D+00 no. steps = 54 no. f-s = 71 - t = 0.70D+00 no. steps = 61 no. f-s = 78 - t = 0.80D+00 no. steps = 69 no. f-s = 86 - t = 0.90D+00 no. steps = 77 no. f-s = 94 - t = 0.10D+01 no. steps = 85 no. f-s = 102 - -Max. absolute error is 0.33E-07 - - -Final statistics: - - number of steps = 85 - number of f evals. = 102 - number of nonlinear iters. = 99 - number of nonlinear conv. failures = 0 - number of error test failures = 3 diff --git a/examples/cvode/fcmix_serial/CMakeLists.txt b/examples/cvode/fcmix_serial/CMakeLists.txt deleted file mode 100644 index 91a39cbecf..0000000000 --- a/examples/cvode/fcmix_serial/CMakeLists.txt +++ /dev/null @@ -1,288 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# David J. Gardner @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FCVODE serial examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FCVODE_examples - "fcvAdvDiff_bnd\;develop" - "fcvDiurnal_kry_bp\;develop" - "fcvDiurnal_kry\;develop" - "fcvRoberts_dns\;develop" - "fcvRoberts_dns_constraints\;develop" - ) - -# Examples using LAPACK linear solvers -set(FCVODE_examples_BL - "fcvRoberts_dnsL\;develop" - ) - -# Add sparse solvers examples for 64-bit indextype configurations only, -# not compatible with 32-bit indextype -if(SUNDIALS_INDEX_SIZE MATCHES "64") - - # Examples using KLU linear solver - set(FCVODE_examples_KLU - "fcvRoberts_klu\;develop" - ) - - # Examples using SuperLU_MT linear solver - set(FCVODE_examples_SUPERLUMT - "fcvRoberts_sps\;develop" - ) - -endif() - -# Specify libraries to link against -set(FNVECS_LIB sundials_fnvecserial) - -# Only static FCMIX libraries are available -set(FCVODE_LIB sundials_fcvode${_STATIC_LIB_SUFFIX}) - -if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - list(APPEND FCVODE_LIB sundials_cvode_fused_stubs) -endif() - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FCVODE_LIB} ${FNVECS_LIB}) - -# Add the build and install targets for each example -foreach(example_tuple ${FCVODE_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${EXE_EXTRA_LINK_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial) - endif() - -endforeach(example_tuple ${FCVODE_examples}) - - -# Add the build and install targets for each LAPACK example (if needed) -if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - - set(SUNLINSOLLAPACK_LIBS - sundials_sunlinsollapackband - sundials_sunlinsollapackdense - sundials_fsunlinsollapackband - sundials_fsunlinsollapackdense) - - # LAPACK libraries - list(APPEND SUNLINSOLLAPACK_LIBS ${LAPACK_LIBRARIES}) - - foreach(example_tuple ${FCVODE_examples_BL}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial) - endif() - - endforeach(example_tuple ${FCVODE_examples_BL}) - -endif() - - -# Add the build and install targets for each KLU example (if needed) -if(BUILD_SUNLINSOL_KLU) - - set(SUNLINSOLKLU_LIBS - sundials_sunlinsolklu - sundials_fsunlinsolklu) - - # KLU libraries - list(APPEND SUNLINSOLKLU_LIBS) - - foreach(example_tuple ${FCVODE_examples_KLU}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial) - endif() - - endforeach(example_tuple ${FCVODE_examples_KLU}) - -endif() - - -# Add the build and install targets for each SuperLU_MT example (if needed) -if(BUILD_SUNLINSOL_SUPERLUMT) - - set(SUNLINSOLSLUMT_LIBS - sundials_sunlinsolsuperlumt - sundials_fsunlinsolsuperlumt) - - foreach(example_tuple ${FCVODE_examples_SUPERLUMT}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial) - endif() - - endforeach(example_tuple ${FCVODE_examples_SUPERLUMT}) - -endif() - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "CVODE") - set(SOLVER_LIB "sundials_cvode") - set(SOLVER_FLIB "sundials_fcvode") - if(SUNDIALS_BUILD_PACKAGE_FUSED_KERNELS) - set(LIBS "-lsundials_cvode_fused_stubs ${LIBS}") - endif() - - examples2string(FCVODE_examples EXAMPLES) - - if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE) - examples2string(FCVODE_examples_BL EXAMPLES_BL) - else() - set(EXAMPLES_BL "") - endif() - - if(BUILD_SUNLINSOL_KLU) - examples2string(FCVODE_examples_KLU EXAMPLES_KLU) - else() - set(EXAMPLES_KLU "") - endif() - - if(BUILD_SUNLINSOL_SUPERLUMT) - examples2string(FCVODE_examples_SUPERLUMT EXAMPLES_SLUMT) - else() - set(EXAMPLES_SLUMT "") - endif() - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_serial/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_serial/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/cvode/fcmix_serial/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/cvode/fcmix_serial - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(cvode fcmix_serial) - -endif() diff --git a/examples/cvode/fcmix_serial/README b/examples/cvode/fcmix_serial/README deleted file mode 100644 index a1c5bb387a..0000000000 --- a/examples/cvode/fcmix_serial/README +++ /dev/null @@ -1,52 +0,0 @@ -List of serial CVODE FCMIX examples - - fcvAdvDiff_bnd : advection-diffusion example (BDF/BAND) - fcvDiurnal_kry_bp : kinetics-transport example (BDF/SPGMR/FCVBP) - fcvDiurnal_kry : kinetics-transport example (BDF/SPGMR/User Prec) - fcvRoberts_dns : chemical kinetics example (BDF/DENSE) - fcvRoberts_dnsL : chemical kinetics example (BDF/DENSE lapack) - fcvRoberts_klu : dense kinetics example with KLU sparse linear solver - fcvRoberts_sps : dense kinetics example with SuperLUMT sparse solver - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.f b/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.f deleted file mode 100644 index 532caac99d..0000000000 --- a/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.f +++ /dev/null @@ -1,316 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: Advection-diffusion, band linear solver -C with banded user Jacobian. -C -C The following is a simple example problem with a banded -C Jacobian. The problem is the semi-discrete form of the -C advection-diffusion equation in 2D: -C du/dt = d^2 u / dx^2 + .5 du/dx + d^2 u / dy^2 -C on the rectangle 0 <= x <= 2, 0 <= y <= 1, and the time -C interval 0 <= t <= 1. Homogeneous Dirichlet boundary conditions -C are posed, and the initial condition is the following: -C u(x,y,t=0) = x(2-x)y(1-y)exp(5xy) . -C The PDE is discretized on a uniform MX+2 by MY+2 grid with -C central differencing, and with boundary values eliminated, -C leaving an ODE system of size NEQ = MX*MY. -C This program solves this problem with CVODE, using the Fortran/C -C interface routine package. This solution uses the BDF method, -C a user-supplied banded Jacobian routine, and scalar relative and -C absolute tolerances. It prints results at t = .1, .2, ..., 1.0. -C At the end of the run, various counters of interest are printed. -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 MX, MY, MXMY - PARAMETER (MX=10, MY=5) - PARAMETER (MXMY=MX*MY) -C - DOUBLE PRECISION XMAX, YMAX - DATA XMAX/2.0D0/, YMAX/1.0D0/ -C - INTEGER*4 LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE - INTEGER*4 IER, METH, IATOL, ITASK, JOUT -C The following declaration specification should match C type long int. - INTEGER*8 NEQ, IOUT(25), IPAR(2), MU, ML - DOUBLE PRECISION RTOL, ATOL, T0, T, TOUT, DTOUT, UNORM - DOUBLE PRECISION U(MXMY), ROUT(10), RPAR(5) -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNJE/17/ -C - CALL INITBX(XMAX, YMAX, MX, MY, U, IPAR, RPAR) -C - NEQ = MX*MY - T0 = 0.0D0 - METH = 2 - IATOL = 1 - RTOL = 0.0D0 - ATOL = 1.0D-5 - MU = MY - ML = MY - DTOUT = 0.1D0 - ITASK = 1 -C - WRITE(6,10) NEQ - 10 FORMAT('Band example problem:'// - 1 ' Advection-diffusion, NEQ = ', I2//) -C - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF -C -C initialize banded matrix module - call FSUNBANDMATINIT(1, NEQ, MU, ML, MU+ML, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNBANDEMATINIT IER = ', I5) - STOP - ENDIF -C -C initialize banded linear solver module - call FSUNBANDLINSOLINIT(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNBANDLINSOLINIT IER = ', I5) - STOP - ENDIF -C - CALL FCVMALLOC(T0, U, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF -C -C attach matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ',I5) - CALL FCVFREE - STOP - ENDIF -C - CALL FCVBANDSETJAC(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVDENSESETJAC returned IER = ',I5) - CALL FCVFREE - STOP - ENDIF -C - CALL MAXNORM(NEQ, U, UNORM) - WRITE(6,48) T0, UNORM - 48 FORMAT(' At t = ', F6.2, ' max.norm(u) = ', E14.6) -C - TOUT = DTOUT - DO 70 JOUT = 1, 10 -C - CALL FCVODE(TOUT, T, U, ITASK, IER) -C - CALL MAXNORM(NEQ, U, UNORM) - WRITE(6,50) T, UNORM, IOUT(LNST) - 50 FORMAT(' At t = ', F6.2, ' max.norm(u) = ', E14.6, - 1 ' NST = ', I4) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF -C - TOUT = TOUT + DTOUT - 70 CONTINUE -C - WRITE(6,80) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF) - 80 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4) -C - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE INITBX(XMAX, YMAX, MX, MY, U0, IPAR, RPAR) -C Load IPAR and RPAR with problem constants and U0 with initial values - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - INTEGER*4 MX, MY - DOUBLE PRECISION XMAX, YMAX, U0(MY,MX), RPAR(*) -C - INTEGER*4 I, J - DOUBLE PRECISION DX, DY, X, Y, HDCOEF, HACOEF, VDCOEF -C -C Problem constants - DX = XMAX / (MX + 1) - DY = YMAX / (MY + 1) - HDCOEF = 1.0D0 / (DX * DX) - HACOEF = 0.5D0 / (2.0D0 * DX) - VDCOEF = 1.0D0 / (DY * DY) -C Load constants in IPAR and RPAR - IPAR(1) = MX - IPAR(2) = MY - RPAR(1) = DX - RPAR(2) = DY - RPAR(3) = HDCOEF - RPAR(4) = HACOEF - RPAR(5) = VDCOEF -C -C Loop over grid and load initial values. - DO 20 I = 1, MX - X = I * DX - DO 10 J = 1, MY - Y = J * DY - U0(J,I) = X * (XMAX - X) * Y * (YMAX - Y) * - * EXP(5.0D0 * X * Y) - 10 CONTINUE - 20 CONTINUE -C - RETURN - END - - SUBROUTINE MAXNORM(N, U, UNORM) -C Compute max-norm of array U - IMPLICIT NONE -C - INTEGER*8 I, N - DOUBLE PRECISION U(*), UNORM, TEMP -C - TEMP = 0.0D0 - DO 10 I = 1, N - TEMP = MAX(ABS(U(I)), TEMP) - 10 CONTINUE - UNORM = TEMP - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, U, UDOT, IPAR, RPAR, IER) -C Right-hand side routine - IMPLICIT NONE -C - DOUBLE PRECISION T, U(*), UDOT(*), RPAR(*) -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - INTEGER*4 I, MX, IOFF, MY, J, IJ - DOUBLE PRECISION UIJ, UDN, UUP, ULT, URT, HDIFF, HADV, VDIFF - DOUBLE PRECISION DX, DY, HDCOEF, HACOEF, VDCOEF -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - DX = RPAR(1) - DY = RPAR(2) - HDCOEF = RPAR(3) - HACOEF = RPAR(4) - VDCOEF = RPAR(5) -C -C Loop over all grid points. - DO 20 I = 1, MX - IOFF = (I - 1) * MY - DO 10 J = 1, MY -C -C Extract u at x_i, y_j and four neighboring points. - IJ = J + IOFF - UIJ = U(IJ) - UDN = 0.0D0 - IF (J .NE. 1) UDN = U(IJ - 1) - UUP = 0.0D0 - IF (J .NE. MY) UUP = U(IJ + 1) - ULT = 0.0D0 - IF (I .NE. 1) ULT = U(IJ - MY) - URT = 0.0D0 - IF (I .NE. MX) URT = U(IJ + MY) -C -C Set diffusion and advection terms and load into UDOT. - HDIFF = HDCOEF * (ULT - 2.0D0 * UIJ + URT) - HADV = HACOEF * (URT - ULT) - VDIFF = VDCOEF * (UUP - 2.0D0 * UIJ + UDN) - UDOT(IJ) = HDIFF + HADV + VDIFF - 10 CONTINUE - 20 CONTINUE -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVBJAC(N, MU, ML, MDIM, T, U, FU, - 1 BJAC, H, IPAR, RPAR, V1, V2, V3, IER) -C Load banded Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 N, MU, ML, MDIM, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, U(*), FU(*), BJAC(MDIM,*), H, RPAR(*) - DOUBLE PRECISION V1(*), V2(*), V3(*) -C - INTEGER*4 MBAND, MX, MY - INTEGER*4 I, J, K, IOFF, MU1, MU2 - DOUBLE PRECISION DX, DY, HDCOEF, HACOEF, VDCOEF -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - DX = RPAR(1) - DY = RPAR(2) - HDCOEF = RPAR(3) - HACOEF = RPAR(4) - VDCOEF = RPAR(5) -C - MU1 = MU + 1 - MU2 = MU + 2 - MBAND = MU + 1 + ML -C -C Loop over all grid points. - DO 20 I = 1, MX - IOFF = (I - 1) * MY - DO 10 J = 1, MY - K = J + IOFF -C -C Set Jacobian elements in column k of Jb. - BJAC(MU1,K) = -2.0D0 * (VDCOEF + HDCOEF) - IF (I .NE. 1) BJAC(1,K) = HDCOEF + HACOEF - IF (I .NE. MX) BJAC(MBAND,K) = HDCOEF - HACOEF - IF (J .NE. 1) BJAC(MU,K) = VDCOEF - IF (J .NE. MY) BJAC(MU2,K) = VDCOEF -C - 10 CONTINUE - 20 CONTINUE -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.out b/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.out deleted file mode 100644 index 98819b8833..0000000000 --- a/examples/cvode/fcmix_serial/fcvAdvDiff_bnd.out +++ /dev/null @@ -1,24 +0,0 @@ -Band example problem: - - Advection-diffusion, NEQ = 50 - - - At t = 0.00 max.norm(u) = 0.895472E+02 - At t = 0.10 max.norm(u) = 0.413289E+01 NST = 85 - At t = 0.20 max.norm(u) = 0.103929E+01 NST = 103 - At t = 0.30 max.norm(u) = 0.297983E+00 NST = 113 - At t = 0.40 max.norm(u) = 0.876577E-01 NST = 120 - At t = 0.50 max.norm(u) = 0.262564E-01 NST = 126 - At t = 0.60 max.norm(u) = 0.783042E-02 NST = 130 - At t = 0.70 max.norm(u) = 0.232939E-02 NST = 134 - At t = 0.80 max.norm(u) = 0.695343E-03 NST = 137 - At t = 0.90 max.norm(u) = 0.211598E-03 NST = 140 - At t = 1.00 max.norm(u) = 0.655685E-04 NST = 142 - - -Final statistics: - - No. steps = 142 No. f-s = 173 No. J-s = 3 No. LU-s = 23 - No. nonlinear iterations = 170 - No. nonlinear convergence failures = 0 - No. error test failures = 3 diff --git a/examples/cvode/fcmix_serial/fcvDiurnal_kry.f b/examples/cvode/fcmix_serial/fcvDiurnal_kry.f deleted file mode 100644 index 56a7c78930..0000000000 --- a/examples/cvode/fcmix_serial/fcvDiurnal_kry.f +++ /dev/null @@ -1,1028 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: 2D kinetics-transport, precond. Krylov -C solver. -C -C An ODE system is generated from the following 2-species diurnal -C kinetics advection-diffusion PDE system in 2 space dimensions: -C -C dc(i)/dt = Kh*(d/dx)**2 c(i) + V*dc(i)/dx + (d/dy)(Kv(y)*dc(i)/dy) -C + Ri(c1,c2,t) for i = 1,2, where -C R1(c1,c2,t) = -q1*c1*c3 - q2*c1*c2 + 2*q3(t)*c3 + q4(t)*c2 , -C R2(c1,c2,t) = q1*c1*c3 - q2*c1*c2 - q4(t)*c2 , -C Kv(y) = Kv0*exp(y/5) , -C Kh, V, Kv0, q1, q2, and c3 are constants, and q3(t) and q4(t) -C vary diurnally. -C -C The problem is posed on the square -C 0 .le. x .le. 20, 30 .le. y .le. 50 (all in km), -C with homogeneous Neumann boundary conditions, and for time t -C in 0 .le. t .le. 86400 sec (1 day). -C -C The PDE system is treated by central differences on a uniform -C 10 x 10 mesh, with simple polynomial initial profiles. -C The problem is solved with CVODE, with the BDF/GMRES method and -C the block-diagonal part of the Jacobian as a left -C preconditioner. -C -C Note: this program includes modified (64-bit integer) versions -C of the dense linear solver routines DGEFA and DGESL from LINPACK, -C and BLAS routines DCOPY and DSCAL. -C -C The second and third dimensions of U here must match the values -C of MX and MY, for consistency with the output statements below. -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 MX, MY - PARAMETER (MX=10, MY=10) - INTEGER*4 LENIPAR, LENRPAR - PARAMETER (LENIPAR=6+2*MX*MY, LENRPAR=12+8*MX*MY) -C - INTEGER*4 METH,IATOL,ITASK,IER,LNCFL,LNPS - INTEGER*4 LNST,LNFE,LNSETUP,LNNI,LNCF,LQ,LH,LNPE,LNLI,LNETF - INTEGER*4 JOUT,JPRETYPE,IGSTYPE,MAXL -C The following declaration specification should match C type long int. - INTEGER*8 NEQ, IOUT(25), IPAR(LENIPAR) - INTEGER*4 NST,NFE,NPSET,NPE,NPS,NNI,NETF - INTEGER*4 NLI,NCFN,NCFL - DOUBLE PRECISION ATOL,AVDIM,T,TOUT,TWOHR,RTOL,FLOOR,DELT - DOUBLE PRECISION U(2,MX,MY),ROUT(10),RPAR(LENRPAR) -C - DATA TWOHR/7200.0D0/, RTOL/1.0D-5/, FLOOR/100.0D0/, - & JPRETYPE/1/, IGSTYPE/1/, MAXL/0/, DELT/0.0D0/ - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - & LQ/9/, LNPE/20/, LNLI/22/, LNPS/21/, LNCFL/23/ - DATA LH/2/ -C -C Load problem constants into IPAR, RPAR, and set initial values - CALL INITKX(MX, MY, U, IPAR, RPAR) -C -C Set other input arguments. - NEQ = 2*MX*MY - T = 0.0D0 - METH = 2 - IATOL = 1 - ATOL = RTOL * FLOOR - ITASK = 1 -C - WRITE(6,10) NEQ - 10 FORMAT('Krylov example problem:'// - & ' Kinetics-transport, NEQ = ', I4/) -C -C Initialize vector specification - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF -C -C Initialize SPGMR linear solver module - call FSUNSPGMRINIT(1, JPRETYPE, MAXL, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - STOP - ENDIF - call FSUNSPGMRSETGSTYPE(1, IGSTYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - STOP - ENDIF -C -C Initialize CVODE - CALL FCVMALLOC(T, U, METH, IATOL, RTOL, ATOL, - & IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF -C -C attach linear solver module to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ',I5) - CALL FCVFREE - STOP - ENDIF -C -C attach preconditioner to CVLs interface - CALL FCVLSSETPREC(1, IER) -C -C Loop over output points, call FCVODE, print sample solution values. - TOUT = TWOHR - DO JOUT = 1, 12 -C - CALL FCVODE(TOUT, T, U, ITASK, IER) -C - WRITE(6,50) T, IOUT(LNST), IOUT(LQ), ROUT(LH) - 50 FORMAT(/' t = ', E11.3, 3X, 'nst = ', I5, - & ' q = ', I2, ' h = ', E14.6) - WRITE(6,55) U(1,1,1), U(1,5,5), U(1,10,10), - & U(2,1,1), U(2,5,5), U(2,10,10) - 55 FORMAT(' c1 (bot.left/middle/top rt.) = ', 3E14.6/ - & ' c2 (bot.left/middle/top rt.) = ', 3E14.6) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - & ' Linear Solver returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF -C - TOUT = TOUT + TWOHR -C - ENDDO - -C Print final statistics. - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - WRITE(6,80) NST, NFE, NPSET, NPE, NPS, NNI, NLI, AVDIM, NCFN, - & NCFL, NETF - 80 FORMAT(//'Final statistics:'// - & ' number of steps = ', I5, 5X, - & ' number of f evals. =', I5/ - & ' number of prec. setups = ', I5/ - & ' number of prec. evals. = ', I5, 5X, - & ' number of prec. solves = ', I5/ - & ' number of nonl. iters. = ', I5, 5X, - & ' number of lin. iters. = ', I5/ - & ' average Krylov subspace dimension (NLI/NNI) = ', E14.6/ - & ' number of conv. failures.. nonlinear = ', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3) -C - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE INITKX(MX, MY, U0, IPAR, RPAR) -C Routine to set problem constants and initial values -C - IMPLICIT NONE -C - INTEGER*4 MX, MY -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - DOUBLE PRECISION RPAR(*) -C - INTEGER*4 MM, JY, JX, P_IPP, P_BD, P_P - DOUBLE PRECISION U0 - DIMENSION U0(2,MX,MY) - DOUBLE PRECISION Q1, Q2, Q3, Q4, A3, A4, OM, C3, DY, HDCO - DOUBLE PRECISION VDCO, HACO, X, Y - DOUBLE PRECISION CX, CY, DKH, DKV0, DX, HALFDA, PI, VEL -C - DATA DKH/4.0D-6/, VEL/0.001D0/, DKV0/1.0D-8/, HALFDA/4.32D4/, - 1 PI/3.1415926535898D0/ -C -C Problem constants - MM = MX * MY - Q1 = 1.63D-16 - Q2 = 4.66D-16 - Q3 = 0.0D0 - Q4 = 0.0D0 - A3 = 22.62D0 - A4 = 7.601D0 - OM = PI / HALFDA - C3 = 3.7D16 - DX = 20.0D0 / (MX - 1.0D0) - DY = 20.0D0 / (MY - 1.0D0) - HDCO = DKH / DX**2 - HACO = VEL / (2.0D0 * DX) - VDCO = (1.0D0 / DY**2) * DKV0 -C -C Load constants in IPAR and RPAR - IPAR(1) = MX - IPAR(2) = MY - IPAR(3) = MM -C - RPAR(1) = Q1 - RPAR(2) = Q2 - RPAR(3) = Q3 - RPAR(4) = Q4 - RPAR(5) = A3 - RPAR(6) = A4 - RPAR(7) = OM - RPAR(8) = C3 - RPAR(9) = DY - RPAR(10) = HDCO - RPAR(11) = VDCO - RPAR(12) = HACO -C -C Pointers into IPAR and RPAR - P_IPP = 7 - P_BD = 13 - P_P = P_BD + 4*MM -C - IPAR(4) = P_IPP - IPAR(5) = P_BD - IPAR(6) = P_P -C -C Set initial profiles. - DO JY = 1, MY - Y = 30.0D0 + (JY - 1.0D0) * DY - CY = (0.1D0 * (Y - 40.0D0))**2 - CY = 1.0D0 - CY + 0.5D0 * CY**2 - DO JX = 1, MX - X = (JX - 1.0D0) * DX - CX = (0.1D0 * (X - 10.0D0))**2 - CX = 1.0D0 - CX + 0.5D0 * CX**2 - U0(1,JX,JY) = 1.0D6 * CX * CY - U0(2,JX,JY) = 1.0D12 * CX * CY - ENDDO - ENDDO -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, U, UDOT, IPAR, RPAR, IER) -C Routine for right-hand side function f -C - IMPLICIT NONE -C - DOUBLE PRECISION T, U(2,*), UDOT(2,*), RPAR(*) -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - INTEGER*4 ILEFT, IRIGHT - INTEGER*4 JX, JY, MX, MY, MM, IBLOK0, IBLOK, IDN, IUP - DOUBLE PRECISION Q1, Q2, Q3, Q4, A3, A4, OM, C3, DY, HDCO - DOUBLE PRECISION VDCO, HACO - DOUBLE PRECISION C1, C2, C1DN, C2DN, C1UP, C2UP, C1LT, C2LT - DOUBLE PRECISION C1RT, C2RT, CYDN, CYUP, HORD1, HORD2, HORAD1 - DOUBLE PRECISION HORAD2, QQ1, QQ2, QQ3, QQ4, RKIN1, RKIN2, S - DOUBLE PRECISION VERTD1, VERTD2, YDN, YUP -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - MM = IPAR(3) -C - Q1 = RPAR(1) - Q2 = RPAR(2) - Q3 = RPAR(3) - Q4 = RPAR(4) - A3 = RPAR(5) - A4 = RPAR(6) - OM = RPAR(7) - C3 = RPAR(8) - DY = RPAR(9) - HDCO = RPAR(10) - VDCO = RPAR(11) - HACO = RPAR(12) -C -C Set diurnal rate coefficients. - S = SIN(OM * T) - IF (S .GT. 0.0D0) THEN - Q3 = EXP(-A3 / S) - Q4 = EXP(-A4 / S) - ELSE - Q3 = 0.0D0 - Q4 = 0.0D0 - ENDIF - RPAR(3) = Q3 - RPAR(4) = Q4 -C -C Loop over all grid points. - DO JY = 1, MY - YDN = 30.0D0 + (JY - 1.5D0) * DY - YUP = YDN + DY - CYDN = VDCO * EXP(0.2D0 * YDN) - CYUP = VDCO * EXP(0.2D0 * YUP) - IBLOK0 = (JY - 1) * MX - IDN = -MX - IF (JY .EQ. 1) IDN = MX - IUP = MX - IF (JY .EQ. MY) IUP = -MX - DO JX = 1, MX - IBLOK = IBLOK0 + JX - C1 = U(1,IBLOK) - C2 = U(2,IBLOK) -C Set kinetic rate terms. - QQ1 = Q1 * C1 * C3 - QQ2 = Q2 * C1 * C2 - QQ3 = Q3 * C3 - QQ4 = Q4 * C2 - RKIN1 = -QQ1 - QQ2 + 2.0D0 * QQ3 + QQ4 - RKIN2 = QQ1 - QQ2 - QQ4 -C Set vertical diffusion terms. - C1DN = U(1,IBLOK + IDN) - C2DN = U(2,IBLOK + IDN) - C1UP = U(1,IBLOK + IUP) - C2UP = U(2,IBLOK + IUP) - VERTD1 = CYUP * (C1UP - C1) - CYDN * (C1 - C1DN) - VERTD2 = CYUP * (C2UP - C2) - CYDN * (C2 - C2DN) -C Set horizontal diffusion and advection terms. - ILEFT = -1 - IF (JX .EQ. 1) ILEFT = 1 - IRIGHT = 1 - IF (JX .EQ. MX) IRIGHT = -1 - C1LT = U(1,IBLOK + ILEFT) - C2LT = U(2,IBLOK + ILEFT) - C1RT = U(1,IBLOK + IRIGHT) - C2RT = U(2,IBLOK + IRIGHT) - HORD1 = HDCO * (C1RT - 2.0D0 * C1 + C1LT) - HORD2 = HDCO * (C2RT - 2.0D0 * C2 + C2LT) - HORAD1 = HACO * (C1RT - C1LT) - HORAD2 = HACO * (C2RT - C2LT) -C Load all terms into UDOT. - UDOT(1,IBLOK) = VERTD1 + HORD1 + HORAD1 + RKIN1 - UDOT(2,IBLOK) = VERTD2 + HORD2 + HORAD2 + RKIN2 - ENDDO - ENDDO -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVPSET(T, U, FU, JOK, JCUR, GAMMA, H, - & IPAR, RPAR, IER) -C Routine to set and preprocess block-diagonal preconditioner. -C Note: The dimensions in /BDJ/ below assume at most 100 mesh points. -C - IMPLICIT NONE -C - INTEGER*4 IER, JOK, JCUR - DOUBLE PRECISION T, U(2,*), FU(*), GAMMA, H -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - DOUBLE PRECISION RPAR(*) -C - INTEGER*4 MX, MY, MM, P_IPP, P_BD, P_P - DOUBLE PRECISION Q1, Q2, Q3, Q4, C3, DY, HDCO, VDCO -C - IER = 0 -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - MM = IPAR(3) -C - Q1 = RPAR(1) - Q2 = RPAR(2) - Q3 = RPAR(3) - Q4 = RPAR(4) - C3 = RPAR(8) - DY = RPAR(9) - HDCO = RPAR(10) - VDCO = RPAR(11) -C -C Extract pointers into IPAR and RPAR - P_IPP = IPAR(4) - P_BD = IPAR(5) - P_P = IPAR(6) -C -C If needed, recompute BD -C - IF (JOK .EQ. 1) THEN -C JOK = 1. Reuse saved BD - JCUR = 0 - ELSE -C JOK = 0. Compute diagonal Jacobian blocks. -C (using q4 value computed on last FCVFUN call). - CALL PREC_JAC(MX, MY, MM, U, RPAR(P_BD), - & Q1, Q2, Q3, Q4, C3, DY, HDCO, VDCO) - JCUR = 1 - ENDIF -C -C Copy BD to P - CALL DCOPY(4*MM, RPAR(P_BD), 1, RPAR(P_P), 1) -C -C Scale P by -GAMMA - CALL DSCAL(4*MM, -GAMMA, RPAR(P_P), 1) -C -C Perform LU decomposition - CALL PREC_LU(MM, RPAR(P_P), IPAR(P_IPP), IER) -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVPSOL(T, U, FU, R, Z, GAMMA, DELTA, LR, - & IPAR, RPAR, IER) -C Routine to solve preconditioner linear system. -C - IMPLICIT NONE -C - INTEGER*4 IER, LR -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - DOUBLE PRECISION T, U(*), FU(*), R(*), Z(2,*) - DOUBLE PRECISION GAMMA, DELTA, RPAR(*) -C - INTEGER*4 MM, P_IPP, P_P -C - IER = 0 -C -C Extract constants from IPAR and RPAR - MM = IPAR(3) -C -C Extract pointers into IPAR and RPAR - P_IPP = IPAR(4) - P_P = IPAR(6) -C -C Copy RHS into Z - CALL DCOPY(2*MM, R, 1, Z, 1) -C -C Solve the block-diagonal system Px = r using LU factors stored in P -C and pivot data in IPP, and return the solution in Z. - CALL PREC_SOL(MM, RPAR(P_P), IPAR(P_IPP), Z) - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE PREC_JAC(MX, MY, MM, U, BD, - & Q1, Q2, Q3, Q4, C3, DY, HDCO, VDCO) -C Routine to compute diagonal Jacobian blocks -C - IMPLICIT NONE -C - INTEGER*4 MX, MY, MM - DOUBLE PRECISION U(2,*), BD(2,2,MM) - DOUBLE PRECISION Q1, Q2, Q3, Q4, C3, DY, HDCO, VDCO -C - INTEGER*4 JY, JX, IBLOK, IBLOK0 - DOUBLE PRECISION C1, C2, CYDN, CYUP, DIAG, YDN, YUP -C - DO JY = 1, MY - YDN = 30.0D0 + (JY - 1.5D0) * DY - YUP = YDN + DY - CYDN = VDCO * EXP(0.2D0 * YDN) - CYUP = VDCO * EXP(0.2D0 * YUP) - DIAG = -(CYDN + CYUP + 2.0D0 * HDCO) - IBLOK0 = (JY - 1) * MX - DO JX = 1, MX - IBLOK = IBLOK0 + JX - C1 = U(1,IBLOK) - C2 = U(2,IBLOK) - BD(1,1,IBLOK) = (-Q1 * C3 - Q2 * C2) + DIAG - BD(1,2,IBLOK) = -Q2 * C1 + Q4 - BD(2,1,IBLOK) = Q1 * C3 - Q2 * C2 - BD(2,2,IBLOK) = (-Q2 * C1 - Q4) + DIAG - ENDDO - ENDDO - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE PREC_LU(MM, P, IPP, IER) -C Routine to perform LU decomposition on (P+I) -C - IMPLICIT NONE -C - INTEGER*4 IER - INTEGER*4 MM - INTEGER*8 IPP(2,MM) - DOUBLE PRECISION P(2,2,MM) -C - INTEGER*4 I -C -C Add identity matrix and do LU decompositions on blocks, in place. - DO I = 1, MM - P(1,1,I) = P(1,1,I) + 1.0D0 - P(2,2,I) = P(2,2,I) + 1.0D0 - CALL DGEFA(P(1,1,I), 2, 2, IPP(1,I), IER) - IF (IER .NE. 0) RETURN - ENDDO -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE PREC_SOL(MM, P, IPP, Z) -C Routine for backsolve -C - IMPLICIT NONE -C - INTEGER*4 MM - INTEGER*8 IPP(2,MM) - DOUBLE PRECISION P(2,2,MM), Z(2,MM) -C - INTEGER*4 I -C - DO I = 1, MM - CALL DGESL(P(1,1,I), 2, 2, IPP(1,I), Z(1,I), 0) - ENDDO - - RETURN - END - -C ---------------------------------------------------------------- - - subroutine dgefa(a, lda, n, ipvt, info) -c - implicit none -c - integer info, idamax, j, k, kp1, l, nm1, n - integer*4 lda - integer*8 ipvt(1) - double precision a(lda,1), t -c -c dgefa factors a double precision matrix by gaussian elimination. -c -c dgefa is usually called by dgeco, but it can be called -c directly with a saving in time if rcond is not needed. -c (time for dgeco) = (1 + 9/n)*(time for dgefa) . -c -c on entry -c -c a double precision(lda, n) -c the matrix to be factored. -c -c lda integer -c the leading dimension of the array a . -c -c n integer -c the order of the matrix a . -c -c on return -c -c a an upper triangular matrix and the multipliers -c which were used to obtain it. -c the factorization can be written a = l*u where -c l is a product of permutation and unit lower -c triangular matrices and u is upper triangular. -c -c ipvt integer(n) -c an integer vector of pivot indices. -c -c info integer -c = 0 normal value. -c = k if u(k,k) .eq. 0.0 . this is not an error -c condition for this subroutine, but it does -c indicate that dgesl or dgedi will divide by zero -c if called. employ rcond in dgeco for a reliable -c indication of singularity. -c -c linpack. this version dated 08/14/78 . -c cleve moler, university of new mexico, argonne national lab. -c -c subroutines and functions -c -c blas daxpy,dscal,idamax -c -c internal variables -c -c gaussian elimination with partial pivoting -c - info = 0 - nm1 = n - 1 - if (nm1 .lt. 1) go to 70 - do 60 k = 1, nm1 - kp1 = k + 1 -c -c find l = pivot index -c - l = idamax(n - k + 1, a(k,k), 1) + k - 1 - ipvt(k) = l -c -c zero pivot implies this column already triangularized -c - if (a(l,k) .eq. 0.0d0) go to 40 -c -c interchange if necessary -c - if (l .eq. k) go to 10 - t = a(l,k) - a(l,k) = a(k,k) - a(k,k) = t - 10 continue -c -c compute multipliers -c - t = -1.0d0 / a(k,k) - call dscal(n - k, t, a(k + 1,k), 1) -c -c row elimination with column indexing -c - do 30 j = kp1, n - t = a(l,j) - if (l .eq. k) go to 20 - a(l,j) = a(k,j) - a(k,j) = t - 20 continue - call daxpy(n - k, t, a(k + 1,k), 1, a(k + 1,j), 1) - 30 continue - go to 50 - 40 continue - info = k - 50 continue - 60 continue - 70 continue - ipvt(n) = n - if (a(n,n) .eq. 0.0d0) info = n - return - end - -C ---------------------------------------------------------------- - - subroutine dgesl(a, lda, n, ipvt, b, job) -c - implicit none -c - integer lda, n, job, k, kb, l, nm1 - integer*8 ipvt(1) - double precision a(lda,1), b(1), ddot, t -c -c dgesl solves the double precision system -c a * x = b or trans(a) * x = b -c using the factors computed by dgeco or dgefa. -c -c on entry -c -c a double precision(lda, n) -c the output from dgeco or dgefa. -c -c lda integer -c the leading dimension of the array a . -c -c n integer -c the order of the matrix a . -c -c ipvt integer(n) -c the pivot vector from dgeco or dgefa. -c -c b double precision(n) -c the right hand side vector. -c -c job integer -c = 0 to solve a*x = b , -c = nonzero to solve trans(a)*x = b where -c trans(a) is the transpose. -c -c on return -c -c b the solution vector x . -c -c error condition -c -c a division by zero will occur if the input factor contains a -c zero on the diagonal. technically this indicates singularity -c but it is often caused by improper arguments or improper -c setting of lda . it will not occur if the subroutines are -c called correctly and if dgeco has set rcond .gt. 0.0 -c or dgefa has set info .eq. 0 . -c -c to compute inverse(a) * c where c is a matrix -c with p columns -c call dgeco(a,lda,n,ipvt,rcond,z) -c if (rcond is too small) go to ... -c do 10 j = 1, p -c call dgesl(a,lda,n,ipvt,c(1,j),0) -c 10 continue -c -c linpack. this version dated 08/14/78 . -c cleve moler, university of new mexico, argonne national lab. -c -c subroutines and functions -c -c blas daxpy,ddot -c -c internal variables -c - nm1 = n - 1 - if (job .ne. 0) go to 50 -c -c job = 0 , solve a * x = b -c first solve l*y = b -c - if (nm1 .lt. 1) go to 30 - do 20 k = 1, nm1 - l = ipvt(k) - t = b(l) - if (l .eq. k) go to 10 - b(l) = b(k) - b(k) = t - 10 continue - call daxpy(n - k, t, a(k + 1,k), 1, b(k + 1), 1) - 20 continue - 30 continue -c -c now solve u*x = y -c - do 40 kb = 1, n - k = n + 1 - kb - b(k) = b(k) / a(k,k) - t = -b(k) - call daxpy(k - 1, t, a(1,k), 1, b(1), 1) - 40 continue - go to 100 - 50 continue -c -c job = nonzero, solve trans(a) * x = b -c first solve trans(u)*y = b -c - do 60 k = 1, n - t = ddot(k - 1, a(1,k), 1, b(1), 1) - b(k) = (b(k) - t) / a(k,k) - 60 continue -c -c now solve trans(l)*x = y -c - if (nm1 .lt. 1) go to 90 - do 80 kb = 1, nm1 - k = n - kb - b(k) = b(k) + ddot(n - k, a(k + 1,k), 1, b(k + 1), 1) - l = ipvt(k) - if (l .eq. k) go to 70 - t = b(l) - b(l) = b(k) - b(k) = t - 70 continue - 80 continue - 90 continue - 100 continue - return - end - -C ---------------------------------------------------------------- - - subroutine daxpy(n, da, dx, incx, dy, incy) -c -c constant times a vector plus a vector. -c uses unrolled loops for increments equal to one. -c jack dongarra, linpack, 3/11/78. -c - implicit none -c - integer i, incx, incy, ix, iy, m, mp1 - integer*4 n - double precision dx(1), dy(1), da -c - if (n .le. 0) return - if (da .eq. 0.0d0) return - if (incx .eq. 1 .and. incy .eq. 1) go to 20 -c -c code for unequal increments or equal increments -c not equal to 1 -c - ix = 1 - iy = 1 - if (incx .lt. 0) ix = (-n + 1) * incx + 1 - if (incy .lt. 0) iy = (-n + 1) * incy + 1 - do 10 i = 1, n - dy(iy) = dy(iy) + da * dx(ix) - ix = ix + incx - iy = iy + incy - 10 continue - return -c -c code for both increments equal to 1 -c -c -c clean-up loop -c - 20 m = mod(n, 4) - if ( m .eq. 0 ) go to 40 - do 30 i = 1, m - dy(i) = dy(i) + da * dx(i) - 30 continue - if ( n .lt. 4 ) return - 40 mp1 = m + 1 - do 50 i = mp1, n, 4 - dy(i) = dy(i) + da * dx(i) - dy(i + 1) = dy(i + 1) + da * dx(i + 1) - dy(i + 2) = dy(i + 2) + da * dx(i + 2) - dy(i + 3) = dy(i + 3) + da * dx(i + 3) - 50 continue - return - end -C ---------------------------------------------------------------- - - subroutine dscal(n, da, dx, incx) -c -c scales a vector by a constant. -c uses unrolled loops for increment equal to one. -c jack dongarra, linpack, 3/11/78. -c - implicit none -c - integer i, incx, m, mp1, nincx - integer*4 n - double precision da, dx(1) -c - if (n.le.0) return - if (incx .eq. 1) go to 20 -c -c code for increment not equal to 1 -c - nincx = n * incx - do 10 i = 1, nincx, incx - dx(i) = da * dx(i) - 10 continue - return -c -c code for increment equal to 1 -c -c -c clean-up loop -c - 20 m = mod(n, 5) - if ( m .eq. 0 ) go to 40 - do 30 i = 1, m - dx(i) = da * dx(i) - 30 continue - if ( n .lt. 5 ) return - 40 mp1 = m + 1 - do 50 i = mp1, n, 5 - dx(i) = da * dx(i) - dx(i + 1) = da * dx(i + 1) - dx(i + 2) = da * dx(i + 2) - dx(i + 3) = da * dx(i + 3) - dx(i + 4) = da * dx(i + 4) - 50 continue - return - end - -C ---------------------------------------------------------------- - - double precision function ddot(n, dx, incx, dy, incy) -c -c forms the dot product of two vectors. -c uses unrolled loops for increments equal to one. -c jack dongarra, linpack, 3/11/78. -c - implicit none -c - integer i, incx, incy, ix, iy, m, mp1 - integer*4 n - double precision dx(1), dy(1), dtemp -c - ddot = 0.0d0 - dtemp = 0.0d0 - if (n .le. 0) return - if (incx .eq. 1 .and. incy .eq. 1) go to 20 -c -c code for unequal increments or equal increments -c not equal to 1 -c - ix = 1 - iy = 1 - if (incx .lt. 0) ix = (-n + 1) * incx + 1 - if (incy .lt. 0) iy = (-n + 1) * incy + 1 - do 10 i = 1, n - dtemp = dtemp + dx(ix) * dy(iy) - ix = ix + incx - iy = iy + incy - 10 continue - ddot = dtemp - return -c -c code for both increments equal to 1 -c -c -c clean-up loop -c - 20 m = mod(n, 5) - if ( m .eq. 0 ) go to 40 - do 30 i = 1,m - dtemp = dtemp + dx(i) * dy(i) - 30 continue - if ( n .lt. 5 ) go to 60 - 40 mp1 = m + 1 - do 50 i = mp1, n, 5 - dtemp = dtemp + dx(i) * dy(i) + dx(i + 1) * dy(i + 1) + - * dx(i + 2) * dy(i + 2) + dx(i + 3) * dy(i + 3) + - * dx(i + 4) * dy(i + 4) - 50 continue - 60 ddot = dtemp - return - end - -C ---------------------------------------------------------------- - - integer function idamax(n, dx, incx) -c -c finds the index of element having max. absolute value. -c jack dongarra, linpack, 3/11/78. -c - implicit none -c - integer i, incx, ix - integer*4 n - double precision dx(1), dmax -c - idamax = 0 - if (n .lt. 1) return - idamax = 1 - if (n .eq. 1) return - if (incx .eq. 1) go to 20 -c -c code for increment not equal to 1 -c - ix = 1 - dmax = abs(dx(1)) - ix = ix + incx - do 10 i = 2, n - if (abs(dx(ix)) .le. dmax) go to 5 - idamax = i - dmax = abs(dx(ix)) - 5 ix = ix + incx - 10 continue - return -c -c code for increment equal to 1 -c - 20 dmax = abs(dx(1)) - do 30 i = 2, n - if (abs(dx(i)) .le. dmax) go to 30 - idamax = i - dmax = abs(dx(i)) - 30 continue - return - end - -C ---------------------------------------------------------------- - - subroutine dcopy(n, dx, incx, dy, incy) -c -c copies a vector, x, to a vector, y. -c uses unrolled loops for increments equal to one. -c jack dongarra, linpack, 3/11/78. -c - implicit none -c - integer i, incx, incy, ix, iy, m, mp1 - integer*4 n - double precision dx(1), dy(1) -c - if (n .le. 0) return - if (incx .eq. 1 .and. incy .eq. 1) go to 20 -c -c code for unequal increments or equal increments -c not equal to 1 -c - ix = 1 - iy = 1 - if (incx .lt. 0) ix = (-n + 1) * incx + 1 - if (incy .lt. 0) iy = (-n + 1) * incy + 1 - do 10 i = 1, n - dy(iy) = dx(ix) - ix = ix + incx - iy = iy + incy - 10 continue - return -c -c code for both increments equal to 1 -c -c -c clean-up loop -c - 20 m = mod(n, 7) - if ( m .eq. 0 ) go to 40 - do 30 i = 1, m - dy(i) = dx(i) - 30 continue - if ( n .lt. 7 ) return - 40 mp1 = m + 1 - do 50 i = mp1, n, 7 - dy(i) = dx(i) - dy(i + 1) = dx(i + 1) - dy(i + 2) = dx(i + 2) - dy(i + 3) = dx(i + 3) - dy(i + 4) = dx(i + 4) - dy(i + 5) = dx(i + 5) - dy(i + 6) = dx(i + 6) - 50 continue - return - end diff --git a/examples/cvode/fcmix_serial/fcvDiurnal_kry.out b/examples/cvode/fcmix_serial/fcvDiurnal_kry.out deleted file mode 100644 index 2afa39a024..0000000000 --- a/examples/cvode/fcmix_serial/fcvDiurnal_kry.out +++ /dev/null @@ -1,63 +0,0 @@ -Krylov example problem: - - Kinetics-transport, NEQ = 200 - - - t = 0.720E+04 nst = 219 q = 5 h = 0.158696E+03 - c1 (bot.left/middle/top rt.) = 0.104683E+05 0.296373E+05 0.111853E+05 - c2 (bot.left/middle/top rt.) = 0.252672E+12 0.715376E+12 0.269977E+12 - - t = 0.144E+05 nst = 251 q = 5 h = 0.377205E+03 - c1 (bot.left/middle/top rt.) = 0.665902E+07 0.531602E+07 0.730081E+07 - c2 (bot.left/middle/top rt.) = 0.258192E+12 0.205680E+12 0.283286E+12 - - t = 0.216E+05 nst = 277 q = 5 h = 0.274584E+03 - c1 (bot.left/middle/top rt.) = 0.266498E+08 0.103636E+08 0.293077E+08 - c2 (bot.left/middle/top rt.) = 0.299279E+12 0.102810E+12 0.331344E+12 - - t = 0.288E+05 nst = 307 q = 4 h = 0.201171E+03 - c1 (bot.left/middle/top rt.) = 0.870209E+07 0.129197E+08 0.965002E+07 - c2 (bot.left/middle/top rt.) = 0.338035E+12 0.502929E+12 0.375096E+12 - - t = 0.360E+05 nst = 336 q = 5 h = 0.101863E+03 - c1 (bot.left/middle/top rt.) = 0.140404E+05 0.202903E+05 0.156090E+05 - c2 (bot.left/middle/top rt.) = 0.338677E+12 0.489443E+12 0.376516E+12 - - t = 0.432E+05 nst = 385 q = 4 h = 0.456580E+03 - c1 (bot.left/middle/top rt.) = 0.522615E-07 -0.607462E-05 0.871309E-07 - c2 (bot.left/middle/top rt.) = 0.338233E+12 0.135487E+12 0.380352E+12 - - t = 0.504E+05 nst = 403 q = 4 h = 0.277279E+03 - c1 (bot.left/middle/top rt.) = -0.266960E-07 -0.450968E-05 -0.267202E-07 - c2 (bot.left/middle/top rt.) = 0.335816E+12 0.493033E+12 0.386445E+12 - - t = 0.576E+05 nst = 419 q = 5 h = 0.344023E+03 - c1 (bot.left/middle/top rt.) = -0.114670E-08 -0.587145E-07 -0.219472E-08 - c2 (bot.left/middle/top rt.) = 0.332031E+12 0.964981E+12 0.390900E+12 - - t = 0.648E+05 nst = 431 q = 5 h = 0.949533E+03 - c1 (bot.left/middle/top rt.) = 0.379212E-09 0.190141E-07 0.719619E-09 - c2 (bot.left/middle/top rt.) = 0.331303E+12 0.892184E+12 0.396342E+12 - - t = 0.720E+05 nst = 441 q = 5 h = 0.700864E+03 - c1 (bot.left/middle/top rt.) = -0.187184E-10 -0.936079E-09 -0.355015E-10 - c2 (bot.left/middle/top rt.) = 0.332972E+12 0.618617E+12 0.403885E+12 - - t = 0.792E+05 nst = 451 q = 5 h = 0.700864E+03 - c1 (bot.left/middle/top rt.) = 0.136509E-12 0.673869E-11 0.258515E-12 - c2 (bot.left/middle/top rt.) = 0.333441E+12 0.666904E+12 0.412026E+12 - - t = 0.864E+05 nst = 461 q = 5 h = 0.700864E+03 - c1 (bot.left/middle/top rt.) = 0.414351E-13 0.207247E-11 0.786247E-13 - c2 (bot.left/middle/top rt.) = 0.335178E+12 0.910668E+12 0.416250E+12 - - -Final statistics: - - number of steps = 461 number of f evals. = 597 - number of prec. setups = 78 - number of prec. evals. = 8 number of prec. solves = 1176 - number of nonl. iters. = 594 number of lin. iters. = 636 - average Krylov subspace dimension (NLI/NNI) = 0.107071E+01 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 27 diff --git a/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.f b/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.f deleted file mode 100644 index 037f968a80..0000000000 --- a/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.f +++ /dev/null @@ -1,374 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: 2D kinetics-transport, precond. Krylov -C solver. -C -C An ODE system is generated from the following 2-species diurnal -C kinetics advection-diffusion PDE system in 2 space dimensions: -C -C dc(i)/dt = Kh*(d/dx)**2 c(i) + V*dc(i)/dx + (d/dy)(Kv(y)*dc(i)/dy) -C + Ri(c1,c2,t) for i = 1,2, where -C R1(c1,c2,t) = -q1*c1*c3 - q2*c1*c2 + 2*q3(t)*c3 + q4(t)*c2 , -C R2(c1,c2,t) = q1*c1*c3 - q2*c1*c2 - q4(t)*c2 , -C Kv(y) = Kv0*exp(y/5) , -C Kh, V, Kv0, q1, q2, and c3 are constants, and q3(t) and q4(t) -C vary diurnally. -C -C The problem is posed on the square -C 0 .le. x .le. 20, 30 .le. y .le. 50 (all in km), -C with homogeneous Neumann boundary conditions, and for time t -C in 0 .le. t .le. 86400 sec (1 day). -C -C The PDE system is treated by central differences on a uniform -C 10 x 10 mesh, with simple polynomial initial profiles. -C The problem is solved with CVODE, with the BDF/GMRES method and -C using the FCVBP banded preconditioner. -C -C The second and third dimensions of U here must match the values -C of MX and MY, for consistency with the output statements below. -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 MX, MY - PARAMETER (MX=10, MY=10) -C - INTEGER*4 LNST, LNFE, LNSETUP, LNNI, LNCF, LNPE, LNLI, LNPS - INTEGER*4 LNCFL, LH, LQ, METH, IATOL, ITASK - INTEGER*4 LNETF, IER, MAXL, JPRETYPE, IGSTYPE, JOUT - INTEGER*4 LLENRW, LLENIW, LLENRWLS, LLENIWLS -C The following declaration specification should match C type long int. - INTEGER*8 NEQ, IOUT(25), IPAR(4) - INTEGER*4 NST, NFE, NPSET, NPE, NPS, NNI - INTEGER*4 NLI, NCFN, NCFL, NETF - INTEGER*4 LENRW, LENIW, LENRWLS, LENIWLS -C The following declaration specification should match C type long int. - INTEGER*8 MU, ML, LENRWBP, LENIWBP, NFEBP - DOUBLE PRECISION ATOL, AVDIM, DELT, FLOOR, RTOL, T, TOUT, TWOHR - DOUBLE PRECISION ROUT(10), U(2,MX,MY), RPAR(12) -C - DATA TWOHR/7200.0D0/, RTOL/1.0D-5/, FLOOR/100.0D0/, - 1 JPRETYPE/1/, IGSTYPE/1/, MAXL/0/, DELT/0.0D0/ - DATA LLENRW/1/, LLENIW/2/, LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, - 1 LNNI/7/, LNSETUP/8/, LQ/9/, LLENRWLS/13/, LLENIWLS/14/, - 1 LNPE/20/, LNLI/22/, LNPS/21/, LNCFL/23/ - DATA LH/2/ -C -C Load problem constants into IPAR, RPAR, and set initial values - CALL INITKX(MX, MY, U, IPAR, RPAR) -C -C Set other input arguments. - NEQ = 2*MX*MY - T = 0.0D0 - METH = 2 - IATOL = 1 - ATOL = RTOL * FLOOR - ITASK = 1 -C - WRITE(6,10) NEQ - 10 FORMAT('Krylov example problem:'// - 1 ' Kinetics-transport, NEQ = ', I4/) -C -C Initialize vector specification - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF -C -C Initialize SPGMR linear solver module - call FSUNSPGMRINIT(1, JPRETYPE, MAXL, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRINIT IER = ', I5) - STOP - ENDIF - call FSUNSPGMRSETGSTYPE(1, IGSTYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,27) IER - 27 FORMAT(///' SUNDIALS_ERROR: FSUNSPGMRSETGSTYPE IER = ', I5) - STOP - ENDIF -C -C Initialize CVODE - CALL FCVMALLOC(T, U, METH, IATOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF -C -C attach linear solver module to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ',I5) - CALL FCVFREE - STOP - ENDIF -C -C Initialize band preconditioner - MU = 2 - ML = 2 - CALL FCVBPINIT(NEQ, MU, ML, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVBPINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF -C -C Loop over output points, call FCVODE, print sample solution values. - TOUT = TWOHR - DO 70 JOUT = 1, 12 -C - CALL FCVODE(TOUT, T, U, ITASK, IER) -C - WRITE(6,50) T, IOUT(LNST), IOUT(LQ), ROUT(LH) - 50 FORMAT(/' t = ', E14.6, 5X, 'no. steps = ', I5, - 1 ' order = ', I3, ' stepsize = ', E14.6) - WRITE(6,55) U(1,1,1), U(1,5,5), U(1,10,10), - 1 U(2,1,1), U(2,5,5), U(2,10,10) - 55 FORMAT(' c1 (bot.left/middle/top rt.) = ', 3E14.6/ - 1 ' c2 (bot.left/middle/top rt.) = ', 3E14.6) -C - IF (IER .NE. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF -C - TOUT = TOUT + TWOHR - 70 CONTINUE - -C Print final statistics. - NST = IOUT(LNST) - NFE = IOUT(LNFE) - NPSET = IOUT(LNSETUP) - NPE = IOUT(LNPE) - NPS = IOUT(LNPS) - NNI = IOUT(LNNI) - NLI = IOUT(LNLI) - AVDIM = DBLE(NLI) / DBLE(NNI) - NCFN = IOUT(LNCF) - NCFL = IOUT(LNCFL) - NETF = IOUT(LNETF) - LENRW = IOUT(LLENRW) - LENIW = IOUT(LLENIW) - LENRWLS = IOUT(LLENRWLS) - LENIWLS = IOUT(LLENIWLS) - WRITE(6,80) NST, NFE, NPSET, NPE, NPS, NNI, NLI, AVDIM, NCFN, - 1 NCFL, NETF, LENRW, LENIW, LENRWLS, LENIWLS - 80 FORMAT(//'Final statistics:'// - & ' number of steps = ', I5, 4X, - & ' number of f evals. = ', I5/ - & ' number of prec. setups = ', I5/ - & ' number of prec. evals. = ', I5, 4X, - & ' number of prec. solves = ', I5/ - & ' number of nonl. iters. = ', I5, 4X, - & ' number of lin. iters. = ', I5/ - & ' average Krylov subspace dimension (NLI/NNI) = ', E14.6/ - & ' number of conv. failures.. nonlinear =', I3, - & ' linear = ', I3/ - & ' number of error test failures = ', I3/ - & ' main solver real/int workspace sizes = ',2I7/ - & ' linear solver real/int workspace sizes = ',2I5) - CALL FCVBPOPT(LENRWBP, LENIWBP, NFEBP) - WRITE(6,82) LENRWBP, LENIWBP, NFEBP - 82 FORMAT('In CVBANDPRE:'/ - & ' real/int workspace sizes = ', 2I7/ - & ' number of f evaluations = ', I5) -C - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE INITKX(MX, MY, U0, IPAR, RPAR) -C Routine to set problem constants and initial values -C - IMPLICIT NONE -C - INTEGER*4 MX, MY -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - DOUBLE PRECISION RPAR(*) -C - INTEGER*8 MM, JY, JX, NEQ - DOUBLE PRECISION U0 - DIMENSION U0(2,MX,MY) - DOUBLE PRECISION Q1, Q2, Q3, Q4, A3, A4, OM, C3, DY, HDCO - DOUBLE PRECISION VDCO, HACO, X, Y - DOUBLE PRECISION CX, CY, DKH, DKV0, DX, HALFDA, PI, VEL -C - DATA DKH/4.0D-6/, VEL/0.001D0/, DKV0/1.0D-8/, HALFDA/4.32D4/, - 1 PI/3.1415926535898D0/ -C -C Problem constants - MM = MX * MY - NEQ = 2 * MM - Q1 = 1.63D-16 - Q2 = 4.66D-16 - Q3 = 0.0D0 - Q4 = 0.0D0 - A3 = 22.62D0 - A4 = 7.601D0 - OM = PI / HALFDA - C3 = 3.7D16 - DX = 20.0D0 / (MX - 1.0D0) - DY = 20.0D0 / (MY - 1.0D0) - HDCO = DKH / DX**2 - HACO = VEL / (2.0D0 * DX) - VDCO = (1.0D0 / DY**2) * DKV0 -C -C Load constants in IPAR and RPAR - IPAR(1) = MX - IPAR(2) = MY - IPAR(3) = MM - IPAR(4) = NEQ -C - RPAR(1) = Q1 - RPAR(2) = Q2 - RPAR(3) = Q3 - RPAR(4) = Q4 - RPAR(5) = A3 - RPAR(6) = A4 - RPAR(7) = OM - RPAR(8) = C3 - RPAR(9) = DY - RPAR(10) = HDCO - RPAR(11) = VDCO - RPAR(12) = HACO -C -C Set initial profiles. - DO 20 JY = 1, MY - Y = 30.0D0 + (JY - 1.0D0) * DY - CY = (0.1D0 * (Y - 40.0D0))**2 - CY = 1.0D0 - CY + 0.5D0 * CY**2 - DO 10 JX = 1, MX - X = (JX - 1.0D0) * DX - CX = (0.1D0 * (X - 10.0D0))**2 - CX = 1.0D0 - CX + 0.5D0 * CX**2 - U0(1,JX,JY) = 1.0D6 * CX * CY - U0(2,JX,JY) = 1.0D12 * CX * CY - 10 CONTINUE - 20 CONTINUE -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, U, UDOT, IPAR, RPAR, IER) -C Routine for right-hand side function f -C - IMPLICIT NONE -C -C The following declaration specification should match C type long int. - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, U(2,*), UDOT(2,*), RPAR(*) -C - INTEGER*4 ILEFT, IRIGHT - INTEGER*8 MX, MY, MM, JY, JX, IBLOK0, IDN, IUP, IBLOK - DOUBLE PRECISION Q1,Q2,Q3,Q4, A3, A4, OM, C3, DY, HDCO, VDCO, HACO - DOUBLE PRECISION C1, C2, C1DN, C2DN, C1UP, C2UP, C1LT, C2LT - DOUBLE PRECISION C1RT, C2RT, CYDN, CYUP, HORD1, HORD2, HORAD1 - DOUBLE PRECISION HORAD2, QQ1, QQ2, QQ3, QQ4, RKIN1, RKIN2, S - DOUBLE PRECISION VERTD1, VERTD2, YDN, YUP -C -C Extract constants from IPAR and RPAR - MX = IPAR(1) - MY = IPAR(2) - MM = IPAR(3) -C - Q1 = RPAR(1) - Q2 = RPAR(2) - Q3 = RPAR(3) - Q4 = RPAR(4) - A3 = RPAR(5) - A4 = RPAR(6) - OM = RPAR(7) - C3 = RPAR(8) - DY = RPAR(9) - HDCO = RPAR(10) - VDCO = RPAR(11) - HACO = RPAR(12) -C -C Set diurnal rate coefficients. - S = SIN(OM * T) - IF (S .GT. 0.0D0) THEN - Q3 = EXP(-A3 / S) - Q4 = EXP(-A4 / S) - ELSE - Q3 = 0.0D0 - Q4 = 0.0D0 - ENDIF -C -C Loop over all grid points. - DO 20 JY = 1, MY - YDN = 30.0D0 + (JY - 1.5D0) * DY - YUP = YDN + DY - CYDN = VDCO * EXP(0.2D0 * YDN) - CYUP = VDCO * EXP(0.2D0 * YUP) - IBLOK0 = (JY - 1) * MX - IDN = -MX - IF (JY .EQ. 1) IDN = MX - IUP = MX - IF (JY .EQ. MY) IUP = -MX - DO 10 JX = 1, MX - IBLOK = IBLOK0 + JX - C1 = U(1,IBLOK) - C2 = U(2,IBLOK) -C Set kinetic rate terms. - QQ1 = Q1 * C1 * C3 - QQ2 = Q2 * C1 * C2 - QQ3 = Q3 * C3 - QQ4 = Q4 * C2 - RKIN1 = -QQ1 - QQ2 + 2.0D0 * QQ3 + QQ4 - RKIN2 = QQ1 - QQ2 - QQ4 -C Set vertical diffusion terms. - C1DN = U(1,IBLOK + IDN) - C2DN = U(2,IBLOK + IDN) - C1UP = U(1,IBLOK + IUP) - C2UP = U(2,IBLOK + IUP) - VERTD1 = CYUP * (C1UP - C1) - CYDN * (C1 - C1DN) - VERTD2 = CYUP * (C2UP - C2) - CYDN * (C2 - C2DN) -C Set horizontal diffusion and advection terms. - ILEFT = -1 - IF (JX .EQ. 1) ILEFT = 1 - IRIGHT = 1 - IF (JX .EQ. MX) IRIGHT = -1 - C1LT = U(1,IBLOK + ILEFT) - C2LT = U(2,IBLOK + ILEFT) - C1RT = U(1,IBLOK + IRIGHT) - C2RT = U(2,IBLOK + IRIGHT) - HORD1 = HDCO * (C1RT - 2.0D0 * C1 + C1LT) - HORD2 = HDCO * (C2RT - 2.0D0 * C2 + C2LT) - HORAD1 = HACO * (C1RT - C1LT) - HORAD2 = HACO * (C2RT - C2LT) -C Load all terms into UDOT. - UDOT(1,IBLOK) = VERTD1 + HORD1 + HORAD1 + RKIN1 - UDOT(2,IBLOK) = VERTD2 + HORD2 + HORAD2 + RKIN2 - 10 CONTINUE - 20 CONTINUE -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.out b/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.out deleted file mode 100644 index 9227652d19..0000000000 --- a/examples/cvode/fcmix_serial/fcvDiurnal_kry_bp.out +++ /dev/null @@ -1,68 +0,0 @@ -Krylov example problem: - - Kinetics-transport, NEQ = 200 - - - t = 0.720000E+04 no. steps = 190 order = 5 stepsize = 0.160965E+03 - c1 (bot.left/middle/top rt.) = 0.104683E+05 0.296373E+05 0.111853E+05 - c2 (bot.left/middle/top rt.) = 0.252672E+12 0.715377E+12 0.269977E+12 - - t = 0.144000E+05 no. steps = 221 order = 5 stepsize = 0.382687E+03 - c1 (bot.left/middle/top rt.) = 0.665902E+07 0.531602E+07 0.730081E+07 - c2 (bot.left/middle/top rt.) = 0.258192E+12 0.205680E+12 0.283286E+12 - - t = 0.216000E+05 no. steps = 246 order = 5 stepsize = 0.278111E+03 - c1 (bot.left/middle/top rt.) = 0.266497E+08 0.103640E+08 0.293077E+08 - c2 (bot.left/middle/top rt.) = 0.299279E+12 0.102815E+12 0.331344E+12 - - t = 0.288000E+05 no. steps = 298 order = 3 stepsize = 0.132506E+03 - c1 (bot.left/middle/top rt.) = 0.870208E+07 0.129196E+08 0.965000E+07 - c2 (bot.left/middle/top rt.) = 0.338035E+12 0.502926E+12 0.375095E+12 - - t = 0.360000E+05 no. steps = 341 order = 4 stepsize = 0.631280E+02 - c1 (bot.left/middle/top rt.) = 0.140403E+05 0.202899E+05 0.156090E+05 - c2 (bot.left/middle/top rt.) = 0.338677E+12 0.489433E+12 0.376516E+12 - - t = 0.432000E+05 no. steps = 402 order = 4 stepsize = 0.448032E+03 - c1 (bot.left/middle/top rt.) = 0.191468E-06 -0.613018E-05 0.439513E-06 - c2 (bot.left/middle/top rt.) = 0.338232E+12 0.135498E+12 0.380352E+12 - - t = 0.504000E+05 no. steps = 422 order = 4 stepsize = 0.317295E+03 - c1 (bot.left/middle/top rt.) = -0.774603E-10 -0.307315E-07 -0.351244E-10 - c2 (bot.left/middle/top rt.) = 0.335816E+12 0.493029E+12 0.386444E+12 - - t = 0.576000E+05 no. steps = 436 order = 5 stepsize = 0.358251E+03 - c1 (bot.left/middle/top rt.) = 0.180088E-10 0.717698E-08 0.858836E-11 - c2 (bot.left/middle/top rt.) = 0.332031E+12 0.964978E+12 0.390899E+12 - - t = 0.648000E+05 no. steps = 449 order = 5 stepsize = 0.594794E+03 - c1 (bot.left/middle/top rt.) = -0.284457E-13 -0.106311E-10 -0.138218E-13 - c2 (bot.left/middle/top rt.) = 0.331302E+12 0.892183E+12 0.396341E+12 - - t = 0.720000E+05 no. steps = 461 order = 5 stepsize = 0.594794E+03 - c1 (bot.left/middle/top rt.) = 0.271046E-15 0.101114E-12 0.130660E-15 - c2 (bot.left/middle/top rt.) = 0.332972E+12 0.618623E+12 0.403884E+12 - - t = 0.792000E+05 no. steps = 473 order = 5 stepsize = 0.594794E+03 - c1 (bot.left/middle/top rt.) = 0.569757E-15 0.205829E-12 0.268970E-15 - c2 (bot.left/middle/top rt.) = 0.333441E+12 0.666892E+12 0.412025E+12 - - t = 0.864000E+05 no. steps = 485 order = 5 stepsize = 0.594794E+03 - c1 (bot.left/middle/top rt.) = 0.270665E-15 0.189895E-16 0.215568E-14 - c2 (bot.left/middle/top rt.) = 0.335178E+12 0.910637E+12 0.416250E+12 - - -Final statistics: - - number of steps = 485 number of f evals. = 616 - number of prec. setups = 85 - number of prec. evals. = 9 number of prec. solves = 1134 - number of nonl. iters. = 613 number of lin. iters. = 597 - average Krylov subspace dimension (NLI/NNI) = 0.973899E+00 - number of conv. failures.. nonlinear = 0 linear = 0 - number of error test failures = 28 - main solver real/int workspace sizes = 2689 53 - linear solver real/int workspace sizes = 2454 42 -In CVBANDPRE: - real/int workspace sizes = 2800 622 - number of f evaluations = 45 diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dns.f b/examples/cvode/fcmix_serial/fcvRoberts_dns.f deleted file mode 100644 index c55caa7dc0..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dns.f +++ /dev/null @@ -1,270 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: Robertson kinetics, direct linear solver -C with dense user Jacobian. -C -C The following is a simple example problem, with the coding -C needed for its solution by CVODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C enable the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with CVODE, using the Fortran/C interface routine -C package. This solution uses the BDF method and a user-supplied -C Jacobian routine, and prints results at t = .4, 4., ..., 4.e10. -C It uses ITOL = 2 and ATOL much smaller for y2 than y1 or y3 -C because y2 has much smaller values. At the end of the run, -C various counters of interest are printed. -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE, LNGE - INTEGER*4 METH, ITOL, ITASK, JOUT, NOUT, IERROOT - INTEGER*4 INFO(2) - INTEGER*4 I -C The following declaration specification should match C type long int - INTEGER*8 NEQ, IPAR, IOUT(25) - DOUBLE PRECISION RTOL, T, T0, TOUT - DOUBLE PRECISION Y(3), ATOL(3), ROUT(10), RPAR -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNGE/12/, LNJE/17/ -C - NEQ = 3 - T0 = 0.0D0 - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 - METH = 2 - ITOL = 2 - RTOL = 1.0D-4 - ATOL(1) = 1.0D-8 - ATOL(2) = 1.0D-14 - ATOL(3) = 1.0D-6 - TOUT = 0.4D0 - ITASK = 1 - JOUT = 0 - NOUT = 12 -C - WRITE(6,10) NEQ - 10 FORMAT('Dense example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) - -C create serial vector - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF - -C initialize dense matrix module - CALL FSUNDENSEMATINIT(1, NEQ, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNDENSEMATINIT returned IER = ', - 1 I5) - STOP - ENDIF - -C initialize dense linear solver module - CALL FSUNDENSELINSOLINIT(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNDENSELINSOLINIT returned IER = ' - 1 , I5) - STOP - ENDIF - -C Call FCVMALLOC to create the solver memory and specify the -C Backward Differentiation Formula - CALL FCVMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF - -C Call FCVROOTINIT to specify the root function g with 2 components - CALL FCVROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVROOTINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C attach the matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C indicate a dense Jacobian function is provided - CALL FCVDENSESETJAC(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVDENSESETJAC returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - - DO WHILE(JOUT .LT. NOUT) -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,50) T, Y(1), Y(2), Y(3) - 50 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FCVROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,65) IERROOT - 65 FORMAT(///' SUNDIALS_ERROR: FCVROOTINFO returned IER = ', - 1 I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,70) (INFO(I), I = 1, 2) - 70 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO -C - CALL FCVDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' SUNDIALS_ERROR: FCVDKY returned IER = ', I4) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,85) Y(1), Y(2), Y(3) - 85 FORMAT(/'Final value of ydot = ', 3E14.6) -C - WRITE(6,90) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF), IOUT(LNGE) - 90 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4/ - 6 ' No. root function evals = ', I4) -C - CALL FCVROOTFREE - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVDJAC(N, T, Y, FY, JAC, H, IPAR, RPAR, - 1 V1, V2, V3, IER) -C Fortran routine for dense user-supplied Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 N, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), FY(*), JAC(N,*), H, RPAR(*) - DOUBLE PRECISION V1(*), V2(*), V3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JAC(1,1) = -0.04D0 - JAC(1,2) = 1.0D4 * Y3 - JAC(1,3) = 1.0D4 * Y2 - JAC(2,1) = 0.04D0 - JAC(2,2) = -1.0D4 * Y3 - 6.0D7 * Y2 - JAC(2,3) = -1.0D4 * Y2 - JAC(3,3) = 0.0D0 - JAC(3,2) = 6.0D7 * Y2 - JAC(3,3) = 0.0D0 -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dns.out b/examples/cvode/fcmix_serial/fcvRoberts_dns.out deleted file mode 100644 index 22d163cf9f..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dns.out +++ /dev/null @@ -1,32 +0,0 @@ -Dense example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2639E+00 y = 0.989965E+00 0.347056E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985164E+00 0.338624E-04 0.148020E-01 -At t = 0.4000E+01 y = 0.905510E+00 0.224034E-04 0.944679E-01 -At t = 0.4000E+02 y = 0.715802E+00 0.918504E-05 0.284189E+00 -At t = 0.4000E+03 y = 0.450536E+00 0.322327E-05 0.549461E+00 -At t = 0.4000E+04 y = 0.183230E+00 0.894438E-06 0.816769E+00 -At t = 0.4000E+05 y = 0.389890E-01 0.162201E-06 0.961011E+00 -At t = 0.4000E+06 y = 0.493638E-02 0.198422E-07 0.995064E+00 -At t = 0.4000E+07 y = 0.516809E-03 0.206829E-08 0.999483E+00 -At t = 0.2079E+08 y = 0.100000E-03 0.400040E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.520244E-04 0.208108E-09 0.999948E+00 -At t = 0.4000E+09 y = 0.520106E-05 0.208044E-10 0.999995E+00 -At t = 0.4000E+10 y = 0.525860E-06 0.210344E-11 0.999999E+00 -At t = 0.4000E+11 y = 0.693451E-07 0.277380E-12 0.100000E+01 - -Final value of ydot = -0.276733E-18 -0.110693E-23 0.276734E-18 - - -Final statistics: - - No. steps = 542 No. f-s = 754 No. J-s = 11 No. LU-s = 107 - No. nonlinear iterations = 751 - No. nonlinear convergence failures = 0 - No. error test failures = 22 - No. root function evals = 570 diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dnsL.f b/examples/cvode/fcmix_serial/fcvRoberts_dnsL.f deleted file mode 100644 index b952682760..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dnsL.f +++ /dev/null @@ -1,273 +0,0 @@ -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: Robertson kinetics, Lapack linear solver -C with dense user Jacobian. -C -C The following is a simple example problem, with the coding -C needed for its solution by CVODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C enable the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with CVODE, using the Fortran/C interface routine -C package. This solution uses the BDF method and a user-supplied -C Jacobian routine, and prints results at t = .4, 4., ..., 4.e10. -C It uses ITOL = 2 and ATOL much smaller for y2 than y1 or y3 -C because y2 has much smaller values. At the end of the run, -C various counters of interest are printed. -C -C Note that this problem should only work with SUNDIALS configured -C to use 'realtype' as 'double' and 'sunindextype' as '32bit' -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE, LNGE - INTEGER*4 METH, ITOL, ITASK, JOUT, NOUT, IERROOT - INTEGER*4 INFO(2) - INTEGER*4 I -C The following declaration specification should match C type long int. - INTEGER*8 NEQ, IPAR, IOUT(25) - DOUBLE PRECISION RTOL, T, T0, TOUT - DOUBLE PRECISION Y(3), ATOL(3), ROUT(10), RPAR -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNGE/12/, LNJE/17/ -C - NEQ = 3 - T0 = 0.0D0 - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 - METH = 2 - ITOL = 2 - RTOL = 1.0D-4 - ATOL(1) = 1.0D-8 - ATOL(2) = 1.0D-14 - ATOL(3) = 1.0D-6 - TOUT = 0.4D0 - ITASK = 1 - JOUT = 0 - NOUT = 12 -C - WRITE(6,10) NEQ - 10 FORMAT('Dense example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) - -C create serial vector - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF - -C initialize dense matrix module - CALL FSUNDENSEMATINIT(1, NEQ, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNDENSEMATINIT returned IER = ', - 1 I5) - STOP - ENDIF - -C initialize LAPACK dense linear solver module - CALL FSUNLAPACKDENSEINIT(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNLAPACKDENSEINIT returned IER = ' - 1 , I5) - STOP - ENDIF - -C Call FCVMALLOC to create the solver memory and specify the -C Backward Differentiation Formula - CALL FCVMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF - -C Call FCVROOTINIT to specify the root function g with 2 components - CALL FCVROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVROOTINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C attach the matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C indicate a dense Jacobian function is provided - CALL FCVDENSESETJAC(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVDENSESETJAC returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - - DO WHILE(JOUT .LT. NOUT) -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,50) T, Y(1), Y(2), Y(3) - 50 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FCVROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,65) IERROOT - 65 FORMAT(///' SUNDIALS_ERROR: FCVROOTINFO returned IER = ', - 1 I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,70) (INFO(I), I = 1, 2) - 70 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO -C - CALL FCVDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' SUNDIALS_ERROR: FCVDKY returned IER = ', I4) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,85) Y(1), Y(2), Y(3) - 85 FORMAT(/'Final value of ydot = ', 3E14.6) -C - WRITE(6,90) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF), IOUT(LNGE) - 90 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4/ - 6 ' No. root function evals = ', I4) -C - CALL FCVROOTFREE - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVDJAC(N, T, Y, FY, JAC, H, IPAR, RPAR, - 1 V1, V2, V3, IER) -C Fortran routine for dense user-supplied Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 N, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), FY(*), JAC(N,*), H, RPAR(*) - DOUBLE PRECISION V1(*), V2(*), V3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JAC(1,1) = -0.04D0 - JAC(1,2) = 1.0D4 * Y3 - JAC(1,3) = 1.0D4 * Y2 - JAC(2,1) = 0.04D0 - JAC(2,2) = -1.0D4 * Y3 - 6.0D7 * Y2 - JAC(2,3) = -1.0D4 * Y2 - JAC(3,3) = 0.0D0 - JAC(3,2) = 6.0D7 * Y2 - JAC(3,3) = 0.0D0 -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dnsL.out b/examples/cvode/fcmix_serial/fcvRoberts_dnsL.out deleted file mode 100644 index 22d163cf9f..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dnsL.out +++ /dev/null @@ -1,32 +0,0 @@ -Dense example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2639E+00 y = 0.989965E+00 0.347056E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985164E+00 0.338624E-04 0.148020E-01 -At t = 0.4000E+01 y = 0.905510E+00 0.224034E-04 0.944679E-01 -At t = 0.4000E+02 y = 0.715802E+00 0.918504E-05 0.284189E+00 -At t = 0.4000E+03 y = 0.450536E+00 0.322327E-05 0.549461E+00 -At t = 0.4000E+04 y = 0.183230E+00 0.894438E-06 0.816769E+00 -At t = 0.4000E+05 y = 0.389890E-01 0.162201E-06 0.961011E+00 -At t = 0.4000E+06 y = 0.493638E-02 0.198422E-07 0.995064E+00 -At t = 0.4000E+07 y = 0.516809E-03 0.206829E-08 0.999483E+00 -At t = 0.2079E+08 y = 0.100000E-03 0.400040E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.520244E-04 0.208108E-09 0.999948E+00 -At t = 0.4000E+09 y = 0.520106E-05 0.208044E-10 0.999995E+00 -At t = 0.4000E+10 y = 0.525860E-06 0.210344E-11 0.999999E+00 -At t = 0.4000E+11 y = 0.693451E-07 0.277380E-12 0.100000E+01 - -Final value of ydot = -0.276733E-18 -0.110693E-23 0.276734E-18 - - -Final statistics: - - No. steps = 542 No. f-s = 754 No. J-s = 11 No. LU-s = 107 - No. nonlinear iterations = 751 - No. nonlinear convergence failures = 0 - No. error test failures = 22 - No. root function evals = 570 diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.f b/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.f deleted file mode 100644 index 7b4073971b..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.f +++ /dev/null @@ -1,288 +0,0 @@ -C -------------------------------------------------------------------- -C Programmer(s): Jimmy Almgren-Bell @ LLNL -C Based on prior version by: Scott D. Cohen, Alan C. Hindmarsh and -C Radu Serban @ LLNL -C -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C -------------------------------------------------------------------- -C FCVODE Example Problem: Robertson kinetics, direct linear solver -C with dense user Jacobian. -C -C The following is a simple example problem, with the coding -C needed for its solution by CVODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C enable the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with CVODE, using the Fortran/C interface routine -C package. This solution uses the BDF method and a user-supplied -C Jacobian routine, and prints results at t = .4, 4., ..., 4.e10. -C It uses ITOL = 2 and ATOL much smaller for y2 than y1 or y3 -C because y2 has much smaller values. The constraint y_i >= 0 -C is posed for all components. At the end of the run, -C various counters of interest are printed. -C -------------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE, LNGE - INTEGER*4 METH, ITOL, ITASK, JOUT, NOUT, IERROOT - INTEGER*4 INFO(2) - INTEGER*4 I - DOUBLE PRECISION CONSTR(3) -C The following declaration specification should match C type long int - INTEGER*8 NEQ, IPAR, IOUT(25) - DOUBLE PRECISION RTOL, T, T0, TOUT - DOUBLE PRECISION Y(3), ATOL(3), ROUT(10), RPAR -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNGE/12/, LNJE/17/ -C - NEQ = 3 - T0 = 0.0D0 - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 - METH = 2 - ITOL = 2 - RTOL = 1.0D-4 - ATOL(1) = 1.0D-6 - ATOL(2) = 1.0D-11 - ATOL(3) = 1.0D-5 - TOUT = 0.4D0 - ITASK = 1 - JOUT = 0 - NOUT = 12 - CONSTR(1) = 1.0D0 - CONSTR(2) = 1.0D0 - CONSTR(3) = 1.0D0 -C - WRITE(6,10) NEQ - 10 FORMAT('Dense example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) - -C create serial vector - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF - -C initialize dense matrix module - CALL FSUNDENSEMATINIT(1, NEQ, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNDENSEMATINIT returned IER = ', - 1 I5) - STOP - ENDIF - -C initialize dense linear solver module - CALL FSUNDENSELINSOLINIT(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNDENSELINSOLINIT returned IER = ' - 1 , I5) - STOP - ENDIF - -C Call FCVMALLOC to create the solver memory and specify the -C Backward Differentiation Formula - CALL FCVMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF - -C Call FCVROOTINIT to specify the root function g with 2 components - CALL FCVROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVROOTINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C attach the matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C indicate a dense Jacobian function is provided - CALL FCVDENSESETJAC(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVDENSESETJAC returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C initialize constraints - CALL FCVSETVIN("CONSTR_VEC", CONSTR, IER) - IF (IER .NE. 0) THEN - WRITE(6,50) IER - 50 FORMAT(///' SUNDIALS_ERROR: FCVSETVIN return IER = ', I5) - CALL FCVFREE - STOP - ENDIF - - DO WHILE(JOUT .LT. NOUT) -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,55) T, Y(1), Y(2), Y(3) - 55 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,65) IER, IOUT(15) - 65 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FCVROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,70) IERROOT - 70 FORMAT(///' SUNDIALS_ERROR: FCVROOTINFO returned IER = ', - 1 I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,75) (INFO(I), I = 1, 2) - 75 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO -C - CALL FCVDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,85) IER - 85 FORMAT(///' SUNDIALS_ERROR: FCVDKY returned IER = ', I4) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,90) Y(1), Y(2), Y(3) - 90 FORMAT(/'Final value of ydot = ', 3E14.6) -C - WRITE(6,95) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF), IOUT(LNGE) - 95 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4/ - 6 ' No. root function evals = ', I4) -C - CALL FCVROOTFREE - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVDJAC(N, T, Y, FY, JAC, H, IPAR, RPAR, - 1 V1, V2, V3, IER) -C Fortran routine for dense user-supplied Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 N, IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), FY(*), JAC(N,*), H, RPAR(*) - DOUBLE PRECISION V1(*), V2(*), V3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JAC(1,1) = -0.04D0 - JAC(1,2) = 1.0D4 * Y3 - JAC(1,3) = 1.0D4 * Y2 - JAC(2,1) = 0.04D0 - JAC(2,2) = -1.0D4 * Y3 - 6.0D7 * Y2 - JAC(2,3) = -1.0D4 * Y2 - JAC(3,3) = 0.0D0 - JAC(3,2) = 6.0D7 * Y2 - JAC(3,3) = 0.0D0 -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.out b/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.out deleted file mode 100644 index fc19df9cd5..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_dns_constraints.out +++ /dev/null @@ -1,32 +0,0 @@ -Dense example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2639E+00 y = 0.989965E+00 0.347056E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985165E+00 0.338627E-04 0.148011E-01 -At t = 0.4000E+01 y = 0.905528E+00 0.224062E-04 0.944493E-01 -At t = 0.4000E+02 y = 0.715866E+00 0.918722E-05 0.284125E+00 -At t = 0.4000E+03 y = 0.450547E+00 0.322302E-05 0.549450E+00 -At t = 0.4000E+04 y = 0.183226E+00 0.894390E-06 0.816773E+00 -At t = 0.4000E+05 y = 0.389863E-01 0.162191E-06 0.961014E+00 -At t = 0.4000E+06 y = 0.493403E-02 0.198330E-07 0.995066E+00 -At t = 0.4000E+07 y = 0.516524E-03 0.206719E-08 0.999483E+00 -At t = 0.1980E+08 y = 0.100000E-03 0.400071E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.477176E-04 0.190880E-09 0.999952E+00 -At t = 0.4000E+09 y = 0.360970E-05 0.144391E-10 0.999996E+00 -At t = 0.4000E+10 y = 0.889920E-06 0.355968E-11 0.999999E+00 -At t = 0.4000E+11 y = 0.635210E-07 0.254084E-12 0.100000E+01 - -Final value of ydot = -0.115031E-17 -0.460125E-23 0.272393E-17 - - -Final statistics: - - No. steps = 399 No. f-s = 567 No. J-s = 12 No. LU-s = 98 - No. nonlinear iterations = 564 - No. nonlinear convergence failures = 2 - No. error test failures = 15 - No. root function evals = 429 diff --git a/examples/cvode/fcmix_serial/fcvRoberts_klu.f b/examples/cvode/fcmix_serial/fcvRoberts_klu.f deleted file mode 100644 index de37f6a2c4..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_klu.f +++ /dev/null @@ -1,345 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Ting Yan @ SMU -C Based on cvRoberts_klu.c and modified to Fortran 77 -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C FCVODE Example Problem: Robertson kinetics -C -C The following is a simple example problem, with the coding -C needed for its solution by CVODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C enable the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with CVODE, using the Fortran/C interface routine -C package. This solution uses the BDF method, Newton iteration with -C the the KLU sparse direct linear solver, and a user-supplied -C Jacobian routine. -C It uses a scalar relative tolerance and a vector absolute -C tolerance. Output is printed in decades from t = .4 to t = 4.e10. -C Run statistics (optional outputs) are printed at the end. -C ---------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE, LNGE - INTEGER*4 METH, ITOL, ITASK, JOUT, NOUT, IERROOT - INTEGER*4 INFO(2) - INTEGER*4 I -C The following declaration specification should match C type long int - INTEGER*8 NEQ, IPAR, IOUT(22), IVAL, MXNLI, MXETF, NNZ - INTEGER*4 SPARSETYPE - DOUBLE PRECISION RTOL, T, T0, TOUT, H0, NLCONV - DOUBLE PRECISION Y(3), ATOL(3), ROUT(6), RPAR -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNGE/12/, LNJE/17/ -C -C Problem constants -C number of equations - NEQ = 3 -C initial time - T0 = 0.0D0 -C initial y components - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 -C basic integration method, 2 for BDF - METH = 2 -C type for absolute tolerance, 2 for array - ITOL = 2 -C scalar relative tolerance - RTOL = 1.0D-4 -C vector absolute tolerance components - ATOL(1) = 1.0D-6 - ATOL(2) = 1.0D-12 - ATOL(3) = 1.0D-4 -C first output time - TOUT = 0.4D0 -C call CVODE in normal mode - ITASK = 1 - JOUT = 0 -C number of output times - NOUT = 12 -C - WRITE(6, 10) NEQ - 10 FORMAT('Klu example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) - -C create serial vector - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF - -C initialize sparse matrix module -C maximum number of nonzeros in the sparse Jac - NNZ = NEQ * NEQ -C CSC - SPARSETYPE = 0 - CALL FSUNSPARSEMATINIT(1, NEQ, NEQ, NNZ, SPARSETYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPARSEMATINIT returned IER = ', - 1 I5) - STOP - ENDIF - -C initialize KLU sparse direct linear solver module - CALL FSUNKLUINIT(1, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNKLUINIT returned IER = ', I5) - STOP - ENDIF - -C Call FCVMALLOC to create the solver memory and specify the -C Backward Differentiation Formula - CALL FCVMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF - -C Set the FCVODE input -C max no. of internal steps before t_out - IVAL = 1000 - CALL FCVSETIIN('MAX_NSTEPS', IVAL, IER) - IF (IER .NE. 0) THEN - WRITE(6,31) IER - 31 FORMAT(///' SUNDIALS_ERROR: FCVSETIIN returned IER = ', I5) - STOP - ENDIF - -C max no. of error test failures - MXETF = 20 - CALL FCVSETIIN('MAX_ERRFAIL', MXETF, IER) - IF (IER .NE. 0) THEN - WRITE(6,31) IER - STOP - ENDIF - -C initial step size - H0 = 1.0D-4 * RTOL - CALL FCVSETRIN('INIT_STEP', H0, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FCVSETRIN returned IER = ', I5) - STOP - ENDIF - -C coefficient in the nonlinear convergence test - NLCONV = 1.0D-4 - CALL FCVSETRIN('NLCONV_COEF', NLCONV, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - STOP - ENDIF - -C Call FCVROOTINIT to specify the root function g with 2 components - CALL FCVROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVROOTINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C attach the matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C indicate a sparse Jacobian function is provided - CALL FCVSPARSESETJAC(IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVSPARSESETJAC returned IER = ', - 1 I5) - CALL FCVFREE - STOP - ENDIF - -C In loop, call FCVODE, print results, and test for error. - DO WHILE(JOUT .LT. NOUT) -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,50) T, Y(1), Y(2), Y(3) - 50 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FCVROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,65) IERROOT - 65 FORMAT(///' SUNDIALS_ERROR: FCVROOTINFO returned IER = ', - 1 I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,70) (INFO(I), I = 1, 2) - 70 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO - -C obtain a derivative of the solution - CALL FCVDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' SUNDIALS_ERROR: FCVDKY returned IER = ', I4) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,85) Y(1), Y(2), Y(3) - 85 FORMAT(/'Final value of ydot = ', 3E14.6) - -C output run statistics - WRITE(6,90) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF), IOUT(LNGE) - 90 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4/ - 6 ' No. root function evals = ', I4) -C - CALL FCVROOTFREE - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVSPJAC(T, Y, FY, N, NNZ, JDATA, JRVALS, - 1 JCPTRS, H, IPAR, RPAR, WK1, WK2, WK3, IER) -C Fortran routine for user-supplied CSC format Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 N, NNZ, IPAR(*) - INTEGER*8 JRVALS(NNZ), JCPTRS(N+1) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), FY(*), H, RPAR(*) - DOUBLE PRECISION JDATA(NNZ) - DOUBLE PRECISION WK1(*), WK2(*), WK3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JCPTRS(1) = 0 - JCPTRS(2) = 3 - JCPTRS(3) = 6 - JCPTRS(4) = 9 - - JDATA(1) = -0.04D0 - JRVALS(1) = 0 - JDATA(2) = 0.04D0 - JRVALS(2) = 1 - JDATA(3) = 0.0D0 - JRVALS(3) = 2 - - JDATA(4) = 1.0D4 * Y3 - JRVALS(4) = 0 - JDATA(5) = -1.0D4 * Y3 - 6.0D7 * Y2 - JRVALS(5) = 1 - JDATA(6) = 6.0D7 * Y2 - JRVALS(6) = 2 - - JDATA(7) = 1.0D4 * Y2 - JRVALS(7) = 0 - JDATA(8) = -1.0D4 * Y2 - JRVALS(8) = 1 - JDATA(9) = 0.0D0 - JRVALS(9) = 2 -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvRoberts_klu.out b/examples/cvode/fcmix_serial/fcvRoberts_klu.out deleted file mode 100644 index ce95e335aa..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_klu.out +++ /dev/null @@ -1,32 +0,0 @@ -Klu example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2636E+00 y = 0.989965E+00 0.347052E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985144E+00 0.338588E-04 0.148222E-01 -At t = 0.4000E+01 y = 0.905426E+00 0.223942E-04 0.945515E-01 -At t = 0.4000E+02 y = 0.715830E+00 0.918572E-05 0.284160E+00 -At t = 0.4000E+03 y = 0.450560E+00 0.322342E-05 0.549437E+00 -At t = 0.4000E+04 y = 0.183240E+00 0.894461E-06 0.816759E+00 -At t = 0.4000E+05 y = 0.389806E-01 0.162165E-06 0.961019E+00 -At t = 0.4000E+06 y = 0.493776E-02 0.198479E-07 0.995062E+00 -At t = 0.4000E+07 y = 0.515949E-03 0.206485E-08 0.999484E+00 -At t = 0.2082E+08 y = 0.100000E-03 0.400040E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.514789E-04 0.205926E-09 0.999949E+00 -At t = 0.4000E+09 y = 0.542638E-05 0.217056E-10 0.999995E+00 -At t = 0.4000E+10 y = 0.464797E-06 0.185919E-11 0.100000E+01 -At t = 0.4000E+11 y = 0.486207E-07 0.194483E-12 0.100000E+01 - -Final value of ydot = -0.876832E-18 -0.350733E-23 0.876835E-18 - - -Final statistics: - - No. steps = 317 No. f-s = 941 No. J-s = 40 No. LU-s = 117 - No. nonlinear iterations = 940 - No. nonlinear convergence failures = 2 - No. error test failures = 11 - No. root function evals = 356 diff --git a/examples/cvode/fcmix_serial/fcvRoberts_sps.f b/examples/cvode/fcmix_serial/fcvRoberts_sps.f deleted file mode 100644 index e2a9818d5a..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_sps.f +++ /dev/null @@ -1,355 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Ting Yan @ SMU -C Based on cvRoberts_sps.c and modified to Fortran 77 -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -C ---------------------------------------------------------------- -C FCVODE Example Problem: Robertson kinetics -C -C The following is a simple example problem, with the coding -C needed for its solution by CVODE. The problem is from chemical -C kinetics, and consists of the following three rate equations: -C -C dy1/dt = -.04*y1 + 1.e4*y2*y3 -C dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -C dy3/dt = 3.e7*y2**2 -C -C on the interval from t = 0.0 to t = 4.e10, with initial -C conditions: -C -C y1 = 1.0, y2 = y3 = 0. -C -C The problem is stiff. While integrating the system, we also -C enable the root finding feature to find the points at which -C y1 = 1.e-4 or at which y3 = 0.01. The following coding solves -C this problem with CVODE, using the Fortran/C interface routine -C package. This solution uses the BDF method, Newton iteration with -C the the SUPERLUMT sparse direct linear solver, and a user-supplied -C Jacobian routine. -C It uses a scalar relative tolerance and a vector absolute -C tolerance. Output is printed in decades from t = .4 to t = 4.e10. -C Run statistics (optional outputs) are printed at the end. -C ---------------------------------------------------------------- -C - IMPLICIT NONE -C - INTEGER*4 IER, LNST, LNFE, LNSETUP, LNNI, LNCF, LNETF, LNJE, LNGE - INTEGER*4 METH, ITOL, ITASK, JOUT, NOUT, IERROOT - INTEGER*4 INFO(2) - INTEGER*4 I -C The following declaration specification should match C type long int - INTEGER*8 NEQ, IPAR, IOUT(25), IVAL, MXNLI, MXETF, NNZ - INTEGER*4 SPARSETYPE, NTHREADS - DOUBLE PRECISION RTOL, T, T0, TOUT, H0, NLCONV - DOUBLE PRECISION Y(3), ATOL(3), ROUT(10), RPAR -C - DATA LNST/3/, LNFE/4/, LNETF/5/, LNCF/6/, LNNI/7/, LNSETUP/8/, - 1 LNGE/12/, LNJE/17/ -C -C Problem constants -C number of equations - NEQ = 3 -C initial time - T0 = 0.0D0 -C initial y components - Y(1) = 1.0D0 - Y(2) = 0.0D0 - Y(3) = 0.0D0 -C basic integration method, 2 for BDF - METH = 2 -C type for absolute tolerance, 2 for array - ITOL = 2 -C scalar relative tolerance - RTOL = 1.0D-4 -C vector absolute tolerance components - ATOL(1) = 1.0D-8 - ATOL(2) = 1.0D-14 - ATOL(3) = 1.0D-6 -C first output time - TOUT = 0.4D0 -C call CVODE in normal mode - ITASK = 1 - JOUT = 0 -C number of output times - NOUT = 12 -C - WRITE(6, 10) NEQ - 10 FORMAT('Superlu_mt example problem:'// - 1 ' Robertson kinetics, NEQ = ', I2//) - -C create serial vector - CALL FNVINITS(1, NEQ, IER) - IF (IER .NE. 0) THEN - WRITE(6,20) IER - 20 FORMAT(///' SUNDIALS_ERROR: FNVINITS returned IER = ', I5) - STOP - ENDIF - -C initialize sparse matrix module -C maximum number of nonzeros in the sparse Jac - NNZ = NEQ * NEQ -C CSC - SPARSETYPE = 0 - CALL FSUNSPARSEMATINIT(1, NEQ, NEQ, NNZ, SPARSETYPE, IER) - IF (IER .NE. 0) THEN - WRITE(6,25) IER - 25 FORMAT(///' SUNDIALS_ERROR: FSUNSPARSEMATINIT returned IER = ', - 1 I5) - STOP - ENDIF - -C initialize KLU sparse direct linear solver module -C number of threads to use in factorization - NTHREADS = 1 - CALL FSUNSUPERLUMTINIT(1, NTHREADS, IER) - IF (IER .NE. 0) THEN - WRITE(6,28) IER - 28 FORMAT(///' SUNDIALS_ERROR: FSUNKLUINIT returned IER = ', I5) - STOP - ENDIF - -C Call FCVMALLOC to create the solver memory and specify the -C Backward Differentiation Formula - CALL FCVMALLOC(T0, Y, METH, ITOL, RTOL, ATOL, - 1 IOUT, ROUT, IPAR, RPAR, IER) - IF (IER .NE. 0) THEN - WRITE(6,30) IER - 30 FORMAT(///' SUNDIALS_ERROR: FCVMALLOC returned IER = ', I5) - STOP - ENDIF - -C Set the FCVODE input -C max no. of internal steps before t_out - IVAL = 900000 - CALL FCVSETIIN('MAX_NSTEPS', IVAL, IER) - IF (IER .NE. 0) THEN - WRITE(6,31) IER - 31 FORMAT(///' SUNDIALS_ERROR: FCVSETIIN returned IER = ', I5) - STOP - ENDIF - -C max no. of iterations - MXNLI = 8 - CALL FCVSETIIN('MAX_NITERS', MXNLI, IER) - IF (IER .NE. 0) THEN - WRITE(6, 31) IER - STOP - ENDIF - -C max no. of error test failures - MXETF = 20 - CALL FCVSETIIN('MAX_ERRFAIL', MXETF, IER) - IF (IER .NE. 0) THEN - WRITE(6,31) IER - STOP - ENDIF - -C initial step size - H0 = 1.0D-4 * RTOL - CALL FCVSETRIN('INIT_STEP', H0, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - 32 FORMAT(///' SUNDIALS_ERROR: FCVSETRIN returned IER = ', I5) - STOP - ENDIF - -C coefficient in the nonlinear convergence test - NLCONV = 1.0D-7 - CALL FCVSETRIN('NLCONV_COEF', NLCONV, IER) - IF (IER .NE. 0) THEN - WRITE(6,32) IER - STOP - ENDIF - -C Call FCVROOTINIT to specify the root function g with 2 components - CALL FCVROOTINIT(2, IER) - IF (IER .NE. 0) THEN - WRITE(6,35) IER - 35 FORMAT(///' SUNDIALS_ERROR: FCVROOTINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C attach the matrix and linear solver modules to CVLs interface - CALL FCVLSINIT(IER) - IF (IER .NE. 0) THEN - WRITE(6,40) IER - 40 FORMAT(///' SUNDIALS_ERROR: FCVLSINIT returned IER = ', I5) - CALL FCVFREE - STOP - ENDIF - -C indicate a sparse Jacobian function is provided - CALL FCVSPARSESETJAC(IER) - IF (IER .NE. 0) THEN - WRITE(6,45) IER - 45 FORMAT(///' SUNDIALS_ERROR: FCVSPARSESETJAC returned IER = ', - 1 I5) - CALL FCVFREE - STOP - ENDIF - -C In loop, call FCVODE, print results, and test for error. - DO WHILE(JOUT .LT. NOUT) -C - CALL FCVODE(TOUT, T, Y, ITASK, IER) -C - WRITE(6,50) T, Y(1), Y(2), Y(3) - 50 FORMAT('At t = ', E12.4, ' y = ', 3E14.6) -C - IF (IER .LT. 0) THEN - WRITE(6,60) IER, IOUT(15) - 60 FORMAT(///' SUNDIALS_ERROR: FCVODE returned IER = ', I5, /, - 1 ' Linear Solver returned IER = ', I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF -C - IF (IER .EQ. 2) THEN - CALL FCVROOTINFO(2, INFO, IERROOT) - IF (IERROOT .LT. 0) THEN - WRITE(6,65) IERROOT - 65 FORMAT(///' SUNDIALS_ERROR: FCVROOTINFO returned IER = ', - 1 I5) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,70) (INFO(I), I = 1, 2) - 70 FORMAT(5X, 'Above is a root, INFO() = ', 2I3) - ENDIF -C - IF (IER .EQ. 0) THEN - TOUT = TOUT * 10.0D0 - JOUT = JOUT + 1 - ENDIF -C - ENDDO - -C obtain a derivative of the solution - CALL FCVDKY(T, 1, Y, IER) - IF (IER .NE. 0) THEN - WRITE(6,80) IER - 80 FORMAT(///' SUNDIALS_ERROR: FCVDKY returned IER = ', I4) - CALL FCVROOTFREE - CALL FCVFREE - STOP - ENDIF - WRITE(6,85) Y(1), Y(2), Y(3) - 85 FORMAT(/'Final value of ydot = ', 3E14.6) - -C output run statistics - WRITE(6,90) IOUT(LNST), IOUT(LNFE), IOUT(LNJE), IOUT(LNSETUP), - 1 IOUT(LNNI), IOUT(LNCF), IOUT(LNETF), IOUT(LNGE) - 90 FORMAT(//'Final statistics:'// - 1 ' No. steps = ', I4, ' No. f-s = ', I4, - 2 ' No. J-s = ', I4, ' No. LU-s = ', I4/ - 3 ' No. nonlinear iterations = ', I4/ - 4 ' No. nonlinear convergence failures = ', I4/ - 5 ' No. error test failures = ', I4/ - 6 ' No. root function evals = ', I4) -C - CALL FCVROOTFREE - CALL FCVFREE -C - STOP - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVFUN(T, Y, YDOT, IPAR, RPAR, IER) -C Fortran routine for right-hand side function - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), YDOT(*), RPAR(*) -C - YDOT(1) = -0.04D0 * Y(1) + 1.0D4 * Y(2) * Y(3) - YDOT(3) = 3.0D7 * Y(2) * Y(2) - YDOT(2) = -YDOT(1) - YDOT(3) -C - IER = 0 -C - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVROOTFN(T, Y, G, IPAR, RPAR, IER) -C Fortran routine for root finding - IMPLICIT NONE -C - DOUBLE PRECISION T, Y(*), G(*), RPAR(*) -C The following declaration specification should match C type long int - INTEGER*8 IPAR(*) - INTEGER*4 IER -C - G(1) = Y(1) - 1.0D-4 - G(2) = Y(3) - 1.0D-2 -C - IER = 0 - - RETURN - END - -C ---------------------------------------------------------------- - - SUBROUTINE FCVSPJAC(T, Y, FY, N, NNZ, JDATA, JRVALS, - 1 JCPTRS, H, IPAR, RPAR, WK1, WK2, WK3, IER) -C Fortran routine for user-supplied CSC format Jacobian - IMPLICIT NONE -C -C The following declaration specification should match C type long int - INTEGER*8 N, NNZ, IPAR(*) - INTEGER*8 JRVALS(NNZ), JCPTRS(N+1) - INTEGER*4 IER - DOUBLE PRECISION T, Y(*), FY(*), H, RPAR(*) - DOUBLE PRECISION JDATA(NNZ) - DOUBLE PRECISION WK1(*), WK2(*), WK3(*) -C - DOUBLE PRECISION Y1, Y2, Y3 -C - Y1 = Y(1) - Y2 = Y(2) - Y3 = Y(3) - JCPTRS(1) = 0 - JCPTRS(2) = 3 - JCPTRS(3) = 6 - JCPTRS(4) = 9 - - JDATA(1) = -0.04D0 - JRVALS(1) = 0 - JDATA(2) = 0.04D0 - JRVALS(2) = 1 - JDATA(3) = 0.0D0 - JRVALS(3) = 2 - - JDATA(4) = 1.0D4 * Y3 - JRVALS(4) = 0 - JDATA(5) = -1.0D4 * Y3 - 6.0D7 * Y2 - JRVALS(5) = 1 - JDATA(6) = 6.0D7 * Y2 - JRVALS(6) = 2 - - JDATA(7) = 1.0D4 * Y2 - JRVALS(7) = 0 - JDATA(8) = -1.0D4 * Y2 - JRVALS(8) = 1 - JDATA(9) = 0.0D0 - JRVALS(9) = 2 -C - IER = 0 -C - RETURN - END diff --git a/examples/cvode/fcmix_serial/fcvRoberts_sps.out b/examples/cvode/fcmix_serial/fcvRoberts_sps.out deleted file mode 100644 index 613fe9b2de..0000000000 --- a/examples/cvode/fcmix_serial/fcvRoberts_sps.out +++ /dev/null @@ -1,32 +0,0 @@ -Superlu_mt example problem: - - Robertson kinetics, NEQ = 3 - - -At t = 0.2640E+00 y = 0.989965E+00 0.347056E-04 0.100000E-01 - Above is a root, INFO() = 0 1 -At t = 0.4000E+00 y = 0.985172E+00 0.338640E-04 0.147938E-01 -At t = 0.4000E+01 y = 0.905507E+00 0.224034E-04 0.944710E-01 -At t = 0.4000E+02 y = 0.715840E+00 0.918606E-05 0.284150E+00 -At t = 0.4000E+03 y = 0.450575E+00 0.322362E-05 0.549422E+00 -At t = 0.4000E+04 y = 0.183242E+00 0.894472E-06 0.816757E+00 -At t = 0.4000E+05 y = 0.389931E-01 0.162219E-06 0.961007E+00 -At t = 0.4000E+06 y = 0.493709E-02 0.198451E-07 0.995063E+00 -At t = 0.4000E+07 y = 0.516765E-03 0.206812E-08 0.999483E+00 -At t = 0.2078E+08 y = 0.100000E-03 0.400040E-09 0.999900E+00 - Above is a root, INFO() = -1 0 -At t = 0.4000E+08 y = 0.519865E-04 0.207957E-09 0.999948E+00 -At t = 0.4000E+09 y = 0.519161E-05 0.207666E-10 0.999995E+00 -At t = 0.4000E+10 y = 0.520292E-06 0.208117E-11 0.999999E+00 -At t = 0.4000E+11 y = 0.590048E-07 0.236019E-12 0.100000E+01 - -Final value of ydot = -0.166627E-17 -0.666508E-23 0.166628E-17 - - -Final statistics: - - No. steps = 364 No. f-s = 2056 No. J-s = 18 No. LU-s = 98 - No. nonlinear iterations = 2055 - No. nonlinear convergence failures = 0 - No. error test failures = 13 - No. root function evals = 394 diff --git a/examples/ida/fcmix_openmp/CMakeLists.txt b/examples/ida/fcmix_openmp/CMakeLists.txt deleted file mode 100644 index f8aef13813..0000000000 --- a/examples/ida/fcmix_openmp/CMakeLists.txt +++ /dev/null @@ -1,118 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for FIDA opemp examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FIDA_examples - "fidaRoberts_dns_openmp\;\;develop" - ) - -# Specify libraries to link against -set(FNVECS_LIB sundials_fnvecopenmp) - -# Only static FCMIX libraries are available -set(FIDA_LIB sundials_fida${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FIDA_LIB} ${FNVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - -# Add the build and install targets for each example -foreach(example_tuple ${FIDA_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_args) - list(GET example_tuple 2 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - TEST_ARGS ${example_args} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_openmp) - endif() - -endforeach(example_tuple ${FIDA_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_openmp) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "IDA") - set(SOLVER_LIB "sundials_ida") - set(SOLVER_FLIB "sundials_fida") - - examples2string(FIDA_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_openmp_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_openmp/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_openmp/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_openmp - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_openmp_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_openmp/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_openmp/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_openmp - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(ida fcmix_openmp) - -endif() diff --git a/examples/ida/fcmix_openmp/README b/examples/ida/fcmix_openmp/README deleted file mode 100644 index 12a2f1d732..0000000000 --- a/examples/ida/fcmix_openmp/README +++ /dev/null @@ -1,46 +0,0 @@ -List of OpenMP IDA FCMIX examples - - fidaRoberts_dns_openmp : 3-species Robertson kinetics system with OpenMP - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.f b/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.f deleted file mode 100644 index 76e2d1dd15..0000000000 --- a/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.f +++ /dev/null @@ -1,306 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C Steve Smith, Eddy Banks and Alan C. Hindmarsh @ LLNL -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c ---------------------------------------------------------------- -c This simple example problem for FIDA, due to Robertson, is from -c chemical kinetics, and consists of the following three equations: -c -c dy1/dt = -.04*y1 + 1.e4*y2*y3 -c dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -c 0 = y1 + y2 + y3 - 1 -c -c on the interval from t = 0.0 to t = 4.e10, with initial -c conditions: y1 = 1, y2 = y3 = 0. -c -c While integrating the system, we also employ the rootfinding feature -c to find the points at which y1 = 1.e-4 or at which y3 = 0.01. -c -c The problem is solved using a dense linear solver, with a -c user-supplied Jacobian. Output is printed at -c t = .4, 4, 40, ..., 4e10. -c ---------------------------------------------------------------- -c - program fidaRoberts_dns -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, iout(25), ipar - integer ier, ierroot, info(2) - double precision rout(10), rpar - integer iatol, nout, jout, itask - integer nst, kused, hused, i - double precision t0, t1, rtol, tout, tret - double precision y(3), yp(3), atol(3) -c - data nst/3/, kused/9/, hused/2/ - - integer nthreads - nthreads = 4 -c -c Initialize variables -c - neq = 3 - nout = 12 - rtol = 1.0d-4 - t0 = 0.0d0 - t1 = 0.4d0 - iatol = 2 - itask = 1 -c - y(1) = 1.0d0 - y(2) = 0.0d0 - y(3) = 0.0d0 -c - yp(1) = -0.04d0 - yp(2) = 0.04d0 - yp(3) = 0.0d0 -c - atol(1) = 1.0d-6 - atol(2) = 1.0d-10 - atol(3) = 1.0d-6 -c -c Initialize IDA vector environment -c - call fnvinitomp(2, neq, nthreads, ier) - if (ier .ne. 0) then - write(6,10) ier - 10 format(///' SUNDIALS_ERROR: FNVINITS returned IER = ', i5) - stop - endif -c - call fidamalloc(t0, y, yp, iatol, rtol, atol, - & iout, rout, ipar, rpar, ier) - if (ier .ne. 0) then - write(6,20) ier - 20 format(///' SUNDIALS_ERROR: FIDAMALLOC returned IER = ', i5) - stop - endif -c -c Initialize rootfinding problem - - call fidarootinit(2, ier) - if (ier .ne. 0) then - write(6,25) ier - 25 format(///' SUNDIALS_ERROR: FIDAROOTINIT returned IER = ', i5) - call fidafree - stop - endif -c -c Attach dense matrix and linear solver -c - call fsundensematinit(2, neq, neq, ier) - if (ier .ne. 0) then - write(6,30) ier - 30 format(///' SUNDIALS_ERROR: FSUNDENSEMATINIT IER = ', i5) - call fidafree - stop - endif - call fsundenselinsolinit(2, ier) - if (ier .ne. 0) then - write(6,33) ier - 33 format(///' SUNDIALS_ERROR: FSUNDENSELINSOLINIT IER = ', i5) - call fidafree - stop - endif - call fidalsinit(ier) - if (ier .ne. 0) then - write(6,35) ier - 35 format(///' SUNDIALS_ERROR: FIDALSINIT returned IER = ', i5) - call fidafree - stop - endif - call fidadensesetjac(1, ier) - if (ier .ne. 0) then - write(6,37) ier - 37 format(///' SUNDIALS_ERROR: FIDADENSESETJAC IER = ', i5) - call fidafree - stop - endif -c -c Print header -c - call prntintro(rtol, atol, y) -c - tout = t1 -c -c - jout = 1 - do while(jout .le. nout) -c - call fidasolve(tout, tret, y, yp, itask, ier) -c - write(6,40) tret, (y(i), i = 1,3), iout(nst), iout(kused), - & rout(hused) - 40 format(e10.4, 3(1x,e12.4), i5, i3, e12.4) -c - if (ier .lt. 0) then - write(6,50) ier, iout(15) - 50 format(///' SUNDIALS_ERROR: FIDASOLVE returned IER = ',i5,/, - 1 ' Linear Solver returned IER = ',i5) - call fidarootfree - call fidafree - stop - endif -c - if (ier .eq. 2) then - call fidarootinfo(2, info, ierroot) - if (ierroot .lt. 0) then - write(6,55) ierroot - 55 format(///' SUNDIALS_ERROR: FIDAROOTINFO returned IER = ', - 1 i5) - call fidarootfree - call fidafree - stop - endif - write(6,60) (info(i), i = 1,2) - 60 format(5x, 'Above is a root, INFO() = ', 2i3) - endif -c - if (ier .eq. 0) then - tout = tout * 10.0d0 - jout = jout + 1 - endif -c - ENDDO -c -c Print final statistics -c - call prntstats(iout) -c -c Free IDA memory -c - call fidarootfree - call fidafree -c - stop - end -c -c ========== -c - subroutine fidaresfun(tres, y, yp, res, ipar, rpar, reserr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer reserr - double precision tres, rpar(*) - double precision y(*), yp(*), res(*) -c - res(1) = -0.04d0*y(1)+1.0d4*y(2)*y(3) - res(2) = -res(1)-3.0d7*y(2)*y(2)-yp(2) - res(1) = res(1)-yp(1) - res(3) = y(1)+y(2)+y(3)-1.0d0 -c - reserr = 0 -c - return - end -c -c ========== -c - subroutine fidadjac(neq, t, y, yp, r, jac, cj, ewt, h, - 1 ipar, rpar, wk1, wk2, wk3, djacerr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, ipar(*) - integer djacerr - double precision t, h, cj, rpar(*) - double precision y(*), yp(*), r(*), ewt(*), jac(neq,neq) - double precision wk1(*), wk2(*), wk3(*) -c - jac(1,1) = -0.04d0-cj - jac(2,1) = 0.04d0 - jac(3,1) = 1.0d0 - jac(1,2) = 1.0d4*y(3) - jac(2,2) = -1.0d4*y(3)-6.0d7*y(2)-cj - jac(3,2) = 1.0d0 - jac(1,3) = 1.0d4*y(2) - jac(2,3) = -1.0d4*y(2) - jac(3,3) = 1.0d0 -c - djacerr = 0 - - return - end -c -c ========== -c - subroutine fidarootfn(t, y, yp, g, ipar, rpar, ier) -c Fortran routine for rootfinding - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer ier - double precision t, y(*), yp(*), g(*), rpar(*) -c - g(1) = y(1) - 1.0d-4 - g(2) = y(3) - 1.0d-2 - - ier = 0 - - return - end -c -c ========== -c - subroutine prntintro(rtol, atol, y) -c - implicit none -c - integer i - double precision rtol, atol(*), y(*) -c - write(6,60) rtol, (atol(i), i = 1,3), (y(i), i = 1,3) - 60 format(/'fidaRoberts_dns: Robertson kinetics DAE serial example', - & 'problem for IDA', /,' Three equation chemical', - & 'kinetics problem.', //, - & 'Tolerance parameters: rtol = ', e8.2, - & ' atol = ', 3(1x,e8.2), /, - & 'Initial conditions y0 = (', 3(1x,e8.2), ')', //, - & ' t y1 y2 y3 nst', - & ' k h') -c - return - end -c -c ========== -c - subroutine prntstats(iout) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 iout(25) - integer nst, reseval, jaceval, nni, ncf, netf, nge -c - data nst/3/, reseval/4/, jaceval/17/, nni/7/, netf/5/, - & ncf/6/, nge/12/ -c - write(6,70) iout(nst), iout(reseval), iout(jaceval), - & iout(nni), iout(netf), iout(ncf), iout(nge) - 70 format(/'Final Run Statistics:', //, - & 'Number of steps = ', i3, /, - & 'Number of residual evaluations = ', i3, /, - & 'Number of Jacobian evaluations = ', i3, /, - & 'Number of nonlinear iterations = ', i3, /, - & 'Number of error test failures = ', i3, /, - & 'Number of nonlinear conv. failures = ', i3, /, - & 'Number of root function evals. = ', i3) -c - return - end diff --git a/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.out b/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.out deleted file mode 100644 index 7809e8ac6a..0000000000 --- a/examples/ida/fcmix_openmp/fidaRoberts_dns_openmp.out +++ /dev/null @@ -1,34 +0,0 @@ - -fidaRoberts_dns: Robertson kinetics DAE serial exampleproblem for IDA - Three equation chemicalkinetics problem. - -Tolerance parameters: rtol = 0.10E-03 atol = 0.10E-05 0.10E-09 0.10E-05 -Initial conditions y0 = ( 0.10E+01 0.00E+00 0.00E+00) - - t y1 y2 y3 nst k h -0.2640E+00 0.9900E+00 0.3471E-04 0.1000E-01 75 2 0.5716E-01 - Above is a root, INFO() = 0 1 -0.4000E+00 0.9852E+00 0.3386E-04 0.1480E-01 77 3 0.1143E+00 -0.4000E+01 0.9055E+00 0.2240E-04 0.9447E-01 91 4 0.3704E+00 -0.4000E+02 0.7158E+00 0.9185E-05 0.2842E+00 127 4 0.2963E+01 -0.4000E+03 0.4505E+00 0.3223E-05 0.5495E+00 177 3 0.1241E+02 -0.4000E+04 0.1832E+00 0.8940E-06 0.8168E+00 228 3 0.2765E+03 -0.4000E+05 0.3899E-01 0.1622E-06 0.9610E+00 278 5 0.2614E+04 -0.4000E+06 0.4939E-02 0.1985E-07 0.9951E+00 324 5 0.2770E+05 -0.4000E+07 0.5176E-03 0.2072E-08 0.9995E+00 355 4 0.3979E+06 -0.2075E+08 0.1000E-03 0.4000E-09 0.9999E+00 374 4 0.1592E+07 - Above is a root, INFO() = -1 0 -0.4000E+08 0.5191E-04 0.2076E-09 0.9999E+00 380 3 0.6366E+07 -0.4000E+09 0.5882E-05 0.2353E-10 0.1000E+01 394 1 0.9167E+08 -0.4000E+10 0.7054E-06 0.2822E-11 0.1000E+01 402 1 0.1467E+10 -0.4000E+11 -0.7300E-06 -0.2920E-11 0.1000E+01 407 1 0.2347E+11 - -Final Run Statistics: - -Number of steps = 407 -Number of residual evaluations = 557 -Number of Jacobian evaluations = 65 -Number of nonlinear iterations = 557 -Number of error test failures = 6 -Number of nonlinear conv. failures = 0 -Number of root function evals. = 445 diff --git a/examples/ida/fcmix_parallel/CMakeLists.txt b/examples/ida/fcmix_parallel/CMakeLists.txt deleted file mode 100644 index d965269669..0000000000 --- a/examples/ida/fcmix_parallel/CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FIDA parallel examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FIDA_examples - "fidaHeat2D_kry_bbd_p\;1\;4\;develop" - ) - -if(MPI_Fortran_COMPILER) - # use MPI wrapper as the compiler - set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) -else() - # add MPI_INCLUDE_PATH to include directories - include_directories(${MPI_INCLUDE_PATH}) -endif() - -# Specify libraries to link against -set(FNVECP_LIB sundials_fnvecparallel) - -# Only static FCMIX libraries are available -set(FIDA_LIB sundials_fida${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FIDA_LIB} ${FNVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each example -foreach(example_tuple ${FIDA_examples}) - - list(GET example_tuple 0 example) - list(GET example_tuple 1 number_of_nodes) - list(GET example_tuple 2 number_of_tasks) - list(GET example_tuple 3 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - MPI_NPROCS ${number_of_tasks} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - if(NOT MPI_Fortran_COMPILER) - target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES}) - endif() - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_parallel) - endif() - -endforeach(example_tuple ${FIDA_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_parallel) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "IDA") - set(SOLVER_LIB "sundials_ida") - set(SOLVER_FLIB "sundials_fida") - - examples2string(FIDA_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_parallel/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_parallel - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_parallel/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_parallel/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_parallel - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(ida fcmix_parallel) - -endif() diff --git a/examples/ida/fcmix_parallel/README b/examples/ida/fcmix_parallel/README deleted file mode 100644 index 2b90b2de0a..0000000000 --- a/examples/ida/fcmix_parallel/README +++ /dev/null @@ -1,46 +0,0 @@ -List of parallel IDA FCMIX examples - - fidaHeat2D_kry_bbd_p : 2D heat equation (SPGMR w/FIDABBD preconditioner) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f b/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f deleted file mode 100644 index 5a40d0f666..0000000000 --- a/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.f +++ /dev/null @@ -1,849 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C Radu Serban and Alan C. Hindmarsh @ LLNL -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c ---------------------------------------------------------------- -c Example problem for FIDA: 2D heat equation, parallel, GMRES, -c IDABBDPRE. -c -c This example solves a discretized 2D heat equation problem. -c This version uses the Krylov solver SUNSPGMR and BBD -c preconditioning. -c -c The DAE system solved is a spatial discretization of the PDE -c du/dt = d^2u/dx^2 + d^2u/dy^2 -c on the unit square. The boundary condition is u = 0 on all edges. -c Initial conditions are given by u = 16 x (1 - x) y (1 - y). The -c PDE is treated with central differences on a uniform MX x MY -c grid. The values of u at the interior points satisfy ODEs, and -c equations u = 0 at the boundaries are appended, to form a DAE -c system of size N = MX * MY. Here MX = MY = 10. -c -c The system is actually implemented on submeshes, processor by -c processor, with an MXSUB by MYSUB mesh on each of NPEX * NPEY -c processors. -c -c The system is solved with FIDA using the Krylov linear solver -c SUNSPGMR in conjunction with the preconditioner module IDABBDPRE. -c The preconditioner uses a tridiagonal approximation -c (half-bandwidths = 1). The constraints u >= 0 are posed for all -c components. Local error testing on the boundary values is -c suppressed. Output is taken at t = 0, .01, .02, .04, ..., 10.24. -c ---------------------------------------------------------------- -c - program fidaHeat2D_kry_bbd_p -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 mudq, mldq, mukeep, mlkeep, iout(25), ipar(1) - double precision rout(10), rpar(1) - integer nout, ier - parameter (nout = 11) - integer npes, inopt, maxl, maxrs, itask, iatol - integer nlocalg - parameter (nlocalg = mxsubg*mysubg) - double precision t0, t1, tout, tret, dqrely - double precision atol, rtol - double precision constr(nlocalg), uu(nlocalg), up(nlocalg) - double precision res(nlocalg), id(nlocalg) -c - data atol/1.0d-3/, rtol/0.0d0/ -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c -c Initialize variables -c - npex = 2 - npey = 2 - mxsub = 5 - mysub = 5 - mx = npex*mxsub - my = npey*mysub - neq = mx*my - nlocal = mxsub*mysub - inopt = 1 - t0 = 0.0d0 - t1 = 0.01d0 - mudq = mxsub - mldq = mxsub - mukeep = 1 - mlkeep = 1 - dqrely = 0.0d0 - maxl = 0 - maxrs = 0 - itask = 1 - iatol = 1 -c -c Initialize MPI environment -c - call mpi_init(ier) - if (ier .ne. 0) then - write(*,2) ier - 2 format(///' MPI_ERROR: MPI_INIT returned IER = ', i5) - stop - endif -c - call mpi_comm_size(mpi_comm_world, npes, ier) - if (ier .ne. 0) then - write(*,3) ier - 3 format(///' MPI_ERROR: MPI_COMM_SIZE returned IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c - call mpi_comm_rank(mpi_comm_world, thispe, ier) - if (ier .ne. 0) then - write(*,4) ier - 4 format(///' MPI_ERROR: MPI_COMM_RANK returned IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c - if (npes .ne. npex*npey) then - if (thispe .eq. 0) then - write(*,5) npes, npex*npey - 5 format(///' MPI_ERROR: npes = ', i5, ' is not equal to ', - & 'NPEX*NPEY = ', i5) - call mpi_finalize(ier) - stop - endif - endif -c - call fnvinitp(mpi_comm_world, 2, nlocal, neq, ier) - if (ier .ne. 0) then - write(*,6) ier - 6 format(///' SUNDIALS_ERROR: FNVINITP returned IER = ', i5) - call mpi_finalize(ier) - stop - endif -c - jysub = int(thispe/npex) - ixsub = thispe-jysub*npex -c -c Initialize problem data -c - call setinitprofile(uu, up, id, res, constr, ipar, rpar) -c -c Initialize IDA environment -c - call fidamalloc(t0, uu, up, iatol, rtol, atol, - & iout, rout, ipar, rpar, ier) - if (ier .ne. 0) then - write(*,7) ier - 7 format(///' SUNDIALS_ERROR: FIDAMALLOC returned IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Set optional inputs -c - call fidasetiin('SUPPRESS_ALG', 1, ier) - call fidasetvin('ID_VEC', id, ier) - call fidasetvin('CONSTR_VEC', constr, ier) -c -c Initialize and attach SUNSPGMR solver -c - call fsunspgmrinit(2, 1, maxl, ier) - if (ier .ne. 0) then - write(*,8) ier - 8 format(///' SUNDIALS_ERROR: FSUNSPGMRINIT returned IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - call fsunspgmrsetmaxrs(2, 5, ier) - if (ier .ne. 0) then - write(*,9) ier - 9 format(///' SUNDIALS_ERROR: FSUNSPGMRSETMAXRS IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - call fidalsinit(ier) - if (ier .ne. 0) then - write(*,10) ier - 10 format(///' SUNDIALS_ERROR: FIDALSINIT IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Initialize and attach BBD preconditioner module -c - call fidabbdinit(nlocal, mudq, mldq, mukeep, mlkeep, dqrely, ier) - if (ier .ne. 0) then - write(*,11) ier - 11 format(///' SUNDIALS_ERROR: FIDABBDINIT returned IER = ', i5) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Print header -c - if (thispe .eq. 0) then - call prntintro(rtol, atol) - call prntcase(1, mudq, mukeep) - endif -c - tout = t1 - do 12 jout = 1, nout -c - call fidasolve(tout, tret, uu, up, itask, ier) -c - call prntoutput(tret, uu, iout, rout) -c - if (ier .ne. 0) then - write(*,13) ier - 13 format(///' SUNDIALS_ERROR: FIDASOLVE returned IER = ', i5) - call fidafree - stop - endif -c - tout = tout*2.0d0 -c - 12 continue -c -c Print statistics -c - if (thispe .eq. 0) then - call prntfinalstats(iout) - endif -c -c Reinitialize variables and data for second problem -c - mudq = 1 - mldq = 1 -c - call setinitprofile(uu, up, id, res, constr, ipar, rpar) -c - call fidareinit(t0, uu, up, iatol, rtol, atol, ier) - if (ier .ne. 0) then - write(*,43) ier - 43 format(///' SUNDIALS_ERROR: FIDAREINIT returned IER = ', i5) - endif -c - call fidabbdreinit(nlocal, mudq, mldq, dqrely, ier) - if (ier .ne. 0) then - write(*,44) ier - 44 format(///' SUNDIALS_ERROR: FIDABBDREINIT returned IER = ', i5) - call fidafree - stop - endif -c -c Print header -c - if (thispe .eq. 0) then - call prntcase(2, mudq, mukeep) - endif -c - tout = t1 - do 14 jout = 1, nout -c - call fidasolve(tout, tret, uu, up, itask, ier) -c - call prntoutput(tret, uu, iout, rout) -c - if (ier .ne. 0) then - write(*,15) ier - 15 format(///' SUNDIALS_ERROR: FIDASOLVE returned IER = ', i5) - call fidafree - stop - endif -c - tout = tout*2.0d0 -c - 14 continue -c -c Print statistics -c - if (thispe .eq. 0) then - call prntfinalstats(iout) - endif -c -c Free memory -c - call fidafree -c - call mpi_finalize(ier) -c - stop - end -c -c ========== -c - subroutine setinitprofile(uu, up, id, res, constr, ipar, rpar) -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy, rpar(*) - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer i, iloc, j, jloc, offset, loc - integer ixbegin, ixend, jybegin, jyend - integer reserr - double precision xfact, yfact - double precision uu(*), up(*), id(*), res(*), constr(*) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c -c Initialize variables -c - dx = 1.0d0/dble(mx-1) - dy = 1.0d0/dble(my-1) - coeffx = 1.0d0/(dx*dx) - coeffy = 1.0d0/(dy*dy) - coeffxy = 2.0d0/(dx*dx)+2.0d0/(dy*dy) - ixbegin = mxsub*ixsub - ixend = mxsub*(ixsub+1)-1 - jybegin = mysub*jysub - jyend = mysub*(jysub+1)-1 -c - do 16 i = 1, nlocal - id(i) = 1.0d0 - 16 continue -c - jloc = 0 - do 17 j = jybegin, jyend - yfact = dy*dble(j) - offset = jloc*mxsub - iloc = 0 - do 18 i = ixbegin, ixend - xfact = dx*dble(i) - loc = offset+iloc - uu(loc+1) = 16.0d0*xfact*(1.0d0-xfact)*yfact*(1.0d0-yfact) - if (i .eq. 0 .or. i .eq. mx-1) then - id(loc+1) = 0.0d0 - endif - if (j .eq. 0 .or. j .eq. my-1) then - id(loc+1) = 0.0d0 - endif - iloc = iloc+1 - 18 continue - jloc = jloc+1 - 17 continue -c - do 19 i = 1, nlocal - up(i) = 0.0d0 - constr(i) = 1.0d0 - 19 continue -c - call fidaresfun(0.0d0, uu, up, res, ipar, rpar, reserr) -c - do 20 i = 1, nlocal - up(i) = -1.0d0*res(i) - 20 continue -c - return - end -c -c ========== -c - subroutine fidaresfun(tres, u, up, res, ipar, rpar, reserr) -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy, rpar(*) - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer reserr - double precision tres - double precision u(*), up(*), res(*) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - call fidacommfn(nlocal, tres, u, up, ipar, rpar, reserr) -c - call fidaglocfn(nlocal, tres, u, up, res, ipar, rpar, reserr) -c - return - end -c -c ========== -c - subroutine fidacommfn(nloc, tres, u, up, ipar, rpar, reserr) -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy, rpar(*) - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 nloc, ipar(*) - integer reserr - double precision tres, u(*), up(*) -c - integer request(mpi_status_size) - double precision buffer(2*mysub) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - call brecvpost(request, mxsub, mysub, buffer) -c - call bsend(mxsub, mysub, u) -c - call brecvwait(request, mxsub, buffer) -c - return - end -c -c ========== -c - subroutine fidaglocfn(nloc, tres, u, up, res, ipar, rpar, reserr) -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy, rpar(*) - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 nloc, ipar(*) - integer reserr - double precision tres, u(*), up(*), res(*) -c - integer i, lx, ly, offsetu, offsetue, locu, locue - integer ixbegin, ixend, jybegin, jyend, mxsub2 - double precision termx, termy, termctr -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - mxsub2 = mxsub+2 -c - do 21 i = 1, nlocal - res(i) = u(i) - 21 continue -c - offsetu = 0 - offsetue = mxsub2+1 - do 22 ly = 0, mysub-1 - do 23 lx = 0, mxsub-1 - uext(offsetue+lx+1) = u(offsetu+lx+1) - 23 continue - offsetu = offsetu+mxsub - offsetue = offsetue+mxsub2 - 22 continue -c - ixbegin = 0 - ixend = mxsub-1 - jybegin = 0 - jyend = mysub-1 - if (ixsub .eq. 0) then - ixbegin = ixbegin+1 - endif - if (ixsub .eq. npex-1) then - ixend = ixend-1 - endif - if (jysub .eq. 0) then - jybegin = jybegin+1 - endif - if (jysub .eq. npey-1) then - jyend = jyend-1 - endif -c - do 24 ly = jybegin, jyend - do 25 lx = ixbegin, ixend - locu = lx+ly*mxsub - locue = (lx+1)+(ly+1)*mxsub2 - termx = coeffx*(uext(locue)+uext(locue+2)) - termy = coeffy*(uext(locue-mxsub2+1)+uext(locue+mxsub2+1)) - termctr = coeffxy*uext(locue+1) - res(locu+1) = up(locu+1)-(termx+termy-termctr) - 25 continue - 24 continue -c - return - end -c -c ========== -c - subroutine bsend(dsizex, dsizey, uarray) -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c - integer dsizex, dsizey - double precision uarray(*) -c - integer ier, offsetu - double precision bufleft(mysub), bufright(mysub) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - if (jysub .ne. 0) then - call mpi_send(uarray(1), dsizex, mpi_double_precision, - & thispe-npex, 0, mpi_comm_world, ier) - endif -c - if (jysub .ne. npey-1) then - offsetu = (mysub-1)*dsizex - call mpi_send(uarray(offsetu+1), dsizex, mpi_double_precision, - & thispe+npex, 0, mpi_comm_world, ier) - endif -c - if (ixsub .ne. 0) then - do 26 ly = 0, mysub-1 - offsetu = ly*dsizex - bufleft(ly+1) = uarray(offsetu+1) - 26 continue - call mpi_send(bufleft(1), dsizey, mpi_double_precision, - & thispe-1, 0, mpi_comm_world, ier) - endif -c - if (ixsub .ne. npex-1) then - do 27 ly = 0, mysub-1 - offsetu = ly*mxsub+(mxsub-1) - bufright(ly+1) = uarray(offsetu+1) - 27 continue - call mpi_send(bufright(1), dsizey, mpi_double_precision, - & thispe+1, 0, mpi_comm_world, ier) - endif -c - return - end -c -c ========== -c - subroutine brecvpost(request, dsizex, dsizey, buffer) -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c - integer dsizex, dsizey - integer request(*) - double precision buffer(*) - integer ier - integer offsetue -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - if (jysub .ne. 0) then - call mpi_irecv(uext(2), dsizex, mpi_double_precision, - & thispe-npex, 0, mpi_comm_world, request(1), - & ier) - endif -c - if (jysub .ne. npey-1) then - offsetue = (1+(mysub+1)*(mxsub+2)) - call mpi_irecv(uext(offsetue+1), dsizex, mpi_double_precision, - & thispe+npex, 0, mpi_comm_world, request(2), - & ier) - endif -c - if (ixsub .ne. 0) then - call mpi_irecv(buffer(1), dsizey, mpi_double_precision, - & thispe-1, 0, mpi_comm_world, request(3), - & ier) - endif -c - if (ixsub .ne. npex-1) then - call mpi_irecv(buffer(1+mysub), dsizey, mpi_double_precision, - & thispe+1, 0, mpi_comm_world, request(4), - & ier) - endif -c - return - end -c -c ========== -c - subroutine brecvwait(request, dsizex, buffer) -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c - integer request(*) - integer dsizex - double precision buffer(*) - integer ly, dsizex2, offsetue - integer ier, status(mpi_status_size) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - dsizex2 = dsizex+2 -c - if (jysub .ne. 0) then - call mpi_wait(request(1), status, ier) - endif -c - if (jysub .ne. npey-1) then - call mpi_wait(request(2), status, ier) - endif -c - if (ixsub .ne. 0) then - call mpi_wait(request(3), status, ier) - do 28 ly = 0, mysub-1 - offsetue = (ly+1)*dsizex2 - uext(offsetue+1) = buffer(ly+1) - 28 continue - endif -c - if (ixsub .ne. npex-1) then - call mpi_wait(request(4), status, ier) - do 29 ly = 0, mysub-1 - offsetue = (ly+2)*dsizex2-1 - uext(offsetue+1) = buffer(ly+mysub+1) - 29 continue - endif -c - return - end -c -c ========== -c - subroutine prntoutput(tret, u, iout, rout) -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 iout(*), lenrwbbd, leniwbbd, ngebbd - double precision tret, umax, u(*), rout(*) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - call maxnorm(u, umax) -c - if (thispe .eq. 0) then - call fidabbdopt(lenrwbbd, leniwbbd, ngebbd) - write(*,30) tret, umax, iout(9), iout(3), iout(7), - & iout(22), iout(4), iout(16), ngebbd, rout(2), - & iout(20), iout(21) - 30 format(' ', e10.4, ' ', e13.5, ' ', i1, ' ', i2, - & ' ', i3, ' ', i3, ' ', i2,'+',i2, ' ', - & i3, ' ', e9.2, ' ', i2, ' ', i3) - endif -c - return - end -c -c ========== -c - subroutine maxnorm(u, unorm) -c - include "mpif.h" -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c - integer i, ier - double precision temp, unorm, u(*) -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - temp = 0.0d0 -c - do 31 i = 1, nlocal - temp = max(abs(u(i)), temp) - 31 continue -c - call mpi_allreduce(temp, unorm, 1, mpi_double_precision, - & mpi_max, mpi_comm_world, ier) -c -c unorm = temp -c - return - end -c -c ========== -c - subroutine prntintro(rtol, atol) -c -c global variables -c -c The following declaration specification should match C type long int. - integer*8 nlocal, neq - integer npex, npey, mxsub, mysub, mx, my, ixsub, jysub - integer thispe, mxsubg, mysubg - parameter (mxsubg = 5, mysubg = 5) - double precision dx, dy, coeffx, coeffy, coeffxy - double precision uext((mxsubg+2)*(mysubg+2)) -c -c local variables -c - double precision rtol, atol -c - common /pcom/ dx, dy, coeffx, coeffy, coeffxy, uext, - & nlocal, neq, mx, my, mxsub, mysub, npex, npey, - & ixsub, jysub, thispe -c - write(*,32) mx, my, neq, mxsub, mysub, npex, npey, rtol, atol - 32 format(/'fidaHeat2D_kry_bbd_p: Heat equation, parallel example', - & ' for FIDA', /, 16x,'Discretized heat equation', - & ' on 2D unit square.', /, 16x,'Zero boundary', - & ' conditions, polynomial conditions.', /, - & 16x,'Mesh dimensions: ', i2, ' x ', i2, - & ' Total system size: ', i3, //, - & 'Subgrid dimensions: ', i2, ' x ', i2, - & ' Processor array: ', i2, ' x ', i2, /, - & 'Tolerance parameters: rtol = ', e8.2, ' atol = ', - & e8.2, /, 'Constraints set to force all solution', - & ' components >= 0.', /, 'SUPPRESSALG = SUNTRUE to remove', - & ' boundary components from the error test.', /, - & 'Linear solver: SPGMR. Preconditioner: BBDPRE - ', - & 'Banded-block-diagonal.') -c - return - end -c -c ========== -c - subroutine prntcase(num, mudq, mukeep) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 mudq, mukeep - integer num -c - write(*,33) num, mudq, mukeep - 33 format(//, 'Case ', i2, /, ' Difference quotient half-', - & 'bandwidths =', i2, /, ' Retained matrix half-bandwidths =', - & i2, //, 'Output Summary',/,' umax = max-norm of solution', - & /,' nre = nre + nreLS (total number of RES evals.)', - & //, ' time umax k nst nni nli nre', - & ' nge h npe nps', /, - & '-------------------------------------------------------', - & '-------------------') -c - return - end -c -c ========== -c - subroutine prntfinalstats(iout) -c -c local variables -c -c The following declaration specification should match C type long int. - integer*8 iout(*) -c - write(*,34) iout(5), iout(6), iout(23) - 34 format(/, 'Error test failures =', i3, /, - & 'Nonlinear convergence failures =', i3, /, - & 'Linear convergence failures =', i3) -c - return - end diff --git a/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.out b/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.out deleted file mode 100644 index de2abb3b4e..0000000000 --- a/examples/ida/fcmix_parallel/fidaHeat2D_kry_bbd_p.out +++ /dev/null @@ -1,65 +0,0 @@ - -fidaHeat2D_kry_bbd_p: Heat equation, parallel example for FIDA - Discretized heat equation on 2D unit square. - Zero boundary conditions, polynomial conditions. - Mesh dimensions: 10 x 10 Total system size: 100 - -Subgrid dimensions: 5 x 5 Processor array: 2 x 2 -Tolerance parameters: rtol = 0.00E+00 atol = 0.10E-02 -Constraints set to force all solution components >= 0. -SUPPRESSALG = SUNTRUE to remove boundary components from the error test. -Linear solver: SPGMR. Preconditioner: BBDPRE - Banded-block-diagonal. - - -Case 1 - Difference quotient half-bandwidths = 5 - Retained matrix half-bandwidths = 1 - -Output Summary - umax = max-norm of solution - nre = nre + nreLS (total number of RES evals.) - - time umax k nst nni nli nre nge h npe nps --------------------------------------------------------------------------- - 0.1000E-01 0.82411E+00 2 12 14 7 14+ 7 96 0.26E-02 8 21 - 0.2000E-01 0.68812E+00 3 15 18 12 18+12 96 0.51E-02 8 30 - 0.4000E-01 0.47075E+00 3 18 24 22 24+22 108 0.66E-02 9 46 - 0.8000E-01 0.21660E+00 3 22 29 30 29+30 108 0.13E-01 9 59 - 0.1600E+00 0.45659E-01 4 28 37 43 37+43 120 0.26E-01 10 80 - 0.3200E+00 0.21095E-02 4 35 45 59 45+59 120 0.24E-01 10 104 - 0.6400E+00 0.34044E-04 1 40 54 71 54+71 156 0.19E+00 13 125 - 0.1280E+01 0.36151E-18 1 42 56 71 56+71 180 0.76E+00 15 127 - 0.2560E+01 0.81974E-20 1 43 57 71 57+71 192 0.15E+01 16 128 - 0.5120E+01 0.17133E-19 1 44 58 71 58+71 204 0.30E+01 17 129 - 0.1024E+02 0.36660E-19 1 45 59 71 59+71 216 0.61E+01 18 130 - -Error test failures = 1 -Nonlinear convergence failures = 0 -Linear convergence failures = 0 - - -Case 2 - Difference quotient half-bandwidths = 1 - Retained matrix half-bandwidths = 1 - -Output Summary - umax = max-norm of solution - nre = nre + nreLS (total number of RES evals.) - - time umax k nst nni nli nre nge h npe nps --------------------------------------------------------------------------- - 0.1000E-01 0.82411E+00 2 12 14 7 14+ 7 32 0.26E-02 8 21 - 0.2000E-01 0.68812E+00 3 15 18 12 18+12 32 0.51E-02 8 30 - 0.4000E-01 0.47093E+00 3 19 23 20 23+20 36 0.10E-01 9 43 - 0.8000E-01 0.21655E+00 3 23 27 32 27+32 36 0.10E-01 9 59 - 0.1600E+00 0.45225E-01 4 27 33 44 33+44 40 0.20E-01 10 77 - 0.3200E+00 0.21868E-02 3 34 41 67 41+67 44 0.41E-01 11 108 - 0.6400E+00 0.79056E-20 1 39 49 86 49+86 52 0.16E+00 13 135 - 0.1280E+01 0.18819E-19 1 41 51 86 51+86 60 0.66E+00 15 137 - 0.2560E+01 0.20662E-18 1 42 52 86 52+86 64 0.13E+01 16 138 - 0.5120E+01 0.20095E-17 1 43 53 86 53+86 68 0.26E+01 17 139 - 0.1024E+02 0.12941E-16 1 44 54 86 54+86 72 0.52E+01 18 140 - -Error test failures = 0 -Nonlinear convergence failures = 0 -Linear convergence failures = 0 diff --git a/examples/ida/fcmix_pthreads/CMakeLists.txt b/examples/ida/fcmix_pthreads/CMakeLists.txt deleted file mode 100644 index e8c19b9f25..0000000000 --- a/examples/ida/fcmix_pthreads/CMakeLists.txt +++ /dev/null @@ -1,123 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for FIDA PThread examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;args\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Only include tests if Pthreads is enabled -if(PTHREADS_FOUND) - - # Examples using SUNDIALS linear solvers - set(FIDA_examples - "fidaRoberts_dns_pthreads\;\;develop" - ) - -endif() - -# Specify libraries to link against -set(FNVECS_LIB sundials_fnvecpthreads) - -# Only static FCMIX libraries are available -set(FIDA_LIB sundials_fida${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FIDA_LIB} ${FNVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each example -foreach(example_tuple ${FIDA_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_args) - list(GET example_tuple 2 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - TEST_ARGS ${example_args} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS} ${CMAKE_THREAD_LIBS_INIT}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_pthreads) - endif() - -endforeach(example_tuple ${FIDA_examples}) - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_pthreads) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "IDA") - set(SOLVER_LIB "sundials_ida") - set(SOLVER_FLIB "sundials_fida") - - examples2string(FIDA_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_pthreads_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_pthreads/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_pthreads/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_pthreads - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_pthreads_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_pthreads/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_pthreads/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_pthreads - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(ida fcmix_pthreads) - -endif() diff --git a/examples/ida/fcmix_pthreads/README b/examples/ida/fcmix_pthreads/README deleted file mode 100644 index 8b834eeb0a..0000000000 --- a/examples/ida/fcmix_pthreads/README +++ /dev/null @@ -1,47 +0,0 @@ -List of Pthreads IDA FCMIX examples - - fidaRoberts_dns_pthreads : 3-species Robertson kinetics system with Pthreads - - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.f b/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.f deleted file mode 100644 index 47e861a470..0000000000 --- a/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.f +++ /dev/null @@ -1,306 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C Steve Smith, Eddy Banks and Alan C. Hindmarsh @ LLNL -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c ---------------------------------------------------------------- -c This simple example problem for FIDA, due to Robertson, is from -c chemical kinetics, and consists of the following three equations: -c -c dy1/dt = -.04*y1 + 1.e4*y2*y3 -c dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -c 0 = y1 + y2 + y3 - 1 -c -c on the interval from t = 0.0 to t = 4.e10, with initial -c conditions: y1 = 1, y2 = y3 = 0. -c -c While integrating the system, we also employ the rootfinding feature -c to find the points at which y1 = 1.e-4 or at which y3 = 0.01. -c -c The problem is solved using a dense linear solver, with a -c user-supplied Jacobian. Output is printed at -c t = .4, 4, 40, ..., 4e10. -c ---------------------------------------------------------------- -c - program fidaRoberts_dns -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, iout(25), ipar - integer ier, ierroot, info(2) - double precision rout(10), rpar - integer iatol, nout, jout, itask - integer nst, kused, hused, i - double precision t0, t1, rtol, tout, tret - double precision y(3), yp(3), atol(3) -c - data nst/3/, kused/9/, hused/2/ - - integer nthreads - nthreads = 4 -c -c Initialize variables -c - neq = 3 - nout = 12 - rtol = 1.0d-4 - t0 = 0.0d0 - t1 = 0.4d0 - iatol = 2 - itask = 1 -c - y(1) = 1.0d0 - y(2) = 0.0d0 - y(3) = 0.0d0 -c - yp(1) = -0.04d0 - yp(2) = 0.04d0 - yp(3) = 0.0d0 -c - atol(1) = 1.0d-6 - atol(2) = 1.0d-10 - atol(3) = 1.0d-6 -c -c Initialize IDA vector environment -c - call fnvinitpts(2, neq, nthreads, ier) - if (ier .ne. 0) then - write(6,10) ier - 10 format(///' SUNDIALS_ERROR: FNVINITS returned IER = ', i5) - stop - endif -c - call fidamalloc(t0, y, yp, iatol, rtol, atol, - & iout, rout, ipar, rpar, ier) - if (ier .ne. 0) then - write(6,20) ier - 20 format(///' SUNDIALS_ERROR: FIDAMALLOC returned IER = ', i5) - stop - endif -c -c Initialize rootfinding problem - - call fidarootinit(2, ier) - if (ier .ne. 0) then - write(6,25) ier - 25 format(///' SUNDIALS_ERROR: FIDAROOTINIT returned IER = ', i5) - call fidafree - stop - endif -c -c Attach dense matrix and linear solver -c - call fsundensematinit(2, neq, neq, ier) - if (ier .ne. 0) then - write(6,30) ier - 30 format(///' SUNDIALS_ERROR: FSUNDENSEMATINIT IER = ', i5) - call fidafree - stop - endif - call fsundenselinsolinit(2, ier) - if (ier .ne. 0) then - write(6,33) ier - 33 format(///' SUNDIALS_ERROR: FSUNDENSELINSOLINIT IER = ', i5) - call fidafree - stop - endif - call fidalsinit(ier) - if (ier .ne. 0) then - write(6,35) ier - 35 format(///' SUNDIALS_ERROR: FIDALSINIT returned IER = ', i5) - call fidafree - stop - endif - call fidadensesetjac(1, ier) - if (ier .ne. 0) then - write(6,37) ier - 37 format(///' SUNDIALS_ERROR: FIDADENSESETJAC IER = ', i5) - call fidafree - stop - endif -c -c Print header -c - call prntintro(rtol, atol, y) -c - tout = t1 -c -c - jout = 1 - do while(jout .le. nout) -c - call fidasolve(tout, tret, y, yp, itask, ier) -c - write(6,40) tret, (y(i), i = 1,3), iout(nst), iout(kused), - & rout(hused) - 40 format(e10.4, 3(1x,e12.4), i5, i3, e12.4) -c - if (ier .lt. 0) then - write(6,50) ier, iout(15) - 50 format(///' SUNDIALS_ERROR: FIDASOLVE returned IER = ',i5,/, - 1 ' Linear Solver returned IER = ',i5) - call fidarootfree - call fidafree - stop - endif -c - if (ier .eq. 2) then - call fidarootinfo(2, info, ierroot) - if (ierroot .lt. 0) then - write(6,55) ierroot - 55 format(///' SUNDIALS_ERROR: FIDAROOTINFO returned IER = ', - 1 i5) - call fidarootfree - call fidafree - stop - endif - write(6,60) (info(i), i = 1,2) - 60 format(5x, 'Above is a root, INFO() = ', 2i3) - endif -c - if (ier .eq. 0) then - tout = tout * 10.0d0 - jout = jout + 1 - endif -c - ENDDO -c -c Print final statistics -c - call prntstats(iout) -c -c Free IDA memory -c - call fidarootfree - call fidafree -c - stop - end -c -c ========== -c - subroutine fidaresfun(tres, y, yp, res, ipar, rpar, reserr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer reserr - double precision tres, rpar(*) - double precision y(*), yp(*), res(*) -c - res(1) = -0.04d0*y(1)+1.0d4*y(2)*y(3) - res(2) = -res(1)-3.0d7*y(2)*y(2)-yp(2) - res(1) = res(1)-yp(1) - res(3) = y(1)+y(2)+y(3)-1.0d0 -c - reserr = 0 -c - return - end -c -c ========== -c - subroutine fidadjac(neq, t, y, yp, r, jac, cj, ewt, h, - 1 ipar, rpar, wk1, wk2, wk3, djacerr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, ipar(*) - integer djacerr - double precision t, h, cj, rpar(*) - double precision y(*), yp(*), r(*), ewt(*), jac(neq,neq) - double precision wk1(*), wk2(*), wk3(*) -c - jac(1,1) = -0.04d0-cj - jac(2,1) = 0.04d0 - jac(3,1) = 1.0d0 - jac(1,2) = 1.0d4*y(3) - jac(2,2) = -1.0d4*y(3)-6.0d7*y(2)-cj - jac(3,2) = 1.0d0 - jac(1,3) = 1.0d4*y(2) - jac(2,3) = -1.0d4*y(2) - jac(3,3) = 1.0d0 -c - djacerr = 0 - - return - end -c -c ========== -c - subroutine fidarootfn(t, y, yp, g, ipar, rpar, ier) -c Fortran routine for rootfinding - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer ier - double precision t, y(*), yp(*), g(*), rpar(*) -c - g(1) = y(1) - 1.0d-4 - g(2) = y(3) - 1.0d-2 - - ier = 0 - - return - end -c -c ========== -c - subroutine prntintro(rtol, atol, y) -c - implicit none -c - integer i - double precision rtol, atol(*), y(*) -c - write(6,60) rtol, (atol(i), i = 1,3), (y(i), i = 1,3) - 60 format(/'fidaRoberts_dns: Robertson kinetics DAE serial example', - & 'problem for IDA', /,' Three equation chemical', - & 'kinetics problem.', //, - & 'Tolerance parameters: rtol = ', e8.2, - & ' atol = ', 3(1x,e8.2), /, - & 'Initial conditions y0 = (', 3(1x,e8.2), ')', //, - & ' t y1 y2 y3 nst', - & ' k h') -c - return - end -c -c ========== -c - subroutine prntstats(iout) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 iout(25) - integer nst, reseval, jaceval, nni, ncf, netf, nge -c - data nst/3/, reseval/4/, jaceval/17/, nni/7/, netf/5/, - & ncf/6/, nge/12/ -c - write(6,70) iout(nst), iout(reseval), iout(jaceval), - & iout(nni), iout(netf), iout(ncf), iout(nge) - 70 format(/'Final Run Statistics:', //, - & 'Number of steps = ', i3, /, - & 'Number of residual evaluations = ', i3, /, - & 'Number of Jacobian evaluations = ', i3, /, - & 'Number of nonlinear iterations = ', i3, /, - & 'Number of error test failures = ', i3, /, - & 'Number of nonlinear conv. failures = ', i3, /, - & 'Number of root function evals. = ', i3) -c - return - end diff --git a/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.out b/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.out deleted file mode 100644 index 7809e8ac6a..0000000000 --- a/examples/ida/fcmix_pthreads/fidaRoberts_dns_pthreads.out +++ /dev/null @@ -1,34 +0,0 @@ - -fidaRoberts_dns: Robertson kinetics DAE serial exampleproblem for IDA - Three equation chemicalkinetics problem. - -Tolerance parameters: rtol = 0.10E-03 atol = 0.10E-05 0.10E-09 0.10E-05 -Initial conditions y0 = ( 0.10E+01 0.00E+00 0.00E+00) - - t y1 y2 y3 nst k h -0.2640E+00 0.9900E+00 0.3471E-04 0.1000E-01 75 2 0.5716E-01 - Above is a root, INFO() = 0 1 -0.4000E+00 0.9852E+00 0.3386E-04 0.1480E-01 77 3 0.1143E+00 -0.4000E+01 0.9055E+00 0.2240E-04 0.9447E-01 91 4 0.3704E+00 -0.4000E+02 0.7158E+00 0.9185E-05 0.2842E+00 127 4 0.2963E+01 -0.4000E+03 0.4505E+00 0.3223E-05 0.5495E+00 177 3 0.1241E+02 -0.4000E+04 0.1832E+00 0.8940E-06 0.8168E+00 228 3 0.2765E+03 -0.4000E+05 0.3899E-01 0.1622E-06 0.9610E+00 278 5 0.2614E+04 -0.4000E+06 0.4939E-02 0.1985E-07 0.9951E+00 324 5 0.2770E+05 -0.4000E+07 0.5176E-03 0.2072E-08 0.9995E+00 355 4 0.3979E+06 -0.2075E+08 0.1000E-03 0.4000E-09 0.9999E+00 374 4 0.1592E+07 - Above is a root, INFO() = -1 0 -0.4000E+08 0.5191E-04 0.2076E-09 0.9999E+00 380 3 0.6366E+07 -0.4000E+09 0.5882E-05 0.2353E-10 0.1000E+01 394 1 0.9167E+08 -0.4000E+10 0.7054E-06 0.2822E-11 0.1000E+01 402 1 0.1467E+10 -0.4000E+11 -0.7300E-06 -0.2920E-11 0.1000E+01 407 1 0.2347E+11 - -Final Run Statistics: - -Number of steps = 407 -Number of residual evaluations = 557 -Number of Jacobian evaluations = 65 -Number of nonlinear iterations = 557 -Number of error test failures = 6 -Number of nonlinear conv. failures = 0 -Number of root function evals. = 445 diff --git a/examples/ida/fcmix_serial/CMakeLists.txt b/examples/ida/fcmix_serial/CMakeLists.txt deleted file mode 100644 index 812d0686ec..0000000000 --- a/examples/ida/fcmix_serial/CMakeLists.txt +++ /dev/null @@ -1,115 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FIDA serial examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FIDA_examples - "fidaRoberts_dns\;develop" - ) - -# Specify libraries to link against -set(FNVECS_LIB sundials_fnvecserial) - -# Only static FCMIX libraries are available -set(FIDA_LIB sundials_fida${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FIDA_LIB} ${FNVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - -# Add the build and install targets for each example -foreach(example_tuple ${FIDA_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_serial) - endif() - -endforeach(example_tuple ${FIDA_examples}) - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_serial) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "IDA") - set(SOLVER_LIB "sundials_ida") - set(SOLVER_FLIB "sundials_fida") - - examples2string(FIDA_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_serial/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_serial - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/ida/fcmix_serial/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/ida/fcmix_serial/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/ida/fcmix_serial - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(ida fcmix_serial) - -endif() diff --git a/examples/ida/fcmix_serial/README b/examples/ida/fcmix_serial/README deleted file mode 100644 index 9f8719e398..0000000000 --- a/examples/ida/fcmix_serial/README +++ /dev/null @@ -1,46 +0,0 @@ -List of serial IDA FCMIX examples - - fidaRoberts_dns : chemical kinetics example (DENSE) - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/ida/fcmix_serial/fidaRoberts_dns.f b/examples/ida/fcmix_serial/fidaRoberts_dns.f deleted file mode 100644 index be6b1f672c..0000000000 --- a/examples/ida/fcmix_serial/fidaRoberts_dns.f +++ /dev/null @@ -1,303 +0,0 @@ -C ---------------------------------------------------------------- -C Programmer(s): Daniel R. Reynolds @ SMU -C Alan C. Hindmarsh and Radu Serban @ LLNL -C ---------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c ---------------------------------------------------------------- -c This simple example problem for FIDA, due to Robertson, is from -c chemical kinetics, and consists of the following three equations: -c -c dy1/dt = -.04*y1 + 1.e4*y2*y3 -c dy2/dt = .04*y1 - 1.e4*y2*y3 - 3.e7*y2**2 -c 0 = y1 + y2 + y3 - 1 -c -c on the interval from t = 0.0 to t = 4.e10, with initial -c conditions: y1 = 1, y2 = y3 = 0. -c -c While integrating the system, we also employ the rootfinding feature -c to find the points at which y1 = 1.e-4 or at which y3 = 0.01. -c -c The problem is solved using a dense linear solver, with a -c user-supplied Jacobian. Output is printed at -c t = .4, 4, 40, ..., 4e10. -c ---------------------------------------------------------------- -c - program fidaRoberts_dns -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, iout(25), ipar - integer ier, ierroot, info(2) - double precision rout(10), rpar - integer iatol, nout, jout, itask - integer nst, kused, hused, i - double precision t0, t1, rtol, tout, tret - double precision y(3), yp(3), atol(3) -c - data nst/3/, kused/9/, hused/2/ -c -c Initialize variables -c - neq = 3 - nout = 12 - rtol = 1.0d-4 - t0 = 0.0d0 - t1 = 0.4d0 - iatol = 2 - itask = 1 -c - y(1) = 1.0d0 - y(2) = 0.0d0 - y(3) = 0.0d0 -c - yp(1) = -0.04d0 - yp(2) = 0.04d0 - yp(3) = 0.0d0 -c - atol(1) = 1.0d-6 - atol(2) = 1.0d-10 - atol(3) = 1.0d-6 -c -c Initialize IDA vector environment -c - call fnvinits(2, neq, ier) - if (ier .ne. 0) then - write(6,10) ier - 10 format(///' SUNDIALS_ERROR: FNVINITS returned IER = ', i5) - stop - endif -c - call fidamalloc(t0, y, yp, iatol, rtol, atol, - & iout, rout, ipar, rpar, ier) - if (ier .ne. 0) then - write(6,20) ier - 20 format(///' SUNDIALS_ERROR: FIDAMALLOC returned IER = ', i5) - stop - endif -c -c Initialize rootfinding problem - - call fidarootinit(2, ier) - if (ier .ne. 0) then - write(6,25) ier - 25 format(///' SUNDIALS_ERROR: FIDAROOTINIT returned IER = ', i5) - call fidafree - stop - endif -c -c Attach dense matrix and linear solver -c - call fsundensematinit(2, neq, neq, ier) - if (ier .ne. 0) then - write(6,30) ier - 30 format(///' SUNDIALS_ERROR: FSUNDENSEMATINIT IER = ', i5) - call fidafree - stop - endif - call fsundenselinsolinit(2, ier) - if (ier .ne. 0) then - write(6,33) ier - 33 format(///' SUNDIALS_ERROR: FSUNDENSELINSOLINIT IER = ', i5) - call fidafree - stop - endif - call fidalsinit(ier) - if (ier .ne. 0) then - write(6,35) ier - 35 format(///' SUNDIALS_ERROR: FIDALSINIT returned IER = ', i5) - call fidafree - stop - endif - call fidadensesetjac(1, ier) - if (ier .ne. 0) then - write(6,37) ier - 37 format(///' SUNDIALS_ERROR: FIDADENSESETJAC IER = ', i5) - call fidafree - stop - endif -c -c Print header -c - call prntintro(rtol, atol, y) -c - tout = t1 -c -c - jout = 1 - do while(jout .le. nout) -c - call fidasolve(tout, tret, y, yp, itask, ier) -c - write(6,40) tret, (y(i), i = 1,3), iout(nst), iout(kused), - & rout(hused) - 40 format(e10.4, 3(1x,e12.4), i5, i3, e12.4) -c - if (ier .lt. 0) then - write(6,50) ier, iout(15) - 50 format(///' SUNDIALS_ERROR: FIDASOLVE returned IER = ',i5,/, - 1 ' Linear Solver returned IER = ',i5) - call fidarootfree - call fidafree - stop - endif -c - if (ier .eq. 2) then - call fidarootinfo(2, info, ierroot) - if (ierroot .lt. 0) then - write(6,55) ierroot - 55 format(///' SUNDIALS_ERROR: FIDAROOTINFO returned IER = ', - 1 i5) - call fidarootfree - call fidafree - stop - endif - write(6,60) (info(i), i = 1,2) - 60 format(5x, 'Above is a root, INFO() = ', 2i3) - endif -c - if (ier .eq. 0) then - tout = tout * 10.0d0 - jout = jout + 1 - endif -c - ENDDO -c -c Print final statistics -c - call prntstats(iout) -c -c Free IDA memory -c - call fidarootfree - call fidafree -c - stop - end -c -c ========== -c - subroutine fidaresfun(tres, y, yp, res, ipar, rpar, reserr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer reserr - double precision tres, rpar(*) - double precision y(*), yp(*), res(*) -c - res(1) = -0.04d0*y(1)+1.0d4*y(2)*y(3) - res(2) = -res(1)-3.0d7*y(2)*y(2)-yp(2) - res(1) = res(1)-yp(1) - res(3) = y(1)+y(2)+y(3)-1.0d0 -c - reserr = 0 -c - return - end -c -c ========== -c - subroutine fidadjac(neq, t, y, yp, r, jac, cj, ewt, h, - 1 ipar, rpar, wk1, wk2, wk3, djacerr) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 neq, ipar(*) - integer djacerr - double precision t, h, cj, rpar(*) - double precision y(*), yp(*), r(*), ewt(*), jac(neq,neq) - double precision wk1(*), wk2(*), wk3(*) -c - jac(1,1) = -0.04d0-cj - jac(2,1) = 0.04d0 - jac(3,1) = 1.0d0 - jac(1,2) = 1.0d4*y(3) - jac(2,2) = -1.0d4*y(3)-6.0d7*y(2)-cj - jac(3,2) = 1.0d0 - jac(1,3) = 1.0d4*y(2) - jac(2,3) = -1.0d4*y(2) - jac(3,3) = 1.0d0 -c - djacerr = 0 - - return - end -c -c ========== -c - subroutine fidarootfn(t, y, yp, g, ipar, rpar, ier) -c Fortran routine for rootfinding - implicit none -c -c The following declaration specification should match C type long int. - integer*8 ipar(*) - integer ier - double precision t, y(*), yp(*), g(*), rpar(*) -c - g(1) = y(1) - 1.0d-4 - g(2) = y(3) - 1.0d-2 - - ier = 0 - - return - end -c -c ========== -c - subroutine prntintro(rtol, atol, y) -c - implicit none -c - integer i - double precision rtol, atol(*), y(*) -c - write(6,60) rtol, (atol(i), i = 1,3), (y(i), i = 1,3) - 60 format(/'fidaRoberts_dns: Robertson kinetics DAE serial example', - & 'problem for IDA', /,' Three equation chemical', - & 'kinetics problem.', //, - & 'Tolerance parameters: rtol = ', e8.2, - & ' atol = ', 3(1x,e8.2), /, - & 'Initial conditions y0 = (', 3(1x,e8.2), ')', //, - & ' t y1 y2 y3 nst', - & ' k h') -c - return - end -c -c ========== -c - subroutine prntstats(iout) -c - implicit none -c -c The following declaration specification should match C type long int. - integer*8 iout(25) - integer nst, reseval, jaceval, nni, ncf, netf, nge -c - data nst/3/, reseval/4/, jaceval/17/, nni/7/, netf/5/, - & ncf/6/, nge/12/ -c - write(6,70) iout(nst), iout(reseval), iout(jaceval), - & iout(nni), iout(netf), iout(ncf), iout(nge) - 70 format(/'Final Run Statistics:', //, - & 'Number of steps = ', i3, /, - & 'Number of residual evaluations = ', i3, /, - & 'Number of Jacobian evaluations = ', i3, /, - & 'Number of nonlinear iterations = ', i3, /, - & 'Number of error test failures = ', i3, /, - & 'Number of nonlinear conv. failures = ', i3, /, - & 'Number of root function evals. = ', i3) -c - return - end diff --git a/examples/ida/fcmix_serial/fidaRoberts_dns.out b/examples/ida/fcmix_serial/fidaRoberts_dns.out deleted file mode 100644 index 549e24f9d8..0000000000 --- a/examples/ida/fcmix_serial/fidaRoberts_dns.out +++ /dev/null @@ -1,34 +0,0 @@ - -fidaRoberts_dns: Robertson kinetics DAE serial exampleproblem for IDA - Three equation chemicalkinetics problem. - -Tolerance parameters: rtol = 0.10E-03 atol = 0.10E-05 0.10E-09 0.10E-05 -Initial conditions y0 = ( 0.10E+01 0.00E+00 0.00E+00) - - t y1 y2 y3 nst k h -0.2640E+00 0.9900E+00 0.3471E-04 0.1000E-01 75 2 0.5716E-01 - Above is a root, INFO() = 0 1 -0.4000E+00 0.9852E+00 0.3386E-04 0.1480E-01 77 3 0.1143E+00 -0.4000E+01 0.9055E+00 0.2240E-04 0.9447E-01 91 4 0.3704E+00 -0.4000E+02 0.7158E+00 0.9185E-05 0.2842E+00 127 4 0.2963E+01 -0.4000E+03 0.4505E+00 0.3223E-05 0.5495E+00 177 3 0.1241E+02 -0.4000E+04 0.1832E+00 0.8940E-06 0.8168E+00 228 3 0.2765E+03 -0.4000E+05 0.3899E-01 0.1622E-06 0.9610E+00 278 5 0.2614E+04 -0.4000E+06 0.4939E-02 0.1985E-07 0.9951E+00 324 5 0.2770E+05 -0.4000E+07 0.5176E-03 0.2072E-08 0.9995E+00 355 4 0.3979E+06 -0.2075E+08 0.1000E-03 0.4000E-09 0.9999E+00 374 4 0.1592E+07 - Above is a root, INFO() = -1 0 -0.4000E+08 0.5191E-04 0.2076E-09 0.9999E+00 380 3 0.6366E+07 -0.4000E+09 0.5882E-05 0.2353E-10 0.1000E+01 394 1 0.9167E+08 -0.4000E+10 0.7054E-06 0.2822E-11 0.1000E+01 402 1 0.1467E+10 -0.4000E+11 -0.7300E-06 -0.2920E-11 0.1000E+01 407 1 0.2347E+11 - -Final Run Statistics: - -Number of steps = 407 -Number of residual evaluations = 557 -Number of Jacobian evaluations = 65 -Number of nonlinear iterations = 557 -Number of error test failures = 6 -Number of nonlinear conv. failures = 0 -Number of root function evals. = 437 diff --git a/examples/kinsol/fcmix_parallel/CMakeLists.txt b/examples/kinsol/fcmix_parallel/CMakeLists.txt deleted file mode 100644 index 988bc4bc2d..0000000000 --- a/examples/kinsol/fcmix_parallel/CMakeLists.txt +++ /dev/null @@ -1,132 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FKINSOL parallel examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;nodes\;tasks\;type" where the -# type is develop for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FKINSOL_examples - "fkinDiagon_kry_p\;1\;4\;develop" - ) - -if(MPI_Fortran_COMPILER) - # use MPI wrapper as the compiler - set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) -else() - # add MPI_INCLUDE_PATH to include directories - include_directories(${MPI_INCLUDE_PATH}) -endif() - -# Specify libraries to link against -set(FNVECP_LIB sundials_fnvecparallel) - -# Only static FCMIX libraries are available -set(FKINSOL_LIB sundials_fkinsol${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FKINSOL_LIB} ${FNVECP_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each example -foreach(example_tuple ${FKINSOL_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 number_of_nodes) - list(GET example_tuple 2 number_of_tasks) - list(GET example_tuple 3 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - MPI_NPROCS ${number_of_tasks} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - if(NOT MPI_Fortran_COMPILER) - target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES}) - endif() - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_parallel) - endif() - -endforeach(example_tuple ${FKINSOL_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_parallel) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "KINSOL") - set(SOLVER_LIB "sundials_kinsol") - set(SOLVER_FLIB "sundials_fkinsol") - - examples2string(FKINSOL_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_parallel/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_parallel/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_parallel - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_parallel_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_parallel/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_parallel/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_parallel - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(kinsol fcmix_parallel) - -endif() diff --git a/examples/kinsol/fcmix_parallel/README b/examples/kinsol/fcmix_parallel/README deleted file mode 100644 index 5ca04cc4f1..0000000000 --- a/examples/kinsol/fcmix_parallel/README +++ /dev/null @@ -1,46 +0,0 @@ -List of parallel KINSOL FCMIX examples - - fkinDiagon_kry_p: simple diagonal test with Fortran interface - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f b/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f deleted file mode 100644 index 1a9ac5f708..0000000000 --- a/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.f +++ /dev/null @@ -1,344 +0,0 @@ - program fkinDiagon_kry_p -c -------------------------------------------------------------------- -c Programmer(s): Allan G. Taylor, Alan C. Hindmarsh and -c Radu Serban @ LLNL -c -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c -------------------------------------------------------------------- -c Simple diagonal test with Fortran interface, using user-supplied -c preconditioner setup and solve routines (supplied in Fortran). -c -c This example does a basic test of the solver by solving the -c system: -c f(u) = 0 for -c f(u) = u(i)^2 - i^2 -c -c No scaling is done. -c An approximate diagonal preconditioner is used. -c -c Execution command: mpirun -np 4 fkinDiagon_kry_p -c -------------------------------------------------------------------- -c - implicit none - - include "mpif.h" - - integer localsize - parameter(localsize=32) - integer baseadd, i, ii - integer size, rank, mype, npes -c The following declaration specification should match C type long int. - integer*8 neq, nlocal, iout(16), msbpre - integer ier, globalstrat, prectype, maxl, maxlrst - double precision pp, fnormtol, scsteptol - double precision rout(2), uu(localsize), scale(localsize) - double precision constr(localsize) - - common /pcom/ pp(localsize), nlocal, mype, npes, baseadd - - nlocal = localsize - neq = 4 * nlocal - globalstrat = 0 - fnormtol = 1.0d-5 - scsteptol = 1.0d-4 - prectype = 2 - maxl = 10 - maxlrst = 2 - msbpre = 5 - -c The user MUST call mpi_init, Fortran binding, for the fkinsol package -c to work. The communicator, MPI_COMM_WORLD, is the only one common -c between the Fortran and C bindings. So in the following, the communicator -c MPI_COMM_WORLD is used in calls to mpi_comm_size and mpi_comm_rank -c to determine the total number of processors and the rank (0 ... size-1) -c number of this process. - - call mpi_init(ier) - if (ier .ne. 0) then - write(6,1210) ier - 1210 format('MPI_ERROR: MPI_INIT returned IER = ', i4) - stop - endif - - call fnvinitp(mpi_comm_world, 3, nlocal, neq, ier) - if (ier .ne. 0) then - write(6,1220) ier - 1220 format('SUNDIALS_ERROR: FNVINITP returned IER = ', i4) - call mpi_finalize(ier) - stop - endif - - call mpi_comm_size(mpi_comm_world, size, ier) - if (ier .ne. 0) then - write(6,1222) ier - 1222 format('MPI_ERROR: MPI_COMM_SIZE returned IER = ', i4) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - if (size .ne. 4) then - write(6,1223) - 1223 format('MPI_ERROR: must use 4 processes') - call mpi_finalize(ier) - stop - endif - npes = size - - call mpi_comm_rank(mpi_comm_world, rank, ier) - if (ier .ne. 0) then - write(6,1224) ier - 1224 format('MPI_ERROR: MPI_COMM_RANK returned IER = ', i4) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - mype = rank - baseadd = mype * nlocal - - do 20 ii = 1, nlocal - i = ii + baseadd - uu(ii) = 2.0d0 * i - scale(ii) = 1.0d0 - constr(ii) = 0.0d0 - 20 continue - - call fkincreate(ier) - if (ier .ne. 0) then - write(6,1230) ier - 1230 format('SUNDIALS_ERROR: FKINCREATE returned IER = ', i4) - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - call fkinsetiin('MAX_SETUPS', msbpre, ier) - if (ier .ne. 0) then - write(6,1231) ier - 1231 format('SUNDIALS_ERROR: FKINSETIIN returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - call fkinsetrin('FNORM_TOL', fnormtol, ier) - if (ier .ne. 0) then - write(6,1232) ier - 1232 format('SUNDIALS_ERROR: FKINSETRIN returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - call fkinsetrin('SSTEP_TOL', scsteptol, ier) - if (ier .ne. 0) then - write(6,1232) ier - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - call fkinsetvin('CONSTR_VEC', constr, ier) - if (ier .ne. 0) then - write(6,1233) ier - 1233 format('SUNDIALS_ERROR: FKINSETVIN returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Initialize KINSOL -c - call fkininit(iout, rout, ier) - if (ier .ne. 0) then - write(6,1234) ier - 1234 format('SUNDIALS_ERROR: FKININIT returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Initialize SPGMR linear solver module with right preconditioning -c and maximum Krylov dimension maxl -c - call fsunspgmrinit(3, prectype, maxl, ier) - if (ier .ne. 0) then - write(6,1235) ier - 1235 format('SUNDIALS_ERROR: FSUNSPGMRLINSOLINIT returned IER = ', - 1 i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Attach SPGMR linear solver module to KINSOL -c - call fkinlsinit(ier) - if (ier .ne. 0) then - write(6,1236) ier - 1236 format('SUNDIALS_ERROR: FKINLSINIT returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Set the maximum number of SPGMR restarts to maxlrst -c - call fsunspgmrsetmaxrs(3, maxlrst, ier) - if (ier .ne. 0) then - write(6,1237) ier - 1237 format('SUNDIALS_ERROR: FSUNSPGRM_SETMATRS returned IER = ', - 1 i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif -c -c Set preconditioner routines -c - call fkinlssetprec(1, ier) - if (ier .ne. 0) then - write(6,1238) ier - 1238 format('SUNDIALS_ERROR: FKINLSSETPREC returned IER = ', - 1 i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - if (mype .eq. 0) write(6,1240) - 1240 format('Example program fkinDiagon_kry_p:'// - 1 ' This FKINSOL example', - 2 ' solves a 128 eqn diagonal algebraic system.'/ - 3 ' Its purpose is to demonstrate the use of the Fortran', - 4 ' interface'/' in a parallel environment.') - - call fkinsol(uu, globalstrat, scale, scale, ier) - if (ier .lt. 0) then - write(6,1242) ier, iout(9) - 1242 format('SUNDIALS_ERROR: FKINSOL returned IER = ', i4, /, - 1 ' Linear Solver returned IER = ', i4) - call fkinfree - call mpi_abort(mpi_comm_world, 1, ier) - stop - endif - - if (mype .eq. 0) write(6,1245) ier - 1245 format(/' FKINSOL return code is ', i4) - - if (mype .eq. 0) write(6,1246) - 1246 format(/' The resultant values of uu (process 0) are:'/) - - do 30 i = 1, nlocal, 4 - if(mype .eq. 0) write(6,1256) i + baseadd, uu(i), uu(i+1), - 1 uu(i+2), uu(i+3) - 1256 format(i4, 4(1x, f10.6)) - 30 continue - - if (mype .eq. 0) write(6,1267) iout(3), iout(15), iout(4), - 1 iout(13), iout(14), iout(16) - 1267 format(/'Final statistics:'// - 1 ' nni = ', i3, ', nli = ', i3, /, - 2 ' nfe = ', i3, ', npe = ', i3, /, - 3 ' nps = ', i3, ', ncfl = ', i3) - - call fkinfree - -c An explicit call to mpi_finalize (Fortran binding) is required by -c the constructs used in fkinsol. - call mpi_finalize(ier) - - stop - end - - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The function defining the system f(u) = 0 must be defined by a Fortran -c function with the following name and form. - - subroutine fkfun(uu, fval, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 nlocal - integer mype, npes, baseadd - integer localsize - parameter(localsize=32) - double precision pp - double precision fval(*), uu(*) - - common /pcom/ pp(localsize), nlocal, mype, npes, baseadd - - do 10 i = 1, nlocal - 10 fval(i) = uu(i) * uu(i) - (i + baseadd) * (i + baseadd) - - ier = 0 - - return - end - - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The routine kpreco is the preconditioner setup routine. It must have -c that specific name be used in order that the c code can find and link -c to it. The argument list must also be as illustrated below: - - subroutine fkpset(udata, uscale, fdata, fscale, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 nlocal - integer mype, npes, baseadd - integer localsize - parameter(localsize=32) - double precision pp - double precision udata(*), uscale(*), fdata(*), fscale(*) - - common /pcom/ pp(localsize), nlocal, mype, npes, baseadd - - do 10 i = 1, nlocal - 10 pp(i) = 0.5d0 / (udata(i) + 5.0d0) - - ier = 0 - - return - end - - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The routine kpsol is the preconditioner solve routine. It must have -c that specific name be used in order that the c code can find and link -c to it. The argument list must also be as illustrated below: - - subroutine fkpsol(udata, uscale, fdata, fscale, vv, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 nlocal - integer mype, npes, baseadd - integer localsize - parameter(localsize=32) - double precision pp - double precision udata(*), uscale(*), fdata(*), fscale(*), vv(*) - - common /pcom/ pp(localsize), nlocal, mype, npes, baseadd - - do 10 i = 1, nlocal - 10 vv(i) = vv(i) * pp(i) - - ier = 0 - - return - end diff --git a/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.out b/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.out deleted file mode 100644 index 9a8f8ee542..0000000000 --- a/examples/kinsol/fcmix_parallel/fkinDiagon_kry_p.out +++ /dev/null @@ -1,24 +0,0 @@ -Example program fkinDiagon_kry_p: - - This FKINSOL example solves a 128 eqn diagonal algebraic system. - Its purpose is to demonstrate the use of the Fortran interface - in a parallel environment. - - FKINSOL return code is 0 - - The resultant values of uu (process 0) are: - - 1 1.000000 2.000000 3.000000 4.000000 - 5 5.000000 6.000000 7.000000 8.000000 - 9 9.000000 10.000000 11.000000 12.000000 - 13 13.000000 14.000000 15.000000 16.000000 - 17 17.000000 18.000000 19.000000 20.000000 - 21 21.000000 22.000000 23.000000 24.000000 - 25 25.000000 26.000000 27.000000 28.000000 - 29 29.000000 30.000000 31.000000 32.000000 - -Final statistics: - - nni = 7, nli = 21 - nfe = 8, npe = 2 - nps = 28, ncfl = 0 diff --git a/examples/kinsol/fcmix_serial/CMakeLists.txt b/examples/kinsol/fcmix_serial/CMakeLists.txt deleted file mode 100644 index b8ed342084..0000000000 --- a/examples/kinsol/fcmix_serial/CMakeLists.txt +++ /dev/null @@ -1,117 +0,0 @@ -# --------------------------------------------------------------- -# Programmer(s): Radu Serban @ LLNL -# --------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# --------------------------------------------------------------- -# CMakeLists.txt file for the FKINSOL serial examples -# --------------------------------------------------------------- - -# Example lists are tuples "name\;type" where the type is -# 'develop' for examples excluded from 'make test' in releases - -# Examples using SUNDIALS linear solvers -set(FKINSOL_examples - "fkinDiagon_kry\;develop" - ) - -# Specify libraries to link against -set(FNVECS_LIB sundials_fnvecserial) - -# Only static FCMIX libraries are available -set(FKINSOL_LIB sundials_fkinsol${_STATIC_LIB_SUFFIX}) - -# Set-up linker flags and link libraries -set(SUNDIALS_LIBS ${FKINSOL_LIB} ${FNVECS_LIB} ${EXE_EXTRA_LINK_LIBS}) - - -# Add the build and install targets for each example -foreach(example_tuple ${FKINSOL_examples}) - - # parse the example tuple - list(GET example_tuple 0 example) - list(GET example_tuple 1 example_type) - - # example source files - add_executable(${example} ${example}.f) - - set_target_properties(${example} PROPERTIES FOLDER "Examples") - - # add example to regression tests - sundials_add_test(${example} ${example} - ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR} - ANSWER_FILE ${example}.out - EXAMPLE_TYPE ${example_type}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBS}) - - # install example source and out files - if(EXAMPLES_INSTALL) - install(FILES ${example}.f ${example}.out - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_serial) - endif() - -endforeach(example_tuple ${FKINSOL_examples}) - - -# create Makfile and CMakeLists.txt for examples -if(EXAMPLES_INSTALL) - - # Install the README file - install(FILES README DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_serial) - - # Prepare substitution variables for Makefile and/or CMakeLists templates - set(SOLVER "KINSOL") - set(SOLVER_LIB "sundials_kinsol") - set(SOLVER_FLIB "sundials_fkinsol") - - examples2string(FKINSOL_examples EXAMPLES) - - # Regardless of the platform we're on, we will generate and install - # CMakeLists.txt file for building the examples. This file can then - # be used as a template for the user's own programs. - - # generate CMakelists.txt in the binary directory - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/cmakelists_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_serial/CMakeLists.txt - @ONLY - ) - - # install CMakelists.txt - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_serial/CMakeLists.txt - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_serial - ) - - # On UNIX-type platforms, we also generate and install a makefile for - # building the examples. This makefile can then be used as a template - # for the user's own programs. - - if(UNIX) - # generate Makefile and place it in the binary dir - configure_file( - ${PROJECT_SOURCE_DIR}/examples/templates/makefile_serial_F77_ex.in - ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_serial/Makefile_ex - @ONLY - ) - # install the configured Makefile_ex as Makefile - install( - FILES ${PROJECT_BINARY_DIR}/examples/kinsol/fcmix_serial/Makefile_ex - DESTINATION ${EXAMPLES_INSTALL_PATH}/kinsol/fcmix_serial - RENAME Makefile - ) - endif() - - # add test_install target - sundials_add_test_install(kinsol fcmix_serial) - -endif() diff --git a/examples/kinsol/fcmix_serial/README b/examples/kinsol/fcmix_serial/README deleted file mode 100644 index 7a780fb7d5..0000000000 --- a/examples/kinsol/fcmix_serial/README +++ /dev/null @@ -1,46 +0,0 @@ -List of serial KINSOL FCMIX examples - - fkinDiagon_kry: simple diagonal test with Fortran interface - - -The following CMake command was used to configure SUNDIALS: - - cmake \ --DCMAKE_BUILD_TYPE=DEBUG \ --DBUILD_ARKODE=ON \ --DBUILD_CVODE=ON \ --DBUILD_CVODES=ON \ --DBUILD_IDA=ON \ --DBUILD_IDAS=ON \ --DBUILD_KINSOL=ON \ --DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ --DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ --DBUILD_SHARED_LIBS=OFF \ --DBUILD_STATIC_LIBS=ON \ --DEXAMPLES_ENABLE_C=ON \ --DEXAMPLES_ENABLE_CXX=ON \ --DEXAMPLES_INSTALL=ON \ --DENABLE_MPI=ON \ --DENABLE_LAPACK=ON \ --DENABLE_KLU=ON \ --DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ --DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ --DENABLE_HYPRE=ON \ --DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ --DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ --DENABLE_OPENMP=ON \ --DENABLE_PTHREAD=ON \ --DENABLE_SUPERLUMT=ON \ --DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ --DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ --DSUPERLUMT_THREAD_TYPE=Pthread \ --DENABLE_PETSC=ON \ --DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ --DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ -../sundials - - System Architecture: x86_64 - Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz - Operating System: Red Hat 6.8 - C/Fortran Compilers: gcc/gfortran v4.4.7 - MPI: Open MPI v1.8.8 diff --git a/examples/kinsol/fcmix_serial/fkinDiagon_kry.f b/examples/kinsol/fcmix_serial/fkinDiagon_kry.f deleted file mode 100644 index ade4258753..0000000000 --- a/examples/kinsol/fcmix_serial/fkinDiagon_kry.f +++ /dev/null @@ -1,273 +0,0 @@ - program fkinDiagon_kry -c -------------------------------------------------------------------- -c Programmer(s): Allan G. Taylor, Alan C. Hindmarsh and -c Radu Serban @ LLNL -c -------------------------------------------------------------------- -C SUNDIALS Copyright Start -C Copyright (c) 2002-2023, Lawrence Livermore National Security -C and Southern Methodist University. -C All rights reserved. -C -C See the top-level LICENSE and NOTICE files for details. -C -C SPDX-License-Identifier: BSD-3-Clause -C SUNDIALS Copyright End -c -------------------------------------------------------------------- -c Simple diagonal test with Fortran interface, using user-supplied -c preconditioner setup and solve routines (supplied in Fortran). -c -c This example does a basic test of the solver by solving the -c system: -c f(u) = 0 for -c f(u) = u(i)^2 - i^2 -c -c No scaling is done. -c An approximate diagonal preconditioner is used. -c -c -------------------------------------------------------------------- -c - implicit none - - integer PROBSIZE - parameter(PROBSIZE=128) -c The following declaration specification should match C type long int. - integer*8 neq, iout(16), msbpre - integer ier, globalstrat, prectype, maxl, maxlrst, i - double precision pp, fnormtol, scsteptol - double precision rout(2), uu(PROBSIZE), scale(PROBSIZE) - double precision constr(PROBSIZE) - - common /pcom/ pp(PROBSIZE) - common /psize/ neq - - neq = PROBSIZE - globalstrat = 0 - fnormtol = 1.0d-5 - scsteptol = 1.0d-4 - prectype = 2 - maxl = 10 - maxlrst = 2 - msbpre = 5 - -c * * * * * * * * * * * * * * * * * * * * * * - - call fnvinits(3, neq, ier) - if (ier .ne. 0) then - write(6,1220) ier - 1220 format('SUNDIALS_ERROR: FNVINITS returned IER = ', i4) - stop - endif - - do 20 i = 1, neq - uu(i) = 2.0d0 * i - scale(i) = 1.0d0 - constr(i) = 0.0d0 - 20 continue - - call fkincreate(ier) - if (ier .ne. 0) then - write(6,1230) ier - 1230 format('SUNDIALS_ERROR: FKINCREATE returned IER = ', i4) - stop - endif - - call fkinsetiin('MAX_SETUPS', msbpre, ier) - if (ier .ne. 0) then - write(6,1231) ier - 1231 format('SUNDIALS_ERROR: FKINSETIIN returned IER = ', i4) - call fkinfree - stop - endif - - call fkinsetrin('FNORM_TOL', fnormtol, ier) - if (ier .ne. 0) then - write(6,1232) ier - 1232 format('SUNDIALS_ERROR: FKINSETRIN returned IER = ', i4) - call fkinfree - stop - endif - - call fkinsetrin('SSTEP_TOL', scsteptol, ier) - if (ier .ne. 0) then - write(6,1232) ier - call fkinfree - stop - endif - - call fkinsetvin('CONSTR_VEC', constr, ier) - if (ier .ne. 0) then - write(6,1233) ier - 1233 format('SUNDIALS_ERROR: FKINSETVIN returned IER = ', i4) - call fkinfree - stop - endif -c -c Initialize KINSOL -c - call fkininit(iout, rout, ier) - if (ier .ne. 0) then - write(6,1234) ier - 1234 format('SUNDIALS_ERROR: FKININIT returned IER = ', i4) - call fkinfree - stop - endif -c -c Initialize SPGMR linear solver module with right preconditioning -c and maximum Krylov dimension maxl -c - call fsunspgmrinit(3, prectype, maxl, ier) - if (ier .ne. 0) then - write(6,1235) ier - 1235 format('SUNDIALS_ERROR: FSUNSPGMRLINSOLINIT returned IER = ', - 1 i4) - call fkinfree - stop - endif -c -c Attach SPGMR linear solver module to KINSOL -c - call fkinlsinit(ier) - if (ier .ne. 0) then - write(6,1236) ier - 1236 format('SUNDIALS_ERROR: FKINLSINIT returned IER = ', i4) - call fkinfree - stop - endif -c -c Set the maximum number of SPGMR restarts to maxlrst -c - call fsunspgmrsetmaxrs(3, maxlrst, ier) - if (ier .ne. 0) then - write(6,1237) ier - 1237 format('SUNDIALS_ERROR: FSUNSPGRM_SETMATRS returned IER = ', - 1 i4) - call fkinfree - stop - endif -c -c Set preconditioner routines -c - call fkinlssetprec(1, ier) - if (ier .ne. 0) then - write(6,1238) ier - 1238 format('SUNDIALS_ERROR: FKINLSSETPREC returned IER = ', - 1 i4) - call fkinfree - stop - endif - - write(6,1240) - 1240 format('Example program fkinDiagon_kry:'//' This FKINSOL example', - 1 ' solves a 128 eqn diagonal algebraic system.'/ - 2 ' Its purpose is to demonstrate the use of the Fortran', - 3 ' interface'/' in a serial environment.'/// - 4 ' globalstrategy = KIN_NONE') - - call fkinsol(uu, globalstrat, scale, scale, ier) - if (ier .lt. 0) then - write(6,1242) ier, iout(9) - 1242 format('SUNDIALS_ERROR: FKINSOL returned IER = ', i4, /, - 1 ' Linear Solver returned IER = ', i4) - call fkinfree - stop - endif - - write(6,1245) ier - 1245 format(/' FKINSOL return code is ', i4) - - write(6,1246) - 1246 format(//' The resultant values of uu are:'/) - - do 30 i = 1, neq, 4 - write(6,1256) i, uu(i), uu(i+1), uu(i+2), uu(i+3) - 1256 format(i4, 4(1x, f10.6)) - 30 continue - - write(6,1267) iout(3), iout(15), iout(4), iout(13), iout(14), - 1 iout(16) - 1267 format(//'Final statistics:'// - 1 ' nni = ', i3, ', nli = ', i3, /, - 2 ' nfe = ', i3, ', npe = ', i3, /, - 3 ' nps = ', i3, ', ncfl = ', i3) - - call fkinfree - - stop - end - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The function defining the system f(u) = 0 must be defined by a Fortran -c function with the following name and form. - - subroutine fkfun(uu, fval, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 neq - double precision fval(*), uu(*) - - common /psize/ neq - - do 10 i = 1, neq - 10 fval(i) = uu(i) * uu(i) - i * i - - ier = 0 - - return - end - - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The routine kpreco is the preconditioner setup routine. It must have -c that specific name be used in order that the c code can find and link -c to it. The argument list must also be as illustrated below: - - subroutine fkpset(udata, uscale, fdata, fscale, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 neq - double precision pp - double precision udata(*), uscale(*), fdata(*), fscale(*) - - common /pcom/ pp(128) - common /psize/ neq - - do 10 i = 1, neq - 10 pp(i) = 0.5d0 / (udata(i) + 5.0d0) - - ier = 0 - - return - end - - -c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -c The routine kpsol is the preconditioner solve routine. It must have -c that specific name be used in order that the c code can find and link -c to it. The argument list must also be as illustrated below: - - subroutine fkpsol(udata, uscale, fdata, fscale, vv, ier) - - implicit none - - integer ier, i -c The following declaration specification should match C type long int. - integer*8 neq - double precision pp - double precision udata(*), uscale(*), fdata(*), fscale(*), vv(*) - - common /pcom/ pp(128) - common /psize/ neq - - do 10 i = 1, neq - 10 vv(i) = vv(i) * pp(i) - - ier = 0 - - return - end diff --git a/examples/kinsol/fcmix_serial/fkinDiagon_kry.out b/examples/kinsol/fcmix_serial/fkinDiagon_kry.out deleted file mode 100644 index 27dd57d354..0000000000 --- a/examples/kinsol/fcmix_serial/fkinDiagon_kry.out +++ /dev/null @@ -1,53 +0,0 @@ -Example program fkinDiagon_kry: - - This FKINSOL example solves a 128 eqn diagonal algebraic system. - Its purpose is to demonstrate the use of the Fortran interface - in a serial environment. - - - globalstrategy = KIN_NONE - - FKINSOL return code is 0 - - - The resultant values of uu are: - - 1 1.000000 2.000000 3.000000 4.000000 - 5 5.000000 6.000000 7.000000 8.000000 - 9 9.000000 10.000000 11.000000 12.000000 - 13 13.000000 14.000000 15.000000 16.000000 - 17 17.000000 18.000000 19.000000 20.000000 - 21 21.000000 22.000000 23.000000 24.000000 - 25 25.000000 26.000000 27.000000 28.000000 - 29 29.000000 30.000000 31.000000 32.000000 - 33 33.000000 34.000000 35.000000 36.000000 - 37 37.000000 38.000000 39.000000 40.000000 - 41 41.000000 42.000000 43.000000 44.000000 - 45 45.000000 46.000000 47.000000 48.000000 - 49 49.000000 50.000000 51.000000 52.000000 - 53 53.000000 54.000000 55.000000 56.000000 - 57 57.000000 58.000000 59.000000 60.000000 - 61 61.000000 62.000000 63.000000 64.000000 - 65 65.000000 66.000000 67.000000 68.000000 - 69 69.000000 70.000000 71.000000 72.000000 - 73 73.000000 74.000000 75.000000 76.000000 - 77 77.000000 78.000000 79.000000 80.000000 - 81 81.000000 82.000000 83.000000 84.000000 - 85 85.000000 86.000000 87.000000 88.000000 - 89 89.000000 90.000000 91.000000 92.000000 - 93 93.000000 94.000000 95.000000 96.000000 - 97 97.000000 98.000000 99.000000 100.000000 - 101 101.000000 102.000000 103.000000 104.000000 - 105 105.000000 106.000000 107.000000 108.000000 - 109 109.000000 110.000000 111.000000 112.000000 - 113 113.000000 114.000000 115.000000 116.000000 - 117 117.000000 118.000000 119.000000 120.000000 - 121 121.000000 122.000000 123.000000 124.000000 - 125 125.000000 126.000000 127.000000 128.000000 - - -Final statistics: - - nni = 7, nli = 21 - nfe = 8, npe = 2 - nps = 28, ncfl = 0 diff --git a/examples/templates/cmakelists_parallel_F90_ex.in b/examples/templates/cmakelists_parallel_F90_ex.in deleted file mode 100644 index da650a7b5b..0000000000 --- a/examples/templates/cmakelists_parallel_F90_ex.in +++ /dev/null @@ -1,108 +0,0 @@ -# ----------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# ----------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ----------------------------------------------------------------- -# CMakeLists.txt for @SOLVER@ Fortran MPI examples -# -# This file is generated from a template using variables -# set at configuration time. It can be used as a template for -# other user CMakeLists configuration files. -# ----------------------------------------------------------------- - -cmake_minimum_required(VERSION @CMAKE_VERSION@) - -# Set cache variables for compilers and flags -set(CMAKE_Fortran_COMPILER - @MPI_Fortran_COMPILER@ - CACHE FILEPATH "MPI Fortran compiler") - -set(CMAKE_Fortran_FLAGS - "@CMAKE_Fortran_FLAGS@" - CACHE STRING "Fortran compiler flags") - -# Specify project name and languages -project(@SOLVER@_F90_parallel_examples Fortran) - -# Enable testing -include(CTest) - -# ------------------------------------------------------------------------------ - -# Specify the path to SUNDIALS header files -set(SUNDIALS_INCLUDE_DIR - @CMAKE_INSTALL_PREFIX@/include - CACHE PATH "Location of SUNDIALS header files") - -# Specify the path to SUNDIALS libraries -set(SUNDIALS_LIBRARY_DIR - @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ - CACHE PATH "Location of SUNDIALS libraries") - -# Find the SUNDIALS libraries -find_library(SUNDIALS_SOLVER_LIB - @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} - DOC "@SOLVER@ library") - -find_library(SUNDIALS_SOLVER_FLIB - @SOLVER_FLIB@ ${SUNDIALS_LIBRARY_DIR} - DOC "@SOLVER@ Fortran-C library") - -find_library(SUNDIALS_NVEC_LIB - sundials_nvecparallel ${SUNDIALS_LIBRARY_DIR} - DOC "NVECTOR_PARALLEL library") - -find_library(SUNDIALS_NVEC_FLIB - sundials_fnvecparallel ${SUNDIALS_LIBRARY_DIR} - DOC "NVECTOR Fortran-C library") - -# Set additional libraries -set(SUNDIALS_EXTRA_LIBS @LIBS@ CACHE STRING "Additional libraries") - -# For SUNDIALS module examples the solver library is not needed -if(NOT SUNDIALS_SOLVER_LIB) - set(SUNDIALS_SOLVER_LIB "") -endif() - -# List of SUNDIALS libraries -set(SUNDIALS_LIBRARIES - -L${SUNDIALS_LIBRARY_DIR} - ${SUNDIALS_SOLVER_FLIB} - ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_FLIB} - ${SUNDIALS_NVEC_LIB} - ${SUNDIALS_EXTRA_LIBS}) - -# ------------------------------------------------------------------------------ - -# Set the names of the examples to be built and their dependencies -set(examples @EXAMPLES@) -set(examples_dependencies @EXAMPLES_DEPENDENCIES@) -if(examples) - list(REMOVE_DUPLICATES examples) -endif() - -# Create targets for each example -foreach(example ${examples}) - - # example source files - add_executable(${example} ${example}.f90 ${examples_dependencies}) - - # directories to include - target_include_directories(${example} PRIVATE ${SUNDIALS_INCLUDE_DIR}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBRARIES}) - - # add the example to ctest - add_test(NAME ${example} COMMAND ${example}) - -endforeach() diff --git a/examples/templates/cmakelists_serial_F90_ex.in b/examples/templates/cmakelists_serial_F90_ex.in deleted file mode 100644 index c08f0aef2b..0000000000 --- a/examples/templates/cmakelists_serial_F90_ex.in +++ /dev/null @@ -1,288 +0,0 @@ -# ----------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# David J. Gardner @ LLNL -# ----------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ----------------------------------------------------------------- -# CMakeLists.txt for @SOLVER@ Fortran 90 serial examples. -# -# This file is generated from a template using variables -# set at configuration time. It can be used as a template for -# other user CMakeLists configuration files. -# ----------------------------------------------------------------- - -cmake_minimum_required(VERSION @CMAKE_VERSION@) - -# Set cache variables for compilers and flags -set(CMAKE_Fortran_COMPILER - @_EXAMPLES_Fortran_COMPILER@ - CACHE FILEPATH "Fortran compiler") - -set(CMAKE_Fortran_FLAGS - "@CMAKE_Fortran_FLAGS@" - CACHE STRING "Fortran compiler flags") - -# Specify project name and languages -project(@SOLVER@_F90_serial_examples Fortran) - -# Enable testing -include(CTest) - -# ------------------------------------------------------------------------------ - -# Specify the path to SUNDIALS header files -set(SUNDIALS_INCLUDE_DIR - @CMAKE_INSTALL_PREFIX@/include - CACHE PATH "Location of SUNDIALS header files") - -# Specify the path to SUNDIALS libraries -set(SUNDIALS_LIBRARY_DIR - @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ - CACHE PATH "Location of SUNDIALS libraries") - -# Find the SUNDIALS libraries -find_library(SUNDIALS_SOLVER_LIB - @SOLVER_LIB@ ${SUNDIALS_LIBRARY_DIR} - DOC "@SOLVER@ library") - -find_library(SUNDIALS_SOLVER_FLIB - @SOLVER_FLIB@ ${SUNDIALS_LIBRARY_DIR} - DOC "@SOLVER@ Fortran-C library") - -find_library(SUNDIALS_NVEC_LIB - sundials_nvecserial ${SUNDIALS_LIBRARY_DIR} - DOC "NVECTOR_SERIAL library") - -find_library(SUNDIALS_NVEC_FLIB - sundials_fnvecserial ${SUNDIALS_LIBRARY_DIR} - DOC "NVECTOR_SERIAL Fortran-C library") - -# Set additional libraries -set(SUNDIALS_EXTRA_LIBS @LIBS@ CACHE STRING "Additional libraries") - -# For SUNDIALS module examples the solver library is not needed -if(NOT SUNDIALS_SOLVER_LIB) - set(SUNDIALS_SOLVER_LIB "") -endif() - -# List of SUNDIALS libraries -set(SUNDIALS_LIBRARIES - -L${SUNDIALS_LIBRARY_DIR} - ${SUNDIALS_SOLVER_FLIB} - ${SUNDIALS_SOLVER_LIB} - ${SUNDIALS_NVEC_FLIB} - ${SUNDIALS_NVEC_LIB} - ${SUNDIALS_EXTRA_LIBS}) - -# ------------------------------------------------------------------------------ - -# Set the names of the examples to be built and their dependencies -set(examples @EXAMPLES@) -set(examples_dependencies @EXAMPLES_DEPENDENCIES@) -if(examples) - list(REMOVE_DUPLICATES examples) -endif() - -# Create targets for each example -foreach(example ${examples}) - - # example source files - add_executable(${example} ${example}.f90 ${examples_dependencies}) - - # directories to include - target_include_directories(${example} PRIVATE ${SUNDIALS_INCLUDE_DIR}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBRARIES}) - - # add the example to ctest - add_test(NAME ${example} COMMAND ${example}) - -endforeach() - -# ------------------------------------------------------------------------------ - -# Set LAPACK libraries -set(LAPACK_LIBRARIES - @LAPACK_LIBS@ - CACHE STRING "Lapack libraries") - -# Set the names of the examples to be built and their dependencies -set(examples_bl @EXAMPLES_BL@) -set(examples_dependencies_bl @EXAMPLES_DEPENDENCIES_BL@) -if(examples_bl) - list(REMOVE_DUPLICATES examples_bl) -endif() - -if(LAPACK_LIBRARIES AND examples_bl) - - # Find the SUNDIALS linear solver libraries - find_library(SUNDIALS_SUNLINSOLLAPACKBAND_LIB - sundials_sunlinsollapackband ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS banded LAPACK linear solver library") - - find_library(SUNDIALS_SUNLINSOLLAPACKBAND_FLIB - sundials_fsunlinsollapackband ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS banded LAPACK linear solver Fortran-C library") - - find_library(SUNDIALS_SUNLINSOLLAPACKDENSE_LIB - sundials_sunlinsollapackdense ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS dense LAPACK linear solver library") - - find_library(SUNDIALS_SUNLINSOLLAPACKDENSE_FLIB - sundials_fsunlinsollapackdense ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS dense LAPACK linear solver Fortran-C library") - - # Create targets for each example - foreach(example ${examples_bl}) - - # example source files - add_executable(${example} ${example}.f90 ${examples_dependencies_bl}) - - # directories to include - target_include_directories(${example} PRIVATE ${SUNDIALS_INCLUDE_DIR}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBRARIES}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLLAPACKBAND_FLIB}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLLAPACKDENSE_FLIB}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLLAPACKBAND_LIB}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLLAPACKDENSE_LIB}) - target_link_libraries(${example} ${LAPACK_LIBRARIES}) - - # add the example to ctest - add_test(NAME ${example} COMMAND ${example}) - - endforeach() - -endif() - -# ------------------------------------------------------------------------------ - -# KLU include directory and libraries -set(KLU_INCLUDE_DIR - @KLU_INCLUDE_DIR@ - CACHE PATH "Location of KLU header files") - -set(KLU_LIBRARIES - @KLU_LIBRARIES@ - CACHE STRING "KLU libraries") - -# Set the names of the examples to be built and their dependencies -set(examples_klu @EXAMPLES_KLU@) -set(examples_dependencies_klu @EXAMPLES_DEPENDENCIES_KLU@) -if(examples_klu) - list(REMOVE_DUPLICATES examples_klu) -endif() - -if(KLU_LIBRARIES AND examples_klu) - - # Find the SUNDIALS linear solver libraries - find_library(SUNDIALS_SUNLINSOLKLU_LIB - sundials_sunlinsolklu ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS KLU linear solver library") - - find_library(SUNDIALS_SUNLINSOLKLU_FLIB - sundials_fsunlinsolklu ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS KLU linear solver Fortran-C library") - - # Create targets for each example - foreach(example ${examples_klu}) - - # example source files - add_executable(${example} ${example}.f90 ${examples_dependencies_klu}) - - # directories to include - target_include_directories(${example} PRIVATE ${SUNDIALS_INCLUDE_DIR}) - target_include_directories(${example} PRIVATE ${KLU_INCLUDE_DIR}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBRARIES}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLKLU_FLIB}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLKLU_LIB}) - target_link_libraries(${example} ${KLU_LIBRARIES}) - - # add the example to ctest - add_test(NAME ${example} COMMAND ${example}) - - endforeach() - -endif() - -# ------------------------------------------------------------------------------ - -# SuperLU_MT include directory, libraries, and threading type -set(SUPERLUMT_INCLUDE_DIR - @SUPERLUMT_INCLUDE_DIR@ - CACHE PATH "Location of SuperLU_MT KLU header files") - -set(SUPERLUMT_LIBRARIES - @SUPERLUMT_LIBRARY@ @SUPERLUMT_LIBRARIES@ - CACHE STRING "SuperLU_MT libraries") - -set(SUPERLUMT_THREAD_TYPE - @SUPERLUMT_THREAD_TYPE@ - CACHE STRING "SuperLU_MT Threading") - -# Set the names of the examples to be built and their dependencies -set(examples_slumt @EXAMPLES_SLUMT@) -set(examples_dependencies_slumt @EXAMPLES_DEPENDENCIES_SLUMT@) -if(examples_slumt) - list(REMOVE_DUPLICATES examples_slumt) -endif() - -if(SUPERLUMT_LIBRARIES AND examples_slumt) - - # Find the SUNDIALS linear solver libraries - find_library(SUNDIALS_SUNLINSOLSLUMT_LIB - sundials_sunlinsolsuperlumt ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS SuperLU_MT linear solver library") - - find_library(SUNDIALS_SUNLINSOLSLUMT_FLIB - sundials_fsunlinsolsuperlumt ${SUNDIALS_LIBRARY_DIR} - DOC "SUNDIALS SuperLU_MT linear solver Fortran-C library") - - if(SUPERLUMT_THREAD_TYPE STREQUAL "OPENMP") - find_package(OpenMP REQUIRED) - # Update C compiler and linker flags - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") - else(SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") - find_package(Threads REQUIRED) - endif() - - # Create targets for each example - foreach(example ${examples_slumt}) - - # example source files - add_executable(${example} ${example}.f90 ${examples_dependencies_slumt}) - - # directories to include - target_include_directories(${example} PRIVATE ${SUNDIALS_INCLUDE_DIR}) - target_include_directories(${example} PRIVATE ${SUPERLUMT_INCLUDE_DIR}) - - # libraries to link against - target_link_libraries(${example} ${SUNDIALS_LIBRARIES}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLSLUMT_FLIB}) - target_link_libraries(${example} ${SUNDIALS_SUNLINSOLSLUMT_LIB}) - target_link_libraries(${example} ${SUPERLUMT_LIBRARIES}) - - if(SUPERLUMT_THREAD_TYPE STREQUAL "PTHREAD") - target_link_libraries(${example} Threads::Threads) - endif() - - # add the example to ctest - add_test(NAME ${example} COMMAND ${example}) - - endforeach() - -endif() diff --git a/examples/templates/makefile_serial_F90_ex.in b/examples/templates/makefile_serial_F90_ex.in deleted file mode 100644 index affcdd4e13..0000000000 --- a/examples/templates/makefile_serial_F90_ex.in +++ /dev/null @@ -1,110 +0,0 @@ -# -*- mode: makefile -*- -# ----------------------------------------------------------------- -# Programmer(s): Daniel R. Reynolds @ SMU -# David J. Gardner @ LLNL -# ----------------------------------------------------------------- -# SUNDIALS Copyright Start -# Copyright (c) 2002-2023, Lawrence Livermore National Security -# and Southern Methodist University. -# All rights reserved. -# -# See the top-level LICENSE and NOTICE files for details. -# -# SPDX-License-Identifier: BSD-3-Clause -# SUNDIALS Copyright End -# ----------------------------------------------------------------- -# Makefile for @SOLVER@ Fortran90 serial examples -# -# This file is generated from a template using variables -# set at configuration time. It can be used as a template for -# other user Makefiles. -# ----------------------------------------------------------------- - -SHELL = @SHELL@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -libdir = @libdir@ - -F90 = @F90@ -F90FLAGS = @F90FLAGS@ -F90_LDFLAGS = @F90_LDFLAGS@ -F90_LIBS = @F90_LIBS@ - -LINKFLAGS = -Wl,-rpath,@libdir@ - -# ----------------------------------------------------------------------------------------- - -LIBRARIES_LAPACK = -lsundials_fsunlinsollapackdense -lsundials_fsunlinsollapackband -lsundials_sunlinsollapackdense -lsundials_sunlinsollapackband @LAPACK_LIBS@ -LINKFLAGS_LAPACK = ${LINKFLAGS}:@LAPACK_LIBRARY_DIR@ - -INCLUDES_KLU = @KLU_INCLUDE_DIR@ -LIBRARIES_KLU = -lsundials_fsunlinsolklu -lsundials_sunlinsolklu @KLU_LIBS@ -LINKFLAGS_KLU = ${LINKFLAGS}:@KLU_LIBRARY_DIR@ - -INCLUDES_SLUMT = @SUPERLUMT_INCLUDE_DIR@ -LIBRARIES_SLUMT = -lsundials_fsunlinsolsuperlumt -lsundials_sunlinsolsuperlumt @SUPERLUMT_LIBS@ -LINKFLAGS_SLUMT = ${LINKFLAGS}:@SUPERLUMT_LIBRARY_DIR@ - -TMP_INCS = ${includedir} ${INCLUDES_SLUMT} ${INCLUDES_KLU} -INCLUDES = $(addprefix -I, ${TMP_INCS}) -LIBRARIES = -l@SOLVER_FLIB@ -l@SOLVER_LIB@ -lsundials_fnvecserial -lsundials_nvecserial ${LIBS} - -# ----------------------------------------------------------------------------------------- - -EXAMPLES = @EXAMPLES@ -OBJECTS = ${EXAMPLES:=.o} - -# LAPACK Examples -EXAMPLES_BL = @EXAMPLES_BL@ -OBJECTS_BL = ${EXAMPLES_BL:=.o} - -# KLU Examples -EXAMPLES_KLU = @EXAMPLES_KLU@ -OBJECTS_KLU = ${EXAMPLES_KLU:=.o} - -# SuperLU_MT Examples -EXAMPLES_SLUMT = @EXAMPLES_SLUMT@ -OBJECTS_SLUMT = ${EXAMPLES_SLUMT:=.o} - -# ----------------------------------------------------------------------------------------- - -.SUFFIXES : .o .f90 - -.f90.o : - ${F90} ${F90FLAGS} ${INCLUDES} -c $< - -# ----------------------------------------------------------------------------------------- - -all: examples examples_bl examples_klu examples_slumt - -examples: ${OBJECTS} - @for i in ${EXAMPLES} ; do \ - echo "${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LINKFLAGS}" ; \ - ${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LINKFLAGS} ; \ - done - -examples_bl: ${OBJECTS_BL} - @for i in ${EXAMPLES_BL} ; do \ - echo "${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_LAPACK} ${LINKFLAGS_LAPACK}" ; \ - ${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_LAPACK} ${LINKFLAGS_LAPACK} ; \ - done - -examples_klu: ${OBJECTS_KLU} - @for i in ${EXAMPLES_KLU} ; do \ - echo "${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_KLU} ${LINKFLAGS_KLU}" ; \ - ${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_KLU} ${LINKFLAGS_KLU} ; \ - done - -examples_slumt: ${OBJECTS_SLUMT} - @for i in ${EXAMPLES_SLUMT} ; do \ - echo "${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_SLUMT} ${LINKFLAGS_SLUMT}" ; \ - ${F90} -o $${i} $${i}.o ${F90_LDFLAGS} ${F90_LIBS} ${INCLUDES} -L${libdir} ${LIBRARIES} ${LIBRARIES_SLUMT} ${LINKFLAGS_SLUMT} ; \ - done - -clean: - rm -f ${OBJECTS} ${OBJECTS_BL} ${OBJECTS_KLU} ${OBJECTS_SLUMT} - rm -f ${EXAMPLES} ${EXAMPLES_BL} ${EXAMPLES_KLU} ${EXAMPLES_SLUMT} - -# -----------------------------------------------------------------------------------------