SciML / diffeqpy

Solving differential equations in Python using DifferentialEquations.jl and the SciML Scientific Machine Learning organization
MIT License
508 stars 39 forks source link

DAE with Mass Matrix #140

Closed vick2075 closed 3 months ago

vick2075 commented 3 months ago

Question❓

If you need help or have a general question, the primary online discussion venue for Julia is the Discourse forum. Here, we only answer questions about internal design and implementation.

Hi,

I'm trying to solve DAE with mass matrix as per testset found here: https://archimede.uniba.it/~testset/problems/transamp.php using the Fortran code: transamp.f and translated in Python using diffeqpy.

However, I'm having problem with either the formulation with diffeqpy or I'm using the wrong arguments for solver.

Can you please help me out?

I've attached my Python script.

Thanks Vickram pyjultransistor.py.txt

ChrisRackauckas commented 3 months ago

That looks generally correct. I haven't had a chance to run this yet though. What's the error that you're getting?

vick2075 commented 3 months ago

That looks generally correct. I haven't had a chance to run this yet though. What's the error that you're getting?

I can't figure out what the error is all about as it's very long. I've even tried autodiff=false as well but to no avail. error.pdf

ChrisRackauckas commented 3 months ago

Did you try doing the JIT compilation? That would make it move to the Julia side which would both speed it up and handle autodiff.

vick2075 commented 3 months ago

Did you try doing the JIT compilation? That would make it move to the Julia side which would both speed it up and handle autodiff.

Just did and here are the script and the error: error.pdf pyjultransistor.pdf

ChrisRackauckas commented 3 months ago

That's not the syntax. It takes the ODEProblem, see https://github.com/SciML/diffeqpy?tab=readme-ov-file#compilation-with-dejit-and-julia

vick2075 commented 3 months ago

That's not the syntax. It takes the ODEProblem, see https://github.com/SciML/diffeqpy?tab=readme-ov-file#compilation-with-dejit-and-julia

Still not good: error.pdf pyjultransistor.pdf

vick2075 commented 3 months ago

I found the error: At du[3] I had (U4/-Ub)/R4+alpha fac1 instead of (U4-Ub)/R4+alphafac1

pyjultransistor.pdf This is the corrected script

Thanks for the helps!