├── cvode ├── CMakeFiles │ ├── cmake.check_cache │ ├── 3.22.1 │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ └── CMakeSystem.cmake │ └── CMakeError.log ├── examples │ └── cvode │ │ ├── CXX_sycl │ │ └── README │ │ ├── raja │ │ └── README │ │ ├── CXX_onemkl │ │ └── README │ │ ├── magma │ │ └── README │ │ ├── cuda │ │ └── README │ │ ├── hip │ │ └── README │ │ ├── petsc │ │ └── README │ │ ├── C_openmpdev │ │ └── README │ │ ├── superludist │ │ └── README │ │ ├── CXX_serial │ │ └── README │ │ ├── CXX_parallel │ │ └── README │ │ ├── C_openmp │ │ └── README │ │ └── parhyp │ │ └── README ├── src │ ├── sunadjointcheckpointscheme │ │ ├── CMakeLists.txt │ │ └── fixed │ │ │ ├── fmod_int32 │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ ├── sunmemory │ │ ├── sycl │ │ │ └── CMakeLists.txt │ │ ├── cuda │ │ │ └── CMakeLists.txt │ │ ├── system │ │ │ └── CMakeLists.txt │ │ ├── hip │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── sunadaptcontroller │ │ ├── CMakeLists.txt │ │ ├── imexgus │ │ │ ├── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ ├── mrihtol │ │ │ ├── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ └── soderlind │ │ │ ├── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ └── CMakeLists.txt │ │ │ └── fmod_int64 │ │ │ └── CMakeLists.txt │ ├── sunnonlinsol │ │ ├── CMakeLists.txt │ │ ├── newton │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── fixedpoint │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ └── petscsnes │ │ │ └── CMakeLists.txt │ ├── sundials │ │ ├── fmod_int32 │ │ │ └── CMakeLists.txt │ │ ├── fmod_int64 │ │ │ └── CMakeLists.txt │ │ ├── sundials_adjointstepper_impl.h │ │ ├── sundials_mpi_errors.c │ │ ├── sundials_adjointcheckpointscheme_impl.h │ │ ├── sundials_stepper_impl.h │ │ ├── sundials_debug.h │ │ ├── sundials_iterative_impl.h │ │ ├── sundials_macros.h │ │ └── sundials_futils.c │ ├── cvode │ │ ├── NOTICE │ │ └── LICENSE │ ├── nvector │ │ ├── cuda │ │ │ └── CMakeLists.txt │ │ ├── hip │ │ │ └── CMakeLists.txt │ │ ├── sycl │ │ │ └── CMakeLists.txt │ │ ├── parhyp │ │ │ └── CMakeLists.txt │ │ ├── openmpdev │ │ │ └── CMakeLists.txt │ │ ├── serial │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── openmp │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── pthreads │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── petsc │ │ │ └── CMakeLists.txt │ │ ├── trilinos │ │ │ └── CMakeLists.txt │ │ ├── parallel │ │ │ └── CMakeLists.txt │ │ └── mpiplusx │ │ │ ├── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ └── CMakeLists.txt │ │ │ └── fmod_int64 │ │ │ └── CMakeLists.txt │ ├── sunmatrix │ │ ├── onemkldense │ │ │ └── CMakeLists.txt │ │ ├── band │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── cusparse │ │ │ └── CMakeLists.txt │ │ ├── dense │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── sparse │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ └── slunrloc │ │ │ └── CMakeLists.txt │ ├── sunlinsol │ │ ├── pcg │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── spbcgs │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── klu │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── spgmr │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── cusolversp │ │ │ └── CMakeLists.txt │ │ ├── spfgmr │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── band │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── dense │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── sptfqmr │ │ │ ├── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── onemkldense │ │ │ └── CMakeLists.txt │ │ ├── lapackdense │ │ │ ├── fmod_int32 │ │ │ │ └── CMakeLists.txt │ │ │ └── fmod_int64 │ │ │ │ └── CMakeLists.txt │ │ ├── superludist │ │ │ └── CMakeLists.txt │ │ ├── superlumt │ │ │ └── CMakeLists.txt │ │ ├── lapackband │ │ │ └── CMakeLists.txt │ │ └── magmadense │ │ │ └── CMakeLists.txt │ └── CMakeLists.txt ├── external │ ├── sundials-addon-example │ │ ├── CMakeLists.txt │ │ └── LICENSE │ └── CMakeLists.txt ├── include │ ├── sundials │ │ ├── sundials_core.hpp │ │ ├── sundials_mpi_errors.h │ │ ├── sundials_mpi_types.h │ │ ├── sundials_convertibleto.hpp │ │ ├── sundials_nvector.hpp │ │ ├── sundials_futils.h │ │ ├── sundials_matrix.hpp │ │ ├── sundials_memory.hpp │ │ ├── sundials_version.h │ │ ├── sundials_linearsolver.hpp │ │ ├── sundials_nonlinearsolver.hpp │ │ ├── priv │ │ │ └── sundials_context_impl.h │ │ ├── sundials_core.h │ │ └── sundials_profiler.hpp │ └── cvode │ │ └── cvode_bandpre.h ├── NOTICE ├── cmake │ └── macros │ │ ├── SundialsAddExecutable.cmake │ │ └── SundialsAddNvectorBenchmark.cmake └── LICENSE ├── output └── ShaleHillsTestRun │ ├── ShaleHills.gw.dat │ └── ShaleHills.river.flx1.dat ├── input ├── ShaleHills │ ├── ShaleHills.bc │ ├── ShaleHills.geol │ ├── ShaleHills.lsm │ └── ShaleHills.soil ├── Chimborazo │ ├── Chimborazo.soil │ ├── Chimborazo.lsm │ ├── Chimborazo.calib │ └── Chimborazo.riv └── ndep.txt ├── src ├── co2 │ ├── get_co2.c │ └── read_annual_file.c ├── bgc │ ├── get_ndep.c │ ├── soilpsi.c │ ├── n_conc.c │ └── zero_srcsnk.c ├── init_mesh.c ├── read_ic.c ├── include │ ├── custom_io.h │ └── pihm.h ├── transpt │ └── solute_conc.c └── read_att.c ├── pihm.job └── LICENSE.md /cvode/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /cvode/examples/cvode/CXX_sycl/README: -------------------------------------------------------------------------------- 1 | List of CVODE SYCL examples 2 | 3 | cvAdvDiff_kry_sycl : 2-D advection-diffusion (nonstiff) 4 | -------------------------------------------------------------------------------- /cvode/examples/cvode/raja/README: -------------------------------------------------------------------------------- 1 | List of RAJA CVODE examples 2 | 3 | cvAdvDiff_kry_cuda : 2-D advection-diffusion (nonstiff) 4 | -------------------------------------------------------------------------------- /output/ShaleHillsTestRun/ShaleHills.gw.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSUmodeling/MM-PIHM/HEAD/output/ShaleHillsTestRun/ShaleHills.gw.dat -------------------------------------------------------------------------------- /output/ShaleHillsTestRun/ShaleHills.river.flx1.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSUmodeling/MM-PIHM/HEAD/output/ShaleHillsTestRun/ShaleHills.river.flx1.dat -------------------------------------------------------------------------------- /cvode/examples/cvode/CXX_onemkl/README: -------------------------------------------------------------------------------- 1 | List of oneMKL CVODE examples 2 | 3 | cvRoberts_blockdiag_onemkl : block diagonal example with oneMKL linear solver 4 | -------------------------------------------------------------------------------- /cvode/examples/cvode/magma/README: -------------------------------------------------------------------------------- 1 | List of MAGMA CVODE examples 2 | 3 | cv_bruss_batched_magma : block diagonal example with MAGMA dense batched LU solver 4 | -------------------------------------------------------------------------------- /cvode/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSUmodeling/MM-PIHM/HEAD/cvode/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /input/ShaleHills/ShaleHills.bc: -------------------------------------------------------------------------------- 1 | BC_TS 1 TYPE 1 # 1 = Dirichlet, 2 = Neumann 2 | TIME HEAD 3 | #TS m 4 | 2008-01-01 00:00 270.00 5 | 2012-07-31 00:00 270.00 6 | -------------------------------------------------------------------------------- /cvode/examples/cvode/cuda/README: -------------------------------------------------------------------------------- 1 | List of CUDA CVODE examples 2 | 3 | cvAdvDiff_kry_cuda : 2-D advection-diffusion (nonstiff) 4 | cvRoberts_block_cusolversp_batchq : block diagonal example with cuSOLVER sparse batched QR 5 | -------------------------------------------------------------------------------- /cvode/examples/cvode/hip/README: -------------------------------------------------------------------------------- 1 | List of Hip CVODE examples 2 | 3 | cvAdvDiff_kry_hip : 2-D advection-diffusion (nonstiff) 4 | cvAdvDiff_diag_hip : 2-D advection-diffusion (nonstiff) with diagonal solver 5 | and fused HIP kernels 6 | -------------------------------------------------------------------------------- /src/co2/get_co2.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | double GetCO2(int t, tsdata_struct *co2_ts) 4 | { 5 | double co2; 6 | 7 | IntrplForcing(t, 1, INTRPL, FORCING_CO2, co2_ts); 8 | 9 | co2 = co2_ts->value[0]; 10 | 11 | return co2; 12 | } 13 | -------------------------------------------------------------------------------- /src/bgc/get_ndep.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | double GetNdep(int t, tsdata_struct *ndep_ts) 4 | { 5 | double ndep; 6 | 7 | IntrplForcing(t, 1, INTRPL, FORCING_NDEP, ndep_ts); 8 | 9 | ndep = ndep_ts->value[0]; 10 | 11 | return ndep; 12 | } 13 | -------------------------------------------------------------------------------- /input/ShaleHills/ShaleHills.geol: -------------------------------------------------------------------------------- 1 | NUMGEOL 1 2 | INDEX KSATV KSATH MAXSMC MINSMC ALPHA BETA MACHF MACVF DMAC 3 | #- m/s m/s m3/m3 m3/m3 1/m - m2/m2 m2/m2 m 4 | 1 1.625E-7 1.202E-7 0.0370 0.00 10.0 2.0 0.01 0.01 1.0 5 | 6 | KMACV_RO 100.0 7 | KMACH_RO 1000.0 8 | -------------------------------------------------------------------------------- /cvode/CMakeFiles/CMakeError.log: -------------------------------------------------------------------------------- 1 | Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. 2 | Compiler: /Library/Developer/CommandLineTools/usr/bin/cc 3 | Build flags: 4 | Id flags: 5 | 6 | The output was: 7 | 1 8 | ld: library 'System' not found 9 | cc: error: linker command failed with exit code 1 (use -v to see invocation) 10 | 11 | 12 | -------------------------------------------------------------------------------- /cvode/CMakeFiles/3.22.1/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Darwin-24.5.0") 2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin") 3 | set(CMAKE_HOST_SYSTEM_VERSION "24.5.0") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Darwin-24.5.0") 9 | set(CMAKE_SYSTEM_NAME "Darwin") 10 | set(CMAKE_SYSTEM_VERSION "24.5.0") 11 | set(CMAKE_SYSTEM_PROCESSOR "arm64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /pihm.job: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH --nodes=1 4 | #SBATCH --ntasks=12 5 | #SBATCH --time=48:00:00 6 | #SBATCH --mail-type=BEGIN,END 7 | #SBATCH --mail-user=yshi@psu.edu 8 | 9 | echo "Job started on `hostname` at `date`" 10 | jobstart=`date +%s` 11 | 12 | export OMP_NUM_THREADS=12 13 | ./flux-pihm -bo ShaleHills ShaleHills 14 | 15 | jobend=`date +%s` 16 | echo -e "\nJob ended at `date`" 17 | dt=$((jobend - jobstart)) 18 | ds=$((dt % 60)) 19 | dm=$(((dt / 60) % 60)) 20 | dh=$((dt / 3600)) 21 | printf "Elapsed time %d:%02d:%02d" $dh $dm $ds 22 | -------------------------------------------------------------------------------- /cvode/src/sunadjointcheckpointscheme/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # ------------------------------------------------------------------------------ 12 | 13 | add_subdirectory(fixed) 14 | -------------------------------------------------------------------------------- /src/init_mesh.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void InitMesh(const meshtbl_struct *meshtbl, elem_struct elem[]) 4 | { 5 | int i; 6 | 7 | #if defined(_OPENMP) 8 | # pragma omp parallel for 9 | #endif 10 | for (i = 0; i < nelem; i++) 11 | { 12 | int j; 13 | 14 | elem[i].ind = i + 1; 15 | 16 | for (j = 0; j < NUM_EDGE; j++) 17 | { 18 | elem[i].node[j] = meshtbl->node[i][j]; 19 | elem[i].nabr[j] = meshtbl->nabr[i][j]; 20 | elem[i].nabr_river[j] = 0; // initialize to 0 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/bgc/soilpsi.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | // Given a list of site constants and the soil water content, 4 | // this function returns the soil water potential (MPa) 5 | // Inputs: 6 | // vwc (m3/m3) water mass per unit area 7 | // psi_s (MPa) soil matric potential 8 | // 9 | // Uses the van Genuchten relation 10 | void SoilPsi(const soil_struct *soil, double vwc, double *psi) 11 | { 12 | double theta; 13 | 14 | theta = (vwc - soil->smcmin) / (soil->smcmax - soil->smcmin); 15 | theta = MIN(theta, 1.0); 16 | theta = MAX(theta, SATMIN); 17 | 18 | // Calculate psi 19 | *psi = Psi(theta, soil->alpha, soil->beta) * 1000.0 * GRAV / 1.0E6; 20 | } 21 | -------------------------------------------------------------------------------- /input/Chimborazo/Chimborazo.soil: -------------------------------------------------------------------------------- 1 | NUMSOIL 3 2 | INDEX SILT CLAY OM BD KINF KSATV KSATH MAXSMC MINSMC ALPHA BETA MACHF MACVF DMAC QTZ 3 | #- % % % g/cm3 m/s m/s m/s m3/m3 m3/m3 1/m - m2/m2 m2/m2 m 100% 4 | 1 30.67 40.20 7.62 1.93 -999 -999 -999 -999 -999 -999 -999 0.01 0.01 1.0 -999 5 | 2 30.90 40.85 7.74 2.13 -999 -999 -999 -999 -999 -999 -999 0.01 0.01 1.0 -999 6 | 3 30.90 40.85 6.94 2.13 -999 -999 -999 -999 -999 -999 -999 0.01 0.01 1.0 -999 7 | DINF 0.10 # m 8 | KMACV_RO 100.0 9 | KMACH_RO 1000.0 10 | -------------------------------------------------------------------------------- /cvode/examples/cvode/petsc/README: -------------------------------------------------------------------------------- 1 | List of PETSc CVODE examples 2 | 3 | cvAdvDiff_petsc : 1-D advection-diffusion (nonstiff) 4 | cv_petsc_ex7 : Nonlinear time-dependent PDE in 2D based on PETSc TS example ex7 5 | 6 | The following CMake command was used to configure SUNDIALS: 7 | 8 | cmake \ 9 | -DCMAKE_BUILD_TYPE=DEBUG \ 10 | -DBUILD_ARKODE=ON \ 11 | -DBUILD_CVODE=ON \ 12 | -DBUILD_CVODES=ON \ 13 | -DBUILD_IDA=ON \ 14 | -DBUILD_IDAS=ON \ 15 | -DBUILD_KINSOL=ON \ 16 | -DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ 17 | -DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ 18 | -DBUILD_SHARED_LIBS=ON \ 19 | -DBUILD_STATIC_LIBS=ON \ 20 | -DEXAMPLES_ENABLE_C=ON \ 21 | -DEXAMPLES_INSTALL=ON \ 22 | -DENABLE_PETSC=ON \ 23 | -DPETSC_DIR=/home/user1/petsc \ 24 | ../sundials 25 | -------------------------------------------------------------------------------- /cvode/external/sundials-addon-example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # --------------------------------------------------------------- 12 | 13 | cmake_minimum_required(VERSION 3.18) 14 | project(example-sundials-addon) 15 | 16 | # Create mynvector library 17 | sundials_add_library( 18 | sundials_external_mynvector 19 | SOURCES myNVector.c 20 | HEADERS myNVector.h 21 | INCLUDE_SUBDIR nvector 22 | LINK_LIBRARIES PUBLIC sundials_core 23 | OUTPUT_NAME sundials_external_mynvector) 24 | -------------------------------------------------------------------------------- /cvode/src/sunmemory/sycl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create library 16 | sundials_add_library( 17 | sundials_sunmemsycl 18 | SOURCES sundials_sycl_memory.cpp 19 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_sycl.h 20 | INCLUDE_SUBDIR sunmemory 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | OBJECT_LIB_ONLY) 23 | -------------------------------------------------------------------------------- /cvode/src/sunmemory/cuda/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunmemcuda 18 | SOURCES sundials_cuda_memory.cu 19 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_cuda.h 20 | LINK_LIBRARIES PUBLIC sundials_core 21 | INCLUDE_SUBDIR sunmemory 22 | OBJECT_LIB_ONLY) 23 | -------------------------------------------------------------------------------- /cvode/src/sunmemory/system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunmemsys 18 | SOURCES sundials_system_memory.c 19 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_system.h 20 | INCLUDE_SUBDIR sunmemory 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | OBJECT_LIB_ONLY) 23 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # adaptivity controller level CMakeLists.txt for SUNDIALS 15 | # ------------------------------------------------------------------------------ 16 | 17 | # required native adaptivity controllers 18 | add_subdirectory(imexgus) 19 | add_subdirectory(soderlind) 20 | add_subdirectory(mrihtol) 21 | -------------------------------------------------------------------------------- /cvode/src/sunmemory/hip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunmemhip 18 | SOURCES sundials_hip_memory.hip.cpp 19 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmemory/sunmemory_hip.h 20 | INCLUDE_SUBDIR sunmemory 21 | LINK_LIBRARIES PUBLIC sundials_core PRIVATE hip::device 22 | OBJECT_LIB_ONLY) 23 | -------------------------------------------------------------------------------- /input/Chimborazo/Chimborazo.lsm: -------------------------------------------------------------------------------- 1 | LATITUDE -1.443456 2 | LONGITUDE -78.763137 3 | NSOIL 10 4 | SLDPTH_DATA 0.107 0.123 0.142 0.165 0.192 0.223 0.260 0.301 0.350 0.377 5 | RAD_MODE_DATA 0 6 | SBETA_DATA -2.0 7 | FXEXP_DATA 2.0 8 | CSOIL_DATA 2E6 9 | SALP_DATA 2.6 10 | FRZK_DATA 0.15 11 | ZBOT_DATA -8.0 12 | TBOT_DATA 273.15 13 | CZIL_DATA 0.05 14 | LVCOEF_DATA 0.5 15 | ###################### 16 | # Print Control # 17 | ###################### 18 | T1 HOURLY 19 | STC HOURLY 20 | SMC HOURLY 21 | SH2O HOURLY 22 | SNOWH HOURLY 23 | ALBEDO HOURLY 24 | LE HOURLY 25 | SH HOURLY 26 | G HOURLY 27 | ETP HOURLY 28 | ESNOW HOURLY 29 | ROOTW HOURLY 30 | SOILM HOURLY 31 | SOLAR HOURLY 32 | CH HOURLY 33 | -------------------------------------------------------------------------------- /input/ShaleHills/ShaleHills.lsm: -------------------------------------------------------------------------------- 1 | LATITUDE 40.6646917 2 | LONGITUDE -77.904627 3 | NSOIL 10 4 | SLDPTH_DATA 0.107 0.123 0.142 0.165 0.192 0.223 0.260 0.301 0.350 0.377 5 | RAD_MODE_DATA 1 6 | SBETA_DATA -2.0 7 | FXEXP_DATA 2.0 8 | CSOIL_DATA 2E6 9 | SALP_DATA 2.6 10 | FRZK_DATA 0.15 11 | ZBOT_DATA -8.0 12 | TBOT_DATA 282.15 13 | CZIL_DATA 0.05 14 | LVCOEF_DATA 0.5 15 | ###################### 16 | # Print Control # 17 | ###################### 18 | T1 HOURLY 19 | STC HOURLY 20 | SMC HOURLY 21 | SH2O HOURLY 22 | SNOWH HOURLY 23 | ALBEDO HOURLY 24 | LE HOURLY 25 | SH HOURLY 26 | G HOURLY 27 | ETP HOURLY 28 | ESNOW HOURLY 29 | ROOTW HOURLY 30 | SOILM HOURLY 31 | SOLAR HOURLY 32 | CH HOURLY 33 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # nonlinear solver level CMakeLists.txt for SUNDIALS 15 | # ------------------------------------------------------------------------------ 16 | 17 | # required modules 18 | add_subdirectory(newton) 19 | add_subdirectory(fixedpoint) 20 | 21 | if(BUILD_SUNNONLINSOL_PETSCSNES) 22 | add_subdirectory(petscsnes) 23 | endif() 24 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_core.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * -----------------------------------------------------------------*/ 12 | 13 | #ifndef _SUNDIALS_CORE_HPP 14 | #define _SUNDIALS_CORE_HPP 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #endif /* _SUNDIALS_CORE_HPP */ 26 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_mpi_errors.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * -----------------------------------------------------------------*/ 12 | 13 | #ifndef _SUNDIALS_MPI_ERRORS_H 14 | #define _SUNDIALS_MPI_ERRORS_H 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | SUNDIALS_EXPORT 23 | void SUNMPIAbortErrHandlerFn(int line, const char* func, const char* file, 24 | const char* msg, SUNErrCode err_code, 25 | void* err_user_data, SUNContext sunctx); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /* _SUNDIALS_MPI_ERRORS_H */ 32 | -------------------------------------------------------------------------------- /src/read_ic.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void ReadIc(const char fn[], elem_struct elem[], river_struct river[]) 4 | { 5 | FILE *fp; 6 | int i; 7 | int size; 8 | 9 | fp = pihm_fopen(fn, "rb"); 10 | pihm_printf(VL_VERBOSE, " Reading %s\n", fn); 11 | 12 | fseek(fp, 0L, SEEK_END); 13 | size = ftell(fp); 14 | 15 | if (size != (int)(sizeof(ic_struct) * nelem + sizeof(river_ic_struct) * nriver)) 16 | { 17 | pihm_printf(VL_ERROR, "Error in initial condition file %s.\nThe file size does not match requirement.\n", fn); 18 | pihm_printf(VL_ERROR, "Please use a correct initial condition file.\n"); 19 | pihm_exit(EXIT_FAILURE); 20 | } 21 | 22 | fseek(fp, 0L, SEEK_SET); 23 | 24 | for (i = 0; i < nelem; i++) 25 | { 26 | fread(&elem[i].ic, sizeof(ic_struct), 1, fp); 27 | } 28 | 29 | for (i = 0; i < nriver; i++) 30 | { 31 | fread(&river[i].ic, sizeof(river_ic_struct), 1, fp); 32 | } 33 | 34 | fclose(fp); 35 | } 36 | -------------------------------------------------------------------------------- /input/Chimborazo/Chimborazo.calib: -------------------------------------------------------------------------------- 1 | KSATH 100.0 # Horizontal saturated hydraulic conductivity 150.0 200.0, 300, 150, 100, 70, 10, "200" 2 | KSATV 50 # Vertital saturated hydraulic conductivity 0.7 700 , 50, 100, 250, "350" 3 | KINF 4.0 # Infiltration conductivity 40.0 4 | KMACSATH 4.0 # Horizontal saturated macropore hydraulic conductivity 5 | KMACSATV 1.0 # Vertital saturated macropore hydraulic conductivity 6 | DROOT 1.0 # Rooting depth 7 | DMAC 2.0 # Macropore depth 8 | POROSITY 3.5 9 | ALPHA 2.5 10 | BETA 1.5 11 | MACVF 7.0 12 | MACHF 7.0 13 | VEGFRAC 1.0 14 | ALBEDO 1.0 15 | ROUGH 1.0 16 | ROUGH_RIV 1.0 17 | KRIVH 1.0 18 | RIV_DPTH 1.0 19 | RIV_WDTH 1.0 20 | 21 | LSM_CALIBRATION 22 | DRIP 1.0 23 | CMCMAX 2.0 24 | RS 0.4 25 | CZIL 1.0 26 | FXEXP 1.0 27 | CFACTR 1.0 28 | RGL 1.0 29 | HS 1.0 30 | REFSMC 1.0 31 | WLTSMC 1.0 32 | 33 | SCENARIO 34 | PRCP 1.0 # Multiplier 35 | SFCTMP 0.0 # Offset in K 36 | -------------------------------------------------------------------------------- /cvode/src/sunmemory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # SUNMemory level CMakeLists.txt for SUNDIALS 15 | # ------------------------------------------------------------------------------ 16 | 17 | if(ENABLE_CALIPER AND SUNDIALS_BUILD_WITH_PROFILING) 18 | include_directories(${caliper_INCLUDE_DIR}) 19 | endif() 20 | 21 | add_subdirectory(system) 22 | 23 | if(ENABLE_CUDA) 24 | add_subdirectory(cuda) 25 | endif() 26 | 27 | if(ENABLE_HIP) 28 | add_subdirectory(hip) 29 | endif() 30 | 31 | if(ENABLE_SYCL) 32 | add_subdirectory(sycl) 33 | endif() 34 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 PIHM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cvode/src/sundials/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 SUNDIALS object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | set(sundials_SOURCES fsundials_core_mod.c fsundials_core_mod.f90) 24 | 25 | sundials_add_f2003_library(sundials_fcore_mod SOURCES ${sundials_SOURCES}) 26 | -------------------------------------------------------------------------------- /cvode/src/sundials/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 SUNDIALS object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | set(sundials_SOURCES fsundials_core_mod.c fsundials_core_mod.f90) 24 | 25 | sundials_add_f2003_library(sundials_fcore_mod SOURCES ${sundials_SOURCES}) 26 | -------------------------------------------------------------------------------- /cvode/src/sunadjointcheckpointscheme/fixed/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # --------------------------------------------------------------- 12 | 13 | # Disable warnings from unused SWIG macros which we can't control 14 | if(ENABLE_ALL_WARNINGS) 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 17 | endif() 18 | 19 | sundials_add_f2003_library( 20 | sundials_fadjointcheckpointscheme_fixed 21 | SOURCES fsunadjointcheckpointscheme_fixed_mod.f90 22 | fsunadjointcheckpointscheme_fixed_mod.c 23 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 24 | OUTPUT_NAME sundials_fadjointcheckpointscheme_fixed OBJECT_LIB_ONLY) 25 | 26 | message(STATUS "Added SUNADJOINTCHECKPOINTSCHEME_FIXED interface") 27 | -------------------------------------------------------------------------------- /cvode/src/sunadjointcheckpointscheme/fixed/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # --------------------------------------------------------------- 12 | 13 | # Disable warnings from unused SWIG macros which we can't control 14 | if(ENABLE_ALL_WARNINGS) 15 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 17 | endif() 18 | 19 | sundials_add_f2003_library( 20 | sundials_fadjointcheckpointscheme_fixed 21 | SOURCES fsunadjointcheckpointscheme_fixed_mod.f90 22 | fsunadjointcheckpointscheme_fixed_mod.c 23 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 24 | OUTPUT_NAME sundials_fadjointcheckpointscheme_fixed OBJECT_LIB_ONLY) 25 | 26 | message(STATUS "Added SUNADJOINTCHECKPOINTSCHEME_FIXED interface") 27 | -------------------------------------------------------------------------------- /src/co2/read_annual_file.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void ReadAnnualFile(const char fn[], tsdata_struct *ts) 4 | { 5 | FILE *fp; 6 | char timestr[MAXSTRING]; 7 | char cmdstr[MAXSTRING]; 8 | int k; 9 | int lno = 0; 10 | 11 | fp = pihm_fopen(fn, "r"); 12 | pihm_printf(VL_VERBOSE, " Reading %s\n", fn); 13 | 14 | ts->length = CountLines(fp, cmdstr, 1, "EOF"); 15 | ts->ftime = (int *)malloc(ts->length * sizeof(int)); 16 | ts->data = (double **)malloc(ts->length * sizeof(double *)); 17 | 18 | FindLine(fp, "BOF", &lno, fn); 19 | for (k = 0; k < ts->length; k++) 20 | { 21 | ts->data[k] = (double *)malloc(sizeof(double)); 22 | NextLine(fp, cmdstr, &lno); 23 | if (sscanf(cmdstr, "%s %lf", timestr, &ts->data[k][0]) != 2) 24 | { 25 | pihm_error(ERROR, ERR_WRONG_FORMAT, fn, lno); 26 | } 27 | 28 | ts->ftime[k] = StrTime(timestr); 29 | if (ts->ftime[k] == BADVAL) 30 | { 31 | pihm_error(ERROR, ERR_WRONG_FORMAT, fn, lno); 32 | } 33 | } 34 | 35 | fclose(fp); 36 | } 37 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/imexgus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunadaptcontrollerimexgus 18 | SOURCES sunadaptcontroller_imexgus.c 19 | HEADERS 20 | ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_imexgus.h 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | INCLUDE_SUBDIR sunadaptcontroller 23 | OBJECT_LIB_ONLY) 24 | 25 | # Add F2003 module if the interface is enabled 26 | if(BUILD_FORTRAN_MODULE_INTERFACE) 27 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 28 | endif() 29 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/mrihtol/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunadaptcontrollermrihtol 18 | SOURCES sunadaptcontroller_mrihtol.c 19 | HEADERS 20 | ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_mrihtol.h 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | INCLUDE_SUBDIR sunadaptcontroller 23 | OBJECT_LIB_ONLY) 24 | 25 | # Add F2003 module if the interface is enabled 26 | if(BUILD_FORTRAN_MODULE_INTERFACE) 27 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 28 | endif() 29 | -------------------------------------------------------------------------------- /src/bgc/n_conc.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void SoluteConc(elem_struct elem[], river_struct river[]) 4 | { 5 | int i; 6 | 7 | // Calculate solute N concentrations 8 | #if defined(_OPENMP) 9 | # pragma omp parallel for 10 | #endif 11 | for (i = 0; i < nelem; i++) 12 | { 13 | double storage; 14 | 15 | // Element surface 16 | elem[i].solute[0].conc_surf = 0.0; 17 | 18 | // Element subsurface 19 | storage = (elem[i].ws.unsat + elem[i].ws.gw) * elem[i].soil.porosity + elem[i].soil.depth * elem[i].soil.smcmin; 20 | elem[i].solute[0].conc = (storage > 0.0) ? MOBILEN_PROPORTION * elem[i].ns.sminn / storage : 0.0; 21 | elem[i].solute[0].conc = MAX(elem[i].solute[0].conc, 0.0); 22 | } 23 | 24 | #if defined(_OPENMP) 25 | # pragma omp parallel for 26 | #endif 27 | for (i = 0; i < nriver; i++) 28 | { 29 | double storage; 30 | 31 | storage = river[i].ws.stage; 32 | river[i].solute[0].conc = (storage > 0.0) ? river[i].ns.streamn / storage : 0.0; 33 | river[i].solute[0].conc = MAX(river[i].solute[0].conc, 0.0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/soderlind/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Create a library out of the generic sundials modules 16 | sundials_add_library( 17 | sundials_sunadaptcontrollersoderlind 18 | SOURCES sunadaptcontroller_soderlind.c 19 | HEADERS 20 | ${SUNDIALS_SOURCE_DIR}/include/sunadaptcontroller/sunadaptcontroller_soderlind.h 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | INCLUDE_SUBDIR sunadaptcontroller 23 | OBJECT_LIB_ONLY) 24 | 25 | # Add F2003 module if the interface is enabled 26 | if(BUILD_FORTRAN_MODULE_INTERFACE) 27 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 28 | endif() 29 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_adjointstepper_impl.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * -----------------------------------------------------------------*/ 12 | 13 | #ifndef SUNDIALS_ADJOINTSTEPPER_IMPL_H_ 14 | #define SUNDIALS_ADJOINTSTEPPER_IMPL_H_ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | struct SUNAdjointStepper_ 21 | { 22 | suncountertype nrecompute; 23 | suncountertype final_step_idx; 24 | 25 | SUNStepper adj_sunstepper, fwd_sunstepper; 26 | sunbooleantype own_adj_sunstepper, own_fwd_sunstepper; 27 | SUNAdjointCheckpointScheme checkpoint_scheme; 28 | 29 | void* user_data; 30 | void* content; 31 | SUNContext sunctx; 32 | 33 | sunrealtype tf; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /cvode/examples/cvode/C_openmpdev/README: -------------------------------------------------------------------------------- 1 | List of OpenMP device offloading CVODE examples 2 | 3 | cvAdvDiff_kry_ompdev : 2-D advection-diffusion (nonstiff) 4 | 5 | Sample results: 6 | 7 | SUNDIALS was built with OpenMP enabled, and the example output was run using 8 | LLNL LC's wrapped xlc compiler for gpu program compilation: xlc-gpu 9 | 10 | The following CMake command was used to configure SUNDIALS: 11 | 12 | cmake \ 13 | -DCMAKE_C_COMPILER=xlc-gpu \ 14 | -DBUILD_ARKODE=ON \ 15 | -DBUILD_CVODE=ON \ 16 | -DBUILD_CVODES=ON \ 17 | -DBUILD_IDA=ON \ 18 | -DBUILD_IDAS=ON \ 19 | -DBUILD_KINSOL=ON \ 20 | -DBUILD_SHARED_LIBS=OFF \ 21 | -DBUILD_STATIC_LIBS=ON \ 22 | -DBUILD_TESTING=ON \ 23 | -DCMAKE_INSTALL_PREFIX=/usr/local/sundials \ 24 | -DEXAMPLES_ENABLE_C=ON \ 25 | -DEXAMPLES_INSTALL_PATH=/user/local/sundials/examples \ 26 | -DEXAMPLES_INSTALL=ON \ 27 | -DENABLE_OPENMP=ON \ 28 | -DENABLE_OPENMP_DEVICE=ON \ 29 | -DOPENMP_DEVICE_WORKS=ON \ 30 | -DSUNDIALS_INDEX_SIZE=64 \ 31 | -DSUNDIALS_PRECISION=double \ 32 | ../sundials 33 | 34 | System Architecture: ppc64le 35 | Processor Type: IBM POWER8 @ 2.5GHz 36 | Operating System: Red Hat 7.3 37 | C Compiler: xlc-gpu 38 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/imexgus/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollerimexgus_mod 23 | SOURCES fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c 24 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 25 | OUTPUT_NAME sundials_fsunadaptcontrollerimexgus_mod OBJECT_LIB_ONLY) 26 | 27 | message(STATUS "Added SUNAdaptController_ImExGus F2003 interface") 28 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/imexgus/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollerimexgus_mod 23 | SOURCES fsunadaptcontroller_imexgus_mod.f90 fsunadaptcontroller_imexgus_mod.c 24 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 25 | OUTPUT_NAME sundials_fsunadaptcontrollerimexgus_mod OBJECT_LIB_ONLY) 26 | 27 | message(STATUS "Added SUNAdaptController_ImExGus F2003 interface") 28 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/mrihtol/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollermrihtol_mod 23 | SOURCES fsunadaptcontroller_mrihtol_mod.f90 fsunadaptcontroller_mrihtol_mod.c 24 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 25 | OUTPUT_NAME sundials_fsunadaptcontrollermrihtol_mod OBJECT_LIB_ONLY) 26 | 27 | message(STATUS "Added SUNAdaptController_MRIHTol F2003 interface") 28 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/mrihtol/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollermrihtol_mod 23 | SOURCES fsunadaptcontroller_mrihtol_mod.f90 fsunadaptcontroller_mrihtol_mod.c 24 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 25 | OUTPUT_NAME sundials_fsunadaptcontrollermrihtol_mod OBJECT_LIB_ONLY) 26 | 27 | message(STATUS "Added SUNAdaptController_MRIHTol F2003 interface") 28 | -------------------------------------------------------------------------------- /cvode/src/sunadjointcheckpointscheme/fixed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # --------------------------------------------------------------- 12 | 13 | # Create a library out of the generic sundials modules 14 | sundials_add_library( 15 | sundials_adjointcheckpointscheme_fixed 16 | SOURCES sunadjointcheckpointscheme_fixed.c 17 | HEADERS 18 | ${SUNDIALS_SOURCE_DIR}/include/sundials/sundials_adjointstepper.h 19 | ${SUNDIALS_SOURCE_DIR}/include/sundials/sundials_adjointcheckpointscheme.h 20 | ${SUNDIALS_SOURCE_DIR}/include/sunadjointcheckpointscheme/sunadjointcheckpointscheme_fixed.h 21 | LINK_LIBRARIES PUBLIC sundials_core 22 | INCLUDE_SUBDIR sunadjointcheckpointscheme 23 | OBJECT_LIB_ONLY) 24 | 25 | # Add F2003 module if the interface is enabled 26 | if(BUILD_FORTRAN_MODULE_INTERFACE) 27 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 28 | endif() 29 | -------------------------------------------------------------------------------- /cvode/NOTICE: -------------------------------------------------------------------------------- 1 | This work was produced under the auspices of the U.S. Department of 2 | Energy by Lawrence Livermore National Laboratory under Contract 3 | DE-AC52-07NA27344. 4 | 5 | This work was prepared as an account of work sponsored by an agency of 6 | the United States Government. Neither the United States Government nor 7 | Lawrence Livermore National Security, LLC, nor any of their employees 8 | makes any warranty, expressed or implied, or assumes any legal liability 9 | or responsibility for the accuracy, completeness, or usefulness of any 10 | information, apparatus, product, or process disclosed, or represents that 11 | its use would not infringe privately owned rights. 12 | 13 | Reference herein to any specific commercial product, process, or service 14 | by trade name, trademark, manufacturer, or otherwise does not necessarily 15 | constitute or imply its endorsement, recommendation, or favoring by the 16 | United States Government or Lawrence Livermore National Security, LLC. 17 | 18 | The views and opinions of authors expressed herein do not necessarily 19 | state or reflect those of the United States Government or Lawrence 20 | Livermore National Security, LLC, and shall not be used for advertising 21 | or product endorsement purposes. -------------------------------------------------------------------------------- /input/Chimborazo/Chimborazo.riv: -------------------------------------------------------------------------------- 1 | NUMRIV 12 2 | INDEX FROM TO DOWN LEFT RIGHT SHAPE MATL BC RES 3 | 1 1 2 2 43 93 1 1 0 0 4 | 2 2 3 3 23 48 1 1 0 0 5 | 3 3 4 4 45 46 1 1 0 0 6 | 4 4 5 5 44 64 1 1 0 0 7 | 5 5 6 6 47 177 1 1 0 0 8 | 6 6 95 7 17 176 1 1 0 0 9 | 7 95 7 8 80 139 1 1 0 0 10 | 8 7 8 9 106 146 1 1 0 0 11 | 9 8 9 10 81 112 1 1 0 0 12 | 10 9 101 11 77 157 1 1 0 0 13 | 11 101 10 12 74 128 1 1 0 0 14 | 12 10 11 -3 57 82 1 1 0 0 15 | SHAPE 1 16 | INDEX DPTH OINT CWID 17 | #- m - - 18 | 1 0.6 1 2.0 19 | MATERIAL 1 20 | INDEX ROUGH CWR KH 21 | #- s/m1/3 - m/s 22 | 1 0.04 0.60 1.157E-05 23 | BC 0 24 | RES 0 25 | -------------------------------------------------------------------------------- /cvode/src/cvode/NOTICE: -------------------------------------------------------------------------------- 1 | This work was produced under the auspices of the U.S. Department of 2 | Energy by Lawrence Livermore National Laboratory under Contract 3 | DE-AC52-07NA27344. 4 | 5 | This work was prepared as an account of work sponsored by an agency of 6 | the United States Government. Neither the United States Government nor 7 | Lawrence Livermore National Security, LLC, nor any of their employees 8 | makes any warranty, expressed or implied, or assumes any legal liability 9 | or responsibility for the accuracy, completeness, or usefulness of any 10 | information, apparatus, product, or process disclosed, or represents that 11 | its use would not infringe privately owned rights. 12 | 13 | Reference herein to any specific commercial product, process, or service 14 | by trade name, trademark, manufacturer, or otherwise does not necessarily 15 | constitute or imply its endorsement, recommendation, or favoring by the 16 | United States Government or Lawrence Livermore National Security, LLC. 17 | 18 | The views and opinions of authors expressed herein do not necessarily 19 | state or reflect those of the United States Government or Lawrence 20 | Livermore National Security, LLC, and shall not be used for advertising 21 | or product endorsement purposes. -------------------------------------------------------------------------------- /cvode/src/nvector/cuda/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Slaven Peles and Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the cuda NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_CUDA\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nveccuda 22 | SOURCES nvector_cuda.cu 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_cuda.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES sundials_sunmemcuda_obj 27 | OUTPUT_NAME sundials_nveccuda 28 | VERSION ${nveclib_VERSION} 29 | SOVERSION ${nveclib_SOVERSION}) 30 | 31 | message(STATUS "Added NVECTOR_CUDA module") 32 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/soderlind/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollersoderlind_mod 23 | SOURCES fsunadaptcontroller_soderlind_mod.f90 24 | fsunadaptcontroller_soderlind_mod.c 25 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 26 | OUTPUT_NAME sundials_fsunadaptcontrollersoderlind_mod OBJECT_LIB_ONLY) 27 | 28 | message(STATUS "Added SUNAdaptController_Soderlind F2003 interface") 29 | -------------------------------------------------------------------------------- /cvode/src/sunadaptcontroller/soderlind/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | # Disable warnings from unused SWIG macros which we can't control 16 | if(ENABLE_ALL_WARNINGS) 17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 19 | endif() 20 | 21 | sundials_add_f2003_library( 22 | sundials_fsunadaptcontrollersoderlind_mod 23 | SOURCES fsunadaptcontroller_soderlind_mod.f90 24 | fsunadaptcontroller_soderlind_mod.c 25 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 26 | OUTPUT_NAME sundials_fsunadaptcontrollersoderlind_mod OBJECT_LIB_ONLY) 27 | 28 | message(STATUS "Added SUNAdaptController_Soderlind F2003 interface") 29 | -------------------------------------------------------------------------------- /cvode/src/nvector/hip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the hip NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_HIP\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvechip 22 | SOURCES nvector_hip.hip.cpp 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_hip.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES sundials_sunmemhip_obj 27 | LINK_LIBRARIES PUBLIC hip::device 28 | OUTPUT_NAME sundials_nvechip 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_HIP module") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/sycl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the SYCL NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_SYCL\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvecsycl 22 | SOURCES nvector_sycl.cpp 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_sycl.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES sundials_sunmemsycl_obj 27 | COMPILE_FEATURES PUBLIC cxx_std_17 28 | OUTPUT_NAME sundials_nvecsycl 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_SYCL module") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/parhyp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Radu Serban, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the parhyp NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_PARHYP\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvecparhyp 22 | SOURCES nvector_parhyp.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parhyp.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PUBLIC SUNDIALS::HYPRE MPI::MPI_C 28 | OUTPUT_NAME sundials_nvecparhyp 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_PARHYP module") 33 | -------------------------------------------------------------------------------- /input/ShaleHills/ShaleHills.soil: -------------------------------------------------------------------------------- 1 | NUMSOIL 5 2 | INDEX SILT CLAY OM BD KINF KSATV KSATH MAXSMC MINSMC ALPHA BETA MACHF MACVF DMAC QTZ 3 | #- % % % g/cm3 m/s m/s m/s m3/m3 m3/m3 1/m - m2/m2 m2/m2 m 100% 4 | 1 41.67 14.44 4.02 1.15 9.098E-5 1.625E-5 1.202E-5 0.3698 0.05 8.80 1.24 0.01 0.01 1.0 0.25 5 | 2 33.90 15.85 3.44 1.53 1.516E-4 1.862E-5 9.802E-6 0.4032 0.05 6.45 1.212 0.01 0.01 1.0 0.25 6 | 3 33.90 15.85 3.44 1.49 9.833E-5 1.086E-5 2.263E-5 0.4247 0.05 6.50 1.258 0.01 0.01 1.0 0.25 7 | 4 39.70 19.86 3.66 1.64 1.506E-5 6.762E-6 3.047E-5 0.4179 0.05 5.34 1.26 0.01 0.01 1.0 0.25 8 | 5 39.70 19.86 3.66 1.48 8.281E-5 3.705E-5 6.962E-5 0.4928 0.05 5.82 1.22 0.01 0.01 1.0 0.25 9 | DINF 0.10 # m 10 | KMACV_RO 100.0 11 | KMACH_RO 1000.0 12 | 13 | # If data are not available, KINF, KSATV, KSATH, MAXSMC, MINSMC, ALPHA, BETA, and QTZ values can be -999, in which case, pedotransfer functions will be used to calculate those properties from soil texture. 14 | -------------------------------------------------------------------------------- /cvode/src/nvector/openmpdev/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): David J. Gardner, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the openmpdev NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_OPENMPDEV\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvecopenmpdev 22 | SOURCES nvector_openmpdev.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmpdev.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PUBLIC OpenMP::OpenMP_C 28 | OUTPUT_NAME sundials_nvecopenmpdev 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_OPENMPDEV module") 33 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/onemkldense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | install(CODE "MESSAGE(\"\nInstall SUNMATRIX_ONEMKLDENSE\n\")") 16 | 17 | # Create the library 18 | sundials_add_library( 19 | sundials_sunmatrixonemkldense 20 | SOURCES sunmatrix_onemkldense.cpp 21 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_onemkldense.h 22 | INCLUDE_SUBDIR sunmatrix 23 | LINK_LIBRARIES PUBLIC sundials_core 24 | OBJECT_LIBRARIES sundials_sunmemsycl_obj 25 | COMPILE_FEATURES PUBLIC cxx_std_17 26 | INCLUDE_DIRECTORIES PUBLIC ${MKL_INCLUDE_DIR} 27 | LINK_LIBRARIES PUBLIC MKL::MKL_DPCPP 28 | OUTPUT_NAME sundials_sunmatrixonemkldense 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_ONEMKLDENSE module") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/serial/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 serial NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fnvecserial_mod 25 | SOURCES fnvector_serial_mod.f90 fnvector_serial_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fnvecserial_mod 28 | VERSION ${nveclib_VERSION} 29 | SOVERSION ${nveclib_SOVERSION}) 30 | 31 | message(STATUS "Added NVECTOR_SERIAL F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/pcg/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 PCG SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolpcg_mod 25 | SOURCES fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolpcg_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_PCG F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/band/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 band SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixband_mod 25 | SOURCES fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunmatrixband_mod 28 | VERSION ${sunmatrixlib_VERSION} 29 | SOVERSION ${sunmatrixlib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNMATRIX_BAND F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/cusparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the CUDA cuSPARSE SUNMatrix 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNMATRIX_CUSPARSE\n\")") 18 | 19 | # Add the library 20 | sundials_add_library( 21 | sundials_sunmatrixcusparse 22 | SOURCES sunmatrix_cusparse.cu 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_cusparse.h 24 | INCLUDE_SUBDIR sunmatrix 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES sundials_sunmemcuda_obj 27 | LINK_LIBRARIES PUBLIC CUDA::cusparse CUDA::cusolver 28 | OUTPUT_NAME sundials_sunmatrixcusparse 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_CUSPARSE module") 33 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_mpi_types.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * ----------------------------------------------------------------- 12 | * This header file contains definitions of MPI data types, which 13 | * are used by MPI parallel vector implementations. 14 | * -----------------------------------------------------------------*/ 15 | 16 | #ifndef _SUNDIALS_MPI_TYPES_H 17 | #define _SUNDIALS_MPI_TYPES_H 18 | 19 | #include 20 | #include 21 | 22 | /* define MPI data types */ 23 | 24 | #if defined(SUNDIALS_SINGLE_PRECISION) 25 | #define MPI_SUNREALTYPE MPI_FLOAT 26 | #elif defined(SUNDIALS_DOUBLE_PRECISION) 27 | #define MPI_SUNREALTYPE MPI_DOUBLE 28 | #elif defined(SUNDIALS_EXTENDED_PRECISION) 29 | #define MPI_SUNREALTYPE MPI_LONG_DOUBLE 30 | #endif 31 | 32 | #if defined(SUNDIALS_INT64_T) 33 | #define MPI_SUNINDEXTYPE MPI_INT64_T 34 | #elif defined(SUNDIALS_INT32_T) 35 | #define MPI_SUNINDEXTYPE MPI_INT32_T 36 | #endif 37 | 38 | #endif /* _SUNDIALS_MPI_TYPES_H */ 39 | -------------------------------------------------------------------------------- /cvode/src/nvector/openmp/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 openmp NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fnvecopenmp_mod 25 | SOURCES fnvector_openmp_mod.f90 fnvector_openmp_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fnvecopenmp_mod 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_OPENMP F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/openmp/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 openmp NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fnvecopenmp_mod 25 | SOURCES fnvector_openmp_mod.f90 fnvector_openmp_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fnvecopenmp_mod 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_OPENMP F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/serial/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 serial NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fnvecserial_mod 25 | SOURCES fnvector_serial_mod.f90 fnvector_serial_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fnvecserial_mod 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_SERIAL F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/dense/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 dense SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixdense_mod 25 | SOURCES fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunmatrixdense_mod 28 | VERSION ${sunmatrixlib_VERSION} 29 | SOVERSION ${sunmatrixlib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNMATRIX_DENSE F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/cmake/macros/SundialsAddExecutable.cmake: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMake function that wraps the add_executable command. 15 | # 16 | # It adds one extra single-value argument, SCALAR_TYPE. Otherwise 17 | # this function behaves exactly as add_executable does. 18 | # 19 | # --------------------------------------------------------------- 20 | 21 | function(sundials_add_executable NAME) 22 | 23 | set(options) 24 | set(singleValueArgs SCALAR_TYPE) 25 | set(multiValueArgs) 26 | 27 | cmake_parse_arguments(arg "${options}" "${singleValueArgs}" 28 | "${multiValueArgs}" ${ARGN}) 29 | 30 | string(TOUPPER "${arg_SCALAR_TYPE}" _scalarUpper) 31 | if(NOT _scalarUpper OR _scalarUpper STREQUAL SUNDIALS_SCALAR_TYPE) 32 | add_executable(${NAME} ${arg_UNPARSED_ARGUMENTS}) 33 | endif() 34 | 35 | endfunction() 36 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/sparse/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 sparse SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixsparse_mod 25 | SOURCES fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunmatrixsparse_mod 28 | VERSION ${sunmatrixlib_VERSION} 29 | SOVERSION ${sunmatrixlib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNMATRIX_SPARSE F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spbcgs/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 SPBCGS SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspbcgs_mod 25 | SOURCES fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolspbcgs_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPBCGS F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/pcg/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 PCG SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolpcg_mod 25 | SOURCES fsunlinsol_pcg_mod.f90 fsunlinsol_pcg_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunlinsolpcg_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_PCG F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/band/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 band SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixband_mod 25 | SOURCES fsunmatrix_band_mod.f90 fsunmatrix_band_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunmatrixband_mod 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_BAND F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/klu/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 KLU SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolklu_mod 25 | SOURCES fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixsparse_mod sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolklu_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_KLU F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/dense/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 dense SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixdense_mod 25 | SOURCES fsunmatrix_dense_mod.f90 fsunmatrix_dense_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunmatrixdense_mod 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_DENSE F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/sparse/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 sparse SUNMatrix object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunmatrixsparse_mod 25 | SOURCES fsunmatrix_sparse_mod.f90 fsunmatrix_sparse_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunmatrixsparse_mod 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_SPARSE F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_convertibleto.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * Base class for converting C++ wrappers (views) to SUNDIALS objects 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_CONVERTIBLETO_HPP 18 | #define _SUNDIALS_CONVERTIBLETO_HPP 19 | 20 | namespace sundials { 21 | 22 | template 23 | class ConvertibleTo 24 | { 25 | public: 26 | // Explicit conversion to the underlying type 27 | virtual T Convert() = 0; 28 | virtual T Convert() const = 0; 29 | 30 | // Implicit conversion to the underlying type 31 | virtual operator T() = 0; 32 | virtual operator T() const = 0; 33 | 34 | virtual ~ConvertibleTo() = default; 35 | }; 36 | 37 | } // namespace sundials 38 | 39 | #endif // _SUNDIALS_CONVERTIBLETO_HPP 40 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spbcgs/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 SPBCGS SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspbcgs_mod 25 | SOURCES fsunlinsol_spbcgs_mod.f90 fsunlinsol_spbcgs_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunlinsolspbcgs_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_SPBCGS F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spgmr/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPGMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspgmr_mod 25 | SOURCES fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolspgmr_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPGMR F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/cusolversp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the cuda cuSolverSp SUNLinearSolver 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_CUSOLVERSP\n\")") 18 | 19 | sundials_add_library( 20 | sundials_sunlinsolcusolversp 21 | SOURCES sunlinsol_cusolversp_batchqr.cu 22 | HEADERS 23 | ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_cusolversp_batchqr.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PUBLIC sundials_sunmatrixcusparse CUDA::cusolver PRIVATE 28 | CUDA::cusparse 29 | OUTPUT_NAME sundials_sunlinsolcusolversp 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_CUSOLVERSP module") 34 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spfgmr/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPFGMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspfgmr_mod 25 | SOURCES fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolspfgmr_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPFGMR F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/newton/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 Newton SUNNonlinearSolver 15 | # object library 16 | # --------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunnonlinsolnewton_mod 26 | SOURCES fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 28 | OUTPUT_NAME sundials_fsunnonlinsolnewton_mod 29 | VERSION ${sunnonlinsollib_VERSION} 30 | SOVERSION ${sunnonlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNNONLINSOL_NEWTON F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_nvector.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * C++ view of SUNDIALS NVector 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_NVECTOR_HPP 18 | #define _SUNDIALS_NVECTOR_HPP 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace sundials { 25 | namespace impl { 26 | using BaseNVector = BaseObject<_generic_N_Vector, _generic_N_Vector_Ops>; 27 | } // namespace impl 28 | 29 | namespace experimental { 30 | struct NVectorDeleter 31 | { 32 | void operator()(N_Vector v) 33 | { 34 | if (v) { N_VDestroy(v); } 35 | } 36 | }; 37 | 38 | using NVectorView = ClassView; 39 | } // namespace experimental 40 | } // namespace sundials 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/band/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 band SUNLinearSolver object library 15 | # ---------------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolband_mod 25 | SOURCES fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixband_mod sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolband_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_BAND F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/dense/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 dense SUNLinearSolver object library 15 | # ---------------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsoldense_mod 25 | SOURCES fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsoldense_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | message(STATUS "Added SUNLINSOL_DENSE F2003 interface") 31 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/sptfqmr/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPTFQMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolsptfqmr_mod 25 | SOURCES fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OUTPUT_NAME sundials_fsunlinsolsptfqmr_mod 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPTFQMR F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_futils.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * SUNDIALS Fortran 2003 interface utility definitions. 15 | * -----------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_FUTILS_H 18 | #define _SUNDIALS_FUTILS_H 19 | 20 | #include 21 | #include 22 | 23 | #include "sundials/sundials_types.h" 24 | 25 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 26 | extern "C" { 27 | #endif 28 | 29 | /* Create a file pointer with the given file name and mode. */ 30 | SUNDIALS_EXPORT SUNErrCode SUNDIALSFileOpen(const char* filename, 31 | const char* modes, FILE** fp); 32 | 33 | /* Close a file pointer with the given file name. */ 34 | SUNDIALS_EXPORT SUNErrCode SUNDIALSFileClose(FILE** fp); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /cvode/src/nvector/serial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Radu Serban, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the serial NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_SERIAL\n\")") 18 | 19 | # Create the sundials_nvecserial library 20 | sundials_add_library( 21 | sundials_nvecserial 22 | SOURCES nvector_serial.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_serial.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_nvecserial 28 | VERSION ${nveclib_VERSION} 29 | SOVERSION ${nveclib_SOVERSION}) 30 | 31 | message(STATUS "Added NVECTOR_SERIAL module") 32 | 33 | # Add F2003 module if the interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # SUNDIALS Copyright Start 3 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | # and Southern Methodist University. 5 | # All rights reserved. 6 | # 7 | # See the top-level LICENSE and NOTICE files for details. 8 | # 9 | # SPDX-License-Identifier: BSD-3-Clause 10 | # SUNDIALS Copyright End 11 | # --------------------------------------------------------------- 12 | 13 | # Steps to add an external addon to SUNDIALS: 14 | # 15 | # WARNING: external addons are not maintained by the SUNDIALS team and may come 16 | # with their own license with different rules. 17 | # 18 | # 1. Clone/copy the addon into /external/ (the same directory as 19 | # this file you are reading). 20 | # 2. Copy the sundials-addon-example block for your own external project. 21 | # 3. When building SUNDIALS, set the CMake option SUNDIALS_ENABLE_EXTERNAL_ADDONS 22 | # to ON 23 | # 4. Build SUNDIALS as usual. 24 | 25 | include(FetchContent) 26 | 27 | # COPY THE FetchContent BLOCK BELOW FOR YOUR OWN EXTERNAL ADDON COMMENT THESE 28 | # LINES OUT TO DISABLE THE EXAMPLE ADDON 29 | FetchContent_Declare( 30 | sundials-addon-example SOURCE_DIR 31 | ${PROJECT_SOURCE_DIR}/external/sundials-addon-example) 32 | FetchContent_MakeAvailable(sundials-addon-example) 33 | # COPY THE BLOCK ABOVE FOR YOUR OWN EXTERNAL ADDON 34 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_matrix.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * C++ view of SUNDIALS SUNMatrix 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_MATRIX_HPP 18 | #define _SUNDIALS_MATRIX_HPP 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace sundials { 25 | namespace impl { 26 | using BaseMatrix = BaseObject<_generic_SUNMatrix, _generic_SUNMatrix_Ops>; 27 | } // namespace impl 28 | 29 | namespace experimental { 30 | struct SUNMatrixDeleter 31 | { 32 | void operator()(SUNMatrix A) 33 | { 34 | if (A) { SUNMatDestroy(A); } 35 | } 36 | }; 37 | 38 | using SUNMatrixView = ClassView; 39 | } // namespace experimental 40 | } // namespace sundials 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spgmr/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPGMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspgmr_mod 25 | SOURCES fsunlinsol_spgmr_mod.f90 fsunlinsol_spgmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunlinsolspgmr_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_SPGMR F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/band/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the band SUNMatrix library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNMATRIX_BAND\n\")") 18 | 19 | # Add the sunmatrix_band library 20 | sundials_add_library( 21 | sundials_sunmatrixband 22 | SOURCES sunmatrix_band.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_band.h 24 | INCLUDE_SUBDIR sunmatrix 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunmatrixband 28 | VERSION ${sunmatrixlib_VERSION} 29 | SOVERSION ${sunmatrixlib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNMATRIX_BAND module") 32 | 33 | # Add F2003 module if the interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spfgmr/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPFGMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolspfgmr_mod 25 | SOURCES fsunlinsol_spfgmr_mod.f90 fsunlinsol_spfgmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunlinsolspfgmr_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_SPFGMR F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/newton/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 Newton SUNNonlinearSolver 15 | # object library 16 | # --------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunnonlinsolnewton_mod 26 | SOURCES fsunnonlinsol_newton_mod.f90 fsunnonlinsol_newton_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 28 | OBJECT_LIBRARIES 29 | OUTPUT_NAME sundials_fsunnonlinsolnewton_mod 30 | VERSION ${sunnonlinsollib_VERSION} 31 | SOVERSION ${sunnonlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNNONLINSOL_NEWTON F2003 interface") 34 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/klu/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 KLU SUNLinearSolver object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolklu_mod 25 | SOURCES fsunlinsol_klu_mod.f90 fsunlinsol_klu_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixsparse_mod 29 | OUTPUT_NAME sundials_fsunlinsolklu_mod 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_KLU F2003 interface") 34 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/onemkldense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | 15 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_ONEMKLDENSE\n\")") 16 | 17 | # Add the sunlinsol_onemkldense library 18 | sundials_add_library( 19 | sundials_sunlinsolonemkldense 20 | SOURCES sunlinsol_onemkldense.cpp 21 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_onemkldense.h 22 | INCLUDE_SUBDIR sunlinsol 23 | LINK_LIBRARIES PUBLIC sundials_core 24 | OBJECT_LIBRARIES 25 | COMPILE_FEATURES PUBLIC cxx_std_17 26 | INCLUDE_DIRECTORIES PUBLIC ${MKL_INCLUDE_DIR} 27 | LINK_LIBRARIES PUBLIC MKL::MKL_DPCPP sundials_sunmatrixonemkldense 28 | sundials_nvecsycl 29 | OUTPUT_NAME sundials_sunlinsolonemkldense 30 | VERSION ${sunmatrixlib_VERSION} 31 | SOVERSION ${sunmatrixlib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_ONEMKLDENSE module") 34 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/fixedpoint/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 fixed-point SUNNonlinearSolver 15 | # object library 16 | # --------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunnonlinsolfixedpoint_mod 26 | SOURCES fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 28 | OUTPUT_NAME sundials_fsunnonlinsolfixedpoint_mod 29 | VERSION ${sunnonlinsollib_VERSION} 30 | SOVERSION ${sunnonlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNNONLINSOL_FIXEDPOINT F2003 interface") 33 | -------------------------------------------------------------------------------- /src/bgc/zero_srcsnk.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | // Zero the source and sink state variables 4 | void ZeroSrcSnk(cstate_struct *cs, nstate_struct *ns, summary_struct *summary, solute_struct *solute) 5 | { 6 | // Zero the carbon sources and sinks 7 | cs->psnsun_src = 0.0; 8 | cs->psnshade_src = 0.0; 9 | cs->leaf_mr_snk = 0.0; 10 | cs->leaf_gr_snk = 0.0; 11 | cs->froot_mr_snk = 0.0; 12 | cs->froot_gr_snk = 0.0; 13 | cs->livestem_mr_snk = 0.0; 14 | cs->livestem_gr_snk = 0.0; 15 | cs->deadstem_gr_snk = 0.0; 16 | cs->livecroot_mr_snk = 0.0; 17 | cs->livecroot_gr_snk = 0.0; 18 | cs->deadcroot_gr_snk = 0.0; 19 | cs->litr1_hr_snk = 0.0; 20 | cs->litr2_hr_snk = 0.0; 21 | cs->litr4_hr_snk = 0.0; 22 | cs->soil1_hr_snk = 0.0; 23 | cs->soil2_hr_snk = 0.0; 24 | cs->soil3_hr_snk = 0.0; 25 | cs->soil4_hr_snk = 0.0; 26 | cs->fire_snk = 0.0; 27 | 28 | // Zero the nitrogen sources and sinks 29 | ns->nfix_src = 0.0; 30 | ns->ndep_src = 0.0; 31 | ns->nleached_snk = 0.0; 32 | ns->nvol_snk = 0.0; 33 | ns->fire_snk = 0.0; 34 | 35 | solute->snksrc = 0.0; 36 | 37 | // Zero the summary variables 38 | summary->cum_npp = 0.0; 39 | summary->cum_nep = 0.0; 40 | summary->cum_nee = 0.0; 41 | summary->cum_gpp = 0.0; 42 | summary->cum_mr = 0.0; 43 | summary->cum_gr = 0.0; 44 | summary->cum_hr = 0.0; 45 | summary->cum_fire = 0.0; 46 | } 47 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spgmr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the SPGMR SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPGMR\n\")") 18 | 19 | # Add the sunlinsol_spgmr library 20 | sundials_add_library( 21 | sundials_sunlinsolspgmr 22 | SOURCES sunlinsol_spgmr.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spgmr.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunlinsolspgmr 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPGMR module") 32 | 33 | # Add F90 module if F2003 interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/sptfqmr/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the F2003 SPTFQMR SUNLinearSolver object library 15 | # ------------------------------------------------------------------------ 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolsptfqmr_mod 25 | SOURCES fsunlinsol_sptfqmr_mod.f90 fsunlinsol_sptfqmr_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_fsunlinsolsptfqmr_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_SPTFQMR F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/nvector/openmp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Steve Smith and Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the openmp NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_OPENMP\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvecopenmp 22 | SOURCES nvector_openmp.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_openmp.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PUBLIC OpenMP::OpenMP_C 28 | OUTPUT_NAME sundials_nvecopenmp 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_OPENMP module") 33 | 34 | # Add F2003 module if the interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spfgmr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the SPFGMR SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPFGMR\n\")") 18 | 19 | # Add the sunlinsol_spfgmr library 20 | sundials_add_library( 21 | sundials_sunlinsolspfgmr 22 | SOURCES sunlinsol_spfgmr.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spfgmr.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunlinsolspfgmr 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPFGMR module") 32 | 33 | # Add F90 module if F2003 interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /src/include/custom_io.h: -------------------------------------------------------------------------------- 1 | #ifndef CUCTOMIO_HEADER 2 | #define CUCTOMIO_HEADER 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #if defined(_MSC_VER) 10 | # define strcasecmp _stricmp 11 | # define strncasecmp _strnicmp 12 | #endif 13 | 14 | // Maximum string length 15 | #define MAXSTRING 1024 16 | 17 | // Verbosity level 18 | #define VL_ERROR -999 19 | #define VL_SILENT -2 20 | #define VL_BRIEF -1 21 | #define VL_NORMAL 0 22 | #define VL_VERBOSE 1 23 | 24 | // Error type 25 | #define ERROR 1 26 | #define WARNING 0 27 | 28 | void _custom_exit(const char *, int, const char *, int, int); 29 | FILE* _custom_fopen(const char *, const char *); 30 | void _custom_printf(int, int, const char *, ...); 31 | #if !defined(_PIHM_) 32 | void _error(const char *, int, const char *, const char *, int, int, int, const char *, ...); 33 | #else 34 | void _error(const char *, int, const char *, int, int, const char *, ...); 35 | #endif 36 | int CountLines(FILE *, char *, int, ...); 37 | int CountOccurr(FILE *, const char *); 38 | void FindLine(FILE *, const char *, int *, const char *); 39 | int NextLine(FILE *, char *, int *); 40 | int NonBlank(char *); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/sptfqmr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the SPTFQMR SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPTFQMR\n\")") 18 | 19 | # Add the sunlinsol_sptfqmr library 20 | sundials_add_library( 21 | sundials_sunlinsolsptfqmr 22 | SOURCES sunlinsol_sptfqmr.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_sptfqmr.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunlinsolsptfqmr 28 | VERSION ${sunlinsollib_VERSION} 29 | SOVERSION ${sunlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNLINSOL_SPTFQMR module") 32 | 33 | # Add F90 module if F2003 interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/src/nvector/pthreads/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 Pthreads NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | set(nvecpthreads_SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c) 24 | 25 | sundials_add_f2003_library( 26 | sundials_fnvecpthreads_mod 27 | SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c 28 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 29 | OBJECT_LIBRARIES 30 | OUTPUT_NAME sundials_fnvecpthreads_mod 31 | VERSION ${nveclib_VERSION} 32 | SOVERSION ${nveclib_SOVERSION}) 33 | 34 | message(STATUS "Added NVECTOR_PTHREADS F2003 interface") 35 | -------------------------------------------------------------------------------- /cvode/src/nvector/pthreads/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 Pthreads NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | set(nvecpthreads_SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c) 24 | 25 | sundials_add_f2003_library( 26 | sundials_fnvecpthreads_mod 27 | SOURCES fnvector_pthreads_mod.f90 fnvector_pthreads_mod.c 28 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 29 | OBJECT_LIBRARIES 30 | OUTPUT_NAME sundials_fnvecpthreads_mod 31 | VERSION ${nveclib_VERSION} 32 | SOVERSION ${nveclib_SOVERSION}) 33 | 34 | message(STATUS "Added NVECTOR_PTHREADS F2003 interface") 35 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/fixedpoint/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 fixed-point SUNNonlinearSolver 15 | # object library 16 | # --------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunnonlinsolfixedpoint_mod 26 | SOURCES fsunnonlinsol_fixedpoint_mod.f90 fsunnonlinsol_fixedpoint_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 28 | OBJECT_LIBRARIES 29 | OUTPUT_NAME sundials_fsunnonlinsolfixedpoint_mod 30 | VERSION ${sunnonlinsollib_VERSION} 31 | SOVERSION ${sunnonlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNNONLINSOL_FIXEDPOINT F2003 interface") 34 | -------------------------------------------------------------------------------- /cvode/src/nvector/pthreads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Steve Smith and Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the pthreads NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_PTHREADS\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvecpthreads 22 | SOURCES nvector_pthreads.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_pthreads.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PRIVATE Threads::Threads 28 | OUTPUT_NAME sundials_nvecpthreads 29 | VERSION ${nveclib_VERSION} 30 | SOVERSION ${nveclib_SOVERSION}) 31 | 32 | message(STATUS "Added NVECTOR_PTHREADS module") 33 | 34 | # Add F2003 module if the interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/band/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 band SUNLinearSolver object library 15 | # ---------------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsolband_mod 25 | SOURCES fsunlinsol_band_mod.f90 fsunlinsol_band_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixband_mod 29 | OUTPUT_NAME sundials_fsunlinsolband_mod 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_BAND F2003 interface") 34 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/lapackdense/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 LAPACK dense SUNLinearSolver 15 | # object library 16 | # ---------------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunlinsollapackdense_mod 26 | SOURCES fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod sundials_fcore_mod 28 | OUTPUT_NAME sundials_fsunlinsollapackdense_mod 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | message(STATUS "Added SUNLINSOL_LAPACKDENSE F2003 interface") 32 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/dense/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 dense SUNLinearSolver object library 15 | # ---------------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | sundials_add_f2003_library( 24 | sundials_fsunlinsoldense_mod 25 | SOURCES fsunlinsol_dense_mod.f90 fsunlinsol_dense_mod.c 26 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 27 | OBJECT_LIBRARIES 28 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod 29 | OUTPUT_NAME sundials_fsunlinsoldense_mod 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | message(STATUS "Added SUNLINSOL_DENSE F2003 interface") 33 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/pcg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, 3 | # and Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the PCG SUNLinearSolver library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_PCG\n\")") 19 | 20 | # Add the sunlinsol_pcg library 21 | sundials_add_library( 22 | sundials_sunlinsolpcg 23 | SOURCES sunlinsol_pcg.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_pcg.h 25 | INCLUDE_SUBDIR sunlinsol 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_sunlinsolpcg 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_PCG module") 33 | 34 | # Add F90 module if F2003 interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/dense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the dense SUNMatrix library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNMATRIX_DENSE\n\")") 19 | 20 | # Add the sunmatrix_dense library 21 | sundials_add_library( 22 | sundials_sunmatrixdense 23 | SOURCES sunmatrix_dense.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_dense.h 25 | INCLUDE_SUBDIR sunmatrix 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_sunmatrixdense 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_DENSE module") 33 | 34 | # Add F2003 module if the interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /src/include/pihm.h: -------------------------------------------------------------------------------- 1 | #ifndef PIHM_HEADER 2 | #define PIHM_HEADER 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #if defined(_WIN32) || defined(_WIN64) 14 | # include 15 | # include 16 | # include 17 | #else 18 | # include 19 | #endif 20 | #if defined(unix) || defined(__unix__) || defined(__unix) 21 | # include 22 | #endif 23 | #if defined(_OPENMP) 24 | # include 25 | #endif 26 | 27 | #define VERSION "1.0.0.post" 28 | 29 | // SUNDIAL Header Files 30 | #include "cvode/cvode.h" // Prototypes for CVODE fcts., consts. 31 | #include "sunlinsol/sunlinsol_spgmr.h" // Access to SPGMR SUNLinearSolver 32 | #if defined(_CVODE_OMP) 33 | # include "nvector/nvector_openmp.h" // Access to N_Vector 34 | #else 35 | # include "nvector/nvector_serial.h" 36 | #endif 37 | #include "sundials/sundials_math.h" // Definition of macros SUNSQR and EXP 38 | #include "sundials/sundials_dense.h" // Prototypes for small dense fcts. 39 | 40 | #if defined(_NOAH_) 41 | # include "spa.h" 42 | #endif 43 | 44 | #include "custom_io.h" 45 | 46 | #include "pihm_const.h" 47 | #include "pihm_input_struct.h" 48 | #include "elem_struct.h" 49 | #include "river_struct.h" 50 | #include "pihm_struct.h" 51 | #include "pihm_func.h" 52 | #include "pihm_errors.h" 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/transpt/solute_conc.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void SoluteConc(elem_struct elem[], river_struct river[]) 4 | { 5 | int kelem, kriver; 6 | 7 | #if defined(_OPENMP) 8 | # pragma omp parallel for 9 | #endif 10 | for (kelem = 0; kelem < nelem; kelem++) 11 | { 12 | int ksolute; 13 | double storage; 14 | 15 | storage = (elem[kelem].ws.unsat + elem[kelem].ws.gw) * elem[kelem].soil.porosity + elem[kelem].soil.depth * elem[kelem].soil.smcmin; 16 | 17 | for (ksolute = 0; ksolute < nsolute; ksolute++) 18 | { 19 | elem[kelem].solute[ksolute].conc_surf = 0.0; 20 | elem[kelem].solute[ksolute].conc = (storage > 0.0) ? elem[kelem].solute[ksolute].amount / storage : 0.0; 21 | elem[kelem].solute[ksolute].conc = MAX(elem[kelem].solute[ksolute].conc, 0.0); 22 | } 23 | } 24 | 25 | #if defined(_OPENMP) 26 | # pragma omp parallel for 27 | #endif 28 | for (kriver = 0; kriver < nriver; kriver++) 29 | { 30 | int ksolute; 31 | double storage; 32 | 33 | storage = river[kriver].ws.stage; 34 | 35 | for (ksolute = 0; ksolute < nsolute; ksolute++) 36 | { 37 | river[kriver].solute[ksolute].conc = (storage > 0.0) ? river[kriver].solute[ksolute].amount / storage : 0.0; 38 | river[kriver].solute[ksolute].conc = MAX(river[kriver].solute[ksolute].conc, 0.0); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_memory.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * C++ view of SUNDIALS SUNMemoryHelper 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_MEMORY_HPP 18 | #define _SUNDIALS_MEMORY_HPP 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace sundials { 25 | namespace impl { 26 | using BaseMemoryHelper = BaseObject; 27 | } // namespace impl 28 | 29 | namespace experimental { 30 | struct SUNMemoryHelperDeleter 31 | { 32 | void operator()(SUNMemoryHelper helper) 33 | { 34 | if (helper) { SUNMemoryHelper_Destroy(helper); } 35 | } 36 | }; 37 | 38 | using SUNMemoryHelperView = ClassView; 39 | } // namespace experimental 40 | } // namespace sundials 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/sparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, 3 | # and Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the sparse SUNMatrix library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNMATRIX_SPARSE\n\")") 19 | 20 | # Add the sunmatrix_sparse library 21 | sundials_add_library( 22 | sundials_sunmatrixsparse 23 | SOURCES sunmatrix_sparse.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_sparse.h 25 | INCLUDE_SUBDIR sunmatrix 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_sunmatrixsparse 29 | VERSION ${sunmatrixlib_VERSION} 30 | SOVERSION ${sunmatrixlib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNMATRIX_SPARSE module") 33 | 34 | # Add F2003 module if the interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/klu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the klu SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_KLU\n\")") 18 | 19 | # Add the library 20 | sundials_add_library( 21 | sundials_sunlinsolklu 22 | SOURCES sunlinsol_klu.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_klu.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse SUNDIALS::KLU 28 | OUTPUT_NAME sundials_sunlinsolklu 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_KLU module") 33 | 34 | # Add F90 module if F2003 interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/spbcgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, 3 | # and Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the SPBCGS SUNLinearSolver library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SPBCGS\n\")") 19 | 20 | # Add the sunlinsol_spbcgs library 21 | sundials_add_library( 22 | sundials_sunlinsolspbcgs 23 | SOURCES sunlinsol_spbcgs.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_spbcgs.h 25 | INCLUDE_SUBDIR sunlinsol 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | OUTPUT_NAME sundials_sunlinsolspbcgs 29 | VERSION ${sunlinsollib_VERSION} 30 | SOVERSION ${sunlinsollib_SOVERSION}) 31 | 32 | message(STATUS "Added SUNLINSOL_SPBCGS module") 33 | 34 | # Add F90 module if F2003 interface is enabled 35 | if(BUILD_FORTRAN_MODULE_INTERFACE) 36 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 37 | endif() 38 | -------------------------------------------------------------------------------- /cvode/src/nvector/petsc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Radu Serban @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the petsc NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_PETSC\n\")") 18 | 19 | if(MPI_C_COMPILER) 20 | # use MPI wrapper as the compiler 21 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 22 | else() 23 | # add MPI_INCLUDE_PATH to include directories 24 | include_directories(${MPI_INCLUDE_PATH}) 25 | endif() 26 | 27 | # Create the library 28 | sundials_add_library( 29 | sundials_nvecpetsc 30 | SOURCES nvector_petsc.c 31 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_petsc.h 32 | INCLUDE_SUBDIR nvector 33 | LINK_LIBRARIES PUBLIC sundials_core 34 | OBJECT_LIBRARIES 35 | LINK_LIBRARIES PUBLIC SUNDIALS::PETSC 36 | OUTPUT_NAME sundials_nvecpetsc 37 | VERSION ${nveclib_VERSION} 38 | SOVERSION ${nveclib_SOVERSION}) 39 | 40 | message(STATUS "Added NVECTOR_PETSC module") 41 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_version.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): David J. Gardner @ LLNL 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * This header file is for routines to get SUNDIALS version info 15 | * -----------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_VERSION_H 18 | #define _SUNDIALS_VERSION_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 24 | extern "C" { 25 | #endif 26 | 27 | /* Fill a string with SUNDIALS version information */ 28 | SUNDIALS_EXPORT 29 | SUNErrCode SUNDIALSGetVersion(char* version, int len); 30 | 31 | /* Fills integers with the major, minor, and patch release version numbers and a 32 | string with the release label.*/ 33 | SUNDIALS_EXPORT 34 | SUNErrCode SUNDIALSGetVersionNumber(int* major, int* minor, int* patch, 35 | char* label, int len); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_linearsolver.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * C++ view of SUNDIALS SUNLinaerSolver 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_LINEARSOLVER_HPP 18 | #define _SUNDIALS_LINEARSOLVER_HPP 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace sundials { 25 | namespace impl { 26 | using BaseLinearSolver = 27 | BaseObject<_generic_SUNLinearSolver, _generic_SUNLinearSolver_Ops>; 28 | } // namespace impl 29 | 30 | namespace experimental { 31 | struct SUNLinearSolverDeleter 32 | { 33 | void operator()(SUNLinearSolver LS) 34 | { 35 | if (LS) { SUNLinSolFree(LS); } 36 | } 37 | }; 38 | 39 | using SUNLinearSolverView = ClassView; 40 | } // namespace experimental 41 | } // namespace sundials 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/band/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, 3 | # and Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the band SUNLinearSolver library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_BAND\n\")") 19 | 20 | # Add the library 21 | sundials_add_library( 22 | sundials_sunlinsolband 23 | SOURCES sunlinsol_band.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_band.h 25 | INCLUDE_SUBDIR sunlinsol 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | LINK_LIBRARIES PUBLIC sundials_sunmatrixband 29 | OUTPUT_NAME sundials_sunlinsolband 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_BAND module") 34 | 35 | # Add F2003 module if the interface is enabled 36 | if(BUILD_FORTRAN_MODULE_INTERFACE) 37 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 38 | endif() 39 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/lapackdense/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ---------------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ---------------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 LAPACK dense SUNLinearSolver 15 | # object library 16 | # ---------------------------------------------------------------------- 17 | 18 | # Disable warnings from unused SWIG macros which we can't control 19 | if(ENABLE_ALL_WARNINGS) 20 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 21 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 22 | endif() 23 | 24 | sundials_add_f2003_library( 25 | sundials_fsunlinsollapackdense_mod 26 | SOURCES fsunlinsol_lapackdense_mod.f90 fsunlinsol_lapackdense_mod.c 27 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 28 | OBJECT_LIBRARIES 29 | LINK_LIBRARIES PUBLIC sundials_fsunmatrixdense_mod 30 | OUTPUT_NAME sundials_fsunlinsollapackdense_mod 31 | VERSION ${sunlinsollib_VERSION} 32 | SOVERSION ${sunlinsollib_SOVERSION}) 33 | message(STATUS "Added SUNLINSOL_LAPACKDENSE F2003 interface") 34 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/newton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): David J. Gardner @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the Newton SUNNonlinearSolver library 15 | # ------------------------------------------------------------------------------ 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNNONLINSOL_NEWTON\n\")") 18 | 19 | # Add the library 20 | sundials_add_library( 21 | sundials_sunnonlinsolnewton 22 | SOURCES sunnonlinsol_newton.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_newton.h 24 | INCLUDE_SUBDIR sunnonlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunnonlinsolnewton 28 | VERSION ${sunnonlinsollib_VERSION} 29 | SOVERSION ${sunnonlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNNONLINSOL_NEWTON module") 32 | 33 | # Add F2003 module if interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/dense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds, Ashley Crawford @ SMU 3 | # and Cody J. Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # CMakeLists.txt file for the dense SUNLinearSolver library 16 | # --------------------------------------------------------------- 17 | 18 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_DENSE\n\")") 19 | 20 | # Add the sunlinsol_dense library 21 | sundials_add_library( 22 | sundials_sunlinsoldense 23 | SOURCES sunlinsol_dense.c 24 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_dense.h 25 | INCLUDE_SUBDIR sunlinsol 26 | LINK_LIBRARIES PUBLIC sundials_core 27 | OBJECT_LIBRARIES 28 | LINK_LIBRARIES PUBLIC sundials_sunmatrixdense 29 | OUTPUT_NAME sundials_sunlinsoldense 30 | VERSION ${sunlinsollib_VERSION} 31 | SOVERSION ${sunlinsollib_SOVERSION}) 32 | 33 | message(STATUS "Added SUNLINSOL_DENSE module") 34 | 35 | # Add F90 module if F2003 interface is enabled 36 | if(BUILD_FORTRAN_MODULE_INTERFACE) 37 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 38 | endif() 39 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/fixedpoint/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the fixed-point SUNNonlinearSolver library 15 | # ------------------------------------------------------------------------------ 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNNONLINSOL_FIXEDPOINT\n\")") 18 | 19 | # Add the library 20 | sundials_add_library( 21 | sundials_sunnonlinsolfixedpoint 22 | SOURCES sunnonlinsol_fixedpoint.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_fixedpoint.h 24 | INCLUDE_SUBDIR sunnonlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | OUTPUT_NAME sundials_sunnonlinsolfixedpoint 28 | VERSION ${sunnonlinsollib_VERSION} 29 | SOVERSION ${sunnonlinsollib_SOVERSION}) 30 | 31 | message(STATUS "Added SUNNONLINSOL_FIXEDPOINT module") 32 | 33 | # Add F2003 module if the interface is enabled 34 | if(BUILD_FORTRAN_MODULE_INTERFACE) 35 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 36 | endif() 37 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_nonlinearsolver.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * C++ view of SUNDIALS SUNNonlinearSolver 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_NONLINEARSOLVER_HPP 18 | #define _SUNDIALS_NONLINEARSOLVER_HPP 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace sundials { 25 | namespace impl { 26 | using BaseNonlinearSolver = 27 | BaseObject<_generic_SUNNonlinearSolver, _generic_SUNNonlinearSolver_Ops>; 28 | } // namespace impl 29 | 30 | namespace experimental { 31 | struct SUNNonlinearSolverDeleter 32 | { 33 | void operator()(SUNNonlinearSolver NLS) 34 | { 35 | if (NLS) { SUNNonlinSolFree(NLS); } 36 | } 37 | }; 38 | 39 | using SUNNonlinearSolverView = 40 | ClassView; 41 | } // namespace experimental 42 | } // namespace sundials 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_mpi_errors.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * -----------------------------------------------------------------*/ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "sundials_macros.h" 23 | #include "sundials_utils.h" 24 | 25 | void SUNMPIAbortErrHandlerFn(int line, const char* func, const char* file, 26 | SUNDIALS_MAYBE_UNUSED const char* msg, 27 | SUNErrCode err_code, 28 | SUNDIALS_MAYBE_UNUSED void* err_user_data, 29 | SUNContext sunctx) 30 | { 31 | char* file_and_line = sunCombineFileAndLine(line, file); 32 | SUNLogger_QueueMsg(sunctx->logger, SUN_LOGLEVEL_ERROR, file_and_line, func, 33 | "SUNMPIAbortErrHandler: Calling MPI_Abort now, use a " 34 | "different " 35 | "error handler to avoid program termination.\n"); 36 | free(file_and_line); 37 | MPI_Abort(sunctx->comm, err_code); 38 | } 39 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/superludist/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ----------------------------------------------------------------------------- 14 | # CMakeLists.txt file for the superlu-dist SUNLinearSolver library 15 | # ----------------------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SUPERLUDIST\n\")") 18 | 19 | # Add the library 20 | sundials_add_library( 21 | sundials_sunlinsolsuperludist 22 | SOURCES sunlinsol_superludist.c 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superludist.h 24 | INCLUDE_SUBDIR sunlinsol 25 | LINK_LIBRARIES PUBLIC sundials_core 26 | OBJECT_LIBRARIES 27 | LINK_LIBRARIES 28 | PUBLIC sundials_sunmatrixslunrloc SUNDIALS::SUPERLUDIST 29 | $,OpenMP::OpenMP_C,> MPI::MPI_C 30 | COMPILE_OPTIONS PRIVATE ${_compile_options} 31 | OUTPUT_NAME sundials_sunlinsolsuperludist 32 | VERSION ${sunlinsollib_VERSION} 33 | SOVERSION ${sunlinsollib_SOVERSION}) 34 | 35 | message(STATUS "Added SUNLINSOL_SUPERLUDIST module") 36 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_adjointcheckpointscheme_impl.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * SUNAdjointCheckpointScheme private class definition. 15 | * ----------------------------------------------------------------*/ 16 | 17 | #ifndef SUNDIALS_ADJOINTCHECKPOINTSCHEME_IMPL_H_ 18 | #define SUNDIALS_ADJOINTCHECKPOINTSCHEME_IMPL_H_ 19 | 20 | #include 21 | 22 | typedef struct SUNAdjointCheckpointScheme_Ops_* SUNAdjointCheckpointScheme_Ops; 23 | 24 | struct SUNAdjointCheckpointScheme_Ops_ 25 | { 26 | SUNAdjointCheckpointSchemeNeedsSavingFn needssaving; 27 | SUNAdjointCheckpointSchemeInsertVectorFn insertvector; 28 | SUNAdjointCheckpointSchemeLoadVectorFn loadvector; 29 | SUNAdjointCheckpointSchemeDestroyFn destroy; 30 | SUNAdjointCheckpointSchemeEnableDenseFn enableDense; 31 | }; 32 | 33 | struct SUNAdjointCheckpointScheme_ 34 | { 35 | SUNAdjointCheckpointScheme_Ops ops; 36 | void* content; 37 | SUNContext sunctx; 38 | }; 39 | 40 | #endif /* SUNDIALS_ADJOINTCHECKPOINTSCHEME_IMPL_H_ */ 41 | -------------------------------------------------------------------------------- /cvode/include/sundials/priv/sundials_context_impl.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * !!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15 | * This is a 'private' header file and should not be used in user 16 | * code. It is subject to change without warning. 17 | * !!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 18 | * ----------------------------------------------------------------- 19 | * SUNDIALS context class implementation. 20 | * ----------------------------------------------------------------*/ 21 | 22 | #ifndef _SUNDIALS_CONTEXT_IMPL_H 23 | #define _SUNDIALS_CONTEXT_IMPL_H 24 | 25 | #include 26 | 27 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 28 | extern "C" { 29 | #endif 30 | 31 | struct SUNContext_ 32 | { 33 | SUNProfiler profiler; 34 | sunbooleantype own_profiler; 35 | SUNLogger logger; 36 | sunbooleantype own_logger; 37 | SUNErrCode last_err; 38 | SUNErrHandler err_handler; 39 | SUNComm comm; 40 | }; 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /cvode/src/nvector/trilinos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Slaven Peles, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the Trilinos NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_Trilinos\n\")") 18 | 19 | # Create the library 20 | sundials_add_library( 21 | sundials_nvectrilinos 22 | SOURCES nvector_trilinos.cpp 23 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_trilinos.h 24 | INCLUDE_SUBDIR nvector 25 | LINK_LIBRARIES PUBLIC sundials_core Tpetra::all_libs 26 | OUTPUT_NAME sundials_nvectrilinos 27 | VERSION ${nveclib_VERSION} 28 | SOVERSION ${nveclib_SOVERSION}) 29 | 30 | # Install the exported NVECTRILINOS CXX header files in a separate subdirectory 31 | install( 32 | FILES 33 | ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorInterface.hpp 34 | ${SUNDIALS_SOURCE_DIR}/include/nvector/trilinos/SundialsTpetraVectorKernels.hpp 35 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nvector/trilinos") 36 | 37 | message(STATUS "Added NVECTOR_Trilinos module") 38 | -------------------------------------------------------------------------------- /src/read_att.c: -------------------------------------------------------------------------------- 1 | #include "pihm.h" 2 | 3 | void ReadAtt(const char fn[], atttbl_struct *atttbl) 4 | { 5 | int i; 6 | FILE *fp; 7 | char cmdstr[MAXSTRING]; 8 | int match; 9 | int index; 10 | int lno = 0; 11 | 12 | fp = pihm_fopen(fn, "r"); 13 | pihm_printf(VL_VERBOSE, " Reading %s\n", fn); 14 | 15 | atttbl->soil = (int *)malloc(nelem * sizeof(int)); 16 | atttbl->geol = (int *)malloc(nelem * sizeof(int)); 17 | atttbl->lc = (int *)malloc(nelem * sizeof(int)); 18 | atttbl->bc = (int **)malloc(nelem * sizeof(int *)); 19 | atttbl->meteo = (int *)malloc(nelem * sizeof(int)); 20 | atttbl->lai = (int *)malloc(nelem * sizeof(int)); 21 | for (i = 0; i < nelem; i++) 22 | { 23 | atttbl->bc[i] = (int *)malloc(NUM_EDGE * sizeof(int)); 24 | } 25 | 26 | // Check header line 27 | NextLine(fp, cmdstr, &lno); 28 | if (!CheckHeader(cmdstr, 9, "INDEX", "SOIL", "GEOL", "LC", "METEO", "LAI", "BC1", "BC2", "BC3")) 29 | { 30 | pihm_error(ERROR, ERR_WRONG_FORMAT, fn, lno); 31 | } 32 | for (i = 0; i < nelem; i++) 33 | { 34 | NextLine(fp, cmdstr, &lno); 35 | match = sscanf(cmdstr, "%d %d %d %d %d %d %d %d %d", 36 | &index, &atttbl->soil[i], &atttbl->geol[i], &atttbl->lc[i], &atttbl->meteo[i], &atttbl->lai[i], &atttbl->bc[i][0], &atttbl->bc[i][1], &atttbl->bc[i][2]); 37 | if (match != 9 || index != i + 1) 38 | { 39 | pihm_error(ERROR, ERR_WRONG_FORMAT, fn, lno); 40 | } 41 | } 42 | 43 | fclose(fp); 44 | } 45 | -------------------------------------------------------------------------------- /cvode/src/sunmatrix/slunrloc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ----------------------------------------------------------------------------- 14 | # CMakeLists.txt file for the SuperLU SLU_NR_LOC SUNMatrix library 15 | # ----------------------------------------------------------------------------- 16 | 17 | install(CODE "message(\"\nInstall SUNMATRIX_SLUNRLOC\n\")") 18 | 19 | # Use MPI 20 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 21 | set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) 22 | 23 | # Add the library 24 | sundials_add_library( 25 | sundials_sunmatrixslunrloc 26 | SOURCES sunmatrix_slunrloc.c 27 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunmatrix/sunmatrix_slunrloc.h 28 | INCLUDE_SUBDIR sunmatrix 29 | LINK_LIBRARIES PUBLIC sundials_core 30 | OBJECT_LIBRARIES 31 | LINK_LIBRARIES PUBLIC SUNDIALS::SUPERLUDIST 32 | $,OpenMP::OpenMP_C,> 33 | COMPILE_OPTIONS PRIVATE ${_compile_options} 34 | OUTPUT_NAME sundials_sunmatrixslunrloc 35 | VERSION ${sunlinsollib_VERSION} 36 | SOVERSION ${sunlinsollib_VERSION}) 37 | 38 | message(STATUS "Added SUNMATRIX_SLUNRLOC module") 39 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_core.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * ----------------------------------------------------------------- 12 | * Header file that includes the SUNDIALS core. 13 | * ----------------------------------------------------------------*/ 14 | 15 | #ifndef _SUNDIALS_CORE_H 16 | #define _SUNDIALS_CORE_H 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #if SUNDIALS_MPI_ENABLED 38 | #include 39 | #endif 40 | 41 | #endif /* _SUNDIALS_CORE_H */ 42 | -------------------------------------------------------------------------------- /cvode/examples/cvode/superludist/README: -------------------------------------------------------------------------------- 1 | List of parallel CVODE examples 2 | 3 | cvAdvDiff_sludist: advection-diffusion example using the SuperLU_DIST linear solver 4 | 5 | The following CMake command was used to configure SUNDIALS: 6 | 7 | cmake \ 8 | -DSUNDIALS_INDEX_SIZE=64 \ 9 | \ 10 | -DCMAKE_INSTALL_PREFIX="${INST_DIR}" \ 11 | -DEXAMPLES_INSTALL_PATH="${INST_DIR}/examples" \ 12 | \ 13 | -DENABLE_MPI=ON \ 14 | -DMPI_C_COMPILER="${MPIDIR}/bin/mpicc" \ 15 | -DMPI_CXX_COMPILER="${MPIDIR}/bin/mpicxx" \ 16 | -DMPIEXEC_EXECUTABLE="${MPIDIR}/bin/mpirun" \ 17 | \ 18 | -DENABLE_OPENMP=ON \ 19 | \ 20 | -DBUILD_SHARED_LIBS=OFF \ 21 | -DBUILD_STATIC_LIBS=ON \ 22 | -DBUILD_CVODE=ON \ 23 | -DBUILD_CVODES=OFF \ 24 | -DBUILD_IDA=OFF \ 25 | -DBUILD_IDAS=OFF \ 26 | -DBUILD_ARKODE=ON \ 27 | -DBUILD_KINSOL=OFF \ 28 | -DBUILD_TESTING=ON \ 29 | -DEXAMPLES_ENABLE_CXX=ON \ 30 | \ 31 | -DBLAS_ENABLE=OFF \ 32 | -DBLAS_LIBRARIES="${BLAS_LIBRARIES}" \ 33 | \ 34 | -DENABLE_LAPACK=OFF \ 35 | -DLAPACK_LIBRARIES="${LAPACK_LIBRARIES}" \ 36 | \ 37 | -DENABLE_SUPERLUDIST=ON \ 38 | -DSUPERLUDIST_LIBRARY_DIR="${SUPERLUDIST_DIR}/lib64" \ 39 | -DSUPERLUDIST_INCLUDE_DIR="${SUPERLUDIST_DIR}/include" \ 40 | -DSUPERLUDIST_LIBRARIES="${LAPACK_LIBRARIES};${PARMETIS_LIBRARIES}" \ 41 | -DSUPERLUDIST_OpenMP=ON \ 42 | \ 43 | ../ 44 | 45 | 46 | System Architecture: x86_64 47 | Processor Type: Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz 48 | Operating System: Red Hat 7.3 49 | C/Fortran Compilers: gcc/gfortran v4.9.4 50 | MPI: Open MPI v3.1.2 51 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_stepper_impl.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * SUNDIALS Copyright Start 3 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 4 | * and Southern Methodist University. 5 | * All rights reserved. 6 | * 7 | * See the top-level LICENSE and NOTICE files for details. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * SUNDIALS Copyright End 11 | * -----------------------------------------------------------------*/ 12 | 13 | #ifndef _SUNDIALS_STEPPER_IMPL_H 14 | #define _SUNDIALS_STEPPER_IMPL_H 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct SUNStepper_Ops_* SUNStepper_Ops; 24 | 25 | struct SUNStepper_Ops_ 26 | { 27 | SUNStepperEvolveFn evolve; 28 | SUNStepperOneStepFn onestep; 29 | SUNStepperFullRhsFn fullrhs; 30 | SUNStepperReInitFn reinit; 31 | SUNStepperResetFn reset; 32 | SUNStepperResetCheckpointIndexFn resetcheckpointindex; 33 | SUNStepperSetStopTimeFn setstoptime; 34 | SUNStepperSetStepDirectionFn setstepdirection; 35 | SUNStepperSetForcingFn setforcing; 36 | SUNStepperGetNumStepsFn getnumsteps; 37 | SUNStepperDestroyFn destroy; 38 | }; 39 | 40 | struct SUNStepper_ 41 | { 42 | /* stepper specific content and operations */ 43 | void* content; 44 | SUNStepper_Ops ops; 45 | 46 | /* stepper context */ 47 | SUNContext sunctx; 48 | 49 | /* last stepper return flag */ 50 | int last_flag; 51 | }; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* _SUNDIALS_STEPPER_IMPL_H */ 58 | -------------------------------------------------------------------------------- /cvode/src/nvector/parallel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Radu Serban @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the parallel NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_PARALLEL\n\")") 18 | 19 | if(MPI_C_COMPILER) 20 | # use MPI wrapper as the compiler 21 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 22 | else() 23 | # add MPI_INCLUDE_PATH to include directories 24 | include_directories(${MPI_INCLUDE_PATH}) 25 | endif() 26 | 27 | # Create the library 28 | sundials_add_library( 29 | sundials_nvecparallel 30 | SOURCES nvector_parallel.c 31 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_parallel.h 32 | INCLUDE_SUBDIR nvector 33 | LINK_LIBRARIES PUBLIC sundials_core 34 | OBJECT_LIBRARIES 35 | OUTPUT_NAME sundials_nvecparallel 36 | VERSION ${nveclib_VERSION} 37 | SOVERSION ${nveclib_SOVERSION}) 38 | 39 | message(STATUS "Added NVECTOR_PARALLEL module") 40 | 41 | # Add F2003 module if the interface is enabled 42 | if(BUILD_FORTRAN_MODULE_INTERFACE) 43 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 44 | endif() 45 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/superlumt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU, Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the superlumt SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_SUPERLUMT\n\")") 18 | 19 | # Include OpenMP flags if SuperLU_MT is using OpenMP, otherwise we use threads. 20 | if(SUPERLUMT_THREAD_TYPE STREQUAL "OPENMP") 21 | set(_threads OpenMP::OpenMP_C) 22 | else() 23 | set(_threads ${CMAKE_THREAD_LIBS_INIT}) 24 | endif() 25 | 26 | # Add the library 27 | sundials_add_library( 28 | sundials_sunlinsolsuperlumt 29 | SOURCES sunlinsol_superlumt.c 30 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_superlumt.h 31 | INCLUDE_SUBDIR sunlinsol 32 | LINK_LIBRARIES PUBLIC sundials_core 33 | OBJECT_LIBRARIES 34 | LINK_LIBRARIES PUBLIC sundials_sunmatrixsparse SUNDIALS::SUPERLUMT ${_threads} 35 | OUTPUT_NAME sundials_sunlinsolsuperlumt 36 | VERSION ${sunlinsollib_VERSION} 37 | SOVERSION ${sunlinsollib_SOVERSION}) 38 | 39 | message(STATUS "Added SUNLINSOL_SUPERLUMT module") 40 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_debug.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * This header files defines internal utility functions and macros 15 | * for SUNDIALS debugging. 16 | * -----------------------------------------------------------------*/ 17 | 18 | #ifndef _SUNDIALS_DEBUG_H 19 | #define _SUNDIALS_DEBUG_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 24 | extern "C" { 25 | #endif 26 | 27 | /* 28 | * Macro which prints to stderr when in debug mode 29 | */ 30 | #ifdef SUNDIALS_DEBUG 31 | #define SUNDIALS_DEBUG_PRINT(str) fprintf(stderr, str) 32 | #else 33 | #define SUNDIALS_DEBUG_PRINT(str) 34 | #endif 35 | 36 | /* 37 | * Macro which prints error messages in debug mode 38 | */ 39 | #ifdef SUNDIALS_DEBUG 40 | #define SUNDIALS_DEBUG_ERROR(msg) \ 41 | fprintf(stderr, "ERROR in %s (%s line %d): %s", __func__, __FILE__, \ 42 | __LINE__, msg); 43 | #else 44 | #define SUNDIALS_DEBUG_ERROR(msg) 45 | #endif 46 | 47 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 48 | } 49 | #endif 50 | 51 | #endif /* _SUNDIALS_DEBUG_H */ 52 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/lapackband/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Daniel R. Reynolds @ SMU 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the LapackBand SUNLinearSolver library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_LAPACKBAND\n\")") 18 | 19 | # Workaround bug in older versions of CMake where the BLAS::BLAS target, which 20 | # LAPACK::LAPACK depends on, is not picked up by LINK_LIBRARIES 21 | set(_lapack_targets LAPACK::LAPACK) 22 | if(CMAKE_VERSION VERSION_LESS 3.20) 23 | list(APPEND _lapack_targets BLAS::BLAS) 24 | endif() 25 | 26 | # Add the library 27 | sundials_add_library( 28 | sundials_sunlinsollapackband 29 | SOURCES sunlinsol_lapackband.c 30 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_lapackband.h 31 | INCLUDE_SUBDIR sunlinsol 32 | LINK_LIBRARIES PUBLIC sundials_core 33 | OBJECT_LIBRARIES 34 | LINK_LIBRARIES PUBLIC sundials_sunmatrixband ${_lapack_targets} 35 | OUTPUT_NAME sundials_sunlinsollapackband 36 | VERSION ${sunlinsollib_VERSION} 37 | SOVERSION ${sunlinsollib_SOVERSION}) 38 | 39 | message(STATUS "Added SUNLINSOL_LAPACKBAND module") 40 | -------------------------------------------------------------------------------- /cvode/src/sunnonlinsol/petscsnes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # ------------------------------------------------------------------------------ 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # ------------------------------------------------------------------------------ 14 | # CMakeLists.txt file for the PETSc SUNNonlinearSolver library 15 | # ------------------------------------------------------------------------------ 16 | install(CODE "MESSAGE(\"\nInstall SUNNONLINSOL_PETSCSNES\n\")") 17 | 18 | if(MPI_C_COMPILER) 19 | # use MPI wrapper as the compiler 20 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 21 | else() 22 | # add MPI_INCLUDE_PATH to include directories 23 | include_directories(${MPI_INCLUDE_PATH}) 24 | endif() 25 | 26 | # Create the library 27 | sundials_add_library( 28 | sundials_sunnonlinsolpetscsnes 29 | SOURCES sunnonlinsol_petscsnes.c 30 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunnonlinsol/sunnonlinsol_petscsnes.h 31 | INCLUDE_SUBDIR sunnonlinsol 32 | LINK_LIBRARIES PUBLIC sundials_core 33 | OBJECT_LIBRARIES 34 | LINK_LIBRARIES PUBLIC sundials_nvecpetsc SUNDIALS::PETSC 35 | OUTPUT_NAME sundials_sunnonlinsolpetscsnes 36 | VERSION ${nveclib_VERSION} 37 | SOVERSION ${nveclib_SOVERSION}) 38 | 39 | message(STATUS "Added SUNNONLINSOL_PETSCSNES module") 40 | -------------------------------------------------------------------------------- /cvode/src/sunlinsol/magmadense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | 15 | install(CODE "MESSAGE(\"\nInstall SUNLINSOL_MAGMADENSE\n\")") 16 | 17 | if(SUNDIALS_MAGMA_BACKENDS MATCHES "CUDA") 18 | set_source_files_properties(sunlinsol_magmadense.cpp PROPERTIES LANGUAGE CUDA) 19 | set(_libs_needed sundials_sunmatrixmagmadense sundials_nveccuda) 20 | elseif(SUNDIALS_MAGMA_BACKENDS MATCHES "HIP") 21 | set_source_files_properties(sunlinsol_magmadense.cpp PROPERTIES LANGUAGE CXX) 22 | set(_libs_needed sundials_sunmatrixmagmadense sundials_nvechip hip::device) 23 | endif() 24 | 25 | # Add the sunlinsol_magmadense library 26 | sundials_add_library( 27 | sundials_sunlinsolmagmadense 28 | SOURCES sunlinsol_magmadense.cpp 29 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/sunlinsol/sunlinsol_magmadense.h 30 | INCLUDE_SUBDIR sunlinsol 31 | LINK_LIBRARIES PUBLIC sundials_core 32 | OBJECT_LIBRARIES 33 | LINK_LIBRARIES PUBLIC SUNDIALS::MAGMA ${_libs_needed} 34 | OUTPUT_NAME sundials_sunlinsolmagmadense 35 | VERSION ${sunlinsollib_VERSION} 36 | SOVERSION ${sunlinsollib_SOVERSION}) 37 | 38 | message(STATUS "Added SUNLINSOL_MAGMADENSE module") 39 | -------------------------------------------------------------------------------- /cvode/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2002-2025, Lawrence Livermore National Security and Southern Methodist University. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_iterative_impl.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): David J. Gardner and Shelby Lockhart @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * This is the implementation header file for SUNDIALS functions used by 15 | * different iterative solvers. 16 | * ---------------------------------------------------------------------------*/ 17 | 18 | #ifndef _SUNDIALS_ITERATIVE_IMPL_H 19 | #define _SUNDIALS_ITERATIVE_IMPL_H 20 | 21 | #include 22 | 23 | /* ----------------------------------------------------------------------------- 24 | * Type: SUNQRData 25 | * ----------------------------------------------------------------------------- 26 | * A SUNQRData struct holds temporary workspace vectors and sunrealtype arrays for 27 | * a SUNQRAddFn. The N_Vectors and sunrealtype arrays it contains are created by 28 | * the routine calling a SUNQRAdd function. 29 | * ---------------------------------------------------------------------------*/ 30 | 31 | typedef struct _SUNQRData* SUNQRData; 32 | 33 | struct _SUNQRData 34 | { 35 | N_Vector vtemp; 36 | N_Vector vtemp2; 37 | sunrealtype* temp_array; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /cvode/examples/cvode/CXX_serial/README: -------------------------------------------------------------------------------- 1 | List of serial CVODE C++ examples 2 | 3 | cv_heat2D : 2-D heat equation (PCG with Jacobi preconditioner) 4 | 5 | Sample results: 6 | 7 | The example output was produced by running: 8 | 9 | ./cv_heat2D 10 | 11 | The following CMake command was used to configure SUNDIALS: 12 | 13 | cmake \ 14 | -DCMAKE_INSTALL_PREFIX:PATH="$PWD/../install_opt" \ 15 | -DEXAMPLES_INSTALL_PATH:PATH="$PWD/../examples_opt" \ 16 | -DCMAKE_C_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicc \ 17 | -DMPI_C_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicc \ 18 | -DCMAKE_Fortran_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpif90 \ 19 | -DMPI_Fortran_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpif90 \ 20 | -DCMAKE_CXX_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicxx \ 21 | -DMPI_CXX_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicxx \ 22 | -DMPIEXEC_EXECUTABLE=/usr/local/mpich-3.2.1/gnu/bin/mpiexec \ 23 | -DCMAKE_C_FLAGS:STRING="-O0 -g -fPIC" \ 24 | -DCMAKE_Fortran_FLAGS:STRING="-O0 -g -fPIC" \ 25 | -DCMAKE_CXX_FLAGS:STRING="-O0 -g -fPIC" \ 26 | -DOpenMP_C_FLAGS:STRING="-fopenmp" \ 27 | -DOpenMP_CXX_FLAGS:STRING="-fopenmp" \ 28 | -DSUNDIALS_PRECISION:STRING="double" \ 29 | -DSUNDIALS_INDEX_TYPE:STRING="int64_t" \ 30 | -DEXAMPLES_ENABLE_C:BOOL="1" \ 31 | -DEXAMPLES_ENABLE_CXX:BOOL="1" \ 32 | -DEXAMPLES_INSTALL:BOOL="1" \ 33 | -DMPI_ENABLE:BOOL="1" \ 34 | -DOPENMP_ENABLE:BOOL="1" \ 35 | -DPTHREAD_ENABLE:BOOL="1" \ 36 | -DBUILD_SHARED_LIBS:BOOL="1" \ 37 | ../sundials 38 | 39 | System Architecture: x86_64 40 | Processor Type: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz 41 | Operating System: Ubuntu 18.04 42 | C/Fortran Compilers: gcc/gfortran v7.3.0 43 | MPI: MPICH v3.2.1 44 | -------------------------------------------------------------------------------- /cvode/src/cvode/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2002-2025, Lawrence Livermore National Security and Southern Methodist University. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_macros.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Programmer(s): David J. Gardner @ LLNL 3 | * ----------------------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------------------- 14 | * SUNDIALS macros 15 | * ---------------------------------------------------------------------------*/ 16 | 17 | #ifndef _SUNDIALS_MACROS_H 18 | #define _SUNDIALS_MACROS_H 19 | 20 | #include "sundials/sundials_config.h" 21 | 22 | /* ----------------------------------------------------------------------------- 23 | * SUNDIALS_MAYBE_UNUSED 24 | * 25 | * This maps to an attribute that can be used to silence warnings about unused 26 | * classes, typedefs, variables, functions, or methods when the entity cannot be 27 | * removed. For example, functions or variables that are only used when error 28 | * checks or profiling is enabled. 29 | * ---------------------------------------------------------------------------*/ 30 | 31 | #if __cplusplus >= 201703L || __STDC_VERSION__ > 201710L 32 | #define SUNDIALS_MAYBE_UNUSED [[maybe_unused]] 33 | #elif defined(SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_UNUSED) 34 | #define SUNDIALS_MAYBE_UNUSED __attribute__((unused)) 35 | #else 36 | #define SUNDIALS_MAYBE_UNUSED 37 | #endif 38 | 39 | #endif /* _SUNDIALS_MACROS_H */ 40 | -------------------------------------------------------------------------------- /cvode/src/nvector/mpiplusx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the MPIPlusX NVECTOR library 15 | # --------------------------------------------------------------- 16 | 17 | install(CODE "MESSAGE(\"\nInstall NVECTOR_MPIPLUSX\n\")") 18 | 19 | if(MPI_C_FOUND AND MPI_C_COMPILER) 20 | # use MPI wrapper as the compiler 21 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 22 | elseif(MPI_C_FOUND) 23 | # add MPI_INCLUDE_PATH to include directories 24 | include_directories(${MPI_INCLUDE_PATH}) 25 | endif() 26 | 27 | # Create the library 28 | sundials_add_library( 29 | sundials_nvecmpiplusx 30 | SOURCES nvector_mpiplusx.c 31 | HEADERS ${SUNDIALS_SOURCE_DIR}/include/nvector/nvector_mpiplusx.h 32 | INCLUDE_SUBDIR nvector 33 | LINK_LIBRARIES PUBLIC sundials_core 34 | OBJECT_LIBRARIES sundials_nvecmpimanyvector_obj 35 | OUTPUT_NAME sundials_nvecmpiplusx 36 | VERSION ${nveclib_VERSION} 37 | SOVERSION ${nveclib_SOVERSION}) 38 | 39 | message(STATUS "Added NVECTOR_MPIPLUSX module") 40 | 41 | # Add F2003 module if the interface is enabled 42 | if(BUILD_FORTRAN_MODULE_INTERFACE) 43 | add_subdirectory("fmod_int${SUNDIALS_INDEX_SIZE}") 44 | endif() 45 | -------------------------------------------------------------------------------- /cvode/cmake/macros/SundialsAddNvectorBenchmark.cmake: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMake macro for adding nvector benchmark executables. 15 | # --------------------------------------------------------------- 16 | 17 | function(sundials_add_nvector_benchmark NAME) 18 | 19 | set(options) 20 | set(singleValueArgs) 21 | set(multiValueArgs SOURCES SUNDIALS_TARGETS LINK_LIBRARIES INSTALL_SUBDIR) 22 | 23 | cmake_parse_arguments(arg "${options}" "${singleValueArgs}" 24 | "${multiValueArgs}" ${ARGN}) 25 | 26 | set(BENCHMARKS_DIR ${PROJECT_SOURCE_DIR}/benchmarks) 27 | 28 | add_executable(${NAME} ${BENCHMARKS_DIR}/nvector/test_nvector_performance.c 29 | ${arg_SOURCES}) 30 | 31 | set_target_properties(${NAME} PROPERTIES FOLDER "Benchmarks") 32 | 33 | target_include_directories(${NAME} PRIVATE ${BENCHMARKS_DIR}/nvector) 34 | 35 | target_link_libraries(${NAME} PRIVATE ${arg_SUNDIALS_TARGETS} 36 | ${arg_LINK_LIBRARIES} -lm) 37 | 38 | install(TARGETS ${NAME} 39 | DESTINATION "${BENCHMARKS_INSTALL_PATH}/${arg_INSTALL_SUBDIR}") 40 | 41 | endfunction(sundials_add_nvector_benchmark) 42 | -------------------------------------------------------------------------------- /cvode/external/sundials-addon-example/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2002-2025, Lawrence Livermore National Security and Southern Methodist University. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /cvode/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): David J. Gardner, Slaven Peles, and 3 | # Cody Balos @ LLNL 4 | # --------------------------------------------------------------- 5 | # SUNDIALS Copyright Start 6 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | # and Southern Methodist University. 8 | # All rights reserved. 9 | # 10 | # See the top-level LICENSE and NOTICE files for details. 11 | # 12 | # SPDX-License-Identifier: BSD-3-Clause 13 | # SUNDIALS Copyright End 14 | # --------------------------------------------------------------- 15 | # src level CMakeLists.txt for SUNDIALS 16 | # --------------------------------------------------------------- 17 | 18 | # Add all of the shared SUNDIALS components 19 | add_subdirectory(sundials) 20 | add_subdirectory(nvector) 21 | add_subdirectory(sunmatrix) 22 | add_subdirectory(sunlinsol) 23 | add_subdirectory(sunnonlinsol) 24 | add_subdirectory(sunmemory) 25 | add_subdirectory(sunadaptcontroller) 26 | add_subdirectory(sunadjointcheckpointscheme) 27 | 28 | # ARKODE library 29 | if(BUILD_ARKODE) 30 | add_subdirectory(arkode) 31 | endif() 32 | 33 | # CVODE library 34 | if(BUILD_CVODE) 35 | add_subdirectory(cvode) 36 | endif() 37 | 38 | # CVODES library 39 | if(BUILD_CVODES) 40 | add_subdirectory(cvodes) 41 | endif() 42 | 43 | # IDA library 44 | if(BUILD_IDA) 45 | add_subdirectory(ida) 46 | endif() 47 | 48 | # IDAS library 49 | if(BUILD_IDAS) 50 | add_subdirectory(idas) 51 | endif() 52 | 53 | # KINSOL library 54 | if(BUILD_KINSOL) 55 | add_subdirectory(kinsol) 56 | endif() 57 | 58 | # CPODES library 59 | if(BUILD_CPODES) 60 | add_subdirectory(cpodes) 61 | endif() 62 | -------------------------------------------------------------------------------- /cvode/include/cvode/cvode_bandpre.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Daniel R. Reynolds @ SMU 3 | * Alan C. Hindmarsh and Radu Serban @ LLNL 4 | * ----------------------------------------------------------------- 5 | * SUNDIALS Copyright Start 6 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 7 | * and Southern Methodist University. 8 | * All rights reserved. 9 | * 10 | * See the top-level LICENSE and NOTICE files for details. 11 | * 12 | * SPDX-License-Identifier: BSD-3-Clause 13 | * SUNDIALS Copyright End 14 | * ----------------------------------------------------------------- 15 | * This is the header file for the CVBANDPRE module, which provides 16 | * a banded difference quotient Jacobian-based preconditioner. 17 | * -----------------------------------------------------------------*/ 18 | 19 | #ifndef _CVBANDPRE_H 20 | #define _CVBANDPRE_H 21 | 22 | #include 23 | 24 | #ifdef __cplusplus /* wrapper to enable C++ usage */ 25 | extern "C" { 26 | #endif 27 | 28 | /* BandPrec initialization function */ 29 | 30 | SUNDIALS_EXPORT int CVBandPrecInit(void* cvode_mem, sunindextype N, 31 | sunindextype mu, sunindextype ml); 32 | 33 | /* Optional output functions */ 34 | 35 | SUNDIALS_DEPRECATED_EXPORT_MSG( 36 | "Work space functions will be removed in version 8.0.0") 37 | int CVBandPrecGetWorkSpace(void* cvode_mem, long int* lenrwLS, long int* leniwLS); 38 | SUNDIALS_EXPORT int CVBandPrecGetNumRhsEvals(void* cvode_mem, 39 | long int* nfevalsBP); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cvode/examples/cvode/CXX_parallel/README: -------------------------------------------------------------------------------- 1 | List of parallel CVODE C++ examples 2 | 3 | cv_heat2D_p : 2-D heat equation (PCG with Jacobi preconditioner) 4 | 5 | Sample results: 6 | 7 | The example output was produced by running: 8 | 9 | mpiexec -n 4 ./cv_heat2D_p --np 2 2 10 | 11 | The following CMake command was used to configure SUNDIALS: 12 | 13 | cmake \ 14 | -DCMAKE_INSTALL_PREFIX:PATH="$PWD/../install_opt" \ 15 | -DEXAMPLES_INSTALL_PATH:PATH="$PWD/../examples_opt" \ 16 | -DCMAKE_C_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicc \ 17 | -DMPI_C_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicc \ 18 | -DCMAKE_Fortran_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpif90 \ 19 | -DMPI_Fortran_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpif90 \ 20 | -DCMAKE_CXX_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicxx \ 21 | -DMPI_CXX_COMPILER=/usr/local/mpich-3.2.1/gnu/bin/mpicxx \ 22 | -DMPIEXEC_EXECUTABLE=/usr/local/mpich-3.2.1/gnu/bin/mpiexec \ 23 | -DCMAKE_C_FLAGS:STRING="-O0 -g -fPIC" \ 24 | -DCMAKE_Fortran_FLAGS:STRING="-O0 -g -fPIC" \ 25 | -DCMAKE_CXX_FLAGS:STRING="-O0 -g -fPIC" \ 26 | -DOpenMP_C_FLAGS:STRING="-fopenmp" \ 27 | -DOpenMP_CXX_FLAGS:STRING="-fopenmp" \ 28 | -DSUNDIALS_PRECISION:STRING="double" \ 29 | -DSUNDIALS_INDEX_TYPE:STRING="int64_t" \ 30 | -DEXAMPLES_ENABLE_C:BOOL="1" \ 31 | -DEXAMPLES_ENABLE_CXX:BOOL="1" \ 32 | -DEXAMPLES_INSTALL:BOOL="1" \ 33 | -DMPI_ENABLE:BOOL="1" \ 34 | -DOPENMP_ENABLE:BOOL="1" \ 35 | -DPTHREAD_ENABLE:BOOL="1" \ 36 | -DBUILD_SHARED_LIBS:BOOL="1" \ 37 | ../sundials 38 | 39 | System Architecture: x86_64 40 | Processor Type: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz 41 | Operating System: Ubuntu 18.04 42 | C/Fortran Compilers: gcc/gfortran v7.3.0 43 | MPI: MPICH v3.2.1 44 | -------------------------------------------------------------------------------- /cvode/src/sundials/sundials_futils.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer(s): Cody J. Balos 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * ----------------------------------------------------------------- 14 | * SUNDIALS Fortran 2003 interface utility implementations. 15 | * -----------------------------------------------------------------*/ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /* Create a file pointer with the given file name and mode. */ 23 | SUNErrCode SUNDIALSFileOpen(const char* filename, const char* mode, FILE** fp_out) 24 | { 25 | SUNErrCode err = SUN_SUCCESS; 26 | FILE* fp = *fp_out; 27 | 28 | if (filename) 29 | { 30 | if (!strcmp(filename, "stdout")) { fp = stdout; } 31 | else if (!strcmp(filename, "stderr")) { fp = stderr; } 32 | else { fp = fopen(filename, mode); } 33 | } 34 | 35 | if (!fp) { err = SUN_ERR_FILE_OPEN; } 36 | 37 | *fp_out = fp; 38 | return err; 39 | } 40 | 41 | /* Close a file pointer with the given file name. */ 42 | SUNErrCode SUNDIALSFileClose(FILE** fp_ptr) 43 | { 44 | if (!fp_ptr) { return SUN_SUCCESS; } 45 | FILE* fp = *fp_ptr; 46 | if (fp && (fp != stdout) && (fp != stderr)) { fclose(fp); } 47 | return SUN_SUCCESS; 48 | } 49 | -------------------------------------------------------------------------------- /cvode/examples/cvode/C_openmp/README: -------------------------------------------------------------------------------- 1 | List of C_openmp CVODE examples 2 | 3 | cvAdvDiff_bnd_omp: banded example using OpenMP 4 | 5 | 6 | The following CMake command was used to configure SUNDIALS: 7 | 8 | cmake \ 9 | -DCMAKE_BUILD_TYPE=DEBUG \ 10 | -DBUILD_ARKODE=ON \ 11 | -DBUILD_CVODE=ON \ 12 | -DBUILD_CVODES=ON \ 13 | -DBUILD_IDA=ON \ 14 | -DBUILD_IDAS=ON \ 15 | -DBUILD_KINSOL=ON \ 16 | -DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ 17 | -DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ 18 | -DBUILD_SHARED_LIBS=OFF \ 19 | -DBUILD_STATIC_LIBS=ON \ 20 | -DEXAMPLES_ENABLE_C=ON \ 21 | -DEXAMPLES_ENABLE_CXX=ON \ 22 | -DEXAMPLES_INSTALL=ON \ 23 | -DENABLE_MPI=ON \ 24 | -DENABLE_LAPACK=ON \ 25 | -DENABLE_KLU=ON \ 26 | -DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ 27 | -DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ 28 | -DENABLE_HYPRE=ON \ 29 | -DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ 30 | -DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ 31 | -DENABLE_OPENMP=ON \ 32 | -DENABLE_PTHREAD=ON \ 33 | -DENABLE_SUPERLUMT=ON \ 34 | -DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ 35 | -DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ 36 | -DSUPERLUMT_THREAD_TYPE=Pthread \ 37 | -DENABLE_PETSC=ON \ 38 | -DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ 39 | -DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ 40 | ../sundials 41 | 42 | System Architecture: x86_64 43 | Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz 44 | Operating System: Red Hat 6.8 45 | C/Fortran Compilers: gcc/gfortran v4.4.7 46 | MPI: Open MPI v1.8.8 47 | -------------------------------------------------------------------------------- /cvode/src/nvector/mpiplusx/fmod_int32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 MPIPlusX NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | if(MPI_C_COMPILER) 24 | # use MPI wrapper as the compiler 25 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 26 | elseif() 27 | # add MPI_INCLUDE_PATH to include directories 28 | include_directories(${MPI_INCLUDE_PATH}) 29 | endif() 30 | if(MPI_Fortran_COMPILER) 31 | # use MPI wrapper as the compiler 32 | set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) 33 | endif() 34 | 35 | sundials_add_f2003_library( 36 | sundials_fnvecmpiplusx_mod 37 | SOURCES fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c 38 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 39 | OBJECT_LIBRARIES 40 | OUTPUT_NAME sundials_fnvecmpiplusx_mod 41 | VERSION ${nveclib_VERSION} 42 | SOVERSION ${nveclib_SOVERSION}) 43 | 44 | message(STATUS "Added NVECTOR_MPIPLUSX F2003 interface") 45 | -------------------------------------------------------------------------------- /cvode/src/nvector/mpiplusx/fmod_int64/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------- 2 | # Programmer(s): Cody J. Balos @ LLNL 3 | # --------------------------------------------------------------- 4 | # SUNDIALS Copyright Start 5 | # Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | # and Southern Methodist University. 7 | # All rights reserved. 8 | # 9 | # See the top-level LICENSE and NOTICE files for details. 10 | # 11 | # SPDX-License-Identifier: BSD-3-Clause 12 | # SUNDIALS Copyright End 13 | # --------------------------------------------------------------- 14 | # CMakeLists.txt file for the F2003 MPIPlusX NVECTOR object library 15 | # --------------------------------------------------------------- 16 | 17 | # Disable warnings from unused SWIG macros which we can't control 18 | if(ENABLE_ALL_WARNINGS) 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros") 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") 21 | endif() 22 | 23 | if(MPI_C_COMPILER) 24 | # use MPI wrapper as the compiler 25 | set(CMAKE_C_COMPILER ${MPI_C_COMPILER}) 26 | elseif() 27 | # add MPI_INCLUDE_PATH to include directories 28 | include_directories(${MPI_INCLUDE_PATH}) 29 | endif() 30 | if(MPI_Fortran_COMPILER) 31 | # use MPI wrapper as the compiler 32 | set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER}) 33 | endif() 34 | 35 | sundials_add_f2003_library( 36 | sundials_fnvecmpiplusx_mod 37 | SOURCES fnvector_mpiplusx_mod.f90 fnvector_mpiplusx_mod.c 38 | LINK_LIBRARIES PUBLIC sundials_fcore_mod 39 | OBJECT_LIBRARIES 40 | OUTPUT_NAME sundials_fnvecmpiplusx_mod 41 | VERSION ${nveclib_VERSION} 42 | SOVERSION ${nveclib_SOVERSION}) 43 | 44 | message(STATUS "Added NVECTOR_MPIPLUSX F2003 interface") 45 | -------------------------------------------------------------------------------- /cvode/examples/cvode/parhyp/README: -------------------------------------------------------------------------------- 1 | List of parhyp CVODE examples 2 | 3 | cvAdvDiff_non_ph : 1-D advection-diffusion (nonstiff) 4 | 5 | 6 | The following CMake command was used to configure SUNDIALS: 7 | 8 | cmake \ 9 | -DCMAKE_BUILD_TYPE=DEBUG \ 10 | -DBUILD_ARKODE=ON \ 11 | -DBUILD_CVODE=ON \ 12 | -DBUILD_CVODES=ON \ 13 | -DBUILD_IDA=ON \ 14 | -DBUILD_IDAS=ON \ 15 | -DBUILD_KINSOL=ON \ 16 | -DCMAKE_INSTALL_PREFIX=/home/user1/sundials/build/install \ 17 | -DEXAMPLES_INSTALL_PATH=/home/user1/sundials/build/install/examples \ 18 | -DBUILD_SHARED_LIBS=OFF \ 19 | -DBUILD_STATIC_LIBS=ON \ 20 | -DEXAMPLES_ENABLE_C=ON \ 21 | -DEXAMPLES_ENABLE_CXX=ON \ 22 | -DEXAMPLES_INSTALL=ON \ 23 | -DENABLE_MPI=ON \ 24 | -DENABLE_LAPACK=ON \ 25 | -DENABLE_KLU=ON \ 26 | -DKLU_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/include \ 27 | -DKLU_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/suitesparse/4.5.3/lib \ 28 | -DENABLE_HYPRE=ON \ 29 | -DHYPRE_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/hypre/2.11.1/include \ 30 | -DHYPRE_LIBRARY=/usr/casc/sundials/apps/rh6/hypre/2.11.1/lib/libHYPRE.a \ 31 | -DENABLE_OPENMP=ON \ 32 | -DENABLE_PTHREAD=ON \ 33 | -DENABLE_SUPERLUMT=ON \ 34 | -DSUPERLUMT_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/SRC \ 35 | -DSUPERLUMT_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/superlu_mt/SuperLU_MT_3.1/lib \ 36 | -DSUPERLUMT_THREAD_TYPE=Pthread \ 37 | -DENABLE_PETSC=ON \ 38 | -DPETSC_INCLUDE_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/include \ 39 | -DPETSC_LIBRARY_DIR=/usr/casc/sundials/apps/rh6/petsc/3.7.2/lib \ 40 | ../sundials 41 | 42 | System Architecture: x86_64 43 | Processor Type: Intel(R) Xeon(R) CPU E31230 @ 3.20GHz 44 | Operating System: Red Hat 6.8 45 | C/Fortran Compilers: gcc/gfortran v4.4.7 46 | MPI: Open MPI v1.8.8 47 | -------------------------------------------------------------------------------- /input/ndep.txt: -------------------------------------------------------------------------------- 1 | 1931 0.0001 2 | 1932 0.000112857 3 | 1933 0.000125714 4 | 1934 0.000138571 5 | 1935 0.000151429 6 | 1936 0.000164286 7 | 1937 0.000177143 8 | 1938 0.00019 9 | 1939 0.000202857 10 | 1940 0.000215714 11 | 1941 0.000228571 12 | 1942 0.000241429 13 | 1943 0.000254286 14 | 1944 0.000267143 15 | 1945 0.00028 16 | 1946 0.000292857 17 | 1947 0.000305714 18 | 1948 0.000318571 19 | 1949 0.000331429 20 | 1950 0.000344286 21 | 1951 0.000357143 22 | 1952 0.00037 23 | 1953 0.000382857 24 | 1954 0.000395714 25 | 1955 0.000408571 26 | 1956 0.000421429 27 | 1957 0.000434286 28 | 1958 0.000447143 29 | 1959 0.00046 30 | 1960 0.000472857 31 | 1961 0.000485714 32 | 1962 0.000498571 33 | 1963 0.000511429 34 | 1964 0.000524286 35 | 1965 0.000537143 36 | 1966 0.00055 37 | 1967 0.000562857 38 | 1968 0.000575714 39 | 1969 0.000588571 40 | 1970 0.000601429 41 | 1971 0.000614286 42 | 1972 0.000627143 43 | 1973 0.00064 44 | 1974 0.000652857 45 | 1975 0.000665714 46 | 1976 0.000678571 47 | 1977 0.000691429 48 | 1978 0.000704286 49 | 1979 0.000717143 50 | 1980 0.00073 51 | 1981 0.000742857 52 | 1982 0.000755714 53 | 1983 0.000768571 54 | 1984 0.000781429 55 | 1985 0.000794286 56 | 1986 0.000807143 57 | 1987 0.00082 58 | 1988 0.000832857 59 | 1989 0.000845714 60 | 1990 0.000858571 61 | 1991 0.000871429 62 | 1992 0.000884286 63 | 1993 0.000897143 64 | 1994 0.00091 65 | 1995 0.000922857 66 | 1996 0.000935714 67 | 1997 0.000948571 68 | 1998 0.000961429 69 | 1999 0.000974286 70 | 2000 0.000987143 71 | 2001 0.001 72 | 2002 0.001012857 73 | 2003 0.001025714 74 | 2004 0.001038571 75 | -------------------------------------------------------------------------------- /cvode/include/sundials/sundials_profiler.hpp: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------- 2 | * Programmer: Cody J. Balos @ LLNL 3 | * ----------------------------------------------------------------- 4 | * SUNDIALS Copyright Start 5 | * Copyright (c) 2002-2025, Lawrence Livermore National Security 6 | * and Southern Methodist University. 7 | * All rights reserved. 8 | * 9 | * See the top-level LICENSE and NOTICE files for details. 10 | * 11 | * SPDX-License-Identifier: BSD-3-Clause 12 | * SUNDIALS Copyright End 13 | * -----------------------------------------------------------------*/ 14 | 15 | #ifndef _SUNDIALS_PROFILER_HPP 16 | #define _SUNDIALS_PROFILER_HPP 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if defined(SUNDIALS_BUILD_WITH_PROFILING) && defined(SUNDIALS_CALIPER_ENABLED) 23 | #define SUNDIALS_CXX_MARK_FUNCTION(projobj) CALI_CXX_MARK_FUNCTION 24 | #elif defined(SUNDIALS_BUILD_WITH_PROFILING) 25 | #define SUNDIALS_CXX_MARK_FUNCTION(profobj) \ 26 | sundials::ProfilerMarkScope ProfilerMarkScope__(profobj, __func__) 27 | #else 28 | #define SUNDIALS_CXX_MARK_FUNCTION(profobj) 29 | #endif 30 | 31 | namespace sundials { 32 | /* Convenience class for C++ codes. 33 | Allows for simpler profiler statements using C++ scoping rules. */ 34 | class ProfilerMarkScope 35 | { 36 | public: 37 | ProfilerMarkScope(SUNProfiler prof, const char* name) 38 | { 39 | prof_ = prof; 40 | name_ = name; 41 | SUNProfiler_Begin(prof_, name_); 42 | } 43 | 44 | ~ProfilerMarkScope() { SUNProfiler_End(prof_, name_); } 45 | 46 | private: 47 | SUNProfiler prof_; 48 | const char* name_; 49 | }; 50 | } // namespace sundials 51 | 52 | #endif /* SUNDIALS_PROFILER_HPP */ 53 | --------------------------------------------------------------------------------