Hello,
I would like to ask if there is any way to save Ex, Ey, Ez in the same file in order to have a vtu file about the total electric field. For example in the following code what could be used instead of file << u?
V = FunctionSpace(mesh, “CG”, 2)
bcs = [DirichletBC(V, Constant(0.0), boundaries, 1)]
Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v))dx
f = Constant(0.0)
L = fvdx + g_Xvds(5)+ g_Xvds(6) + g_Yvds(3)+ g_Yvds(4) + g_Zv*ds(2)
u = Function(V)
solve(a == L, u, bcs)
Ex = project(u.dx(0), V)
Ey = project(u.dx(1), V)
Ez = project(u.dx(2), V)
#File(‘saved_u.xml’) << u
file = File(“finalfnew.pvd”)
file << u