ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #01986
[Question #164419]: How to compute a pointwise vector product within an ufl-file
New question #164419 on UFL:
https://answers.launchpad.net/ufl/+question/164419
i am really new in working with fenics and the packages around. So i have got a question about ufl. I want to generate an input Matrix for an optimal control problem.
So i am writing down my variational form and want to get the expression
L = c*inner(1,v)*ds(1)
in my matrix (c is only an constant). For that i am assembling L to an Vector B via
assemble(B, L, NULL, & sub_domains, NULL);
Now i want to pointwise multiply this vector with another vector, called z.
I am writing my main programm in C++ and the pointwise multiplying doesn't make any problem.
My question is now. How could i get the pointwise multiplication into the ufl-file, such that, i don't have to do the multiplication after assembling my vector.
I tried to use the Coefficient class in ufl and later on i tried it with the Function class via
elem=FiniteElement("Lagrange",tetrahedron,1)
z = Coefficient(elem) or z = Function(elem).
With the Coefficient class the multiplication
L = z*c*inner(1,v)*ds(1)
does not create an error but the result isn't correct when i'm comparing it with the pointwise operation
z.*B, where B is the assembled Vector from above
in MATLAB. So i'm sure i'm not computing a pointwise multiplication of two vectors.
Could you please help me with this problem. It would really help me.
Regards,
Norman
--
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.
Follow ups