The variable value after projection seems wrong, why?

Hi everyone, the variable value after projection seems wrong. Here is the code,

from dolfin import *
import matplotlib.pyplot as plt
from mshr import *
#from ufl import as_vector

t = 0

domain = Rectangle(Point(0.0,0.0), Point(10.0,10.0))
mesh = generate_mesh(domain,40)

V = FunctionSpace(mesh, “CG”, 1)
u1 = Function(V)
u1.assign(Constant(1.0))

v = project(u1,V)

vtkfile_test = File(‘u1.pvd’)
vtkfile_test << (u1, t)
vtkfile_test = File(‘v.pvd’)
vtkfile_test << (v, t)
exit()

u1 is correct (left), however, the projection variables v seems wrong (right):

What’s the problem here? Why this happen? Thanks a lot if anyone can answer me.

As far as i can see, the minimal and maximal value in both if the plots are 1. Thus this is just a colorbar issue. Please scale your colorbar from say 0 to 2.

1 Like

Thanks a lot. I think you’re right.