Subject: [Ffc] [[email-masked]: Re: [Question #103102]: multiply spatial coordinates x in the variational formulation]

From: Anders Logg <[email-masked]>
Date: Thu, 4 Mar 2010 19:49:24 +0100

Could you add a demo for this?

--
Anders

Subject: Re: [Question #103102]: multiply spatial coordinates x in the variational formulation
From: Anders Logg <[email-masked]>
To: [email-masked]
Date: Thu, 04 Mar 2010 17:51:23 -0000

Question #103102 on FEniCS Project changed:
https://answers.launchpad.net/fenics/+question/103102

Anders Logg posted a new comment:
On Thu, Mar 04, 2010 at 05:45:10PM -0000, Kristian B. Ølgaard wrote:
> Question #103102 on FEniCS Project changed:
> https://answers.launchpad.net/fenics/+question/103102
>
> Kristian B. Ølgaard posted a new comment:
> Support for using spatial coordinates in the variational formulation has
> been added to the '-r quadrature' representation of FFC. You can try it
> out and see if it works.

Cool!

--
Anders

-- 
You received this question notification because you are a member of
FEniCS Team, which is an answer contact for FEniCS Project.

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Mar 2010 20:45:17 +0100

On Thu, Mar 04, 2010 at 08:35:49PM +0100, Kristian Oelgaard wrote:
>
>
> On 4 March 2010 19:49, Anders Logg <[email-masked]> wrote:
> Sure, to FFC, DOLFIN or both?
> The Poisson demo would be good to do because it has both dx and ds integrals.
>
> Kristian

Both.

What would the Poisson demo look like with this feature?

--
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Thu, 4 Mar 2010 20:48:03 +0100 (CET)

> What would the Poisson demo look like with this feature?

element = FiniteElement("Lagrange", triangle, 1)

v = TestFunction(element)
u = TrialFunction(element)

x = triangle.x[0]
d_x = triangle.x[0] - 0.5
d_y = triangle.x[1] - 0.5
f = 10.0*exp(-(d_x*d_x + d_y*d_y) / 0.02)
g = sin(5.0*x)

a = inner(grad(v), grad(u))*dx
L = v*f*dx + v*g*ds

What should we call the demo, and where do we put it in DOLFIN?

Kristian

> --
> Anders
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkuQDc0ACgkQTuwUCDsYZdHIKwCffXYlQdeq+14pKrWhSAgtmTQn
> C3YAnjmeSG75WfLojfI56pKQqzD/VDjO
> =RHAJ
> -----END PGP SIGNATURE-----
>
>

---

From: Kristian Oelgaard <[email-masked]>
Date: Thu, 4 Mar 2010 20:35:49 +0100 (CET)

Kristian

> --
> Anders
>
>
> ---------- Forwarded message ----------
> iEYEARECAAYFAkuQALQACgkQTuwUCDsYZdFQmgCfV8OyyAcA5tdojtbziTD1smke
> cfQAnifKmykv4wsRZuwB+MuPLA2WrzL/
> =z/hB
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp
>
>

---

From: Johan Hake <[email-masked]>
Date: Thu, 4 Mar 2010 12:06:15 -0800

Cool!

Who needs Expressions when you can generate code for the above?

Johan

---

From: Anders Logg <[email-masked]>
Date: Thu, 4 Mar 2010 21:40:48 +0100

> Who needs Expressions when you can generate code for the above?

Looks very cool. Should we expose x in the interface so it can be used
directly? The advantage with Expression is that one write "sin(x[0])"
without first needing to define what x is (as in x = triangle.x).

After all, we already expose i, j, k, ... as indices so it wouldn't be
that strange.

The problem might be that one needs either triangle.x or tetrahedron.x.

--
Anders

---

From: Kristian Oelgaard <[email-masked]>
Date: Fri, 5 Mar 2010 16:56:30 +0100 (CET)

>> The Poisson demo would be good to do because it has both dx and ds integrals.

Done.

Kristian

---

From: Anders Logg <[email-masked]>
Date: Thu, 25 Mar 2010 22:52:56 +0100

This is pretty cool. We can actually write sin(x[0]) directly as part
of the form.

I've imported x from tetrahedron in UFL so x is available by default
and seems to work also in 2D. I don't think it's a problem to expose
x in the interface (we do it already with i, j, k for indices) but
something might break so let's see what happens.

--
Anders