one to solve with PETSc (SNESSolve) a nonlinear problem → let’s call the solution u,

one to solve with SLEPc complex (EPSSolve) an eigenvalue problem that depends on u → let’s call the eigenmode v.

This is working correctly.

Now, I would like to use a third code to solve another (linear) problem that depends on both u and v. I have tried to define and solve the problem naively with problem. I do obtain a solution, but it seems that the original partition is not preserved correctly: saving the solution with savevtk and visualizing it in Paraview shows something that is messed up (I’m using the exact same savevtk command as for u and v).

I’m not sure what is the best way to do that. Should I use varf instead of problem? Do I need PETSc? Some advice and/or an example would be very helpful.

I’m trying to follow exactly navier-stokes-2d-SLEPc-complex.edp. In line 19, does it make a difference whether one uses mesh Th; or meshN Th;? In the latter case, line 21 loadDmesh(Th, ...) works, but in the former case it yields an error:

– FreeFem++ v4.9 (Fri Jun 18 14:45:02 CEST 2021 - git v4.9)
Load: lg_fem lg_mesh lg_mesh3 eigenvalue parallelempi
load: init metis (v 5 )
error operator = PPKN5Fem2D4MeshE, N5Fem2D5Mesh3E
(…)
Error line number 465, in file macro: loadDmesh in /home/FreeFem/lib/ff++/4.9/idp/macro_ddm.idp, before token ;

meshN is a template-like type that will automatically translate to mesh or mesh3, depending on whether you define macro dimension()2// or macro dimension()3// before the inclusion of macro_ddm.idp. So, yes, it makes a difference if you are doing 3D. Otherwise, no difference. The type N5Fem2D5Mesh3E from your log indicates that you are doing 3D, so switch to either meshN Th or mesh3 Th.

Now I’m trying to solve the linear system. What should I use? (You suggested I use the same routines as in navier-stokes-2d-SLEPc-complex.edp, but those are for an eigenvalue problem. And those in navier-stokes-2d-PETSc.edp are for a non-linear system.)

I don’t seem to be able to mix real and complex quantities. In my case u is real and v is complex. Should I define everything as complex?