Skip to content

Commit

Permalink
Merge pull request #2444 from pybamm-team/i2217-idaklu
Browse files Browse the repository at this point in the history
I2217 idaklu
  • Loading branch information
martinjrobins authored Nov 21, 2022
2 parents 24e465d + 2b80d6b commit c8f2890
Show file tree
Hide file tree
Showing 24 changed files with 1,876 additions and 1,183 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added `scale` and `reference` attributes to `Variable` objects, which can be use to make the ODE/DAE solver better conditioned ([#2440](https://github.com/pybamm-team/PyBaMM/pull/2440))
- SEI reactions can now be asymmetric ([#2425](https://github.com/pybamm-team/PyBaMM/pull/2425))
- New Idaklu solver options for jacobian type and linear solver, support Sundials v6 ([#2444](https://github.com/pybamm-team/PyBaMM/pull/2444))

## Optimizations

Expand Down
3 changes: 3 additions & 0 deletions CMakeBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def run(self):
use_python_casadi = False
else:
use_python_casadi = True

build_type = os.getenv("PYBAMM_CPP_BUILD_TYPE", "Release")
cmake_args = [
"-DCMAKE_BUILD_TYPE={}".format(build_type),
"-DPYTHON_EXECUTABLE={}".format(sys.executable),
"-DUSE_PYTHON_CASADI={}".format("TRUE" if use_python_casadi else "FALSE"),
]
Expand Down
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ endif()

add_subdirectory(${PYBIND11_DIR})
pybind11_add_module(idaklu
pybamm/solvers/c_solvers/idaklu_python.cpp
pybamm/solvers/c_solvers/idaklu_python.hpp
pybamm/solvers/c_solvers/idaklu/casadi_functions.cpp
pybamm/solvers/c_solvers/idaklu/casadi_functions.hpp
pybamm/solvers/c_solvers/idaklu/casadi_solver.cpp
pybamm/solvers/c_solvers/idaklu/casadi_solver.hpp
pybamm/solvers/c_solvers/idaklu/casadi_sundials_functions.hpp
pybamm/solvers/c_solvers/idaklu/casadi_sundials_functions.cpp
pybamm/solvers/c_solvers/idaklu/common.hpp
pybamm/solvers/c_solvers/idaklu/python.hpp
pybamm/solvers/c_solvers/idaklu/python.cpp
pybamm/solvers/c_solvers/idaklu/solution.cpp
pybamm/solvers/c_solvers/idaklu/solution.hpp
pybamm/solvers/c_solvers/idaklu/options.hpp
pybamm/solvers/c_solvers/idaklu/options.cpp
pybamm/solvers/c_solvers/idaklu.cpp
pybamm/solvers/c_solvers/idaklu.hpp
pybamm/solvers/c_solvers/idaklu_casadi.cpp
pybamm/solvers/c_solvers/idaklu_casadi.hpp
pybamm/solvers/c_solvers/solution.cpp
pybamm/solvers/c_solvers/solution.hpp
)

if (NOT DEFINED USE_PYTHON_CASADI)
Expand Down
8 changes: 8 additions & 0 deletions FindSUNDIALS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#
# * sundials_ida
# * sundials_sunlinsolklu
# * sundials_sunlinsoldense
# * sundials_sunlinsollapackdense
# * sundials_sunmatrix_sparse
# * sundials_nvecserial
#
Expand All @@ -31,6 +33,9 @@ find_path(SUNDIALS_INCLUDE_DIR
sundials/sundials_math.h
sundials/sundials_types.h
sunlinsol/sunlinsol_klu.h
sunlinsol/sunlinsol_dense.h
sunlinsol/sunlinsol_spbcgs.h
sunlinsol/sunlinsol_lapackdense.h
sunmatrix/sunmatrix_sparse.h
PATH_SUFFIXES
include
Expand All @@ -41,6 +46,9 @@ find_path(SUNDIALS_INCLUDE_DIR
set(SUNDIALS_WANT_COMPONENTS
sundials_idas
sundials_sunlinsolklu
sundials_sunlinsoldense
sundials_sunlinsolspbcgs
sundials_sunlinsollapackdense
sundials_sunmatrixsparse
sundials_nvecserial
)
Expand Down
Loading

0 comments on commit c8f2890

Please sign in to comment.