Whoever is interested in this question, we solved this now (very very dirty) with the following code and it does work but is not a permanent solution:
from dolfin import *
import pylab as pl
import numpy as np
from mshr import *
global_element_order = 2
# Specify the grid
mesh_density = 50
points = 1000
a = 20e-3
b = 10e-3
L = 70e-3
p1 = Point(0,0,0)
p2 = Point(a,b,L)
box1 = Box(Point(0,0,0), Point(a,b,L))
mesh = RectangleMesh(p1,p2,mesh_density,mesh_density)
domain = box1
# Resolution of mesh
mesh = generate_mesh(domain, mesh_density)
# Specify the ansatz function space
V_ned = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", global_element_order)
V = VectorFunctionSpace(mesh, 'CG', 1)
#V = FunctionSpace(mesh, "MOR", global_element_order)
u = Function(V)
#define left boundary
class BoundaryLeft(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and abs(x[2]-L)<DOLFIN_EPS
boundaryLeft = BoundaryLeft()
bc = DirichletBC(V, Expression(("0.0","1","0.0")),boundaryLeft)
bc.apply(u.vector())
plot(u)
u= interpolate(u, V_ned)
plot(u)
#plot
beamline = np.zeros((points,3))
location = np.linspace(0,L,points)
for i in range(points):
x = np.array([a/2,b/2,location[i]])
beamline[i,:] = u(x)
pl.plot(location,(beamline[:,2]),label='z component')
pl.plot(location,(beamline[:,1]),label='y component')
pl.plot(location,(beamline[:,0]),label='x component')
pl.legend(loc='lower left')
pl.show()