Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

GridFunction to numpy array to new GridFunction

More
2 years 2 months ago #4177 by joachim
Hi,

the fes can be a product space consisting of different component spaces.

the fesir can be a vectorial IRSpace, with all components having the same points.

When going from the polynomials to the points, you form one vector coefficient function as argument for the gfuir.Interpolate().
When going back to the polynomial space, you can extract components of the ir-gridfunction: gfuir[2:4]

Joachim
More
2 years 2 months ago #4179 by s.mokbel
Hi Joachim,

Thank you for your response. Can you please elaborate on vectorial IRSpace? Do you mean:

fesir = IntegrationRuleSpace([fesir_u, fesir_p])?
More
2 years 2 months ago #4180 by joachim
If you want a vectorial IRSpace with vector dimension 17 you define it as
Code:
fes = IntegrationRuleSpace(...) ** 17
More
2 years 2 months ago #4181 by s.mokbel
Dear Joachim,

Thank you for the response. This works. I do have an additional question.

Now that I’ve used IntegrationRuleSpace the data in gfuir.vec.data is equal to the actual u,p values as opposed to polynomial coefficients in the original gfu.vec.data.

However, I am not sure where the spatial data corresponding to these values is stored.

Normally with the original gfu I’d evaluate it like:

gfu(mesh(p1,p2)) or gfu.components[0](mesh(p1,p2))

For gfuir this won’t work.

Is there another way to obtain the corresponding spatial locations of the values?
More
2 years 2 months ago #4182 by joachim
you may create another GridFunction gfxyz in an IntegrationRuleSpace of dimension 3, and then you interpolate the coordinate coefficientfunctions as
Code:
gfxzy.Interpolate( CF( (x,y,z) ) )

then the vector entries are the coordinates at the points
The following user(s) said Thank You: s.mokbel
More
2 years 1 month ago - 2 years 1 month ago #4219 by s.mokbel
Thank you, this worked. 
Last edit: 2 years 1 month ago by s.mokbel.
Time to create page: 0.114 seconds