@BillS Thank you! That sounds like a good suggestion. I followed a previous comment from @nate and started reformulating my problem. I got stuck with the sesquilinearity of my variational formulation though, (u, v) = \int_\Omega u \overline{v} \; \mathrm{d} x = (u_r + j u_j, v_r - j v_j). Do I use this to flip signs when I define the elements of my final matrices (in particular the ‘imaginary’ system)? For example here,
s_tt_i = 1.0/u_r * inner(curl_t(v_N_i), curl_t(u_N_i))
t_tt_i = e_r * inner(v_N_i, u_N_i)
s_zz_i = 1.0/u_r * inner(grad(v_L_i), grad(u_L_i))
Creating a new function for inner wouldn’t really cut it no?
The other changes I implemented were:
-
mixed function space with both real and imaginary part (where N denote vector and L Lagrange elements)
W = FunctionSpace(mesh, MixedElement([vector_element, nodal_element, vector_element, nodal_element]))
U, V = TrialFunction(W), TestFunction(W)u_N_r, u_L_r, u_N_i, u_L_i = split(U)
v_N_r, v_L_r, v_N_i, v_L_i = split(V) -
write out my original formulation for both real and imaginary, assemble matrices, apply bcs add both together and solve.
electric_wall = DirichletBC(W, Constant((0.0, 0.0, 0.0, 0.0, 0.0, 0.0)), DomainBoundary())
A_i = PETScMatrix()
…
assemble(a_i, tensor=A_i)
…
electric_wall.apply(A_i)
…
A = A_r + A_i