This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Correct use of nabla_grad on a boundarymesh

0 votes

I am trying to solve the following eigenvalue problem (Schrodinger equation) on a 2D domain:

$$
\frac1{2} \int \nabla \psi \nabla v + \int U \psi v = E \int \psi v
$$

This works fine if I just define a 2D domain as such, but what I actually want to do is to define this domain as part of a boundary of a 3D domain, e.g. the face of a cube (where the cube edges do not necessarily correspond to the x-y-z directions). To obtain this mesh I would use

boundarymesh = BoundaryMesh(mesh, 'exterior')
mesh2d = SubMesh(boundarymesh, meshfunction_over_boundarymesh, some_number)
V = FunctionSpace(mesh2d, 'CG', 1)
etc.

Using something along these lines I manage to define a square 2D mesh and define a functionspace on it. However, proceeding this way gives skewed eigensolutions.

I suspect this has to do with the fact that, if I print the coordinates of mesh2d:

>>> mesh2d.coordinates()
array([[ -2.55111660e+02,   4.50168538e-11,   2.47123433e+02],
       [ -2.55111660e+02,   4.95349434e+00,   2.49707685e+02],
       [ -2.55111660e+02,   3.38179377e-02,   2.51499615e+02],
       ...

... it shows the vertex coordinates of the original 3D mesh, and I suspect that UFL operators like grad are defined with respect to the 3D coordinate system.

My question now is whether it is possible, and if so how, to use derivative operators that are defined locally, on my 2D mesh—so the solutions of the above EVP are the same when I define this square mesh directly or as a submesh of a 3D mesh?

asked Feb 5, 2016 by maartent FEniCS User (3,910 points)
edited Feb 5, 2016 by maartent

If I map the solution back to the plane on the 3D mesh (see method from link) or save and open the 2D boundary mesh in paraview, it actually looks fine again. This leads me to believe that the problem is with the built-in plot tool. Any more thoughts on the issue are welcome though.

http://fenicsproject.org/qa/6810/vertex-mapping-from-submesh-boundarymesh-back-actual-mesh?show=6810#q6810

...