I often solve pdes for my research, and years ago I found pdetoode
in this forum is very handy and solve severy chanlenging pdes (here, here and here for example) in this forum. Thus, I decied to figure its working principle.
I have been studying hard on the package pdetoode
by xzczd for many times and many days each time.
I still can't figure out the how the pde converted to odes.
In particularlly, the following command:
((u : func) | Derivative[dx1 : pat, dt_, dx2___][(u : func)])[
x1 : pat, t_, x2___] :>
(Sow@coordtoindex@{x1, x2};
fdd[{dx1, dx2}, {grid}, Outer[Derivative[dt][u@##]@t &, grid],
"DifferenceOrder" -> o, PeriodicInterpolation -> periodic])
I guess from the context that pat
here means whatever repeats itself several times exactly. However, for code here, after I print dx1
, and x1
. In some cases dx1 = 01
, x1=xy
, this confues me a lot.
How can this be? Maybe I misunderstand something here? What does this piece of code try to do?
I tried my best but I still fails to understand it.
Can anyone explain something on the above code or pdetoode
? Thanks!