Visualisation of dofs when projecting function
When projecting a simple expression, in this case x*y onto a CG space the visualization of dofs disappears when the projected value is a small negative number,
f(x,y)<0, abs(f(x,y))<10e-17.
I'm using DOLFIN 2016.2.0.dev0. This bug is not in DOLFIN 1.6
from dolfin import *
mesh = UnitSquareMesh(15,15)
V = FunctionSpace(mesh,'CG',1)
f = Expression('x[0]*x[1]')
q = project(f,V)
Comments (11)
-
-
- changed status to invalid
-
reporter But why does the visualization remove these nodes?
-
Could you post complete code to reproduce the problem?
-
reporter The only thing added to the code above is
plot(q)
-
Can't reproduce. Is the vector correct? What's the output of
print(q.vector().array())
? -
reporter from dolfin import * import numpy as np mesh = UnitSquareMesh(10,10) V = FunctionSpace(mesh,'CG',1) f = Expression('x[0]*x[1]') q = project(f,V) plot(q,title='Plot of x*y') interactive() t= q.vector().array() print t
Gives the following output:
[ -4.34353546e-18 8.68707093e-18 1.00000000e-01 4.07119023e-18 9.00000000e-02 2.00000000e-01 7.83378043e-18 8.00000000e-02 1.80000000e-01 3.00000000e-01 7.02331485e-18 7.00000000e-02 1.60000000e-01 2.70000000e-01 4.00000000e-01 -9.61382395e-18 6.00000000e-02 1.40000000e-01 2.40000000e-01 3.60000000e-01 5.00000000e-01 -1.35525272e-18 5.00000000e-02 1.20000000e-01 2.10000000e-01 3.20000000e-01 4.50000000e-01 6.00000000e-01 8.13151629e-18 4.00000000e-02 1.00000000e-01 1.80000000e-01 2.80000000e-01 4.00000000e-01 5.40000000e-01 7.00000000e-01 8.52951478e-18 3.00000000e-02 8.00000000e-02 1.50000000e-01 2.40000000e-01 3.50000000e-01 4.80000000e-01 6.30000000e-01 8.00000000e-01 -2.38799094e-18 2.00000000e-02 6.00000000e-02 1.20000000e-01 2.00000000e-01 3.00000000e-01 4.20000000e-01 5.60000000e-01 7.20000000e-01 9.00000000e-01 3.04931861e-18 1.00000000e-02 4.00000000e-02 9.00000000e-02 1.60000000e-01 2.50000000e-01 3.60000000e-01 4.90000000e-01 6.40000000e-01 8.10000000e-01 1.00000000e+00 -5.42101086e-18 2.00000000e-02 6.00000000e-02 1.20000000e-01 2.00000000e-01 3.00000000e-01 4.20000000e-01 5.60000000e-01 7.20000000e-01 9.00000000e-01 -8.44018659e-19 3.00000000e-02 8.00000000e-02 1.50000000e-01 2.40000000e-01 3.50000000e-01 4.80000000e-01 6.30000000e-01 8.00000000e-01 -6.63157466e-18 4.00000000e-02 1.00000000e-01 1.80000000e-01 2.80000000e-01 4.00000000e-01 5.40000000e-01 7.00000000e-01 -1.08420217e-17 5.00000000e-02 1.20000000e-01 2.10000000e-01 3.20000000e-01 4.50000000e-01 6.00000000e-01 1.63053842e-17 6.00000000e-02 1.40000000e-01 2.40000000e-01 3.60000000e-01 5.00000000e-01 2.71050543e-18 7.00000000e-02 1.60000000e-01 2.70000000e-01 4.00000000e-01 -4.13352078e-17 8.00000000e-02 1.80000000e-01 3.00000000e-01 -3.71964745e-18 9.00000000e-02 2.00000000e-01 1.02174140e-17 1.00000000e-01 -8.13151629e-18]
and following plot:
-
Can't reproduce the problem.
-
reporter Really strange, When I ran this I was using the latest pull of dolfin: 2016.2.0.dev0. Do you have any idea of it is the version of some dependencies that may cause this issue?
-
Looks like a VTK issue. Does your build has a general problem plotting negative values?
-
reporter I've never experienced issues with negative numbers earlier. This is my current VTK-setup
dokken@dokken ~/Desktop $ dpkg -l | grep vtk ii libvtk5.10 5.10.1+dfsg-2.1build1 amd64 Visualization Toolkit - A high level 3D visualization library - runtime ii libvtk6-java 6.2.0+dfsg1-10build1 amd64 Visualization Toolkit - A high level 3D visualization library - java ii libvtk6.2 6.2.0+dfsg1-10build1 amd64 VTK libraries ii libvtk6.2-qt 6.2.0+dfsg1-10build1 amd64 VTK libraries, Qt files ii python-vtk 5.10.1+dfsg-2.1build1 amd64 Python bindings for VTK ii tcl-vtk 5.10.1+dfsg-2.1build1 amd64 Tcl bindings for VTK ii tcl-vtk6 6.2.0+dfsg1-10build1 amd64 Tcl bindings for VTK ii vtk6 6.2.0+dfsg1-10build1 amd64 Binaries for VTK6
- Log in to comment
Following snippet tries to explain the behaviour
Output is