ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #01256
Re: rot and curl
On Sat, Apr 25, 2009 at 11:40:35AM +0200, Martin Sandve Alnæs wrote:
> I've verified the curl vs wikipedia and defined rot as the z-component
> of the curl of the 2D vector operand embedded in 3D. Is that right?
>
> ez = (0, 0, 1)
> u = (u0, u1)
> rot(u) = ez . (nabla x (u0, u1, 0))
>
> def curl(self, o, a):
> # o = curl a = "cross(nabla, a)"
> def c(i, j):
> return a[j].dx(i) - a[i].dx(j)
> return as_vector((c(1,2), c(2,0), c(0,1)))
>
> def rot(self, o, a):
> # o = rot a = "cross(nabla, (a0, a1, 0))[2]"
> def c(i, j):
> return a[j].dx(i) - a[i].dx(j)
> return c(0,1)
>
> Martin
It looks correct, but shouldn't there be some dimension check?
Maybe rot can be implemented directly as
def rot(self, o, a):
return curl(as_vector([a[0], a[1], 0]))[2]
?
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References