Hello to everyone!
I am trying to model a velocity vector field of a stationary motion of charged particles inside magnetic field. The equation is very simple:
$$ \dot{\vec{u}}=A \vec{u}\cross\vec{B} $$
$$ A=const $$
but I have troubles composing variational formulation.
Taking this and this examples as guides, I came up with this .ufl file:
from ufl_legacy import (Coefficient, dx,
tetrahedron, Constant, VectorElement,
TestFunctions, TrialFunctions)
dt = 1
A = 1
V = VectorElement("Lagrange", tetrahedron, 2)
u1, u2, u3 = TrialFunctions(V)
un1, un2, un3 = TrialFunctions(V)
v1, v2, v3 = TestFunctions(V)
k = Constant(dt)
A = Constant(A)
B1 = Coefficient(P)
B2 = Coefficient(P)
B3 = Coefficient(P)
a = ((u1 - un1) / k) * v1 * dx - A * (u2 * B3 - u3 * B2) * v1 * dx \
+ ((u2 - un2) / k) * v2 * dx - A * (u3 * B1 - u1 * B3) * v2 * dx \
+ ((u3 - un3) / k) * v3 * dx - A * (u1 * B2 - u2 * B1) * v3 * dx
L = 0
I am planning to define non-constant magnetic field $$ \vec{B} $$ later in .cpp file.
But for now, running the ffc -l dolfin magnetic.ufl
command yields ufl_legacy.log.UFLException: Invalid cell 1.
I believe that this error message is caused by incorrect variational formulation. Does anyone know how to fix it, or alternatively know of a different way of solving this equation?
Many thanks,
Michael