Hello,

I am currently working on a process that takes values from a numpy array and projects them back to a gridfunction. I am doing this using IntegrationRuleSpace, as explained here: GridFunction to numpy array to new GridFunction - Kunena.

The process works well, except for a weird thing that is happening during the L2 projection step (gfuir → gfu).

I am working with a mixed finite element space, so I do p and u separately. If I try to get the test and trial functions like this:

fes_p = L2(mesh=mesh, order=interp_ord-1)

fes_u = HDiv(mesh=mesh, order=interp_ord)

fes = FESpace([fes_u, fes_p])

u, p = fes.TrialFunction()

v, q = fes.TestFunction()

# Do l2 projection…

I get a bunch of nans in my gfu.

However, when I get the test and trial functions like this:

fes_p = L2(mesh=mesh, order=interp_ord-1)

p, q = fes_p.TnT()

# Do l2 projection…

It works well, and I have the expected values in gfu.

Why would this happen? It is my understanding that both of the methods should give the same test and trial functions.

Best,

Sajeda