PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

How to change the code implementation in pybammsolvers applied in PyBaMM

Open Azure-Dreamer opened this issue 9 months ago • 1 comments

I would like to realize some changes to the IDAKLUSolver, and have successfully build it by

pip install .

as the introduction of pybammsolver introduction said.

But when I copied the generated idaklu.cpython-39-x86_64-linux-gnu.so file and covered the original one in the environment,

solver = pybamm.IDAKLUSolver()

raises

ImportError("KLU is not installed")
ImportError: KLU is not installed

I would like to ask what I should do to change the process of solver implementation.

Azure-Dreamer avatar Mar 14 '25 16:03 Azure-Dreamer

A process like this should work:

# Setup environment
virtualenv .venv
source .venv/bin/activate
git clone [email protected]:pybamm-team/pybammsolvers.git
git clone [email protected]:pybamm-team/PyBaMM.git

# Install PyBaMM
cd PyBaMM
pip install -e ".[all,dev,jax]"
          
# Replace PyBaMM solvers
cd ../pybammsolvers
pip uninstall pybammsolvers --yes
python install_KLU_Sundials.py
pip install .
          
# Run pybamm tests
cd ../PyBaMM

kratman avatar Jun 18 '25 22:06 kratman