Understanding few lines from NeuralPDE.jl PDE example (phi solution)

Hi all,
first time I’m trying to use PINNs with Julia, as I’m reading the docs there are some parts that I’m missing.
In this example :

I see that the lines used for the predictions are:

phi = discretization.phi
u_predict = reshape([first(phi([x,y],res.u)) for x in xs for y in ys],(length(xs),length(ys)))

However, in this example, the predictions are calculated like this:

phi = discretization.phi
depvars = [:u,:w]
minimizers_ = [res.u.depvar[depvars[i]] for i in 1:length(chain)]
u_predict  = [[phi[i]([t,x], minimizers_[i])[1] for t in ts  for x in xs] for i in 1:2]

Can someone explain to me the difference between the two u_predict lines? I’m not sure I’m following just by reading the docs.
My other question is about the phi object, what does it contain exactly? Is it the trained network?

It’s a difference between whether it’s a system of equations (array of neural networks) or a single equation (thus it’s just a neural network directly).

It’s the neural network you passed but munged to directly represent the PDE solution. So phi[i]([t,x]) is equal to u[i](t,x) when trained for a multi-dimensional system, and for a single dimensional system it’s just phi(t,x).

Thank you so much!
Can you please share why [1] or first is used when calling phi[i]([t,x], minimizers_[i])[1]? What does the first index represent?

The first NN