- Thank you received: 108
GridFunction to numpy array to new GridFunction
2 years 9 months ago #4177
by joachim
Replied by joachim on topic GridFunction to numpy array to new GridFunction
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
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
2 years 9 months ago #4179
by s.mokbel
Replied by s.mokbel on topic GridFunction to numpy array to new GridFunction
Hi Joachim,
Thank you for your response. Can you please elaborate on vectorial IRSpace? Do you mean:
fesir = IntegrationRuleSpace([fesir_u, fesir_p])?
Thank you for your response. Can you please elaborate on vectorial IRSpace? Do you mean:
fesir = IntegrationRuleSpace([fesir_u, fesir_p])?
2 years 9 months ago #4180
by joachim
Replied by joachim on topic GridFunction to numpy array to new GridFunction
If you want a vectorial IRSpace with vector dimension 17 you define it as
Code:
fes = IntegrationRuleSpace(...) ** 17
2 years 9 months ago #4181
by s.mokbel
Replied by s.mokbel on topic GridFunction to numpy array to new GridFunction
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?
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?
2 years 9 months ago #4182
by joachim
Replied by joachim on topic GridFunction to numpy array to new GridFunction
you may create another GridFunction gfxyz in an IntegrationRuleSpace of dimension 3, and then you interpolate the coordinate coefficientfunctions as
then the vector entries are the coordinates at the points
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
Time to create page: 0.117 seconds