Long PDE input / using user_func
#355
-
I'm working with a very long string input for a PDE, and I am wondering if there are any performance changes if I were to use I can convert this to an explicit string representation that looks something like this, but much longer and with more composition: If I evaluate a similar string using numpy values for the variables with After implementing this string description of the PDE, I encountered the Thus, my questions are the following:
I've included my code below, with a simplified
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is an interesting use-case and I must admit that we have never tested in detail how the performance of the A suitable alternative might be to do implement the class defining the PDE yourself. The documentation shows the first steps for how to do this. You could use the infrastructure of |
Beta Was this translation helpful? Give feedback.
This is an interesting use-case and I must admit that we have never tested in detail how the performance of the
PDE
class scales with the length of the input string. I would not be surprised if it does not perform well for your situation. Basically, the string is parsed bysympy
, converted into a python function usinglambdify
, and compiled bynumba
for speed. However, every occurrence oflaplace(u)
andd_dx(u)
will trigger a separate evaluation of the differential operators, since variable reuse has not been implemented yet (since it's a bit of a tricky thing to do right). Consequently, I suspect that using the automatic infrastructure provided by thePDE
class is less than ideal.A suit…