Hello,
I am trying to evaluate the electric field in a 2D conductor generated by a known external time varying magnetic field. The electric field verifies the two equations :
curl(\boldsymbol{E}) = - {\partial \boldsymbol{B} \over \partial t}
div(\boldsymbol E) = 0
The 2D domain \Omega is surrounded by a closed contour \partial \Omega as its boundary where the electric field is tangential to the contour :
\boldsymbol{E} \cdot \boldsymbol{n} = 0 on \partial \Omega
The variational formulation with a vector test function \boldsymbol{F} for the first equation would be :
\int_{\Omega} curl(\boldsymbol{E}) \cdot \boldsymbol{F} \,dx = - \int_{\Omega} {\partial \boldsymbol{B} \over \partial t} \cdot \boldsymbol{F} \,dx.
-
It is a first order equation, so no integration by parts is necessary to decrease the constraint on the finite elements. And also I donāt know how a curl fits in an integration by partsā¦
-
\Omega is a 2D domain so E_z = 0 and E_x and E_y are independant of z.
So curl(\boldsymbol{E}) lies only in the z direction and the variational form will be not null only for F_z. I suspect this is the reason why naively assembling the A matrix doesnāt work in the example belowā¦
Expressing the variational form in the z axis results in a scalar equation. That would require a scalar test function while \boldsymbol{E} is still a 2D vector. The test and trial function would then not be in the same space leading to a non square linear system to solve.
The boundary condition also is a scalar equationā¦
What is the proper way to formalize this problem to solve it efficiently with Fenics ?
from fenics import *
mesh = UnitSquareMesh(8,8)
V = VectorFunctionSpace(mesh, 'P', 1, dim=3)
bcs=[]
E = TrialFunction(V)
F = TestFunction(V)
B_dot = Constant((0.0, 0.0, -1.0))
a = dot(curl(E),F)*dx
L = dot(B_dot,F)*dx
A = assemble(a)
# Returns : Index out of bounds.