# Solver for complex-valued Maxwell equation

**URL:** <https://community.freefem.org/t/solver-for-complex-valued-maxwell-equation/3112>\
**Category:** General Discussion\
**Created:** [April 19, 2024, 2:37pm UTC](https://community.freefem.org/t/solver-for-complex-valued-maxwell-equation/3112 "2024-04-19T14:37:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aanovotny](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@aanovotny](https://community.freefem.org/u/aanovotny)\
**Post date:** [April 19, 2024, 2:37pm UTC](https://community.freefem.org/t/solver-for-complex-valued-maxwell-equation/3112/1 "2024-04-19T14:37:19Z")

</div>

Hi!  
I am solving a complex-valued Maxwell equation, as follows:

load “lapack”  
load “MUMPS”  
load “PETSc-complex”  
load “Element\_Mixte3d”

func Pk = Edge03d;  
fespace Vhk(Th,Pk, periodic = [[1,y,z],[2,y,z],[3,x,z],[4,x,z],[5,x,y],[6,x,y]]);  
varf cprob(def(V), def(W)) = int3d(Th, qforder = 4)(1.0/mur\*(Bx(V)_Bx(W) + By(V)By(W) + Bz(V)Bz(W)) - k0^2nn(Vx_Wx + Vy_Wy + Vz_Wz));  
matrix\<complex\> A = cprob(Vhk, Vhk, solver = “MUMPS”); // cell problem

It seems the solution precision is not awesome. I am wondering on how to improve it. I mean, can I replace solver = “MUMPS” by something more appropriate to the problem I am dealing with?Thanks!
