### GenericVector.abs() returns NoneType

226
views
0
8 months ago by

The GenericVector() class provides some useful operations for vectors. I would like to use the abs() method but somehow it returns None.  The sum() method, however, seems to work fine.

I get the output

None
5.0

when I run the following minimal example:

from fenics import *

mesh = UnitSquareMesh(3,3)
fe = FiniteElement('Lagrange',mesh.ufl_cell(),1)
V = FunctionSpace(mesh, fe)

v = TestFunction(V)
f = Constant(5.0)

rhs = f*v*dx

b = assemble(rhs)

print b.abs()
print b.sum()

Is anyone able to reproduce this behaviour?

Community: FEniCS Project

1
8 months ago by
Hi,

this is expected behavior: the abs() method on a GenericVector object replaces all entries of a vector by their absolute values, and returns you nothing (contrary to the sum(), min(), max(), etc. methods).
See the documentation
Of course... Seems I should've gotten a little more sleep last night.