Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Implementing a new linear solver

Implementing a new linear solver

Good day!

I am currently working on integrating an additional linear solver into OpenModelica/Ida. However, I have encountered a couple of problems doing so and I'd like to ask a question.

First of all, it seems to be that you have to integrate the linear solver into two distinct places. The integration into Sundials/Ida in OMCompiler/3rdParty/sundials/idas is quite straightforward and works fine. However, there is another module called "linearSystem" in OMCompiler/SimulationRuntime/c/simulation/solver, in which you basically implement every (linear and non-linear) solver again. Why is that? Why does one have to implement a linear solver twice (once in 3rdParty/sundials and once in SimulationRuntime)?
For instance, the linear solver KLU is integrated in 3rdParty/sundials/src/idas/idas_klu and in SimulationRuntime/c/simulation/solver/linearSolverKlu. It seems that both are called during runtime, but I want to ask you whether you know more about this topic.

Thanks

Re: Implementing a new linear solver


Hello and welcome to the OpenModelica forum,

What kind of linear solver are you planning to integrate?

We use linear solvers for several purposes, therefore we have different modules at different places.

On one hand there is the implementation of SUNDIALS/IDA, which has it's own interface to integrate
different linear solvers. Here the user can choose between internal linear solver, LAPACK, KLU,
SUPERLU and some more iterative solvers. Here is OpenModelica the user.
Currently we interfacing from IDA: KLU and LAPACK .

On the other Hand we need to solve, so called linear "algebraic loops" to obtain the RHS for the integrator.
Here we are also interfacing different external solver e.g. KLU, UMFPACK, LAPACK, but we have also
some own implementations like the totalpivot solver.

As far as I understand you want to integrate your linear solver into the IDA integrator, then it's enough
to add it under 3rdParty/sundials/idas and interfacing it in SimulationRuntime/c/simulation/ida_solver.c,
that you do not need to use "linearSystem" module.

Do you have your code on github? Then you could probably start a Pull-Request and we can further see
what you have done how it would fit into the project.

so long.
WIlli





Re: Implementing a new linear solver

Hello

thanks for the quick answer.

I am currently working on implementing one (or more) CPU-parallelized solver into IDA to see if I can gain any speedups in circuit simulation. However, I am still working on getting test models large enough to receive speedups over KLU or LAPACK. I would first like to test the security and robustness of my implementation before I upload anything to GitHub.

Best Regards,
Lennart

There are 0 guests and 0 other users also viewing this topic
You are here: