Dear all,
I’m currently reproducing a paper: Sabino 2020. It’s background in physics is the vortex-induced vibration of a spring-mounted, damped, rigid circular cylinder, immersed in a Newtonian viscous flow and capable of moving in the direction orthogonal to the unperturbed flow.

I wrote a similar program based on this script——navier-stokes-2d-SLEPc-complex.edp, but it made some errors that I couldn’t understand.

This is my script and log files: (688.2 KB)
I have simplified the script as much as possible. I guess the error is in the matrix entered into
EPSSolve(). But I don’t know the exact reason for the error.

Thank you in advance!

Please update your FreeFEM/PETSc installation if you want to feed a MatNest to EPSSolve() directly, or use an intermediate call to MatConvert().

Dear @prj,
Thank you very much for your quick reply.

  1. My FreeFem++ version is 4.13 and I’m running on Windows 11. Although the FreeFem++ official website has been updated to version 4.14, it is currently a pre-release, and there is no windows version. In fact, I did find that my macro_ddm.idp file was different from that in FreeFem-sources. For example, the difference between macro DmeshBuild() and DmeshCreate(). I’m not sure what the difference is, but I think the functionality embodied in the scripts is the same.
  2. Thanks again for your help. Although I don’t understand the meaning of MatNest and MatConvert(), my script is running. There may still be some problems with the scripts, but I will continue to debug it. In addition , can you help me understand the meaning of MatNest and MatConvert().


Here are some references: FreeFem-sources/examples/hpddm/laplace-lagrange-PETSc.edp at 220957ed86797a6c1ed771f1fe1c27078e94f28a · FreeFem/FreeFem-sources · GitHub and MATNEST — PETSc v3.20.3-461-g585a01bd688 documentation.

Dear prj,
Thank you so much for your assistance. I think the scripts has the effect I wanted. And these references help me understand MatConvert() and MatNest. But now I have some new questions. In my script, EPSSolve() take the following sparams:

string params = " -eps_tol 1.0e-10 " +
" -eps_nev " + nev + " " +
" -eps_type krylovschur " +
" -st_type sinvert " +
// " -st_pc_type lu " +
" -st_pc_type cholesky " +
// " -st_matstructure same " +
// " -eps_monitor_all " +
// " -eps_view " +
// " -eps_view_value " +
" -eps_target " + real(SHIFT) + “+” + imag(SHIFT) + “i” + " " +
" -eps_gen_nonhermitian"
int k = EPSSolve(A, B, array = EigenVEC, values = val, sparams = params);

Of course, during testing I found that iterations would not converge if I used -st_pc_type cholesky. So I used -st_pc_type lu, and I got really good results because of it.
I can understand the meaning of some of these sparams, but these sparams are transferred from other scripts. Is there a specific reference to introduce all the sparams of EPSSolve()?


You can have a look at the SLEPc and PETSc users manual, e.g.,

Ok, I get it. Thanks for your help.

Dear prj,

I have a new question about EPSSolve. I;m reading this help manual slepc.pdf. I find the Advanced Usage of EPS described in Chapter 2, section 6. Section 2.6.1 is about entering an initial guess into EPS.

This gives me a little insight that I can assign the calculated eigenmode to the next eigenvalue as an initial guess. In SLEPc, they provide the command EPSSetInitialSpace(EPS eps, PetscInt n, Vec is[]). However, I did not find similar examples in FreeFem.

In the source file FreeFem-sources/plugin/mpi/SLEPc-code.hpp, there have the command EPSSetInitialSpace()EPSSetInitialSpace(). Therefore, I believe it is possible to add an initial guess for EPSSolve() in FreeFem. Can you give me a typical example. Thank you in advance!