shift-invert transformation problem with slepc

38 views
Skip to first unread message

Anton Ermakov

unread,
Aug 23, 2021, 9:39:29 PM8/23/21
to deal.II User Group
Dear All,

I am trying to use a shift-invert transformation in step-36. I did minimal changes in the solve function adding the following code that describes what spectral transformation I need to do:

SolverControl solver_control (dof_handler.n_dofs(), 1e-9);
SLEPcWrappers::SolverKrylovSchur eigensolver(solver_control);
eigensolver.set_which_eigenpairs (EPS_SMALLEST_REAL);
eigensolver.set_problem_type (EPS_GHEP);

double eigen_shift = 1.0e-4;
SLEPcWrappers::TransformationShiftInvert::AdditionalData additional_data(eigen_shift);
SLEPcWrappers::TransformationShiftInvert shift (MPI_COMM_WORLD, additional_data);
eigensolver.set_transformation (shift);

eigensolver.solve(stiffness_matrix,
                      mass_matrix,
                      eigenvalues,
                      eigenfunctions,
                      eigenfunctions.size());

and it gives me the following error: 

[0]PETSC ERROR: Shift-and-invert requires a target 'which' (see EPSSetWhichEigenpairs), for instance -st_type sinvert -eps_target 0 -eps_target_magnitude

Any help to resolve this error is greatly appreciated. I also attached the full code of modified step-36.

Thank you,
Anton.
step-36.cc

simon...@gmail.com

unread,
Aug 24, 2021, 2:14:20 AM8/24/21
to deal.II User Group
Hi,

I think you need to set both which eigen pair and the target value. For example, if you look for the eigenvalue closest in magnitude to 0, you need to set the following

const double target_eigenvalue = 0;
eigensolver.set_which_eigenpairs(EPS_TARGET_MAGNITUDE);
eigensolver.set_target_eigenvalue(target_eigenvalue);

Depending on slepc version it might be that you can only choose EPS_TARGET_MAGNITUDE. See question 8 here:

https://slepc.upv.es/documentation/faq.htm

Best,
Simon

Anton Ermakov

unread,
Aug 24, 2021, 1:27:13 PM8/24/21
to deal.II User Group
Ok, I see - it is that EPS_TARGET_MAGNITUDE flag that was missing. It works now! Thanks a lot, Simon.
Anton.

Reply all
Reply to author
Forward
0 new messages