Closed colinsauze closed 5 years ago
The instruction "so that run_ftcs works properly" was intended to imply that this wasn't meant to work as-is, and would only work when correctly vectorised, but maybe it's better to start off with a working example…
The supplied non vectorised example expects a return from ftcs but doesn't return anything. But this will get removed when vectorising it.
The Tn parameter needs some pre-initalisation before being passed in.
for t in range(nt): Tn = ftcs(Ti, alpha, dt, dx) Ti = Tn.copy()
can become:
for t in range(nt): Tn = numpy.empty_like(Ti) ftcs(Ti, alpha, dt, dx,Tn) Ti = Tn.copy()
I'll submit a pull request with modified code.