[petsc-users] BCs for a EPS solver
Emmanuel Ayala
juaneah at gmail.com
Tue Feb 18 13:18:35 CST 2020
Thanks for the answer.
Finally I generate a submatrix and It worked.
Kind regards.
El mar., 18 de feb. de 2020 a la(s) 03:51, Jose E. Roman (jroman at dsic.upv.es)
escribió:
> You put alpha on the diagonal of A and beta on the diagonal of B to get an
> eigenvalue lambda=alpha/beta. If you set beta=0 then lambda=Inf. The choice
> depends on where your wanted eigenvalues are and how you are solving the
> eigenproblem. The choice of lambda=Inf suggested by Jeremy avoids inserting
> eigenvalues that may interfere with the problem's eigenvalues, but this is
> good for shift-and-invert, not for the case where you solve linear systems
> with B.
>
> Anyway, this kind of manipulation may have an impact on convergence of the
> eigensolver or on conditioning of the linear solves. A possibly better
> approach is just to get rid of the BC unknowns by creating smaller A, B
> matrices, e.g. with MatGetSubMatrix().
>
> Jose
>
>
> El 18 feb 2020, a las 0:41, Matthew Knepley <knepley at gmail.com> escribió:
>
> On Mon, Feb 17, 2020 at 4:33 PM Emmanuel Ayala <juaneah at gmail.com> wrote:
>
>> Hi,
>>
>> Thank you for the clarification, now I understand what means change those
>> values, and I tried to do that.
>>
>> But if I put the row i to the identity in A, and zero in B, the solver
>> crash:
>>
>
> So if you need to factor B, maybe reverse it?
>
> Thanks,
>
> Matt
>
>
>> [0]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>> [0]PETSC ERROR: Error in external library
>> [1]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>> [1]PETSC ERROR: Error in external library
>> [1]PETSC ERROR: Error reported by MUMPS in numerical factorization phase:
>> INFOG(1)=-10, INFO(2)=0
>>
>> [1]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for
>> trouble shooting.
>> [1]PETSC ERROR: Petsc Release Version 3.12.3, Jan, 03, 2020
>> [1]PETSC ERROR: [2]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>> [2]PETSC ERROR: Error in external library
>> [2]PETSC ERROR: Error reported by MUMPS in numerical factorization phase:
>> INFOG(1)=-10, INFO(2)=0
>>
>> [2]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for
>> trouble shooting.
>> [2]PETSC ERROR: Petsc Release Version 3.12.3, Jan, 03, 2020
>> [2]PETSC ERROR: ./comp on a arch-linux-c-opt-O2-mumps named ayala by
>> ayala Mon Feb 17 15:28:01 2020
>> [3]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>> [3]PETSC ERROR: Error in external library
>> [3]PETSC ERROR: Error reported by MUMPS in numerical factorization phase:
>> INFOG(1)=-10, INFO(2)=0
>>
>> [3]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for
>> trouble shooting.
>> [3]PETSC ERROR: Petsc Release Version 3.12.3, Jan, 03, 2020
>> [3]PETSC ERROR: ./comp on a arch-linux-c-opt-O2-mumps named ayala by
>> ayala Mon Feb 17 15:28:01 2020
>> [3]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O2
>> -march=native -mtune=native" CXXOPTFLAGS="-O2 -march=native -mtune=native"
>> FOPTFLAGS="-O2 -march=native -mtune=native" --download-mpich
>> --download-mumps --download-scalapack --download-parmetis --download-metis
>> --download-superlu_dist --download-cmake --download-fblaslapack=1
>> --with-cxx-dialect=C++11
>> [3]PETSC ERROR: #1 MatFactorNumeric_MUMPS() line 1365 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/impls/aij/mpi/mumps/mumps.c
>> [0]PETSC ERROR: Error reported by MUMPS in numerical factorization phase:
>> INFOG(1)=-10, INFO(2)=33
>>
>> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for
>> trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.12.3, Jan, 03, 2020
>> [0]PETSC ERROR: ./comp on a arch-linux-c-opt-O2-mumps named ayala by
>> ayala Mon Feb 17 15:28:01 2020
>> [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O2
>> -march=native -mtune=native" CXXOPTFLAGS="-O2 -march=native -mtune=native"
>> FOPTFLAGS="-O2 -march=native -mtune=native" --download-mpich
>> --download-mumps --download-scalapack --download-parmetis --download-metis
>> --download-superlu_dist --download-cmake --download-fblaslapack=1
>> --with-cxx-dialect=C++11
>> [0]PETSC ERROR: #1 MatFactorNumeric_MUMPS() line 1365 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/impls/aij/mpi/mumps/mumps.c
>> ./comp on a arch-linux-c-opt-O2-mumps named ayala by ayala Mon Feb 17
>> 15:28:01 2020
>> [1]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O2
>> -march=native -mtune=native" CXXOPTFLAGS="-O2 -march=native -mtune=native"
>> FOPTFLAGS="-O2 -march=native -mtune=native" --download-mpich
>> --download-mumps --download-scalapack --download-parmetis --download-metis
>> --download-superlu_dist --download-cmake --download-fblaslapack=1
>> --with-cxx-dialect=C++11
>> [1]PETSC ERROR: #1 MatFactorNumeric_MUMPS() line 1365 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/impls/aij/mpi/mumps/mumps.c
>> [1]PETSC ERROR: #2 MatLUFactorNumeric() line 3057 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/interface/matrix.c
>> [2]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O2
>> -march=native -mtune=native" CXXOPTFLAGS="-O2 -march=native -mtune=native"
>> FOPTFLAGS="-O2 -march=native -mtune=native" --download-mpich
>> --download-mumps --download-scalapack --download-parmetis --download-metis
>> --download-superlu_dist --download-cmake --download-fblaslapack=1
>> --with-cxx-dialect=C++11
>> [2]PETSC ERROR: #1 MatFactorNumeric_MUMPS() line 1365 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/impls/aij/mpi/mumps/mumps.c
>> [2]PETSC ERROR: #2 MatLUFactorNumeric() line 3057 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/interface/matrix.c
>> [2]PETSC ERROR: [3]PETSC ERROR: #2 MatLUFactorNumeric() line 3057 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/interface/matrix.c
>> [3]PETSC ERROR: #3 PCSetUp_LU() line 126 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/impls/factor/lu/lu.c
>> [3]PETSC ERROR: #4 PCSetUp() line 894 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: #2 MatLUFactorNumeric() line 3057 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #3 PCSetUp_LU() line 126 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/impls/factor/lu/lu.c
>> [0]PETSC ERROR: [1]PETSC ERROR: #3 PCSetUp_LU() line 126 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/impls/factor/lu/lu.c
>> [1]PETSC ERROR: #4 PCSetUp() line 894 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/interface/precon.c
>> [1]PETSC ERROR: #3 PCSetUp_LU() line 126 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/impls/factor/lu/lu.c
>> [2]PETSC ERROR: #4 PCSetUp() line 894 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/interface/precon.c
>> [2]PETSC ERROR: #5 KSPSetUp() line 376 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/ksp/interface/itfunc.c
>> [3]PETSC ERROR: #5 KSPSetUp() line 376 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/ksp/interface/itfunc.c
>> [3]PETSC ERROR: #6 STSetUp_Shift() line 120 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/impls/shift/shift.c
>> #4 PCSetUp() line 894 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: #5 KSPSetUp() line 376 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: #6 STSetUp_Shift() line 120 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/impls/shift/shift.c
>> [0]PETSC ERROR: #5 KSPSetUp() line 376 in
>> /home/ayala/Documents/PETSc/petsc-3.12.3/src/ksp/ksp/interface/itfunc.c
>> [1]PETSC ERROR: #6 STSetUp_Shift() line 120 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/impls/shift/shift.c
>> [1]PETSC ERROR: #7 STSetUp() line 271 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/interface/stsolve.c
>> [1]PETSC ERROR: #8 EPSSetUp() line 273 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/eps/interface/epssetup.c
>> [2]PETSC ERROR: #6 STSetUp_Shift() line 120 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/impls/shift/shift.c
>> [2]PETSC ERROR: #7 STSetUp() line 271 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/sys/classes/st/interface/stsolve.c
>> [2]PETSC ERROR: #8 EPSSetUp() line 273 in
>> /home/ayala/Documents/SLEPc/slepc-3.12.2/src/eps/interface/epssetup.c
>> [2]PETSC ERROR: #9 FourBar_NaturalPulsation() line 3937 in
>> /home/ayala/Nextcloud/cpp_projects/2020-02-13-muboto-balancing-v17-mma/
>> Multibody.cc
>>
>> El lun., 17 de feb. de 2020 a la(s) 13:20, Matthew Knepley (
>> knepley at gmail.com) escribió:
>>
>>> On Mon, Feb 17, 2020 at 1:59 PM Emmanuel Ayala <juaneah at gmail.com>
>>> wrote:
>>>
>>>> Hi, thanks for the quick answer.
>>>>
>>>> I just did it, and it does not work. My problem is GNHEP and I use the
>>>> default solver (Krylov-Schur). Moreover I run the code with the options:
>>>> -st_ksp_type preonly -st_pc_type lu -st_pc_factor_mat_solver_type mumps
>>>>
>>>
>>> I guess a better question is: What do you expect to work?
>>>
>>> For a linear solve,
>>>
>>> A x = b
>>>
>>> if a row i is 0 except for a one on the diagonal, then I get
>>>
>>> x_i = b_i
>>>
>>> so hopefully you put the correct boundary value in b_i. For the
>>> generalized eigenproblem
>>>
>>> A x = \lambda B x
>>>
>>> if you set row i to the identity in A, and zero in B, we get
>>>
>>> x_i = 0
>>>
>>> and you must put the boundary values into x after you have finished the
>>> solve. Is this what you did?
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>
>>>> Any other suggestions?
>>>> Kind regards.
>>>>
>>>> El lun., 17 de feb. de 2020 a la(s) 12:39, Jeremy Theler (
>>>> jeremy at seamplex.com) escribió:
>>>>
>>>>> The usual trick is to set ones in one matrix and zeros in the other
>>>>> one.
>>>>>
>>>>>
>>>>> On Mon, 2020-02-17 at 12:35 -0600, Emmanuel Ayala wrote:
>>>>> > Hi everyone,
>>>>> >
>>>>> > I have an eigenvalue problem where I need to apply BCs to the
>>>>> > stiffness and mass matrix.
>>>>> >
>>>>> > Usually, for KSP solver, it is enough to set to zero the rows and
>>>>> > columns related to the boundary conditions. I used to apply it with
>>>>> > MatZeroRowsColumns, with a 1s on the diagonal. Then the solver works
>>>>> > well.
>>>>> >
>>>>> > There is something similar to KSP for EPS solver ?
>>>>> >
>>>>> > I already used MatZeroRowsColumns (for EPS solver), with a 1s on the
>>>>> > diagonal, and I got wrong result.
>>>>> >
>>>>> > Kind regards.
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> <http://www.cse.buffalo.edu/~knepley/>
>>>
>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200218/f1e5685f/attachment-0001.html>
More information about the petsc-users
mailing list