← Back to team overview

fenics team mailing list archive

Re: user defined operator cov(A)

 

Sorry for my bad English. I meant "adjoint matrix", not "covariance matrix".

Best,
Chong Luo
----- Original Message ----
From: Chong Luo <luo.chong@xxxxxxxxx>
To: fenics-dev@xxxxxxxxxx
Sent: Thursday, March 20, 2008 9:46:42 PM
Subject: [FEniCS-dev] user defined operator cov(A)

I saw in FFC manual that in the .form files, we can "define new operators
using standard Python syntax".

 I want to define the covariance of a matrix A, so I wrote the following code:

def cov(A):
    B = A
    for i in range(1, 3):
        for j in range(1, 3):
            B[i][j] = A[(i+2)%3][(j+2)%3]*A[(i+1)%3][(j+1)%3] \
                     -A[(i+2)%3][(j+1)%3]*A[(i+1)%3][(j+2)%3]

a(F) = dot(grad(v), mult(cov(F), grad(u)))*dx
L = dot(v, f)*dx + dot(v('+'), g('+'))*dS

However, I got this error: 
  File "Elasticity.py", line 36
    a(F) = dot(grad(v), mult(cov(F), grad(u)))*dx
SyntaxError: can't assign to function call


Any idea how to make it work? Similarly I'd like to implement 
the operator d^2(det(F))/dF^2, because these are needed in
incompressible nonlinear elasticity.

Thank you!

Best,

Chong Luo
PhD student in Applied Math
University of Minnesota







      Never miss a thing.   Make Yahoo your homepage.

-----Inline Attachment Follows-----

_______________________________________________
FEniCS-dev mailing list
FEniCS-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/fenics-dev







      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ