Complex-valued formulation returns NaNs
I would like to convert the curl-curl demo into something that can deal with complex values, so as advised in several answers around here, I split the problem into real an imaginary part and pose the problem in the product space.
As a first attempt, I tried converting the exact demo problem into product space:
=======
from dolfin import *
parameters[
mesh = UnitSphere(8)
PN = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
W = PN * PN
bc = DirichletBC(W, (0, 0, 0, 0, 0, 0), "on_boundary")
rhs = project(
A = Function(W)
v0 = TestFunction(W)
u0 = TrialFunction(W)
ur = u0[0]
ui = u0[1]
vr = v0[0]
vi = v0[1]
a = inner(curl(ur), curl(vr))*dx - inner(curl(ui), curl(vi))*dx \
+ inner(curl(ur), curl(vi))*dx + inner(curl(ui), curl(vr))*dx
L = -inner(
- inner(rhs[0],vi)*dx - inner(rhs[1], vr)*dx
solve(a == L, A, bc)
Ar, Ai = A.split()
P1 = VectorFunctionS
v1 = TestFunction(P1)
u1 = TrialFunction(P1)
J = Function(P1)
solve(inner(v1, u1)*dx == dot(v1, curl(Ar))*dx, J)
plot(J, vmin=-1.0, vmax=1.0)
file=File(
file << J
interactive()
=======
The density equation for J is solved with real(A) as a right hand side, so I expected to get the same result as in the vanilla real-valued demo. Hoever, no data is plotted and the color bar indicates a number of NaNs.
What could be the problem?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Nico Schlömer
- Solved:
- Last query:
- Last reply: