Hi!

I want to solve a nonlinear nonsymmetric system of equation via a newton raphson iteration.

The problem is defined as:

fesCurl_cplx = HCurl(mesh, order = 3, nograds = True, complex = True)

fes1_cplx_iron = H1(mesh, order = 3, complex = True)

fesMixed = FESpace([fesCurl_cplx, fes1_cplx_iron])

u_A, u_Psi = fesMixed.TrialFunction()

v_A, v_Psi = fesMixed.TestFunction()

sysmat_Mixed = BilinearForm(fesMixed)

sysmat_Mixed += SymbolicBFI(

mu_inv*curl(u_A) curl(v_A) +*sigma

1jomega

*v_A*u_A +

1j

*omega*sigma

*v_A*grad(u_Psi)

*u_Psi +*

1jomega

1j

*sigma*grad(v_Psi)

*grad(u_Psi) +*

1jomega

1j

*sigma*grad(v_Psi)

*u_A)*

rhs_Mixed = LinearForm(fesMixed)

rhs_Mixed += SymbolicLFI(v_Aj_coil)

rhs_Mixed = LinearForm(fesMixed)

rhs_Mixed += SymbolicLFI(v_A

rhs_Mixed.Assemble()

sol_Mixed = GridFunction(fesMixed, name = “Mixed”)

The Newton Raphson iteration works like this:

lhs = sol_Mixed.vec.CreateVector()

res = sol_Mixed.vec.CreateVector()

dsol = sol_Mixed.vec.CreateVector()

for it in range(10):

# calculate residual vector

sysmat_Mixed.Apply(sol_Mixed.vec, lhs)

res.data = rhs_Mixed.vec - lhs

```
# create preconditioner
pre = Preconditioner(sysmat_Mixed, "bddc") # "bddc", "multigrid"
# assemble linearized system matrix
sysmat_Mixed.AssembleLinearization(sol_Mixed.vec)
# solve linear system of equations
solvers.GMRes(A = sysmat_Mixed.mat, pre = pre.mat, b = res,
x = dsol, printrates = True, tol = 1e-10, maxsteps = 200)
# update solution
sol_Mixed.vec.data -= dsol
# check convergence
resval = sqrt(abs(InnerProduct(dsol, res)))
print ("residual = ", resval)
if resval < 1e-8:
break
```

For the first iteration loop this works fine but when assembling the linearization for the second time, the program crashes.

How can I fix that?

Thanks!

Nils