Differnce between dot() and inner() in FEniCS 2017.2.0 (stable)
5 months ago by
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. 2.9494483360838974 0.0
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?
Community: FEniCS Project
5 months ago by
Please login to add an answer/comment or follow this question.