Access Component of Vector-Valued function

More
2 years 7 months ago #4288 by walker_tr9
This is really basic question, but if uu is a grid function, or a Trial function, or Test function, then how can I just get one of the components?  I seem to have to do this:  (assume uu has 3 components)

uu_0 = InnerProduct(uu, (1, 0, 0))

Is there another way?
More
2 years 7 months ago #4289 by hvwahl
Hi,

you can do uu_0 = uu[0].

Best wishes,
Henry
More
2 years 7 months ago #4291 by walker_tr9
Yeah, I guess I have to do this as a separate line, and not combine with other operations.  Duh.
More
2 years 7 months ago #4327 by joachim
you can combine component access with everything else, it is yet another node in the expression tree, try:

print (u[0])

You can't apply differential operators to components (as you can't apply for other expression), but you can do a 

Grad(u)[0,:]





 
More
2 years 7 months ago #4328 by walker_tr9
Ok, thanks!  I got what I needed working.
Time to create page: 0.097 seconds