[deal.II] Re: shift-invert transformation problem with slepc

2021-08-24 Thread Anton Ermakov
Ok, I see - it is that EPS_TARGET_MAGNITUDE flag that was missing. It works 
now! Thanks a lot, Simon.
Anton.

On Tuesday, August 24, 2021 at 12:14:20 AM UTC-6 simon...@gmail.com wrote:

> 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
>
> On Tuesday, August 24, 2021 at 3:39:29 AM UTC+2 anton.i...@gmail.com 
> wrote:
>
>> 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.
>>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/879b9d55-f2ae-456f-828b-91bb26b6ba20n%40googlegroups.com.


[deal.II] Re: shift-invert transformation problem with slepc

2021-08-24 Thread simon...@gmail.com
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

On Tuesday, August 24, 2021 at 3:39:29 AM UTC+2 anton.i...@gmail.com wrote:

> 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.
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/ada0420b-83b5-4af0-a77c-d71c9af63dd6n%40googlegroups.com.