Problem with Test and Trial functions used to project from gfuir -> gfu

More
2 years 9 months ago - 2 years 9 months ago #4216 by s.mokbel
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:  ngsolve.org/forum/ngspy-forum/1456-gridf...-to-new-gridfunction

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 
 

 
Last edit: 2 years 9 months ago by s.mokbel.
More
2 years 9 months ago #4217 by joachim
Hi Sajeda,
can you send the complete example, otherwise it's difficult to guess,
Joachim
More
2 years 9 months ago - 2 years 9 months ago #4220 by s.mokbel
I have attached some sample code. I have printed out the two scenarios, so the problem should be clear once you run the file.

Obviously, I have just assigned random data to gfuir, so the values are not meaningful, but you can see the main issue with the nans (coming from mixed FES trial/test functions only).

Please note that I have tested this on real data, and I have gotten the expected output for the changed gfu, so there is nothing wrong with my process. 

Note: I tried to attach this as a file but it did not work, and gave me unrelated error, I tried to copy and paste the code but it did not transfer the line breaks, is there an email I can send the file to? There seem so be a lot of issues with the forum lately. 

Thank you,
Sajeda 
Last edit: 2 years 9 months ago by s.mokbel.
Time to create page: 0.102 seconds