Differnce between dot() and inner() in FEniCS 2017.2.0 (stable)

5 months ago by
Dear community.

I recently upgraded to the latest stable FEniCS version (2017.2.0) (using Arch Linux and Python 3.6.4) and to my surprise it seems like dot() and inner() do not do the same thing for vector-valued functions. Allow me to present a minimal working example (MWE). In this code I'm using a mesh created with Gmsh that consists of two concentric spheres corresponding to an inner and an outer boundary. I have also executed instant-clean prior to running this MWE.

from dolfin import *

mesh = Mesh("../mesh/3D/sphere_in_sphere_res1.xml")
bnd  = MeshFunction("size_t", mesh, "../mesh/3D/sphere_in_sphere_res1_facet_region.xml")
ext_bnd_id = 58
int_bnd_id = 59

V = FunctionSpace(mesh, 'CG', 1)
bce = DirichletBC(V, Constant(0.0), bnd, ext_bnd_id)
bci = DirichletBC(V, Constant(1.0), bnd, int_bnd_id)

u = TrialFunction(V)
v = TestFunction(V)
phi = Function(V)

a = inner(grad(u), grad(v))*dx
L = Constant(0.0)*v*dx

solve(a==L, phi, [bci, bce])
E = project(-grad(phi))

dss = Measure('ds', domain=mesh, subdomain_data=bnd)
n = FacetNormal(mesh)

print(assemble(inner(E, -1*n) * dss(int_bnd_id)))
print(assemble(dot(E, -1*n)   * dss(int_bnd_id)))

The output of the MWE is:

Solving linear variational problem.

It was my understanding that inner() and dot() should do the same thing for vector-valued functions. Is this a bug in FEniCS? Or if not, perhaps someone can enlighten me?

Kind regards,
Community: FEniCS Project

1 Answer

5 months ago by
This may be my bad. I tried running dijitso clean as well as instant-clean and now it seems that both methods results in 2.9... Sorry for the inconvenience.
The question, I suppose, is why was this expression cached to zero in the first place? And that turned out to be something I would call a FEniCS bug: https://bitbucket.org/fenics-project/dolfin/issues/998/datatype-issues-with-ds-measure-and
written 5 months ago by Sigvald Marholm  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »