-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
First of all, thank you very much for 6770470 and fc32432. I am trying to solve multiple ODEs at once by concatenating them using the below code. The code without de.jit works fine.
func = de.ODEFunction(combined_model)
prob = de.ODEProblem(func, y0, (t0, dt),pvder_dict)
prob_jit = de.jit(prob ) #Error occurs if I use de.jit
def combined_model(dy,y,p,t):
"""Concatenate ODE residuals from multiple models of same type"""
i = 0
pvder_dict = p
for dss_id in pvder_dict:
for node in pvder_dict[dss_id]:
for der_id in pvder_dict[dss_id][node]:
sim = pvder_dict[dss_id][node][der_id]["sim"]
nEqs = sim.DER_model.n_ODE
start_index = i * nEqs
end_index = (i + 1) * nEqs
dy[start_index:end_index] = sim.ODE_model(y[start_index:end_index],t)
i += 1
return dyHowever, if I use de.jit I am getting the following error:
@ChrisRackauckas @LilithHafner could you suggest something that I could try out? For individual ODE, I can get up to 10 times speed up with de.jit. However, my application requires solving hundreds of ODE models simultaneously.
File "/home/tdcosim_cloud/tdcosim_cloud/model/pvder/odesolverutilities.py", line 154, in get_diffeqpy_integrator
diffeqpy_ode = ode.jit(diffeqpy_ode)
^^^^^^^^^^^^^^^^^^^^^
File "/root/.julia/packages/PythonCall/qTEA1/src/jlwrap/any.jl", line 208, in __call__
return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tdcosim_cloud/tdcosim_cloud/model/pvder/odesolverutilities.py", line 103, in funcval_diffeqpy
for der_id in pvder_dict[dss_id][node]:
~~~~~~~~~~~~~~~~~~^^^^^^
File "/root/.julia/packages/PythonCall/qTEA1/src/jlwrap/any.jl", line 214, in __getitem__
return self._jl_callmethod($(pyjl_methodnum(pyjlany_getitem)), k)
^^^^^^^^^^^^^^^^^^^^^^^^^^
juliacall.JuliaError: MethodError: no method matching getindex(::Symbolics.Num, ::Symbolics.Num)
Closest candidates are:
getindex(::Number)
@ Base number.jl:95
getindex(::Union{AbstractChar, Number}, !Matched::CartesianIndex{0})
@ Base multidimensional.jl:853
getindex(::Number, !Matched::Integer)
@ Base number.jl:96
Metadata
Metadata
Assignees
Labels
No labels