Subject: [FFC-dev] Named Functions

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 06 Dec 2008 15:48:34 +0000

It would be useful if we could somehow associate names with mixed 
functions, e.g.

   P2 = VectorElement("Lagrange", "triangle", 2)
   P1 = FiniteElement("Lagrange", "triangle", 1)
   TH = P2 + P1
   (u, p, "U") = Functions(TH)

so that in the DOLFIN-specific C++ wrapper code we can use

   a.U = u;

to attach mixed functions rather than

   a.w0 = u;
   a.w1 = v;
   etc.

which is error prone. Andy suggestions on a nice way to do this in the 
FFC input? Will this be part of UFL?

Garth

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Sat, 6 Dec 2008 18:01:31 +0100

> FFC input? Will this be part of UFL?

I get the problem and idea, but I don't get this code example. You
can't assign to "U".

Also, I think we should remove "Functions" from UFL, using "split"
explicitly instead:

U = Function(TH)
u, p = split(u)

then we will have:

a.U = u; // mixed function

in the dolfin code.

We can add a name attribute to Function in UFL, but I
removed this a short while ago to keep things simple...
Then this would do the same:

u, p = split(Function(TH, name="U"))

--
Martin

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 06 Dec 2008 17:31:44 +0000

> I get the problem and idea, but I don't get this code example. You

The example isn't a suggestion, just an illustration that I would 
somehow like to associate the name "U" with the mixed function.

> a.U = u; // mixed function

That would be nice.

> u, p = split(Function(TH, name="U"))

The first of your examples look simpler to me.

Garth

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Sat, 6 Dec 2008 18:36:57 +0100

2008/12/6 Garth N. Wells <[email-masked]>:
> The example isn't a suggestion, just an illustration that I would somehow
> like to associate the name "U" with the mixed function.
>

Good! I'll make it happen (for UFL).

(I'm hoping to get a basic UFL-based form compiler up and
running before christmas, with most features in place).

--
Martin

---

From: Anders Logg <[email-masked]>
Date: Sat, 6 Dec 2008 21:16:53 +0100

>    (u, p, "U") = Functions(TH)

Is it ever necessary to create a Functions that way?

TestFunctions and TrialFunctions are special since they correspond to
subsets of a bigger system, but for coefficients, one can just do

  u = Function(P2)
  p = Function(P1)

Even though it seems strange to name two coefficients "u" and "p" for
Stokes.

-- 
Anders

> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev

---

From: "Garth N. Wells" <[email-masked]>
Date: Sat, 06 Dec 2008 20:21:29 +0000

> Even though it seems strange to name two coefficients "u" and "p" for

With the above they won't share the same vector. It's common that the 
Functions that are of interest in the form will come from solution, for 
example, the solution at previous time steps.

Garth

> 
> 
> ------------------------------------------------------------------------
>

---

From: Anders Logg <[email-masked]>
Date: Sat, 6 Dec 2008 21:42:20 +0100

> example, the solution at previous time steps.

ok, I think I get it.

-- 
Anders