Subject: [UFL-dev] Definition of grad

From: Anders Logg <[email-masked]>
Date: Fri, 6 Nov 2009 11:22:53 +0100

This is something we've discussed before, but I want to discuss it
again.

Could we change the definition of the gradient of a vector to be the
"normal" definition:

  grad(u) = du_i / dx_j

?

Then grad would be the derivative of u, and not as today the transpose
of the derivative of u.

  u(x + dx) = u(x) + u' du + h.o.t.

With the current definition, I need to do this in various places:

from ufl import grad as ufl_grad
def grad(v):
    if v.rank() == 1:
        return ufl_grad(v).T
    else:
        return ufl_grad(v)

--
Anders

---

From: Andy Ray Terrel <[email-masked]>
Date: Fri, 6 Nov 2009 08:24:07 -0600

+1

On Fri, Nov 6, 2009 at 4:22 AM, Anders Logg <[email-masked]> wrote:
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkrz+PwACgkQTuwUCDsYZdFemgCbBaM9MKI5aF5Pg/fzu0KW8RzG
> 1icAmwXaV/McdolyaIoLeK76v3WtVVb+
> =YliP
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> UFL-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/ufl-dev
>
>

---

From: Kristian Oelgaard <[email-masked]>
Date: Fri, 06 Nov 2009 16:02:19 +0100

> Could we change the definition of the gradient of a vector to be the

I think this sounds like an excellent idea.

Kristian

---

From: Marie Rognes <[email-masked]>
Date: Sat, 07 Nov 2009 03:01:59 +0100

> I think this sounds like an excellent idea.

Me too.

--
Marie

---

From: Harish Narayanan <[email-masked]>
Date: Fri, 06 Nov 2009 18:45:48 +0100

> Could we change the definition of the gradient of a vector to be the

And while this is up for discussion, I would also like the divergence to
be defined as it usually is:

div(A_{ij..m}) = A_{ij..m,m}

Harish

---

From: Anders Logg <[email-masked]>
Date: Mon, 9 Nov 2009 13:37:09 +0100

> div(A_{ij..m}) = A_{ij..m,m}

What does Martin think?

--
Anders

---

From: "Garth N. Wells" <[email-masked]>
Date: Mon, 09 Nov 2009 12:58:32 +0000

>> I think this sounds like an excellent idea.

Cowards!  ;)  You wait for Martin the leave and then jump on the bandwagon.

I suggested this March/April, and Martin's argument against was for 
consistency with other operations. I think that it's fine to change so 
long that other operations do not break or lead to 
unexpected/inconsistent results.

Garth

---

From: Harish Narayanan <[email-masked]>
Date: Mon, 09 Nov 2009 14:01:33 +0100

> Cowards!  ;)  You wait for Martin the leave and then jump on the bandwagon.

Guilty as charged!

Harish

---

From: Anders Logg <[email-masked]>
Date: Mon, 9 Nov 2009 14:05:29 +0100

> unexpected/inconsistent results.

:-)

I've had this discussion with Martin at least twice and both times he
managed to convince me of his definition. But I keep forgetting the
arguments in favor of the current definition (and more so when it
gets me into trouble).

--
Anders

---

From: Anders Logg <[email-masked]>
Date: Mon, 9 Nov 2009 22:25:34 +0100

> arguments in favor of the current definition (and more so when it

I've created a blueprint:

https://blueprints.launchpad.net/ufl/+spec/redine-grad

Add your comments there. (Harish, add comments on div.)

We can let this sink in for a while and give Martin time to comment.

--
Anders

---

From: Harish Narayanan <[email-masked]>
Date: Mon, 09 Nov 2009 22:43:16 +0100

> Add your comments there. (Harish, add comments on div.)

I will. And there might be something similar with curl too, but who uses
curl anyway! :)

I'd just like to point out that in future discussion, I think it will be
clearer if you used the following notation grad(u)_ij = du_i / dx_j.

Harish

---

From: "Garth N. Wells" <[email-masked]>
Date: 09 Nov 2009 21:48:38 +0000

>clearer if you used the following notation grad(u)_ij = du_i / dx_j.

Yes, otherwise we could have 

  grad(u)_ji = du_i / dx_j 

which would keep Martin happy :).

Garth

---

From: Harish Narayanan <[email-masked]>
Date: Mon, 09 Nov 2009 22:49:28 +0100

> which would keep Martin happy :).

Exactly!

Harish