← Back to team overview

dolfin team mailing list archive

Re: Issues with interpolate

 



Marie Rognes wrote:
Garth N. Wells wrote:


Marie Rognes wrote:

The following code gives r = 0.0. It is not supposed to be.

The problem seems to be that f's vector is still all zeros at the call
to interpolate. Could this be easily fixed?


This example should have led to an error message since f is not a discrete function. I'll take a look.


Ok, thanks!

However,

(a) Why is f not a discrete function? (It is defined on a finite element space?)

On second thought, it may be a discrete function. I think that this is defined in the Python interface and not the C++ interface, so I'll take a look.

(b) I would very much like this not to give an error, but rather work ;) I would use something like this all the time when checking convergence.


Just do

  f.interpolate()

Garth

--
Marie


Garth

--
from dolfin import *

mesh = UnitSquare(1,1)
V_h = FunctionSpace(mesh, "CG", 1)
f = Function(V_h, "1.0")

Q_h = FunctionSpace(mesh, "DG", 1)
Pi_f = interpolate(f, Q_h)

r = norm(Pi_f)
print "r = ", r
---

--
Marie


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







Follow ups

References