SLEPc Shift Invert

64 views
Skip to first unread message

Jonathan Russ

unread,
May 11, 2016, 10:34:57 PM5/11/16
to deal.II User Group
Hello -

I was using step-36 as a starting place to write my own modal analysis code. In version 8.3.0 everything seemed to be working just fine, however since upgrading to 8.4.0 I get the following error (attached as an image) when I try to run the same code. I checked step-36 to be sure it is running correctly but it does not use the TransformationShiftInvert method in SLEPc that I require. Here is the snippet of my solver code that isn't working anymore.

 
 template <int dim>
 
unsigned int EigenvalueProblem<dim>::solve ()
 
{
     
    std
::cout << "   Number of eigenvectors requested: "
             
<< eigenvectors.size() << std::endl;

   
SolverControl solver_control (2000, 1e-9);
   
SLEPcWrappers::SolverKrylovSchur eigensolver(solver_control);
    eigensolver
.set_which_eigenpairs (EPS_SMALLEST_REAL);
    eigensolver
.set_problem_type (EPS_GHEP);
   
   
double eigen_shift = std::pow( 2.0 * PI * parameters.get_double ("Shift frequency"), 2.0);
   
SLEPcWrappers::TransformationShiftInvert::AdditionalData additional_data(eigen_shift);
   
SLEPcWrappers::TransformationShiftInvert shift (additional_data);
    eigensolver
.set_transformation (shift);
     
    eigensolver
.solve (stiffness_matrix,mass_matrix,eigenvalues,eigenvectors,
                       eigenvectors
.size());

   
for (unsigned int i=0; i<eigenvectors.size(); ++i)
      eigenvectors
[i] /= eigenvectors[i].linfty_norm ();

   
// Finally return the number of iterations it took to converge:
   
return solver_control.last_step ();
 
}

I do not wish to use MPI at this point. Is it still possible to invoke this solver in serial with only "additional_data" (no mpi_communicator)?

Thank you in advance for your help.

Jonathan
Error.png

Denis Davydov

unread,
May 12, 2016, 7:44:20 AM5/12/16
to deal.II User Group
Hi Jonathan,

Between 8.3 and 8.4 the interface to spectral transformation changed, so that's why you have an error,
That has to do that now Spectral transformation classes initialize the underlying SLEPc objects straight away,
and to that end SLEPc needs MPI communicator irrespectively of MPI or no-MPI run:


For serial case without MPI, i guess you can just pass PETSC_COMM_SELF or PETSC_COMM_WORLD,
You may still need to run in your main()

Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1);


Regards,
Denis.

Toni Vidal

unread,
May 12, 2016, 7:46:14 AM5/12/16
to deal.II User Group
Hi Jonathan,

Some functions in the SLEPcWrappers now need to be passed a MPI_Comm to their constructor as TransformationShiftInvert (const MPI_Comm &mpi_communicator, const AdditionalData &data=AdditionalData()). So just pass it even you are working in serial.

    SLEPcWrappers::TransformationShiftInvert shift (MPI_COMM_WORLDadditional_data);

Note that in the step-36 only can be run in serial as it is said in its main.

ExcMessage("This program can only be run in serial, use ./step-36"));

El dijous, 12 maig de 2016 4:34:57 UTC+2, Jonathan Russ va escriure:

Jonathan Russ

unread,
May 12, 2016, 8:43:05 PM5/12/16
to deal.II User Group
Great! Thank you very much! That worked perfectly!
Reply all
Reply to author
Forward
0 new messages