Is errornorm also a c++ function?  or is this only Python?

- Shawn

On Wed, 10 Jun 2009, Anders Logg wrote:

On Wed, Jun 10, 2009 at 06:46:53PM +0200, Martin Sandve Alnæs wrote:
Not a linear form, but a functional. That's what norm does anyway.

u = Function(element)
x, y, z = tetrahedron.x
L2 = (sin(2*pi*x) - u)**2*dx

You still have to make sure you compile
with sufficient quadrature order though.

That may not be numerically stable depending on how the form compiler
expands the expression into terms. Use the function errornorm() which
works around this and automatically computes the norm:

 e = errornorm(u, u_h)

Look at the documentation in errornorm.py for a longer explanation.

--
Anders




On Wed, Jun 10, 2009 at 6:33 PM, Shawn Walker<wal...@courant.nyu.edu> wrote:
Actually, I have a question about this.  I may have asked this before, so
forgive me if I repeat.

Suppose my exact solution is sin(2*pi*x).  I would like to compute the exact
error against this function.  Is this doable?  I know you can resample it
with a higher order function, but that is lame!  Can't FFC treat it like a
linear form and use quadrature to evaluate it?  I know it isn't really a
linear form, but FFC wouldn't know the difference!  :) Maybe I am missing
something...

- Shawn

On Wed, 10 Jun 2009, Martin Sandve Alnæs wrote:

The norm definitions should use "inner" instead of "dot" to handle
tensor fields as well.

Martin



On Wed, Jun 10, 2009 at 6:14 PM, Anders Logg<l...@simula.no> wrote:

On Wed, Jun 10, 2009 at 09:58:20AM -0500, Jehanzeb Hameed wrote:

Thanks. So I guess that means no such facility is available in C/C++ ?

No, since the computation depends on the space the functions are in
and so the code needs to be generated. In C++, you need to define a
form file for the norm. Look at

 site-packages/dolfin/norm.py

for how to define the norms.



On Wed, Jun 10, 2009 at 2:03 AM, Anders Logg<l...@simula.no> wrote:

On Tue, Jun 09, 2009 at 05:11:48PM -0500, Jehanzeb Hameed wrote:

Hello,

Is there a builtin function in dolfin to compute L^2 or H_1 norms? If
so, can you please point it out. If not, are there support functions
(e.g. a Gauss Quadrature table, computation of Jacobians, etc) which
can help in this?

Yes, this is available in the DOLFIN Python interface:

 norm(v)

The default computes the L^2 norm. Several options are available:

 L^2:     norm(v, 'L2')
 H^1:     norm(v, 'H1')      includes L^2 term
 H^1_0:   norm(v, 'H10')     does not include L^2 term
 H(div):  norm(v, 'Hdiv')    includes L^2 term
 H(div):  norm(v, 'Hdiv0')   does not include L^2 term
 H(curl): norm(v, 'Hcurl')   includes L^2 term
 H(curl): norm(v, 'Hcurl0')  does not include L^2 term


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkovWqUACgkQTuwUCDsYZdGb3gCfa2gWnzealWzkjPoRj8hf3cr/
0EUAoJh4mpaIzRU9eCnnC+XWlupu6SV0
=so4c
-----END PGP SIGNATURE-----

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkov28sACgkQTuwUCDsYZdE8KQCdEI7wS27QaNw9knI2U9L+RVST
xeUAnRdLrrhAVzsBn6nO1b6CLEpF64ey
=a7iu
-----END PGP SIGNATURE-----

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@fenics.org
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to