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?