feat(KINSOL): Switch from Eigen to KINSOL

Previously QSE solving was done using Eigen. While this worked we were
limited in the ability to use previous iterations to speed up later
steps. We have switched to KINSOL, from SUNDIALS, for linear solving.
This has drastically speed up the process of solving for QSE abundances,
primarily because the jacobian matrix does not need to be generated
every single time time a QSE abundance is requested.
This commit is contained in:
2025-11-19 12:06:21 -05:00
parent f7fbc6c1da
commit 442d4ed86c
12 changed files with 506 additions and 386 deletions

View File

@@ -0,0 +1,47 @@
cmake = import('cmake')
cvode_cmake_options = cmake.subproject_options()
cvode_cmake_options.add_cmake_defines({
'CMAKE_CXX_FLAGS' : '-Wno-deprecated-declarations',
'CMAKE_C_FLAGS' : '-Wno-deprecated-declarations',
'BUILD_SHARED_LIBS' : 'ON',
'BUILD_STATIC_LIBS' : 'OFF',
})
cvode_cmake_options.add_cmake_defines({
'CMAKE_INSTALL_LIBDIR': get_option('libdir'),
'CMAKE_INSTALL_INCLUDEDIR': get_option('includedir')
})
cvode_sp = cmake.subproject(
'cvode',
options: cvode_cmake_options,
)
# For the core SUNDIALS library (SUNContext, etc.)
sundials_core_dep = cvode_sp.dependency('sundials_core_shared')
# For the CVODE integrator library
sundials_cvode_dep = cvode_sp.dependency('sundials_cvode_shared')
# For the serial NVector library
sundials_nvecserial_dep = cvode_sp.dependency('sundials_nvecserial_shared')
# For the dense matrix library
sundials_sunmatrixdense_dep = cvode_sp.dependency('sundials_sunmatrixdense_shared')
# For the dense linear solver library
sundials_sunlinsoldense_dep = cvode_sp.dependency('sundials_sunlinsoldense_shared')
cvode_dep = declare_dependency(
dependencies: [
sundials_core_dep,
sundials_cvode_dep,
sundials_nvecserial_dep,
sundials_sunmatrixdense_dep,
sundials_sunlinsoldense_dep,
],
)