├── AUTHORS ├── BUILD.md ├── LICENSE ├── README.md ├── README.pdf ├── SandiaReport2021-1212.pdf └── src ├── CMakeLists.txt ├── FindGtest.cmake ├── FindKokkos.cmake ├── FindTCHEMPP.cmake ├── FindTChem.cmake ├── FindTines.cmake ├── core ├── CMakeLists.txt ├── CSPlib_CommandLineParser.hpp ├── chem_elem_DAE.cpp ├── chem_elem_DAE.hpp ├── chem_elem_DAE_PFR_TChem.cpp ├── chem_elem_DAE_PFR_TChem.hpp ├── chem_elem_ODE_TChem.cpp ├── chem_elem_ODE_TChem.hpp ├── chem_elem_TCSTRI_TChem.cpp ├── chem_elem_TCSTRI_TChem.hpp ├── chem_elem_TCSTR_TChem.cpp ├── chem_elem_TCSTR_TChem.hpp ├── eigendecomposition_kokkos.hpp ├── gODE.cpp ├── gODE.hpp ├── index.cpp ├── index.hpp ├── indexBatch.cpp ├── indexBatch.hpp ├── index_kokkos.hpp ├── interface_TChem.cpp ├── interface_TChem.hpp ├── kernel.cpp ├── kernel.hpp ├── kernelBatch.cpp ├── kernelBatch.hpp ├── kernel_kokkos.hpp ├── model.cpp ├── model.hpp ├── tools.cpp ├── tools.hpp ├── tools_tines.hpp └── util.hpp ├── example ├── CMakeLists.txt ├── build_example │ └── master_bld ├── data │ └── GRI30 │ │ ├── chem.inp │ │ ├── input.dat │ │ └── therm.dat ├── eigentest │ ├── CMakeLists.txt │ ├── main-eigentest.cpp │ ├── test-check.hpp │ ├── test-kokkos.hpp │ ├── test-magma.cpp │ ├── test-magma.hpp │ ├── test-matrix.hpp │ └── test-mkl.hpp ├── gODE │ ├── CMakeLists.txt │ ├── driverODE_DavisSkodjeK.cpp │ ├── driver_gODE_Davis_Skodje.cpp │ ├── driver_gODE_Davis_Skodje_K.cpp │ └── helperDavisSkodjeK.hpp ├── indexODETChem │ ├── CMakeLists.txt │ ├── runODETChemK.cpp │ ├── run_ODE_TChem_EigenK.cpp │ └── run_index_ODE_TChem.cpp ├── indexPFR_TChem │ ├── CMakeLists.txt │ └── run_index_PFR_TChem.cpp ├── indexTCSTRTChem │ ├── CMakeLists.txt │ ├── runTCSTRI_TChem.cpp │ └── run_index_TCSTR_TChem.cpp ├── runs │ ├── Davis_Skodje │ │ ├── Plot_Davis_Skodje.ipynb │ │ └── run.sh │ ├── Davis_Skodje_KEigenSolver │ │ └── run.sh │ ├── GRI3 │ │ ├── csp_analysis_gas-gri3.ipynb │ │ ├── data │ │ │ ├── chem.inp │ │ │ ├── input.dat │ │ │ ├── sample.dat │ │ │ └── therm.dat │ │ └── run.sh │ ├── GRI3_KEigenSolver │ │ └── run.sh │ ├── GRI3_ign │ │ ├── csp_analysis_gas-gri3.ipynb │ │ ├── data │ │ │ ├── chem.inp │ │ │ ├── input.dat │ │ │ └── therm.dat │ │ └── run.sh │ ├── TCSTR │ │ ├── delete.sh │ │ ├── inputs │ │ │ ├── CSTRSolutionODE.dat │ │ │ ├── chemSurf.inp │ │ │ ├── chemgri30.inp │ │ │ ├── sample_phi1.dat │ │ │ ├── thermSurf.dat │ │ │ └── thermgri30.dat │ │ ├── runAll.sh │ │ └── run_csp.sh │ └── scripts │ │ ├── CSPindexHelper.py │ │ └── compareFiles.py └── stiffnessFactor │ ├── CMakeLists.txt │ └── DriverStiffnessFactor.cpp ├── include ├── CSPlib_ConfigDefs.h.in └── vio.h ├── markdown ├── Figures │ ├── Davis_Skodje │ │ ├── M.jpg │ │ ├── M.pdf │ │ ├── f0.jpg │ │ ├── f0.pdf │ │ ├── f1.jpg │ │ ├── f1.pdf │ │ ├── tau.jpg │ │ ├── tau.pdf │ │ ├── timescales.jpg │ │ └── timescales.pdf │ └── ODE_GRI │ │ ├── CH4_FastIndexV2.jpg │ │ ├── CH4_FastIndexV2.pdf │ │ ├── CH4_SlowIndexV2.jpg │ │ ├── CH4_SlowIndexV2.pdf │ │ ├── CH4_SlowIndexZoom.jpg │ │ ├── CO_FastIndex.jpg │ │ ├── CO_FastIndex.pdf │ │ ├── CO_SlowIndex.jpg │ │ ├── CO_SlowIndex.pdf │ │ ├── M.jpg │ │ ├── M.pdf │ │ ├── Mode0_CSPPointer.jpg │ │ ├── Mode0_CSPPointer.pdf │ │ ├── PartIndexM0.jpg │ │ ├── PartIndexM0.pdf │ │ ├── Temperature[K]_FastIndex.jpg │ │ ├── Temperature[K]_FastIndex.pdf │ │ ├── Temperature[K]_SlowIndex.jpg │ │ ├── Temperature[K]_SlowIndex.pdf │ │ ├── Temperature[K]_SlowIndexZoom.jpg │ │ ├── Temperature[K]_SlowIndexZoom.pdf │ │ ├── tauMp.jpg │ │ ├── tauMp.pdf │ │ ├── timeScales.jpg │ │ └── timeScales.pdf ├── TChemODE.md ├── api.md ├── build.md ├── front.html ├── front.md ├── front.mdpp ├── gODE.md ├── intro.md ├── methodology.md ├── summary.md └── svgs │ ├── 034d0a6be0424bffe9a6e7ac9236c0f5.svg │ ├── 05067449bbf36f614c428d97e870520e.svg │ ├── 07a73994d9e031fb8a192ee570abbe32.svg │ ├── 07d98b30aa77fd1042e2a3dccd444f79.svg │ ├── 0a5174be254172c0eab67e56c6c45b6a.svg │ ├── 0ad8c52fc0aa98c56df0c369fd8f9d7e.svg │ ├── 0bd2b0567653a131bb87bae9a127f503.svg │ ├── 0d10ba2fee4f8f4e6ec5e91b56e5fdf4.svg │ ├── 0de9362d747e484498fc1309fa74e9b2.svg │ ├── 0fe1677705e987cac4f589ed600aa6b3.svg │ ├── 1247fb989d7a35db54126db0de81a3a4.svg │ ├── 17aca71b908655124bedf5625a6b4003.svg │ ├── 190083ef7a1625fbc75f243cffb9c96d.svg │ ├── 1afcdb0f704394b16fe85fb40c45ca7a.svg │ ├── 1cc212e2eaa2312ee8c74c4ac237f60b.svg │ ├── 1f3be6dc50d09ef2dd9dca8851fc6111.svg │ ├── 235667fde28f4f8b7756d9e38128a1d9.svg │ ├── 26be7f6efd6dd5ba387964beca10fe52.svg │ ├── 29632a9bf827ce0200454dd32fc3be82.svg │ ├── 29fb78801f1c792da0c00b3ed4246275.svg │ ├── 2a6d541ffefcb89b946628aca0519768.svg │ ├── 2a89ae6551cca9ae4bcc0ac5baa81559.svg │ ├── 2c7422c17d48ffe9e0a10d299549b3cc.svg │ ├── 2d0871483c28d923f9930ccb6432a429.svg │ ├── 2da3e8aa641ed5a5513d55f297a1f3e0.svg │ ├── 2f118ee06d05f3c2d98361d9c30e38ce.svg │ ├── 348d3db600b28b4792cd37d213085807.svg │ ├── 34a2a6bf81794c2f1c3c6f5e20f62dea.svg │ ├── 3662ab6d7f00c44123fc913194e2b711.svg │ ├── 36b5afebdba34564d884d347484ac0c7.svg │ ├── 373ee9c10f6b62d61adeb9721c372c36.svg │ ├── 3a91172ac0904d6988776a8ee5bd4140.svg │ ├── 3cc93b992f3153a471514b095de7655b.svg │ ├── 3db74330d87f477d8546e797b6de06ff.svg │ ├── 3f2be1666826f75fc30fbfd90af596ce.svg │ ├── 4467369d94a3da6705d94f709b6449e6.svg │ ├── 479ffee91f00b0b86628ad1e66a0afd6.svg │ ├── 4cd33d3e7b60b1dcbc8bbfe1a6066f61.svg │ ├── 4cdb9e1791ac5886dcafc190f32f5bcb.svg │ ├── 4f4f4e395762a3af4575de74c019ebb5.svg │ ├── 4fa9d8a8142bb9cea69c73ba2662cada.svg │ ├── 542eeec6a609dfdc0f4fd38e5e315937.svg │ ├── 5872d29d239f95cc7a5f43cfdd14fdae.svg │ ├── 5ac72f763e651a1bcc268d655e56cc48.svg │ ├── 5ad8a2a64cbdc3a62752e778c653fcef.svg │ ├── 5be0a103e300e1302f36d6e36e3109bb.svg │ ├── 5dfc3ab84de9c94bbfee2e75b72e1184.svg │ ├── 63bb9849783d01d91403bc9a5fea12a2.svg │ ├── 64e120bb63546232c0b0ecdffde52aa1.svg │ ├── 67b2f937bb6e5949bdc33b88ca3e9a52.svg │ ├── 67f338190db57bac70d43e66e745cbfb.svg │ ├── 6a551f004084ea3ff5c2cfe5225f73ae.svg │ ├── 6a5de32c407b38216093651cd9cb6a18.svg │ ├── 6b6a2d6b816a5e9aa1075f5ba26599b0.svg │ ├── 6c36d12620307d3695c2f3e102bdc966.svg │ ├── 6dec54c48a0438a5fcde6053bdb9d712.svg │ ├── 6fd48cccacbca33d14915b733c2492d2.svg │ ├── 70c447e2e539fd3f153cb72e005368c7.svg │ ├── 7314fc999267ea4498d60dcc5d4790cb.svg │ ├── 768a8472de21612006620c511cb67fdd.svg │ ├── 77a3b857d53fb44e33b53e4c8b68351a.svg │ ├── 7adc44611f8aad045f25802819faf9a1.svg │ ├── 7cc8f272d918f0085a6e839aed6ff8e7.svg │ ├── 7ccca27b5ccc533a2dd72dc6fa28ed84.svg │ ├── 85e88daa56884880b8a3141b22f439bc.svg │ ├── 878d4bdfb73bafc0de4fbb3fc749709f.svg │ ├── 89f2e0d2d24bcf44db73aab8fc03252c.svg │ ├── 8b5e1cd19ef6109ce6b47b4590c02b0d.svg │ ├── 8bb53efd3c06955359752da5b8f44f57.svg │ ├── 90278cf3aec9aa09f22dd88835591efb.svg │ ├── 96458543dc5abd380904d95cae6aa2bc.svg │ ├── 965b0163d30bfe5ef7925b51e8f06d79.svg │ ├── 98102b1e2a20b3fd04f22efac742bd3c.svg │ ├── 987e7023af2ace3664824a48b56a7caa.svg │ ├── 9b6dbadab1b122f6d297345e9d3b8dd7.svg │ ├── 9c8a3d770acac19bbf5f5647e2b6f159.svg │ ├── a6454c9f7b435f8182ed7bcdba94a0a0.svg │ ├── a964749a6b635295960fe89162eda4de.svg │ ├── aaec5fe0aa8f7db438189ddf4db3d8f3.svg │ ├── ae28694eed6b85c28c66c51ed964a55d.svg │ ├── ae86a50507c7257c61858ee3120f70d8.svg │ ├── b09bc86177601e586d14fb48ca4cb31d.svg │ ├── b21aa398e878fd7e4157ea90e2cfc71f.svg │ ├── b2b5ffa5313bc923dd73a1facd38dab2.svg │ ├── b2e616897360cbf1f9b6fd5702c2f4a1.svg │ ├── b37fde2679095443d620f67006a92446.svg │ ├── b5d099ee514da5f125a91b56ba1c2553.svg │ ├── b6ba8b9a8f7e37f32b22be4b11824870.svg │ ├── b6c5b75bafc8bbc771fa716cb26245ff.svg │ ├── b6cff40ab5165b0f508b764843486dd7.svg │ ├── b74a6d717caa897899eb0a0c102c4f89.svg │ ├── b77af50fec5b904a16ddda8ca577d295.svg │ ├── b918b3e21d7591cfba1f52fb033634fd.svg │ ├── b96ac72e32ed3d8662cbd6c909de1571.svg │ ├── bdca802a0997aca54b4ebaa3a14815dd.svg │ ├── c0ba58bdecbc90f96d3b42a0a90f1bca.svg │ ├── c287bf2eb39fa0d2a911f9636f7e702f.svg │ ├── c4e8f1527a6f2da2e317f1733ad7c8c6.svg │ ├── c827b5520c6658d4abd4a366611dda5c.svg │ ├── c8af22eca43c83855714d9112bc1fe6d.svg │ ├── ca45d068ac6a52be2e64ea1791cfebce.svg │ ├── cef39aeb23a61b09d838693a0897fe03.svg │ ├── cfae6332b6db8b5a88d3270aa86466b8.svg │ ├── d409de77a3c6c39b91057cb2b7893216.svg │ ├── d6ea8b4a0533c9fefc1550f36097cd63.svg │ ├── d75dc5e047f02c4d72559a3d754184dc.svg │ ├── dae0311a4dd5d3d6476ffe06b114d2f3.svg │ ├── dbb81067f1f28ab23eb88e1db7efe9e2.svg │ ├── dc6bea11cf28aa2f8c20bb86b056011f.svg │ ├── dd785592972414804d1834f338e81b51.svg │ ├── ddb5ecf3fc4acfeb9713ba569e187751.svg │ ├── deceeaf6940a8c7a5a02373728002b0f.svg │ ├── e257acd1ccbe7fcb654708f1a866bfe9.svg │ ├── e4d364d4b643aad76e72ae23b0ef1338.svg │ ├── e614c69edf552cf4eed92ef90ce93dd0.svg │ ├── e6bd8fce01b559d263c8dd7c7ef59a8d.svg │ ├── e7da7c126821a572252c7b295a6a0742.svg │ ├── e87a80dbe324f222b755826ca21f4202.svg │ ├── e97980bc3e9b1b0c68e91c5970823b1b.svg │ ├── e9da97c2519f59f5b154011f4daf5941.svg │ ├── ec232f5b6faa0f8e4d972bdb8ed45c66.svg │ ├── edc4380262f9e43447964b792fdc58cc.svg │ ├── eebba50928d4b9bb96cfd0ca5e4f24a1.svg │ ├── f2eb945d5011642d8520ac730e2548da.svg │ ├── f62db12f95e34116f1f1e827b2c64ce5.svg │ ├── f6aba97ea3d6b0a7ad8744f240b82d5f.svg │ ├── f93ce33e511096ed626b4719d50f17d2.svg │ ├── fb97d38bcc19230b0acd442e17db879c.svg │ ├── fce48928f2bc02b167783ec61396a79f.svg │ ├── fd7918ee56021fa145ba51c6a2a7f6ca.svg │ ├── fd8be73b54f5436a5cd2e73ba9b6bfa9.svg │ └── fef764efb102be2b31612203cfe06adf.svg ├── test ├── CMakeLists.txt ├── chem_elemODETChem │ ├── CMakeLists.txt │ └── driver_model_ODE_TChem2.cpp ├── gDAE │ ├── CMakeLists.txt │ └── driver_gDAE.cpp ├── gODE │ ├── CMakeLists.txt │ └── driver_gODE.cpp ├── index_kokkos │ ├── CMakeLists.txt │ ├── index_batch.cpp │ ├── index_kernel_batch.cpp │ ├── index_kokkos.cpp │ └── index_kokkos_v2.cpp └── kernel_kokkos │ ├── CMakeLists.txt │ └── kernel_kokkos.cpp └── unit-test ├── CMakeLists.txt ├── ODETChem ├── CMakeLists.txt ├── CSPlib_Test_Driver_ODETChem.cpp ├── inputs │ ├── chem.inp │ ├── input.dat │ └── therm.dat └── outputs_ref │ ├── _CH4_FastImportanceIndex.dat │ ├── _CH4_FastImportanceIndexTopElemPosition.dat │ ├── _CH4_SlowImportanceIndex.dat │ ├── _CH4_SlowImportanceIndexTopElemPosition.dat │ ├── _FastImportanceIndex.dat │ ├── _Mode0_ParticipationIndex.dat │ ├── _Mode0_ParticipationIndexTopElemPosition.dat │ ├── _Mode0_cspPointers.dat │ ├── _Mode0_cspPointersTopElemPosition.dat │ ├── _ParticipationIndex.dat │ ├── _RoP.dat │ ├── _SlowImportanceIndex.dat │ ├── _Temperature_FastImportanceIndex.dat │ ├── _Temperature_FastImportanceIndexTopElemPosition.dat │ ├── _Temperature_SlowImportanceIndex.dat │ ├── _Temperature_SlowImportanceIndexTopElemPosition.dat │ ├── _cspPointers.dat │ ├── _eig_val_imag.dat │ ├── _eig_val_real.dat │ ├── _eig_vec_L.dat │ ├── _eig_vec_R.dat │ ├── _f.dat │ ├── _jac.dat │ ├── _jac_numerical_rank.dat │ ├── _m.dat │ ├── _tau.dat │ └── testResults.txt └── T-CSTR ├── CMakeLists.txt ├── CSPlib_Test_Driver_TCSTR.cpp ├── inputs ├── CSTRSolutionODE.dat ├── chemSurf.inp ├── chemgri30.inp ├── sample_phi1.dat ├── thermSurf.dat └── thermgri30.dat └── outputs_ref ├── Constraint0_m.dat ├── Constraint11_m.dat ├── Constraint4_m.dat ├── kmod.echo ├── kmod.err ├── kmod.list ├── kmod.out ├── kmod.reactions ├── kmodSurf.echo ├── kmodSurf.err ├── kmodSurf.list ├── kmodSurf.out └── kmodSurf.reactions /AUTHORS: -------------------------------------------------------------------------------- 1 | CSPlib Authors 2 | ============= 3 | 4 | * v1: Oscar Diaz-Ibarra, Kyngjoo Kim, Fazle Rob, Habib Najm 5 | 6 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # Building CSPlib 2 | 3 | CSPlib requires Tines and Kokkos for the computation of the eigendecomposition on GPU or CPU hardware, and for linear algebra operations. Additionally, CSPlib has an interface to [TChem](https://github.com/sandialabs/TChem). 4 | 5 | For convenience, we explain how to build the CSPlib code using the following environment variables that one can modify according to their working environments. 6 | 7 | ```bash 8 | /// repositories 9 | export CSP_REPOSITORY_PATH=/where/you/clone/csp/git/repo 10 | 11 | /// build directories 12 | export CSP_BUILD_PATH=/where/you/build/csp 13 | 14 | /// install directories 15 | export TCHEM_INSTALL_PATH=/where/you/install/tchem 16 | export KOKKOS_INSTALL_PATH=/where/you/install/kokkos 17 | export TINES_INSTALL_PATH=/where/you/install/tines 18 | 19 | /// Tines requires OpenBlass 20 | export LIBRARY_PATH=${LIBRARY_PATH}:=/where/you/install/OpenBlas/lib 21 | ``` 22 | 23 | ## Download CSPlib 24 | Clone the CSPlib repository. Instructions on how to download and install TChem, kokkos and Tines are found in the [TChem repository](https://github.com/sandialabs/TChem). 25 | 26 | ```bash 27 | git clone https://github.com/sandialabs/CSPlib ${CSP_REPOSITORY_PATH}; 28 | ``` 29 | 30 | ## Configuring CSPlib 31 | 32 | The following example cmake script compiles CSPlib on the host, linking with Tines. 33 | 34 | ```bash 35 | cmake \ 36 | -D CMAKE_INSTALL_PREFIX=${CSP_INSTALL_PATH} \ 37 | -D CMAKE_CXX_COMPILER="${my_cxx}" \ 38 | -D CMAKE_C_COMPILER="${my_cc}" \ 39 | -D KOKKOS_INSTALL_PATH=${KOKKOS_INSTALL_PATH} \ 40 | -D TINES_INSTALL_PATH=${TINES_INSTALL_PATH} \ 41 |   ${CSP_REPOSITORY_PATH}/src 42 | ``` 43 | 44 | The following cmake example compiles CSPlib with TChem. CSPlib uses TChem to compute source terms, the Jacobian of the source term and the $S$ matrix and the rate of progress. TChem requires [Kokkos github pages](https://github.com/kokkos/kokkos) and Tines. Therefore, these libraries must also be installed. 45 | 46 | ```bash 47 | cmake \ 48 | 49 | -D CMAKE_INSTALL_PREFIX=${CSP_INSTALL_PATH} \ 50 | -D CMAKE_CXX_COMPILER="${my_cxx}" \ 51 | -D CMAKE_C_COMPILER="${my_cc}" \ 52 | -D OPENBLAS_INSTALL_PATH=${OPENBLAS_INSTALL_PATH} \ 53 | -D CSP_ENABLE_TCHEMPP=ON \ 54 | -D TCHEM_INSTALL_PATH=${TCHEM_INSTALL_PATH}\ 55 | -D KOKKOS_INSTALL_PATH=${KOKKOS_INSTALL_PATH} \ 56 | -D TINES_INSTALL_PATH=${TINES_INSTALL_PATH} \ 57 |   ${CSP_REPOSITORY_PATH}/src 58 | make install 59 | ``` 60 | 61 | TChem is designed and implemented using Kokkos (a performance portable parallel programming model), thus, CSPlib can also carry out computation on a GPU. For GPUs, we can use the above cmake script and replace the compiler choice by adding ``-D CMAKE_CXX_COMPILER="${KOKKOS_INSTALL_PATH}/bin/nvcc_wrapper"``. 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/README.pdf -------------------------------------------------------------------------------- /SandiaReport2021-1212.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/SandiaReport2021-1212.pdf -------------------------------------------------------------------------------- /src/FindGtest.cmake: -------------------------------------------------------------------------------- 1 | # Check Kokkos installation 2 | FILE(GLOB_RECURSE GTEST_FOUND_CMAKE_FILE "${GTEST_INSTALL_PATH}/GTestConfig.cmake") 3 | MESSAGE(STATUS "Gtest install path : ${GTEST_INSTALL_PATH}") 4 | MESSAGE(STATUS "Gtest found cmake config : ${GTEST_FOUND_CMAKE_FILE}") 5 | IF (GTEST_FOUND_CMAKE_FILE) 6 | INCLUDE(${GTEST_FOUND_CMAKE_FILE}) 7 | SET(GTEST_FOUND ON) 8 | ELSE() 9 | MESSAGE(FATAL_ERROR "-- Gtest is not found at ${GTEST_INSTALL_PATH}") 10 | ENDIF() -------------------------------------------------------------------------------- /src/FindKokkos.cmake: -------------------------------------------------------------------------------- 1 | # Check Kokkos installation 2 | FILE(GLOB_RECURSE KOKKOS_FOUND_CMAKE_FILE "${KOKKOS_INSTALL_PATH}/KokkosConfig.cmake") 3 | 4 | MESSAGE(STATUS "Kokkos install path : ${KOKKOS_INSTALL_PATH}") 5 | MESSAGE(STATUS "Kokkos found cmake config : ${KOKKOS_FOUND_CMAKE_FILE}") 6 | 7 | IF (KOKKOS_FOUND_CMAKE_FILE) # AND KOKKOS_FOUND_INCLUDE_PATH AND KOKKOS_FOUND_LIBRARY) 8 | INCLUDE(${KOKKOS_FOUND_CMAKE_FILE}) 9 | SET(KOKKOS_FOUND ON) 10 | ELSE() 11 | MESSAGE(FATAL_ERROR "-- Kokkos is not found at ${KOKKOS_INSTALL_PATH}") 12 | ENDIF() -------------------------------------------------------------------------------- /src/FindTCHEMPP.cmake: -------------------------------------------------------------------------------- 1 | # Check TChem installation 2 | FILE(GLOB_RECURSE TCHEM_FOUND_CMAKE_FILE "${TCHEM_INSTALL_PATH}/TChemConfig.cmake") 3 | 4 | MESSAGE(STATUS "TChem install path : ${TCHEM_INSTALL_PATH}") 5 | MESSAGE(STATUS "TChem found cmake config : ${TCHEM_FOUND_CMAKE_FILE}") 6 | 7 | IF (TCHEM_FOUND_CMAKE_FILE) 8 | INCLUDE(${TCHEM_FOUND_CMAKE_FILE}) 9 | SET(TCHEM_FOUND ON) 10 | ELSE() 11 | MESSAGE(FATAL_ERROR "-- TChem is not found at ${TCHEM_INSTALL_PATH}") 12 | ENDIF() 13 | -------------------------------------------------------------------------------- /src/FindTChem.cmake: -------------------------------------------------------------------------------- 1 | # Check TCHEM installation 2 | FIND_PATH(TCHEM_FOUND_INCLUDE_PATH TC_interface.h HINTS ${TCHEM_INSTALL_PATH}/include) 3 | FIND_LIBRARY(TCHEM_FOUND_LIBRARY NAMES tchem HINTS ${TCHEM_INSTALL_PATH}/lib) 4 | 5 | IF (TCHEM_FOUND_INCLUDE_PATH AND TCHEM_FOUND_LIBRARY) 6 | ADD_LIBRARY(tchem UNKNOWN IMPORTED) 7 | SET_TARGET_PROPERTIES(tchem PROPERTIES 8 | IMPORTED_LOCATION ${TCHEM_FOUND_LIBRARY} 9 | INTERFACE_INCLUDE_DIRECTORIES ${TCHEM_FOUND_INCLUDE_PATH} 10 | INTERFACE_COMPILE_OPTIONS "-I${TCHEM_FOUND_INCLUDE_PATH}" 11 | # Link option is available from cmake 3.14 12 | # INTERFACE_LINK_OPTIONS "" 13 | INTERFACE_LINK_LIBRARIES "-L${TCHEM_INSTALL_PATH}/lib -ltchem -ltchemutil") 14 | SET(TCHEM_FOUND ON) 15 | ELSE() 16 | MESSAGE(FATAL_ERROR "-- TChem is not found at ${TCHEM_INSTALL_PATH}") 17 | ENDIF() 18 | -------------------------------------------------------------------------------- /src/FindTines.cmake: -------------------------------------------------------------------------------- 1 | # Check Tines installation 2 | FILE(GLOB_RECURSE TINES_FOUND_CMAKE_FILE "${TINES_INSTALL_PATH}/TinesConfig.cmake") 3 | 4 | MESSAGE(STATUS "Tines install path : ${TINES_INSTALL_PATH}") 5 | MESSAGE(STATUS "Tines found cmake config : ${TINES_FOUND_CMAKE_FILE}") 6 | 7 | IF (TINES_FOUND_CMAKE_FILE) 8 | INCLUDE(${TINES_FOUND_CMAKE_FILE}) 9 | SET(TINES_FOUND ON) 10 | ELSE() 11 | MESSAGE(FATAL_ERROR "-- Tines is not found at ${TINES_INSTALL_PATH}") 12 | ENDIF() -------------------------------------------------------------------------------- /src/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Empty list 2 | SET(CSPlib_SOURCES "") 3 | SET(CSPlib_HEADERS "") 4 | 5 | LIST(APPEND CSPlib_SOURCES 6 | tools.cpp 7 | model.cpp 8 | gODE.cpp 9 | chem_elem_DAE.cpp 10 | kernel.cpp 11 | index.cpp 12 | indexBatch.cpp 13 | kernelBatch.cpp 14 | ) 15 | 16 | LIST(APPEND CSPlib_HEADERS 17 | util.hpp tools.hpp 18 | model.hpp chem_elem_DAE.hpp 19 | kernel.hpp index.hpp 20 | CSPlib_CommandLineParser.hpp 21 | eigendecomposition_kokkos.hpp 22 | index_kokkos.hpp 23 | tools_tines.hpp 24 | indexBatch.hpp 25 | kernelBatch.hpp 26 | ) 27 | 28 | ## tchem interface 29 | IF (CSPlib_ENABLE_TCHEMPP) 30 | 31 | LIST(APPEND CSPlib_SOURCES 32 | chem_elem_ODE_TChem.cpp 33 | chem_elem_TCSTR_TChem.cpp 34 | chem_elem_TCSTRI_TChem.cpp 35 | chem_elem_DAE_PFR_TChem.cpp) 36 | 37 | LIST(APPEND CSPlib_HEADERS 38 | chem_elem_ODE_TChem.hpp 39 | chem_elem_TCSTR_TChem.hpp 40 | chem_elem_TCSTRI_TChem.hpp 41 | chem_elem_DAE_PFR_TChem.hpp) 42 | 43 | ENDIF() 44 | 45 | ADD_LIBRARY(CSPlib ${CSPlib_SOURCES}) 46 | 47 | TARGET_LINK_LIBRARIES(${CSPlib_LINK_LIBRARIES}) 48 | 49 | INSTALL(FILES ${CSPlib_HEADERS} DESTINATION include) 50 | -------------------------------------------------------------------------------- /src/core/gODE.cpp: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | #include 24 | #include 25 | #include 26 | #include "gODE.hpp" 27 | 28 | //=========================================================== 29 | GeneralODE::GeneralODE( 30 | std::function& state, std::vector& source)> gfunc, 31 | std::function& state, std::vector>& jmat, unsigned int flag)> jfunc 32 | ) { 33 | rhsfunc = gfunc; 34 | jacfunc = jfunc; 35 | return; 36 | } 37 | //=========================================================== 38 | int GeneralODE::evalSourceVector() { 39 | rhsfunc(_state_vec, _source_vec); 40 | return(0); 41 | } 42 | 43 | //=========================================================== 44 | int GeneralODE::evalJacMatrix(unsigned int useJacAnl) { 45 | jacfunc(_state_vec, _jmat, useJacAnl); 46 | return(0); 47 | } 48 | 49 | //=========================================================== 50 | -------------------------------------------------------------------------------- /src/core/gODE.hpp: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | #ifndef MODEL_CSP_gODE 24 | #define MODEL_CSP_gODE 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include "model.hpp" 36 | 37 | class GeneralODE: public Model { 38 | 39 | public: 40 | GeneralODE( 41 | std::function&, std::vector&)>, 42 | std::function&, std::vector>&, unsigned int )> 43 | ); 44 | 45 | int evalSourceVector(); // from Model 46 | int evalJacMatrix(unsigned int useJacAnl); // from Model 47 | 48 | private: 49 | std::function&, std::vector&)> rhsfunc; 50 | std::function&, std::vector>&, unsigned int )> jacfunc; 51 | 52 | }; 53 | 54 | 55 | #endif //end of header guard 56 | -------------------------------------------------------------------------------- /src/core/model.hpp: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | #ifndef MODEL_CSP 24 | #define MODEL_CSP 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | class Model 35 | { 36 | // friend class Kernel; 37 | 38 | public: 39 | Model(): Nvars(0) {}; 40 | 41 | int init(); 42 | int init(int Nvars); 43 | int setNumOfVariables(int Nvars); 44 | int getNumOfVariables(); 45 | 46 | int setStateVector(const std::vector& state_vec); 47 | int getStateVector(std::vector& state_vec); 48 | 49 | int setStateDB(const std::vector& state_db); 50 | int getStateDB(std::vector& state_db); 51 | 52 | int getSourceVector(std::vector& source_vec); 53 | 54 | int getJacMatrix(std::vector >& jmat); 55 | 56 | virtual int evalSourceVector()=0; 57 | virtual int evalJacMatrix(unsigned int useJacAnl)=0; 58 | 59 | protected: 60 | 61 | // single state vector structures 62 | int Nvars; 63 | std::vector _state_vec; 64 | std::vector _source_vec; 65 | std::vector > _jmat; 66 | 67 | // data base data structures -- for efficiency arguments -- are all stored 68 | // in 1-dimensional vectors -- and intended to be ultimately communicated 69 | // to tchem as such 70 | 71 | // number of entries (state vectors, source vectors, jac matrices) in db 72 | int Ndb; 73 | 74 | // database of state vectors (vec_0,vec_1,...,vec_(Ndb-1)) 75 | // i-th state variable in j-th state vector in db is at: _state_db[i+j*Nvars] 76 | std::vector _state_db; 77 | 78 | // database of source vectors (vec_0,vec_1,...,vec_(Ndb-1)) 79 | // i-th source term in j-th source vector in db is at: _source_db[i+j*Nvars] 80 | std::vector _source_db; 81 | 82 | // database of jacobian matrices (mat_0,mat_1,...,mat_(Ndb-1)) 83 | // each matrix is stored column major in 1D (col_0,col_1,...,col_(Nvars-1)) 84 | // entry in row i, col j, of jac matrix k is stored in _jac_db at: 85 | // _jac_db[i+j*Nvars+k*Nvars*Nvars] 86 | std::vector _jac_db; 87 | 88 | private: 89 | 90 | }; 91 | 92 | #endif //end of header guard 93 | -------------------------------------------------------------------------------- /src/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (CSPlib) 2 | 3 | ADD_SUBDIRECTORY (gODE) 4 | ADD_SUBDIRECTORY (stiffnessFactor) 5 | 6 | IF (CSPlib_ENABLE_TCHEMPP) 7 | ADD_SUBDIRECTORY (indexODETChem) 8 | ADD_SUBDIRECTORY (indexTCSTRTChem) 9 | ADD_SUBDIRECTORY (indexPFR_TChem) 10 | ENDIF() 11 | 12 | IF (CSPlib_ENABLE_KOKKOS) 13 | ADD_SUBDIRECTORY (eigentest) 14 | ENDIF() 15 | 16 | INSTALL(DIRECTORY runs data 17 | DESTINATION ${CMAKE_INSTALL_PREFIX}/example) 18 | -------------------------------------------------------------------------------- /src/example/data/GRI30/input.dat: -------------------------------------------------------------------------------- 1 | 0.000000000000000000e+00 2 | 1.013249999999999884e+06 3 | 1.200000000000000000e+03 4 | 1.379436379808566485e-03 5 | 8.988100906469271342e-04 6 | 1.202438195969679664e-02 7 | 2.173948775212681400e-02 8 | 8.983813651899551916e-03 9 | 1.450823404848083052e-02 10 | 1.800857975327362429e-02 11 | 3.782099233301790958e-02 12 | 1.443166549100211027e-02 13 | 6.224249198829770631e-03 14 | 1.384674427308201471e-02 15 | 9.250020333935748268e-03 16 | 1.064860822879461905e-02 17 | 1.851454593152734168e-02 18 | 2.480906377349505545e-03 19 | 4.781077997181301838e-03 20 | 7.315289277346434006e-04 21 | 3.117170076963017220e-02 22 | 3.011065025329299344e-02 23 | 3.366498006988871000e-02 24 | 3.909735219785899496e-02 25 | 2.494048972105542689e-02 26 | 1.498201112688782484e-02 27 | 2.632094667713423888e-02 28 | 4.137082068337264058e-03 29 | 2.318780302963429490e-02 30 | 5.374624106915112769e-03 31 | 4.832661396175130103e-02 32 | 2.735212729342540935e-02 33 | 2.173406657383385870e-02 34 | 4.620258304218137144e-03 35 | 1.449440379612807091e-02 36 | 9.112839865169666126e-03 37 | 1.207038566656701457e-02 38 | 6.799125166714994938e-04 39 | 2.310758661679012879e-02 40 | 3.511087783449913513e-02 41 | 3.385561452884115058e-02 42 | 3.649448114920544189e-02 43 | 2.211829808105790149e-02 44 | 1.211427085164026342e-02 45 | 1.527582182723080315e-02 46 | 3.569153567626779516e-02 47 | 3.230829997409863635e-03 48 | 3.576908320115761153e-02 49 | 3.597675348894006919e-02 50 | 1.102169619274639967e-02 51 | 6.421681515791027341e-03 52 | 1.694630887079601536e-02 53 | 1.999736115370774267e-02 54 | 3.060285152901273328e-02 55 | 2.409125379150564919e-02 56 | 3.452236296661215231e-02 57 | 1.928842937218850978e-03 58 | 2.513582388607080859e-03 59 | 2.118453486348505915e-03 60 | 1.915029553048436858e-03 61 | 1.488964031817859284e-03 62 | 2.270039438287636390e-03 63 | 1.537930455102480944e-03 64 | 3.134197759078380906e-03 65 | 3.386859281252985621e-03 66 | 1.347631682039496454e-03 67 | 2.782572289123734152e-03 68 | 1.858837698409498973e-03 69 | 1.996431814907937904e-03 70 | 3.253073267527922981e-03 71 | 2.496611292585936091e-04 72 | 3.062219372364352382e-04 73 | 7.105895322470088323e-05 74 | 2.926299912412615341e-03 75 | 2.734885607547925864e-03 76 | 3.057717740966333156e-03 77 | 3.439421705444128258e-03 78 | 2.808697929764329953e-03 79 | 1.621901068731171824e-03 80 | 2.743223660131988064e-03 81 | 4.156836327065238082e-04 82 | 2.249046595123355748e-03 83 | 5.038250224663911149e-04 84 | 3.320104107537703939e-03 85 | 1.834071943390860708e-03 86 | 1.457358006974446372e-03 87 | 9.297989576750522334e-04 88 | 2.721097737091831160e-03 89 | 1.603171824872649592e-03 90 | 1.997800345116698770e-03 91 | 6.603805045623410079e-05 92 | 2.170722582052604828e-03 93 | 2.151252662746712310e-03 94 | 2.168257111180067146e-03 95 | 3.316867756952731217e-03 96 | 2.396304498645045102e-03 97 | 1.263515328857415035e-03 98 | 1.535978964425122138e-03 99 | 2.451872986758787433e-03 100 | 2.116665766449040028e-04 101 | 2.343397639920854689e-03 102 | 2.357003078436968168e-03 103 | 7.394040309456888661e-04 104 | 4.531203712623473609e-04 105 | 1.108594709359171735e-03 106 | 1.278286606839763124e-03 107 | 2.003995903116784216e-03 108 | 1.541495290187546233e-03 109 | 3.473708068824923455e-03 110 | 2.270102433765096521e+03 111 | 1.970548173496078107e+03 112 | 6.193601697599636391e+06 113 | 1.060554504675725912e+04 114 | 5.834136585276814178e+06 115 | -------------------------------------------------------------------------------- /src/example/eigentest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET ( EXEC "eigentest.exe" ) 2 | SET ( SRCS "main-eigentest.cpp" ) 3 | 4 | IF (CSP_ENABLE_TPL_MAGMA) 5 | ADD_DEFINITIONS(-DTEST_MAGMA) 6 | ENDIF() 7 | IF (CSP_ENABLE_TPL_MKL) 8 | ADD_DEFINITIONS(-DTEST_MKL) 9 | ENDIF() 10 | 11 | ADD_EXECUTABLE( ${EXEC} ${SRCS} ) 12 | TARGET_LINK_LIBRARIES( ${EXEC} ${CSP_LINK_LIBRARIES} ) 13 | 14 | SET(copy_EXE_FILES 15 | eigentest.exe 16 | ) 17 | 18 | INSTALL(TARGETS ${copy_EXE_FILES} 19 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 20 | DESTINATION example/eigentest 21 | ) 22 | 23 | -------------------------------------------------------------------------------- /src/example/gODE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "driver_gODE_Davis_Skodje.exe" ) 6 | set ( SRCS "driver_gODE_Davis_Skodje.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | set ( EXEC "driver_gODE_Davis_Skodje_K.exe" ) 12 | set ( SRCS "driver_gODE_Davis_Skodje_K.cpp" ) 13 | 14 | add_executable( ${EXEC} ${SRCS} ) 15 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 16 | 17 | set ( EXEC "driverODE_DavisSkodjeK.exe" ) 18 | set ( SRCS "driverODE_DavisSkodjeK.cpp" ) 19 | 20 | add_executable( ${EXEC} ${SRCS} ) 21 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 22 | 23 | 24 | SET(copy_EXE_FILES 25 | driver_gODE_Davis_Skodje.exe 26 | driver_gODE_Davis_Skodje_K.exe 27 | driverODE_DavisSkodjeK.exe 28 | ) 29 | 30 | INSTALL(TARGETS ${copy_EXE_FILES} 31 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 32 | DESTINATION example/kernel_class 33 | ) 34 | -------------------------------------------------------------------------------- /src/example/indexODETChem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "run_index_ODE_TChem.exe" ) 6 | set ( SRCS "run_index_ODE_TChem.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | set ( EXEC "run_ODE_TChem_EigenK.exe" ) 12 | set ( SRCS "run_ODE_TChem_EigenK.cpp" ) 13 | 14 | add_executable( ${EXEC} ${SRCS} ) 15 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 16 | 17 | set ( EXEC "runODETChemK.exe" ) 18 | set ( SRCS "runODETChemK.cpp" ) 19 | 20 | add_executable( ${EXEC} ${SRCS} ) 21 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 22 | SET(copy_EXE_FILES 23 | run_index_ODE_TChem.exe 24 | run_ODE_TChem_EigenK.exe 25 | runODETChemK.exe) 26 | 27 | SET(copy_OTHER_FILES) 28 | 29 | INSTALL(FILES ${copy_OTHER_FILES} 30 | PERMISSIONS OWNER_READ OWNER_WRITE 31 | DESTINATION example/indexODETChem 32 | ) 33 | 34 | INSTALL(TARGETS ${copy_EXE_FILES} 35 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 36 | DESTINATION example/indexODETChem) 37 | -------------------------------------------------------------------------------- /src/example/indexPFR_TChem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "run_index_PFR_TChem.exe" ) 6 | set ( SRCS "run_index_PFR_TChem.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | SET(copy_EXE_FILES 12 | run_index_PFR_TChem.exe 13 | ) 14 | 15 | SET(copy_OTHER_FILES) 16 | 17 | INSTALL(FILES ${copy_OTHER_FILES} 18 | PERMISSIONS OWNER_READ OWNER_WRITE 19 | DESTINATION example/index_class 20 | ) 21 | 22 | INSTALL(TARGETS ${copy_EXE_FILES} 23 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 24 | DESTINATION example/index_class 25 | ) 26 | -------------------------------------------------------------------------------- /src/example/indexTCSTRTChem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "run_index_TCSTR_TChem.exe" ) 6 | set ( SRCS "run_index_TCSTR_TChem.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | set ( EXEC "runTCSTRI_TChem.exe" ) 12 | set ( SRCS "runTCSTRI_TChem.cpp" ) 13 | 14 | add_executable( ${EXEC} ${SRCS} ) 15 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 16 | 17 | SET(copy_EXE_FILES 18 | run_index_TCSTR_TChem.exe 19 | runTCSTRI_TChem.exe 20 | ) 21 | 22 | SET(copy_OTHER_FILES 23 | #chem.inp 24 | #therm.dat 25 | #periodictable.dat 26 | ) 27 | 28 | INSTALL(FILES ${copy_OTHER_FILES} 29 | PERMISSIONS OWNER_READ OWNER_WRITE 30 | DESTINATION example/indexTCSTRTChem 31 | ) 32 | 33 | INSTALL(TARGETS ${copy_EXE_FILES} 34 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 35 | DESTINATION example/indexTCSTRTChem 36 | ) 37 | -------------------------------------------------------------------------------- /src/example/runs/Davis_Skodje/run.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/kernel_class/driver_gODE_Davis_Skodje.exe 2 | rtol=1e-4 3 | atol=1e-14 4 | y0=2. 5 | z0=1. 6 | tend=100. 7 | nPoints=50000 8 | $exec --tend=$tend --y0=$y0 --nPoints=$nPoints --z0=$z0 --rtol=$rtol --atol=$atol 9 | -------------------------------------------------------------------------------- /src/example/runs/Davis_Skodje_KEigenSolver/run.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/kernel_class/driver_gODE_Davis_Skodje_K.exe 2 | rtol=1e-4 3 | atol=1e-14 4 | y0=2. 5 | z0=1. 6 | tend=100. 7 | nPoints=50000 8 | $exec --tend=$tend --y0=$y0 --nPoints=$nPoints --z0=$z0 --rtol=$rtol --atol=$atol 9 | -------------------------------------------------------------------------------- /src/example/runs/GRI3/data/sample.dat: -------------------------------------------------------------------------------- 1 | T P CH4 O2 N2 AR 2 | 1.000000000000000000e+03 1.013250000000000000e+05 5.483858845025559731e-02 2.187578062376045740e-01 7.137587863547695255e-01 1.264481895737025810e-02 3 | -------------------------------------------------------------------------------- /src/example/runs/GRI3/run.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/indexODETChem/run_index_ODE_TChem.exe 2 | inputs=data/ 3 | chemfile=$inputs"chem.inp" 4 | thermfile=$inputs"therm.dat" 5 | inputfile=$inputs"input.dat" 6 | useTChemSolution=true 7 | csp_outputs=csp_output 8 | mkdir $csp_outputs 9 | prefix=$csp_outputs/ 10 | rtol=1e-8 11 | atol=1e-14 12 | $exec --useTChemSolution=$useTChemSolution --chemfile=$chemfile --thermfile=$thermfile --inputfile=$inputfile --rtol=$rtol --atol=$atol --prefix=$prefix 13 | -------------------------------------------------------------------------------- /src/example/runs/GRI3_KEigenSolver/run.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/indexODETChem/run_ODE_TChem_EigenK.exe 2 | inputs=../GRI3/data/ 3 | chemfile=$inputs"chem.inp" 4 | thermfile=$inputs"therm.dat" 5 | inputfile=$inputs"input.dat" 6 | useTChemSolution=true 7 | csp_outputs=csp_output 8 | mkdir $csp_outputs 9 | prefix=$csp_outputs/ 10 | rtol=1e-8 11 | atol=1e-14 12 | $exec --useTChemSolution=$useTChemSolution --chemfile=$chemfile --thermfile=$thermfile --inputfile=$inputfile --rtol=$rtol --atol=$atol --prefix=$prefix 13 | -------------------------------------------------------------------------------- /src/example/runs/GRI3_ign/run.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/indexODETChem/run_index_ODE_TChem.exe 2 | inputs=data/ 3 | chemfile=$inputs"chem.inp" 4 | thermfile=$inputs"therm.dat" 5 | inputfile=$inputs"input.dat" 6 | useTChemSolution=false 7 | csp_outputs=csp_output 8 | mkdir $csp_outputs 9 | prefix=$csp_outputs/ 10 | rtol=1e-6 11 | atol=1e-10 12 | $exec --useTChemSolution=$useTChemSolution --chemfile=$chemfile --thermfile=$thermfile --inputfile=$inputfile --rtol=$rtol --atol=$atol --prefix=$prefix 13 | -------------------------------------------------------------------------------- /src/example/runs/TCSTR/delete.sh: -------------------------------------------------------------------------------- 1 | rm -rf kmod* 2 | rm -rf math* 3 | rm -rf outputs 4 | -------------------------------------------------------------------------------- /src/example/runs/TCSTR/inputs/sample_phi1.dat: -------------------------------------------------------------------------------- 1 | T P CH4 O2 N2 AR 2 | 5.000000000000000000e+02 1.013250000000000000e+05 5.483858845025559731e-02 2.187578062376045740e-01 7.137587863547695255e-01 1.264481895737025810e-02 3 | -------------------------------------------------------------------------------- /src/example/runs/TCSTR/inputs/thermSurf.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/example/runs/TCSTR/inputs/thermSurf.dat -------------------------------------------------------------------------------- /src/example/runs/TCSTR/runAll.sh: -------------------------------------------------------------------------------- 1 | # make directory to save ouputs 2 | mkdir outputs 3 | Dir=outputs/Constraint 4 | # input 1: number of constrains 2: first part of file name 5 | Nconstraints=11 6 | #for ((i=0; i<=${Nconstraints}; i++)); do 7 | for i in 0 4 11; do 8 | echo "...number of constraints ${i} " 9 | ./run_cspBatch.sh $i ${Dir}$i 10 | done 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/example/runs/TCSTR/run_csp.sh: -------------------------------------------------------------------------------- 1 | exec=$CSPlib_INSTALL_PATH/example/indexTCSTRTChem/run_index_TCSTR_TChem.exe 2 | 3 | inputs=inputs/ 4 | chemfile=$inputs"chemgri30.inp" 5 | thermfile=$inputs"thermgri30.dat" 6 | chemSurffile=$inputs"chemSurf.inp" 7 | thermSurffile=$inputs"thermSurf.dat" 8 | inputfile=$inputs"CSTRSolutionODE.dat" 9 | samplefile=$inputs"sample_phi1.dat" 10 | rtol=1e-3 11 | atol=1e-13 12 | Acat=1.347e-2 13 | Vol=1.347e-1 14 | mdotIn=1e-2 15 | useAnalyticalJacobian=0 16 | number_of_algebraic_constraints=$1 17 | prefix=$2 18 | verbose=true 19 | 20 | $exec --verbose=$verbose --prefix=$prefix --numberOfAlgebraicConstraints=$number_of_algebraic_constraints --useAnalyticalJacobian=$useAnalyticalJacobian --samplefile=$samplefile --rtol=$rtol --atol=$atol --mdotIn=$mdotIn --Acat=$Acat --Vol=$Vol --inputfile=$inputfile --chemfile=$chemfile --thermfile=$thermfile --chemSurffile=$chemSurffile --thermSurffile=$thermSurffile 21 | -------------------------------------------------------------------------------- /src/example/runs/scripts/compareFiles.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | 4 | args=sys.argv 5 | if len(args) < 2: 6 | print('quit.. because less than 2 inputs') 7 | quit() 8 | 9 | file1=args[1] 10 | file2=args[2] 11 | 12 | data1=np.loadtxt(file1).flatten() 13 | data2=np.loadtxt(file2).flatten() 14 | 15 | if len(data1) != len(data2) : 16 | print('quit.. because number of iterms in data is different between data1 and data2') 17 | quit() 18 | 19 | max_abs_diff =0 20 | max_rel_diff =0 21 | for i in range(len(data1)): 22 | if( data1[i] != data2[i]): 23 | rel_error = (data1[i]- data2[i])/(data2[i]+1e-23) 24 | abs_error = (data1[i]- data2[i]) 25 | if abs(rel_error) > max_rel_diff: 26 | max_rel_diff = rel_error 27 | if abs(abs_error) > max_abs_diff: 28 | max_abs_diff=abs_error 29 | 30 | print('max relative error: ', max_rel_diff) 31 | print('max abs error: ', max_abs_diff) 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/example/stiffnessFactor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "DriverStiffnessFactor.exe" ) 6 | set ( SRCS "DriverStiffnessFactor.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | SET(copy_EXE_FILES 12 | DriverStiffnessFactor.exe 13 | ) 14 | 15 | INSTALL(TARGETS ${copy_EXE_FILES} 16 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 17 | DESTINATION example/stiffness_factor 18 | ) 19 | -------------------------------------------------------------------------------- /src/include/CSPlib_ConfigDefs.h.in: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | #ifndef CSPlib_CONFIG_DEFS_H_ 24 | #define CSPlib_CONFIG_DEFS_H_ 25 | 26 | #include "Tines_Config.hpp" 27 | 28 | /*---- DEFINED IF KOKKOS IS ENABLED. */ 29 | #cmakedefine HAVE_KOKKOS 30 | 31 | #cmakedefine CSP_ENABLE_TPL_MKL 32 | 33 | #cmakedefine CSP_ENABLE_TPL_OPENBLAS 34 | #cmakedefine CSP_ENABLE_TPL_OPENBLAS_CBLAS_HEADER 35 | #cmakedefine CSP_ENABLE_TPL_LAPACKE 36 | 37 | #if defined (TINES_ENABLE_TPL_YAML) 38 | #define CSP_ENABLE_TPL_YAML_CPP 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/include/vio.h: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | //=============================================================== 24 | // overload the << operator to output a std::vector of any type 25 | // outputs full std::vector contents starting from beginning to end 26 | // thus a std::vector like (x1,x2,...,xn) is output as : 27 | // x1 x2 ... xn 28 | // elements are separated by one space, and no newline at end 29 | 30 | template 31 | std::ostream& operator<<(std::ostream& os, const std::vector& v) { 32 | for (auto x : v) 33 | os << x << " "; 34 | return os; 35 | } 36 | //=============================================================== 37 | //=============================================================== 38 | // overload the << operator to output a std::vector of std::vectors of any type 39 | // outputs full std::vector-std::vector contents starting from beginning to end 40 | // thus a std::vector-std::vector like (x11,x12,...,x1n,x21,x22,...,x2n,...,xm1,xm2,...,xmn) is output as : 41 | // x11 x12 ... x1n 42 | // x21 x22 ... x2n 43 | // ... 44 | // xm1 xm2 ... xmn 45 | // elements are separated by one space, and with newline at end of each line 46 | 47 | template 48 | std::ostream& operator<<(std::ostream& os, const std::vector >& vv) { 49 | for (auto v : vv){ 50 | for (auto x : v) 51 | os << x << " "; 52 | os << std::endl; 53 | } 54 | return os; 55 | } 56 | //=============================================================== 57 | -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/M.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/M.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/M.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/M.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/f0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/f0.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/f0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/f0.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/f1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/f1.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/f1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/f1.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/tau.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/tau.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/tau.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/tau.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/timescales.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/timescales.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/Davis_Skodje/timescales.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/Davis_Skodje/timescales.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CH4_FastIndexV2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CH4_FastIndexV2.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CH4_FastIndexV2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CH4_FastIndexV2.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CH4_SlowIndexV2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CH4_SlowIndexV2.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CH4_SlowIndexV2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CH4_SlowIndexV2.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CH4_SlowIndexZoom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CH4_SlowIndexZoom.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CO_FastIndex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CO_FastIndex.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CO_FastIndex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CO_FastIndex.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CO_SlowIndex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CO_SlowIndex.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/CO_SlowIndex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/CO_SlowIndex.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/M.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/M.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/M.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/M.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Mode0_CSPPointer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Mode0_CSPPointer.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Mode0_CSPPointer.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Mode0_CSPPointer.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/PartIndexM0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/PartIndexM0.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/PartIndexM0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/PartIndexM0.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_FastIndex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_FastIndex.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_FastIndex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_FastIndex.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndex.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndex.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndexZoom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndexZoom.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndexZoom.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/Temperature[K]_SlowIndexZoom.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/tauMp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/tauMp.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/tauMp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/tauMp.pdf -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/timeScales.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/timeScales.jpg -------------------------------------------------------------------------------- /src/markdown/Figures/ODE_GRI/timeScales.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/markdown/Figures/ODE_GRI/timeScales.pdf -------------------------------------------------------------------------------- /src/markdown/build.md: -------------------------------------------------------------------------------- 1 | # Building CSPlib 2 | 3 | CSPlib requires Tines and Kokkos for the computation of the eigendecomposition on GPU or CPU hardware, and for linear algebra operations. Additionally, CSPlib has an interface to [TChem](https://github.com/sandialabs/TChem). 4 | 5 | For convenience, we explain how to build the CSPlib code using the following environment variables that one can modify according to their working environments. 6 | 7 | ```bash 8 | /// repositories 9 | export CSP_REPOSITORY_PATH=/where/you/clone/csp/git/repo 10 | 11 | /// build directories 12 | export CSP_BUILD_PATH=/where/you/build/csp 13 | 14 | /// install directories 15 | export TCHEM_INSTALL_PATH=/where/you/install/tchem 16 | export KOKKOS_INSTALL_PATH=/where/you/install/kokkos 17 | export TINES_INSTALL_PATH=/where/you/install/tines 18 | 19 | /// Tines requires OpenBlass 20 | export LIBRARY_PATH=@{LIBRARY_PATH}:=/where/you/install/OpenBlas/lib 21 | ``` 22 | 23 | ## Download CSPlib 24 | Clone the CSPlib repository. Instructions on how to download and install TChem, kokkos and Tines are found in the [TChem repository](https://github.com/sandialabs/TChem). 25 | 26 | ```bash 27 | git clone https://github.com/sandialabs/CSPlib @{CSP_REPOSITORY_PATH}; 28 | ``` 29 | 30 | ## Configuring CSPlib 31 | 32 | The following example cmake script compiles CSPlib on the host, linking with Tines. 33 | 34 | ```bash 35 | cmake \ 36 | -D CMAKE_INSTALL_PREFIX=@{CSP_INSTALL_PATH} \ 37 | -D CMAKE_CXX_COMPILER="@{my_cxx}" \ 38 | -D CMAKE_C_COMPILER="@{my_cc}" \ 39 | -D KOKKOS_INSTALL_PATH=@{KOKKOS_INSTALL_PATH} \ 40 | -D TINES_INSTALL_PATH=@{TINES_INSTALL_PATH} \ 41 |   @{CSP_REPOSITORY_PATH}/src 42 | ``` 43 | 44 | The following cmake example compiles CSPlib with TChem. CSPlib uses TChem to compute source terms, the Jacobian of the source term and the $S$ matrix and the rate of progress. TChem requires [Kokkos github pages](https://github.com/kokkos/kokkos) and Tines. Therefore, these libraries must also be installed. 45 | 46 | ```bash 47 | cmake \ 48 | 49 | -D CMAKE_INSTALL_PREFIX=@{CSP_INSTALL_PATH} \ 50 | -D CMAKE_CXX_COMPILER="@{my_cxx}" \ 51 | -D CMAKE_C_COMPILER="@{my_cc}" \ 52 | -D OPENBLAS_INSTALL_PATH=@{OPENBLAS_INSTALL_PATH} \ 53 | -D CSP_ENABLE_TCHEMPP=ON \ 54 | -D TCHEM_INSTALL_PATH=@{TCHEM_INSTALL_PATH}\ 55 | -D KOKKOS_INSTALL_PATH=@{KOKKOS_INSTALL_PATH} \ 56 | -D TINES_INSTALL_PATH=@{TINES_INSTALL_PATH} \ 57 |   @{CSP_REPOSITORY_PATH}/src 58 | make install 59 | ``` 60 | 61 | TChem is designed and implemented using Kokkos (a performance portable parallel programming model), thus, CSPlib can also carry out computation on a GPU. For GPUs, we can use the above cmake script and replace the compiler choice by adding ``-D CMAKE_CXX_COMPILER="@{KOKKOS_INSTALL_PATH}/bin/nvcc_wrapper"``. 62 | -------------------------------------------------------------------------------- /src/markdown/front.mdpp: -------------------------------------------------------------------------------- 1 | # CSPlib - A Software Toolkit for the Analysis of Dynamical Systems and Chemical Kinetic Models 2 | 3 | !TOC 4 | 5 | !INCLUDE "intro.md", 1 6 | !INCLUDE "build.md", 1 7 | !INCLUDE "methodology.md", 1 8 | !INCLUDE "api.md", 1 9 | 10 | ## Examples 11 | !INCLUDE "gODE.md", 1 12 | !INCLUDE "TChemODE.md", 1 13 | 14 | ## Summary 15 | !INCLUDE "summary.md", 1 16 | ## Acknowledgement 17 | This work is supported as part of the Computational Chemical Sciences Program funded by the U.S. Department of Energy, Office of Science, Basic Energy Sciences, Chemical Sciences, Geosciences and Biosciences Division. Sandia National Laboratories is a multimission laboratory managed and operated by National Technology & Engineering Solutions of Sandia, LLC, a wholly owned subsidiary of Honeywell International Inc., for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-NA0003525. 18 | -------------------------------------------------------------------------------- /src/markdown/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | CSPlib is an open source software library for analyzing general ordinary differential equation (ODE) systems and detailed chemical kinetic ODE systems. It relies on the computational singular perturbation (CSP) method for the analysis of these systems. The software provides support for 4 | 5 | * General ODE models (gODE model class) for computing source terms and jacobians for a generic ODE system. 6 | 7 | * TChem model (ChemElemODETChem model class) for computing source term, Jacobian, other necessary chemical reaction data, as well as the rates of progress for a homogenous batch reactor using an elementary step detailed chemical kinetic reaction mechanism. This class relies on the [TChem](https://github.com/sandialabs/TChem#homogenousbatchreactors) library. 8 | 9 | * A set of functions to compute essential elements of CSP analysis (Kernel class). This includes computations of the eigensolution of the Jacobian matrix, CSP basis vectors and co-vectors, time scales (reciprocals of the magnitudes of the Jacobian eigenvalues), mode amplitudes, CSP pointers, and the number of exhausted modes. This class relies on the Tines library. 10 | 11 | * A set of functions to compute the eigensolution of the Jacobian matrix using the Tines library GPU eigensolver. 12 | 13 | * A set of functions to compute CSP indices (Index Class). This includes participation indices and both slow and fast importance indices. 14 | 15 | ## Citing 16 | 17 | * Oscar Diaz-Ibarra, Kyungjoo Kim, Cosmin Safta, and Habib Najm, CSPlib - A Software Toolkit for the Analysis of Dynamical Systems and Chemical Kinetic Models, Sandia National Laboratories, SAND 2021-1212, 2021.* 18 | 19 | ## Nomenclature 20 | 21 | Symbol|Description 22 | --|-- 23 | $\textbf{y}$ | State vector 24 | $\textbf{g}$ | Source vector 25 | $t$ | Time 26 | $\textbf{a}_i$ | CSP basis vector 27 | $\textbf{b}^i$ | CSP basis co-vector 28 | $f^i$ | Mode amplitude 29 | $J_{ij}$ | Jacobian matrix of the ODE right hand side (RHS) 30 | $g_{\mathrm{fast}}$ | ODE RHS component in the fast subspace 31 | $g_{\mathrm{slow}}$ | ODE RHS component in the slow subspace 32 | $M$ | Number of fast exhausted modes 33 | $\delta y^{i}_{\mathrm{error}}$ | Error for variable $i$ 34 | $\mathrm{tol}_{\mathrm{relative}}$ | Relative error tolerance 35 | $\mathrm{tol}_{\mathrm{absolute}}$ | Absolute error tolerance 36 | $\tau$ | Time scale 37 | $\lambda$ | Eigenvalues of Jacobian matrix 38 | $N_{\mathrm{spec}}$ | Number of species 39 | $N_{\mathrm{reac}}$ | Number of reactions 40 | $N_{\mathrm{var}}$ | Number of variables 41 | $S$ | S matrix 42 | $\mathcal{R}_r$ | Rate of progress or reaction $r$ 43 | RoP | Rate of progess 44 | CSPpointer$_{ij}$ | CSP pointer for mode $i$ with respect to variable $j$ 45 | $(I^i_r)_{\mathrm{slow}} $| Slow importance index of reaction $r$ for variable $i$ 46 | $(I^i_r)_{\mathrm{fast}}$ | Fast importance index of reaction $r$ for variable $i$ 47 | $P^i_r$ | Participation index of reaction $r$ for mode $i$ 48 | -------------------------------------------------------------------------------- /src/markdown/summary.md: -------------------------------------------------------------------------------- 1 | We provided instructions to perform a CSP analysis for a general ODE system and a detailed chemical kinetic ODE system in examples [gODE](#cspanalysisforthedavisskodjeproblemusingthegeneralodeclass) and [TChemODE](#cspanalysisforaodesystemusingtchem). These examples showed how to use the different CSPlib functions. We divided the CSP analysis into three blocks, the model block (see [api-model section](#modelclass)), the kernel block (see [api-kernel section](#kernelclass)), and the index block (see [api-index section](#indexclass)). For each block, we have implemented a class. Additionally, we have an interface for the Tines-GPU eigensolver (see [api-Eigen-Solver-With-Tines section](#eigensolverwithtines)). We describe the CSPlib functions in the application programming interface [section](#applicationprogramminginterface). We recommend using these examples as a template and add or delete parts to create an analysis that fits the user’s demands. 2 | -------------------------------------------------------------------------------- /src/markdown/svgs/034d0a6be0424bffe9a6e7ac9236c0f5.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/0fe1677705e987cac4f589ed600aa6b3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/1247fb989d7a35db54126db0de81a3a4.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/190083ef7a1625fbc75f243cffb9c96d.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/1afcdb0f704394b16fe85fb40c45ca7a.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/1f3be6dc50d09ef2dd9dca8851fc6111.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/29632a9bf827ce0200454dd32fc3be82.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/2a6d541ffefcb89b946628aca0519768.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/2d0871483c28d923f9930ccb6432a429.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/2da3e8aa641ed5a5513d55f297a1f3e0.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/2f118ee06d05f3c2d98361d9c30e38ce.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/34a2a6bf81794c2f1c3c6f5e20f62dea.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/36b5afebdba34564d884d347484ac0c7.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/3db74330d87f477d8546e797b6de06ff.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/479ffee91f00b0b86628ad1e66a0afd6.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/markdown/svgs/4f4f4e395762a3af4575de74c019ebb5.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/542eeec6a609dfdc0f4fd38e5e315937.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/5872d29d239f95cc7a5f43cfdd14fdae.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/5be0a103e300e1302f36d6e36e3109bb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/markdown/svgs/5dfc3ab84de9c94bbfee2e75b72e1184.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/63bb9849783d01d91403bc9a5fea12a2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/67b2f937bb6e5949bdc33b88ca3e9a52.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/6dec54c48a0438a5fcde6053bdb9d712.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/77a3b857d53fb44e33b53e4c8b68351a.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/7adc44611f8aad045f25802819faf9a1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/7ccca27b5ccc533a2dd72dc6fa28ed84.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/85e88daa56884880b8a3141b22f439bc.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/89f2e0d2d24bcf44db73aab8fc03252c.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/96458543dc5abd380904d95cae6aa2bc.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/98102b1e2a20b3fd04f22efac742bd3c.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/9c8a3d770acac19bbf5f5647e2b6f159.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/b6c5b75bafc8bbc771fa716cb26245ff.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/b96ac72e32ed3d8662cbd6c909de1571.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/c4e8f1527a6f2da2e317f1733ad7c8c6.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/cef39aeb23a61b09d838693a0897fe03.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/dbb81067f1f28ab23eb88e1db7efe9e2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/dc6bea11cf28aa2f8c20bb86b056011f.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/markdown/svgs/deceeaf6940a8c7a5a02373728002b0f.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/e257acd1ccbe7fcb654708f1a866bfe9.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/e6bd8fce01b559d263c8dd7c7ef59a8d.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/markdown/svgs/f62db12f95e34116f1f1e827b2c64ce5.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/f93ce33e511096ed626b4719d50f17d2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/fb97d38bcc19230b0acd442e17db879c.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/fce48928f2bc02b167783ec61396a79f.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/markdown/svgs/fd8be73b54f5436a5cd2e73ba9b6bfa9.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (CSPlib) 2 | 3 | ADD_SUBDIRECTORY (gODE) 4 | ADD_SUBDIRECTORY (gDAE) 5 | ADD_SUBDIRECTORY (index_kokkos) 6 | ADD_SUBDIRECTORY (kernel_kokkos) 7 | 8 | IF (CSPlib_ENABLE_TCHEMPP) 9 | ADD_SUBDIRECTORY (chem_elemODETChem) 10 | ENDIF() 11 | -------------------------------------------------------------------------------- /src/test/chem_elemODETChem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(.) 3 | include_directories(../../core) 4 | include_directories(../../include) 5 | 6 | set ( EXEC "driver_model_ODE_TChem2" ) 7 | set ( SRCS "driver_model_ODE_TChem2.cpp" ) 8 | 9 | add_executable( ${EXEC} ${SRCS} ) 10 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 11 | 12 | SET(copy_EXE_FILES 13 | driver_model_ODE_TChem2 14 | ) 15 | 16 | INSTALL(FILES ${copy_OTHER_FILES} 17 | PERMISSIONS OWNER_READ OWNER_WRITE 18 | DESTINATION test/model_class 19 | ) 20 | 21 | INSTALL(TARGETS ${copy_EXE_FILES} 22 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 23 | DESTINATION test/model_class 24 | ) 25 | -------------------------------------------------------------------------------- /src/test/gDAE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(.) 3 | include_directories(../../core) 4 | include_directories(../../include) 5 | 6 | set ( EXEC "driver_gDAE" ) 7 | set ( SRCS "driver_gDAE.cpp" ) 8 | 9 | add_executable( ${EXEC} ${SRCS} ) 10 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 11 | 12 | SET(copy_EXE_FILES 13 | driver_gDAE 14 | ) 15 | 16 | INSTALL(FILES ${copy_OTHER_FILES} 17 | PERMISSIONS OWNER_READ OWNER_WRITE 18 | DESTINATION test/model_class 19 | ) 20 | 21 | INSTALL(TARGETS ${copy_EXE_FILES} 22 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 23 | DESTINATION test/model_class 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /src/test/gODE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "driver_gODE" ) 6 | set ( SRCS "driver_gODE.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | SET(copy_EXE_FILES 12 | driver_gODE 13 | ) 14 | 15 | INSTALL(FILES ${copy_OTHER_FILES} 16 | PERMISSIONS OWNER_READ OWNER_WRITE 17 | DESTINATION test/model_class 18 | ) 19 | 20 | INSTALL(TARGETS ${copy_EXE_FILES} 21 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 22 | DESTINATION test/model_class 23 | ) 24 | -------------------------------------------------------------------------------- /src/test/index_kokkos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "index_kokkos.exe" ) 6 | set ( SRCS "index_kokkos.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | set ( EXEC "index_kokkos_v2.exe" ) 12 | set ( SRCS "index_kokkos_v2.cpp" ) 13 | 14 | add_executable( ${EXEC} ${SRCS} ) 15 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 16 | 17 | set ( EXEC "index_kernel_batch.exe" ) 18 | set ( SRCS "index_kernel_batch.cpp" ) 19 | 20 | add_executable( ${EXEC} ${SRCS} ) 21 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 22 | 23 | set ( EXEC "index_batch.exe" ) 24 | set ( SRCS "index_batch.cpp" ) 25 | 26 | add_executable( ${EXEC} ${SRCS} ) 27 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 28 | 29 | SET(copy_EXE_FILES 30 | index_kokkos.exe 31 | index_kokkos_v2.exe 32 | index_kernel_batch.exe 33 | index_batch.exe 34 | ) 35 | 36 | INSTALL(TARGETS ${copy_EXE_FILES} 37 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 38 | DESTINATION test/index_class_kokkos 39 | ) 40 | -------------------------------------------------------------------------------- /src/test/kernel_kokkos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | 5 | set ( EXEC "kernel_kokkos.exe" ) 6 | set ( SRCS "kernel_kokkos.cpp" ) 7 | 8 | add_executable( ${EXEC} ${SRCS} ) 9 | target_link_libraries( ${EXEC} ${CSPlib_LINK_LIBRARIES} ) 10 | 11 | 12 | SET(copy_EXE_FILES 13 | kernel_kokkos.exe 14 | ) 15 | 16 | INSTALL(TARGETS ${copy_EXE_FILES} 17 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 18 | DESTINATION test/kernel_kokkos 19 | ) 20 | -------------------------------------------------------------------------------- /src/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # test 3 | # 4 | ADD_SUBDIRECTORY (T-CSTR) 5 | ADD_SUBDIRECTORY (ODETChem) 6 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | # test 5 | # 6 | ADD_EXECUTABLE(csplib-test-odetchem.x CSPlib_Test_Driver_ODETChem.cpp) 7 | TARGET_LINK_LIBRARIES(csplib-test-odetchem.x ${CSPlib_LINK_LIBRARIES} ) 8 | 9 | INSTALL(DIRECTORY inputs 10 | DESTINATION ${CMAKE_INSTALL_PREFIX}/unit-test/ODETChem) 11 | 12 | INSTALL(DIRECTORY outputs_ref 13 | DESTINATION ${CMAKE_INSTALL_PREFIX}/unit-test/ODETChem) 14 | 15 | FILE(COPY inputs 16 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 17 | 18 | FILE(COPY outputs_ref 19 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 20 | 21 | INSTALL(TARGETS csplib-test-odetchem.x 22 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 23 | DESTINATION "${CMAKE_INSTALL_PREFIX}/${CSPlib_INSTALL_TEST_PATH}/ODETChem") 24 | 25 | ADD_TEST(CSlibTest csplib-test-odetchem.x) 26 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/CSPlib_Test_Driver_ODETChem.cpp: -------------------------------------------------------------------------------- 1 | /* ===================================================================================== 2 | CSPlib version 1.1.0 3 | Copyright (2021) NTESS 4 | https://github.com/sandialabs/csplib 5 | 6 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 7 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains 8 | certain rights in this software. 9 | 10 | This file is part of CSPlib. CSPlib is open-source software: you can redistribute it 11 | and/or modify it under the terms of BSD 2-Clause License 12 | (https://opensource.org/licenses/BSD-2-Clause). A copy of the license is also 13 | provided under the main directory 14 | 15 | Questions? Contact Habib Najm at , or 16 | Kyungjoo Kim at , or 17 | Oscar Diaz-Ibarra at 18 | 19 | Sandia National Laboratories, Livermore, CA, USA 20 | ===================================================================================== */ 21 | 22 | 23 | #include 24 | #include "tools_tines.hpp" 25 | 26 | int 27 | main(int argc, char* argv[]) 28 | { 29 | int r_val(0); 30 | { 31 | ::testing::InitGoogleTest(&argc, argv); 32 | r_val = RUN_ALL_TESTS(); 33 | } 34 | return r_val; 35 | } 36 | 37 | TEST(ChemElemODETChem, ODE) 38 | { 39 | std::string exec="../../example/indexODETChem/run_index_ODE_TChem.exe"; 40 | std::string inputs="inputs/"; 41 | 42 | // input files 43 | std::string chemfile = inputs + "chem.inp"; 44 | std::string thermfile = inputs + "therm.dat"; 45 | std::string inputfile = inputs + "input.dat"; 46 | // tolerances 47 | std::string rtol="1e-8"; 48 | std::string atol="1e-14"; 49 | 50 | // Jacobian, 0 is useAnalyticalJacobian 51 | std::string useAnalyticalJacobian="0"; 52 | std::string verbose="false"; 53 | 54 | std::string invoke=( exec + " --verbose=" + verbose 55 | + " --useAnalyticalJacobian=" + useAnalyticalJacobian 56 | + " --rtol=" + rtol + " --atol=" + atol 57 | + " --inputfile="+inputfile + 58 | + " --chemfile="+chemfile + " --thermfile=" +thermfile); 59 | 60 | const auto invoke_c_str = invoke.c_str(); 61 | printf("testing : %s\n", invoke_c_str); 62 | std::system(invoke_c_str); 63 | 64 | /// compare with ref 65 | EXPECT_TRUE(CSP::Test::compareFilesValues("_CH4_FastImportanceIndexTopElemPosition.dat", 66 | "outputs_ref/_CH4_FastImportanceIndexTopElemPosition.dat") ); 67 | 68 | EXPECT_TRUE(CSP::Test::compareFilesValues("_CH4_SlowImportanceIndexTopElemPosition.dat", 69 | "outputs_ref/_CH4_SlowImportanceIndexTopElemPosition.dat") ); 70 | 71 | EXPECT_TRUE(CSP::Test::compareFilesValues("_Mode0_ParticipationIndexTopElemPosition.dat", 72 | "outputs_ref/_Mode0_ParticipationIndexTopElemPosition.dat") ); 73 | 74 | EXPECT_TRUE(CSP::Test::compareFilesValues("_Temperature_FastImportanceIndexTopElemPosition.dat", 75 | "outputs_ref/_Temperature_FastImportanceIndexTopElemPosition.dat") ); 76 | 77 | EXPECT_TRUE(CSP::Test::compareFilesValues("_Temperature_SlowImportanceIndexTopElemPosition.dat", 78 | "outputs_ref/_Temperature_SlowImportanceIndexTopElemPosition.dat") ); 79 | 80 | EXPECT_TRUE(CSP::Test::compareFilesValues("_jac_numerical_rank.dat", 81 | "outputs_ref/_jac_numerical_rank.dat") ); 82 | // 83 | EXPECT_TRUE(CSP::Test::compareFilesValues("_m.dat", "outputs_ref/_m.dat") ); 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/inputs/input.dat: -------------------------------------------------------------------------------- 1 | iter t dt Density[kg/m3] Pressure[Pascal] Temperature[K] H2 H O O2 OH H2O HO2 H2O2 C CH CH2 CH2(S) CH3 CH4 CO CO2 HCO CH2O CH2OH CH3O CH3OH C2H C2H2 C2H3 C2H4 C2H5 C2H6 HCCO CH2CO HCCOH N NH NH2 NH3 NNH NO NO2 N2O HNO CN HCN H2CN HCNN HCNO HOCN HNCO NCO N2 AR C3H7 C3H8 CH2CHO CH3CHO 2 | 350 1.0987498117e+00 3.9062500000e-06 3.3804310866e-01 1.0132500000e+05 1.1535642705e+03 4.5253765320e-04 8.0077127274e-08 2.5400038586e-07 1.9675041904e-01 1.2212040039e-06 1.4669102257e-02 1.1202936096e-04 1.7142109548e-04 9.5619209276e-19 2.1944658606e-14 9.1982201035e-10 1.2365741054e-10 4.2760712530e-05 4.3578367488e-02 1.0821306164e-02 4.7843993608e-04 1.3757055760e-07 3.8228423701e-03 3.4006858294e-09 1.2242621899e-06 2.2805218205e-04 2.0383163509e-13 2.6612706104e-06 5.8986335018e-09 9.7841835193e-04 1.0759047497e-06 1.3997729652e-03 1.8695176117e-09 7.2822952367e-05 1.0696405666e-09 3.8008582544e-17 1.7892604212e-15 2.2964168266e-16 2.1408983728e-15 1.3873982000e-12 8.3720720583e-13 1.0137837129e-12 2.7459442813e-09 3.5352043603e-15 2.6402141968e-21 6.2207872155e-14 2.5455505987e-18 4.6110470484e-16 1.2413318637e-16 5.4184383907e-18 1.6025415152e-15 1.6714275388e-17 7.1375878461e-01 1.2644818957e-02 2.2296300928e-09 1.0539311095e-05 7.9345977366e-08 8.1270359821e-07 3 | 391 1.0996736398e+00 1.9531250000e-06 3.3804310866e-01 1.0132500000e+05 1.1994713427e+03 6.0996161127e-04 1.6078169558e-07 5.3799563926e-07 1.9024476080e-01 2.4817350815e-06 1.9104071155e-02 1.4920983475e-04 1.6289303522e-04 1.3174052989e-17 1.4706603850e-13 2.9781131008e-09 3.8662219429e-10 6.8290931745e-05 4.0581059077e-02 1.4602521258e-02 7.7497666096e-04 3.1361882994e-07 4.0449274715e-03 8.5586133927e-09 1.9757071076e-06 2.6872387395e-04 1.1132865764e-12 5.1707912110e-06 1.9358920500e-08 1.3274472077e-03 2.2927776556e-06 1.4928614808e-03 7.5001411655e-09 1.3188330751e-04 2.9196495267e-09 3.1930741015e-16 7.6356791850e-15 1.0513457916e-15 8.6354854952e-15 3.0634190480e-12 2.5790393851e-12 2.0929904139e-12 3.9180935023e-09 1.4075365185e-14 3.6904096325e-20 3.2810073926e-13 2.4095022931e-17 2.7872416609e-15 7.7980216786e-16 4.0313991358e-17 5.9761758123e-15 1.0357080813e-16 7.1375878386e-01 1.2644818957e-02 5.0006749299e-09 1.7677378032e-05 1.6455378176e-07 1.9835125172e-06 4 | 542 1.1007371164e+00 2.4414062500e-07 3.3804310866e-01 1.0132500000e+05 1.4353515699e+03 1.4775464800e-03 2.2373745945e-06 8.9354296844e-06 1.5660513246e-01 2.9561376239e-05 4.2134881258e-02 2.5477053541e-04 3.6794937275e-05 2.6979524387e-13 1.8660382559e-10 2.2787013834e-07 2.5013648210e-08 4.2395107578e-04 2.5656684089e-02 3.4607419257e-02 3.4156280814e-03 4.3974099660e-06 3.2179010893e-03 1.9884806703e-07 6.9238493822e-06 2.6702803277e-04 6.6978385259e-10 7.1320522426e-05 1.2574686762e-06 2.9605273746e-03 2.0497784197e-05 1.5358424299e-03 9.1247616210e-07 7.8307352413e-04 1.2125396987e-07 9.7763327332e-13 1.4667190681e-12 2.4690767931e-13 1.1857322088e-12 6.2269249503e-11 2.5006106640e-10 2.4742277277e-11 1.7683039512e-08 1.8456842971e-12 9.0258361414e-16 1.9804949192e-10 1.1603139041e-13 2.0350480173e-12 7.3148253683e-13 7.7304125009e-14 2.0536374722e-12 2.4231528979e-13 7.1375877481e-01 1.2644818957e-02 8.4777597961e-08 4.2347021231e-05 1.5688462968e-06 2.8589209097e-05 5 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_CH4_FastImportanceIndexTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 96 97 118 141 381 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_CH4_SlowImportanceIndexTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 52 97 118 97 118 805306368 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_Mode0_ParticipationIndexTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 203 528 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_Mode0_cspPointers.dat: -------------------------------------------------------------------------------- 1 | 2.1969248029e-12 3.0274623840e-15 5.9270421937e-07 1.0602878463e-13 2.9598969136e-14 1.9817325147e-13 1.8731719957e-18 1.5056206262e-13 -1.4492248172e-17 3.2122606343e-24 1.9158963222e-15 -1.3037566315e-14 3.5569714439e-13 4.4697265108e-15 -1.2627322006e-15 -6.4023372171e-17 -5.3447007658e-20 1.9690380175e-12 -9.1717237023e-16 7.6925734832e-15 1.5437402179e-14 -3.7189302554e-17 1.2955753986e-19 -2.4520778719e-20 4.4360654276e-16 -2.6187344916e-17 7.0695971282e-15 -1.0511989036e-16 3.3879749331e-17 -7.7190753731e-18 -3.3211320858e-22 1.0510584467e-22 -2.4585192349e-18 3.3856140354e-23 -1.3357301542e-28 9.9999940729e-01 -1.2569632877e-18 -6.8129773478e-24 -6.0179176901e-24 -2.9228463076e-22 9.6946074322e-28 -7.9640709709e-26 -2.5071217582e-26 1.5194462752e-21 3.8319138818e-28 -1.9721489692e-30 6.3035244154e-25 1.3236322915e-25 5.7080257507e-13 0.0000000000e+00 1.2261018843e-18 -7.5335190430e-19 1.9152606833e-15 -7.3144872683e-20 2 | 4.3294132164e-12 7.6035576248e-15 6.5345882400e-07 2.1142485297e-13 5.8508867204e-14 3.8013557630e-13 -1.1967832611e-17 3.2582082309e-13 -3.1198943532e-17 4.8362591460e-23 5.2601109225e-15 -2.1939418207e-14 5.9945194220e-13 1.0262302317e-14 -3.1013602161e-15 -1.4355550657e-16 -2.1514090213e-19 3.0659222340e-12 -2.1313780605e-15 1.5390620800e-14 2.5785580293e-14 -9.8946248790e-17 6.2195865601e-19 -7.3487814561e-20 1.5224452116e-15 -7.8524871377e-17 1.4158549136e-14 -2.7532624351e-16 1.0257920561e-16 -2.8667558734e-17 -1.8935722169e-21 6.7859660672e-22 -9.4817205562e-18 1.9169493379e-22 -1.1445742095e-27 9.9999934653e-01 -3.8728803067e-18 -4.2816461077e-23 -2.3361098748e-23 -1.4009011584e-21 1.2485901351e-26 -5.3685549700e-25 -9.3943603897e-25 4.8521884578e-21 5.1077435084e-27 -2.6034005538e-29 2.0690883862e-24 8.7177240579e-25 1.3030687921e-12 0.0000000000e+00 4.6139596247e-18 -3.1756078666e-18 4.6573899638e-15 -3.9457337413e-19 3 | 5.3244512638e-11 2.0667267667e-13 9.6267957886e-07 2.7185768970e-12 6.8975227553e-13 3.0644339220e-12 -6.4243249475e-15 7.0855551647e-12 -1.3912739153e-16 7.5997517743e-19 1.8903586349e-13 -1.6906115208e-13 4.5031662196e-12 2.6121480551e-13 -9.6861371242e-14 -6.5375287096e-16 -4.4901888915e-17 1.1631067061e-11 -3.8859026001e-14 1.3999909707e-13 1.0344943211e-13 -2.6811536367e-15 2.3870805627e-16 2.5430310546e-17 1.0407559048e-13 -5.7567631833e-15 1.3264474137e-13 -9.9529599425e-15 3.0941430489e-15 -3.2746747313e-15 -1.4501558441e-18 6.9706805965e-19 -1.6568636075e-15 1.1867703516e-19 -7.8266382057e-24 9.9999903721e-01 -1.1264860273e-15 -1.0923935233e-20 -6.0365228677e-21 -6.0308490237e-19 2.1612057350e-22 -2.2843146220e-21 -6.5038896367e-21 2.8771972361e-19 1.3104470171e-22 -1.2902361695e-24 1.2559359547e-21 8.9812485888e-22 2.6812282890e-11 -0.0000000000e+00 2.7316486630e-16 -2.6778304963e-16 7.0442863023e-14 -1.2986370318e-16 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_Mode0_cspPointersTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 35 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_Temperature_FastImportanceIndexTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 96 97 100 141 167 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_Temperature_SlowImportanceIndexTopElemPosition.dat: -------------------------------------------------------------------------------- 1 | 57 97 100 118 157 167 2 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_eig_val_imag.dat: -------------------------------------------------------------------------------- 1 | 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 1.07437024155757e+01 -1.07437024155757e+01 0.00000000000000e+00 7.82091534325555e+01 -7.82091534325555e+01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 5.69096814323338e-01 -5.69096814323338e-01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 2 | 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 2.20033221537979e+01 -2.20033221537979e+01 0.00000000000000e+00 1.16985984297547e+02 -1.16985984297547e+02 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 1.39676427980396e+00 -1.39676427980396e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 5.22882412441419e-11 -5.22882412441419e-11 0.00000000000000e+00 3 | 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 -4.15772229120277e+05 4.15772229120277e+05 4.66840008544170e+05 -4.66840008544170e+05 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 1.00605005648349e+03 -1.00605005648349e+03 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 6.98501239447755e-10 -6.98501239447755e-10 0.00000000000000e+00 0.00000000000000e+00 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_eig_val_real.dat: -------------------------------------------------------------------------------- 1 | -4.25293426550438e+08 -1.98504712291330e+08 -1.75731011871414e+08 -8.07124124917235e+07 -2.70352942338671e+07 -2.19972917447198e+07 -2.18856296829970e+07 -2.15366210705523e+07 -1.36071785288439e+07 -1.28625799847712e+07 -7.40821725477565e+06 -3.96637860635427e+06 -2.76050009876825e+06 -2.60727657640063e+06 -2.37145185036861e+06 -1.57826387527259e+06 -1.52847413422126e+06 -1.15178179330789e+06 -1.14956271072115e+06 -7.26084301883189e+05 -3.46528198744608e+05 -1.76537801051090e+05 -6.79036750405191e+04 -2.28967312503018e+04 -1.68518278933246e+04 -1.26706892117349e+04 -1.14197329902831e+04 -5.20776160586231e+03 -1.97621255385747e+03 5.54337056030928e+02 -4.89151849878830e+02 -3.86573224138169e+02 -3.85543223909089e+02 -3.30436203650137e+02 -2.74893643362961e+02 -2.74893643362961e+02 -1.78980238175101e+02 -1.54615844855528e+02 -1.54615844855528e+02 -1.22825899971590e+02 -6.40689007439991e+01 -3.71510705787811e+01 -1.84868850160502e+01 -1.68983905317727e+01 -2.57260869871788e+00 -2.57260869871788e+00 -2.61705514936513e+00 2.34125813066893e-02 -7.00377103697301e-04 3.23181412151843e-08 -8.92325966575148e-10 7.18596846449343e-10 5.53936076752478e-13 0.00000000000000e+00 2 | -4.30595120167759e+08 -1.94447591238666e+08 -1.63065322390513e+08 -7.55911992256927e+07 -2.57674178808268e+07 -2.06848589530782e+07 -2.06775750425466e+07 -2.05728086155887e+07 -1.26906250223258e+07 -1.23611825583653e+07 -6.86681521280399e+06 -3.74817096172223e+06 -3.45828988278275e+06 -3.05519351027687e+06 -2.81461908406970e+06 -2.04275170249704e+06 -1.87891361773611e+06 -1.33971998718811e+06 -1.26268587560460e+06 -1.00337984295807e+06 -3.85989395010510e+05 -2.01662261597543e+05 -7.95358086328219e+04 -3.38960012957330e+04 -2.70750879650629e+04 -1.96099545475187e+04 -1.81577172011378e+04 -8.37213577056797e+03 -4.13260791761639e+03 -1.03378126290068e+03 9.62833369289369e+02 -8.67471006483406e+02 -8.38319679528314e+02 -6.54032730412635e+02 -6.08929960692314e+02 -6.08929960692314e+02 -4.08739914975856e+02 -3.46429124184138e+02 -3.46429124184138e+02 -2.42130545701917e+02 -1.42748898229656e+02 -7.97197626746478e+01 -4.08244454270993e+01 -3.37083671685814e+01 -6.85395907657962e+00 -6.85395907657962e+00 -6.91181157835243e+00 4.85160987266662e-02 -1.52124252717977e-03 3.63461966064715e-08 7.50746565857952e-10 1.96004043715009e-11 1.96004043715009e-11 0.00000000000000e+00 3 | -4.56837463259966e+08 -1.76215787256828e+08 -1.10765390944293e+08 -5.35744058323192e+07 -2.30049901648398e+07 -1.78640113152721e+07 -1.67718364105551e+07 -1.58386849482296e+07 -1.01845408278543e+07 -9.61503712880418e+06 -8.78575147169632e+06 -6.75781941196681e+06 -6.30462334707402e+06 -5.10749309690329e+06 -5.10749309690329e+06 -3.56043998492210e+06 -3.56043998492210e+06 -2.80296248015342e+06 -1.94995576839665e+06 -1.30906945747241e+06 -8.99533777556962e+05 -4.74427117758559e+05 -2.05289017801785e+05 -1.68108747371282e+05 -1.51210908333941e+05 -1.17908171254385e+05 -9.46560432845550e+04 -6.46798223273612e+04 -6.09259230830568e+04 -1.89704180231789e+04 -1.70766048381011e+04 -1.64097082101797e+04 -1.41799072062312e+04 -1.17430058522191e+04 -9.57102212672944e+03 9.00357843373432e+03 -8.27555672033665e+03 -4.81914421115863e+03 -4.81914421115863e+03 -3.08914280143488e+03 -3.04244855124747e+03 -1.38691974131423e+03 -8.27029243390406e+02 -3.76323961948613e+02 -3.60861847562619e+02 -2.99849317434308e+02 -2.14760567922319e+02 3.70487084520722e-01 -8.84194709296595e-02 3.78193754079500e-08 5.99927821059757e-10 5.99927821059757e-10 -4.16115421188751e-11 0.00000000000000e+00 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_f.dat: -------------------------------------------------------------------------------- 1 | -8.93683657763136e-11 1.27958755325138e-08 8.12577262600784e-10 2.09115297185061e-09 -1.68089238326120e-11 -4.73520954868111e-10 -1.37657426349091e-07 -4.29340855000730e-06 9.43386713729883e-12 4.13265592573937e-07 -2.79646641183868e-06 -6.30066524835540e-07 2.17783644384504e-05 -2.73424384057933e-04 -5.84075530442113e-07 -2.73214467106479e-04 2.57527373204051e-10 1.71861530118617e-03 -1.98098147524866e-07 -2.49927022445751e-04 -2.60502869687718e-04 -1.44867916024129e-10 1.19939650510711e-10 1.25950274215571e+00 7.06735554164491e-10 2.81590042728883e+01 3.82270585924135e-08 -4.04431818668388e-07 9.22035350287230e+01 3.86804528364045e+04 1.91491691842604e-04 -1.26274263831501e+02 1.02481209181163e-09 -7.68501140533987e-01 -1.21714011708017e+03 2.60094444454611e+02 1.45387462743979e+03 -4.16065007319517e+03 7.09598815077453e+03 -3.45758006788125e-09 -8.63095982523841e+00 3.51963985597782e+01 -1.76335501856285e-07 -2.86577717821980e+01 1.02361197970422e-03 -1.15366438961622e-03 1.70268166878700e-04 2.30225807198846e+01 6.36661360126809e-01 -2.93445690857652e-07 2.31511997350609e-08 -2.24616448218917e-08 2.50587079163095e-11 0.00000000000000e+00 2 | -8.38708079265512e-11 -2.37503816676957e-08 3.83058556722790e-09 7.70632665746871e-09 -5.05476328343077e-10 9.42256040583821e-07 -2.81884502968995e-10 1.56959946319939e-05 -1.44774385461624e-11 -4.24366075154187e-06 -2.87112048131817e-05 -1.35523376866841e-06 7.39842103723944e-05 -1.81036180246546e-06 -1.32012435058635e-03 3.84448224179366e-11 -9.66397257848500e-04 6.22228421202808e-03 -4.52915014248205e-09 4.55473777878712e-03 5.01863904994911e-04 -3.58683389468813e-10 4.44359857710591e-09 -2.71788359099827e+00 1.29709167848803e-09 7.09055528792894e+01 4.88708289124809e-07 -2.04405948726176e-06 -2.49890047245723e+02 2.04711742688116e-04 -7.92393049967764e+04 1.54957311949540e+02 3.15304407962320e-09 1.78178144835249e+01 3.10911108515465e+03 5.96452175873296e+02 1.13772721237219e+04 1.85510166557212e+03 1.76013343685791e+04 -6.01590247403058e-09 2.94629871678289e+01 -8.09490892429638e+01 -3.50243469110371e-06 -5.23171412593835e+01 2.35636252895833e-03 -3.44120497282326e-03 -3.71660643801904e-04 -5.52488597293260e+01 -1.60007185969693e+00 -3.36002909051558e-07 3.33212790692983e-09 3.82823250877351e-09 -1.07458505982372e-09 0.00000000000000e+00 3 | 2.01999808840149e-09 8.36532559951431e-05 -7.36818711262274e-06 1.88809843546208e-07 -6.25045331694426e-05 1.45238360026617e-02 -1.78589360855490e-07 3.13547587500539e-04 -3.19741667666398e-02 -6.61962409694784e-11 -2.16605780798881e-02 3.34305526206415e-04 -1.32485971095045e-08 5.57889013238583e-01 -5.39258773801770e-02 -3.15405160123470e-01 -9.06927752162492e-02 1.98179046126379e-01 -3.94925930170851e-06 1.63655295410551e+01 -1.28462158590453e+00 7.74265984204700e-07 2.18443230860753e+01 5.54777459001198e-05 5.20841178829766e-06 -4.22063929970743e+02 2.24933170191215e-05 2.17143698493809e-02 1.24679774875343e+04 -5.53546319061338e-01 -1.88073073366553e+03 6.46339838113606e-06 2.74624463668072e+02 4.50236235916834e+03 -2.93546675096842e+03 9.56081106589872e+05 -1.85738575408371e+02 -3.80650954363942e+04 -2.40033839955822e+04 1.59306613657626e+03 7.39311805908279e-04 2.80378934836846e+03 2.28443916117359e-02 7.92765774801584e+02 -1.29440866533203e-01 3.09390847735679e-02 -1.93017647248545e-01 -7.31434675717741e+02 -1.60142256673193e+02 1.33985031425254e-06 2.70858251383288e-08 -2.17085727172162e-08 -5.33066923935621e-10 0.00000000000000e+00 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_jac_numerical_rank.dat: -------------------------------------------------------------------------------- 1 | 48 2 | 48 3 | 48 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_m.dat: -------------------------------------------------------------------------------- 1 | 15 2 | 14 3 | 5 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/_tau.dat: -------------------------------------------------------------------------------- 1 | 2.35131779042770e-09 5.03766378368076e-09 5.69051523320038e-09 1.23896680712219e-08 3.69886856547432e-08 4.54601417122195e-08 4.56920826352509e-08 4.64325391027720e-08 7.34906209895199e-08 7.77449004153105e-08 1.34985242145181e-07 2.52119149290985e-07 3.62253202036184e-07 3.83541972129597e-07 4.21682607574159e-07 6.33607608757621e-07 6.54247250647449e-07 8.68220009910059e-07 8.69895996689625e-07 1.37725054433263e-06 2.88576803741447e-06 5.66450921018665e-06 1.47267434259381e-05 4.36743563554217e-05 5.93407437062730e-05 7.89223051161145e-05 8.75677216666003e-05 1.92021078475311e-04 5.06018443232762e-04 1.80395661650339e-03 2.04435493854866e-03 2.58683203480896e-03 2.59374290088885e-03 3.02630277479762e-03 3.63499539794245e-03 3.63499539794245e-03 5.58720901366593e-03 5.77131662712307e-03 5.77131662712307e-03 8.14160531476914e-03 1.56081966193819e-02 2.69171247132553e-02 5.40924011336581e-02 5.91772333654960e-02 3.79535020516030e-01 3.79535020516030e-01 3.82108875406232e-01 4.27120780447343e+01 1.42780224356420e+03 3.09423736143019e+07 1.12066670416207e+09 1.39160087459484e+09 1.80526245169412e+12 1.00000000000000e+00 2 | 2.32236723818515e-09 5.14277391470793e-09 6.13251171579678e-09 1.32290532528039e-08 3.88087003759925e-08 4.83445404326136e-08 4.83615703457673e-08 4.86078502301464e-08 7.87983253969573e-08 8.08984088114819e-08 1.45627917602236e-07 2.66796795080157e-07 2.89160259519754e-07 3.27311509610197e-07 3.55287863164093e-07 4.89535756488472e-07 5.32222445226030e-07 7.46424633179402e-07 7.91962608690128e-07 9.96631541901319e-07 2.59074475342197e-06 4.95878600228979e-06 1.25729532042166e-05 2.95020050086523e-05 3.69343213691634e-05 5.09945088132053e-05 5.50730022349581e-05 1.19443834572711e-04 2.41977951921648e-04 9.67322620255379e-04 1.03860131139624e-03 1.15277628015932e-03 1.19286237031040e-03 1.52897546789301e-03 1.64115391834496e-03 1.64115391834496e-03 2.44654354361029e-03 2.73486661750517e-03 2.73486661750517e-03 4.13000349501993e-03 7.00530800869084e-03 1.25439410059611e-02 2.44951276015668e-02 2.96662248574316e-02 1.42962645217404e-01 1.42962645217404e-01 1.44679869910223e-01 2.06117150027639e+01 6.57357378677742e+02 2.75131951446592e+07 1.33200742497863e+09 1.79079349334956e+10 1.79079349334956e+10 1.00000000000000e+00 3 | 2.18896233435861e-09 5.67486043995897e-09 9.02809073732180e-09 1.86656293143011e-08 4.34688297119280e-08 5.59784687969319e-08 5.96237630466433e-08 6.31365547877619e-08 9.81880299664611e-08 1.04003758550683e-07 1.13820656459671e-07 1.47976727260452e-07 1.58613757705938e-07 1.95145254764689e-07 1.95145254764689e-07 2.78480533422516e-07 2.78480533422516e-07 3.56765389148293e-07 5.12832145327197e-07 7.63901406676180e-07 1.11168699269514e-06 2.10780531417454e-06 4.87118118011331e-06 5.94853043423981e-06 6.61327949827240e-06 8.48117640500516e-06 1.05645658248549e-05 1.54607722163914e-05 1.64133746260481e-05 5.27136512636758e-05 5.85596498531613e-05 6.09395357426072e-05 7.05223232744825e-05 8.51570724382317e-05 1.04482048704835e-04 1.11066950475295e-04 1.20837791799863e-04 2.03126670945615e-04 2.03126670945615e-04 3.23714397254640e-04 3.28682632805731e-04 7.21022255442419e-04 1.20914708638415e-03 2.65728494890939e-03 2.77114360178094e-03 3.33500842542049e-03 4.65634827507864e-03 2.69914942188509e+00 1.13097261212469e+01 2.64414731658892e+07 1.08604756055339e+09 1.08604756055339e+09 2.40317938023834e+10 1.00000000000000e+00 4 | -------------------------------------------------------------------------------- /src/unit-test/ODETChem/outputs_ref/testResults.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/unit-test/ODETChem/outputs_ref/testResults.txt -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(.) 2 | include_directories(../../core) 3 | include_directories(../../include) 4 | # test 5 | # 6 | ADD_EXECUTABLE(csplib-test-tcstr.x CSPlib_Test_Driver_TCSTR.cpp) 7 | TARGET_LINK_LIBRARIES(csplib-test-tcstr.x ${CSPlib_LINK_LIBRARIES} ) 8 | 9 | INSTALL(DIRECTORY inputs 10 | DESTINATION ${CMAKE_INSTALL_PREFIX}/unit-test/T-CSTR) 11 | 12 | INSTALL(DIRECTORY outputs_ref 13 | DESTINATION ${CMAKE_INSTALL_PREFIX}/unit-test/T-CSTR) 14 | 15 | FILE(COPY inputs 16 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 17 | 18 | FILE(COPY outputs_ref 19 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 20 | 21 | INSTALL(TARGETS csplib-test-tcstr.x 22 | PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE 23 | DESTINATION "${CMAKE_INSTALL_PREFIX}/${CSPlib_INSTALL_TEST_PATH}/T-CSTR") 24 | 25 | ADD_TEST(CSlibTest csplib-test-tcstr.x) 26 | -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/inputs/sample_phi1.dat: -------------------------------------------------------------------------------- 1 | T P CH4 O2 N2 AR 2 | 5.000000000000000000e+02 1.013250000000000000e+05 5.483858845025559731e-02 2.187578062376045740e-01 7.137587863547695255e-01 1.264481895737025810e-02 3 | -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/inputs/thermSurf.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/unit-test/T-CSTR/inputs/thermSurf.dat -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/Constraint0_m.dat: -------------------------------------------------------------------------------- 1 | 28 2 | 28 3 | 29 4 | 59 5 | -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/Constraint11_m.dat: -------------------------------------------------------------------------------- 1 | 21 2 | 20 3 | 23 4 | 48 5 | -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/Constraint4_m.dat: -------------------------------------------------------------------------------- 1 | 26 2 | 27 3 | 30 4 | 55 5 | -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/kmod.err: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/unit-test/T-CSTR/outputs_ref/kmod.err -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/kmodSurf.err: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandialabs/CSPlib/b16fec1da8631bd83903b099b93896dfb3c70a8e/src/unit-test/T-CSTR/outputs_ref/kmodSurf.err -------------------------------------------------------------------------------- /src/unit-test/T-CSTR/outputs_ref/kmodSurf.reactions: -------------------------------------------------------------------------------- 1 | H2 + 2_PT_ => 2H_PT, 2 | 2_PT_ + O2 => 2O_PT, 3 | CH4 + 2_PT_ => H_PT + CH3_PT, 4 | _PT_ + O_PT + CH4 => OH_PT + CH3_PT, 5 | CH4 + OH_PT + _PT_ => H2O_PT + CH3_PT, 6 | H2O + _PT_ => H2O_PT, 7 | CO2 + _PT_ => CO2_PT, 8 | CO + _PT_ => CO_PT, 9 | 2H_PT => 2_PT_ + H2, 10 | 2O_PT => 2_PT_ + O2, 11 | H2O_PT => _PT_ + H2O, 12 | CO_PT => _PT_ + CO, 13 | CO2_PT => _PT_ + CO2, 14 | O_PT + C_PT => _PT_ + CO_PT, 15 | _PT_ + CO_PT => O_PT + C_PT, 16 | O_PT + CO_PT => _PT_ + CO2_PT, 17 | _PT_ + CO2_PT => O_PT + CO_PT, 18 | OH_PT + CO_PT => H_PT + CO2_PT, 19 | H_PT + CO2_PT => OH_PT + CO_PT, 20 | _PT_ + CH3_PT => H_PT + CH2_PT, 21 | H_PT + CH2_PT => _PT_ + CH3_PT, 22 | _PT_ + CH2_PT => H_PT + CH_PT, 23 | H_PT + CH_PT => _PT_ + CH2_PT, 24 | _PT_ + CH_PT => H_PT + C_PT, 25 | H_PT + C_PT => _PT_ + CH_PT, 26 | O_PT + H_PT => _PT_ + OH_PT, 27 | _PT_ + OH_PT => O_PT + H_PT, 28 | _PT_ + H2O_PT => OH_PT + H_PT, 29 | 2OH_PT => O_PT + H2O_PT, 30 | O_PT + H2O_PT => 2OH_PT, 31 | H2 + C_PT => CH2_PT, 32 | CH2_PT => C_PT + H2, 33 | OH_PT + H_PT => _PT_ + H2O_PT, 34 | H_PT + CH3_PT => 2_PT_ + CH4, 35 | H2O_PT + CH3_PT => _PT_ + OH_PT + CH4, 36 | OH_PT + CH3_PT => _PT_ + O_PT + CH4, 37 | --------------------------------------------------------------------------------