Is there any way that I can assign the tensor for the calculation of the next step?
I mean the version for the tensor like “~~.vector()[:] = ~~” which we use for the vector.
Thanks for your help in advance!
Is there any way that I can assign the tensor for the calculation of the next step?
I mean the version for the tensor like “~~.vector()[:] = ~~” which we use for the vector.
Thanks for your help in advance!
If you want to assign values to subspaces of your tensor valued Function
consider FunctionAssigner
.
I think perhaps you’re confusing the nature of Function.vector()
which returns the underlying data array (also called a vector in computer science), with an actual vector valued mathematical entity.
Thanks, Nate!
I’m still confusing about data returning process…
I did the same thing as you mentioned above,
Function2 = Function1.vector(), for the case of both the function 1 and function 2 are vectors.
But when the case of the tensor, the method cannot be applied in the same way… (I mean function 1 and 2 are tensor forms.)
def der_be_(U, Uprev, dT):
U_ = U.vector()[:]
Uprev_ = Uprev.vector()[:]
return (U_ - Uprev_) / dT
In the above case, in the function definition step, the U is tensor and the above code does not work well.
The error message is as follows.
Is there any other proper way to definite for the tensor well?
Thanks a lot.
Sorry, I had mistake in the process of tensor input before the definition of function.
It works well.
Thank you for your attention!