Hi everyone,
after i solved the poisson equation with a specific charge density, i wanted to calculate and simulate the E-field. i looked over other topic to maybe find a close problem to mine but somehow i’ve found very little about it.
i used the Gmsh Python API to define my mesh, then i followed the Tutorial for DOLFINX to solve the poisson equation and everything worked. I then defined the E function and the E_norm function as followed:
s_cg1 = FiniteElement("CG", mesh.ufl_cell(), 1)
V = FunctionSpace(mesh, s_cg1)
phi = Function(V)
...
...#Poisson Equation solution
...
Element = VectorElement("CG", mesh.ufl_cell(), 1)
Q = VectorFunctionSpace(mesh, Element)
E = Function(Q)
E_norm= Function(V)
E = - ufl.grad(phi)
my Kernel crashes everytime i run the code with the definition of VectorElement and VectorFunctionSpace. i would be very thankful if you could help me.
another this is that i know using DOLFIN the mathematical equation for E and E_norm are defined as followed:
E.assign(project(-grad(phi), Q))
E_norm.assign(project(sqrt(inner(E,E)), V))
I’m pretty sure that what i define in the DOLFINX code is not correct and will lead to an Error. could you please give me some hints on how to formulate my code right.
I look forward to your reply.