Re: [petsc-users] BCs for a EPS solver

2020-02-17 Thread Matthew Knepley
On Mon, Feb 17, 2020 at 4:33 PM Emmanuel Ayala 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

Re: [petsc-users] Matrix-free method in PETSc

2020-02-17 Thread Smith, Barry F. via petsc-users
> On Feb 17, 2020, at 7:56 AM, Yuyun Yang wrote: > > Hello, > > I actually have a question about the usage of DMDA since I'm quite new to > this. I wonder if the DMDA suite of functions can be directly called on > vectors created from VecCreate? Yes, but you have to make sure the ones

Re: [petsc-users] BCs for a EPS solver

2020-02-17 Thread Emmanuel Ayala
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: [0]PETSC ERROR: - Error Message

Re: [petsc-users] Crash caused by strange error in KSPSetUp

2020-02-17 Thread Richard Beare via petsc-users
Awesome - thanks for that. I will check it out. I will also look at what needs to be done to bring simulatrophy to a more recent version of petsc. On Tue, 18 Feb 2020 at 03:19, Junchao Zhang wrote: > Hi, Richard, > I tested the case you sent over and found it did fail due to the 32-bit >

Re: [petsc-users] Forming a matrix from vectors

2020-02-17 Thread Zhang, Hong via petsc-users
You can create a dense matrix and use VecPlaceArray() to take a column out of the matrix as a vector. For example, MatCreateDense() MatDenseGetColumn(A,0,col) VecPlaceArray(v,col) … // fill in the vector with values VecResetArray(v) MatDenseRestoreColumn(A,) Hong (Mr.) > On Feb 17, 2020, at

Re: [petsc-users] BCs for a EPS solver

2020-02-17 Thread Matthew Knepley
On Mon, Feb 17, 2020 at 1:59 PM Emmanuel Ayala 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

Re: [petsc-users] BCs for a EPS solver

2020-02-17 Thread Emmanuel Ayala
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 Any other suggestions? Kind regards. El lun.,

Re: [petsc-users] BCs for a EPS solver

2020-02-17 Thread Jeremy Theler
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

[petsc-users] BCs for a EPS solver

2020-02-17 Thread Emmanuel Ayala
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

Re: [petsc-users] SLEPc: The inner product is not well defined

2020-02-17 Thread Emmanuel Ayala
Thank you very much for the answer. This error appears when computing the B-norm of a vector x, as > sqrt(x'*B*x). Probably your B matrix is semi-definite, and due to > floating-point error the value x'*B*x becomes negative for a certain vector > x. The code uses a tolerance of

Re: [petsc-users] Crash caused by strange error in KSPSetUp

2020-02-17 Thread Junchao Zhang via petsc-users
Hi, Richard, I tested the case you sent over and found it did fail due to the 32-bit overflow on number of non-zeros, and with a 64-bit built petsc it passed. You had a typo when you reported that --with-64-bit-indicies=yes failed. It should be --with-64-bit-indices=yes. You can go with a 64-bit

Re: [petsc-users] Matrix-free method in PETSc

2020-02-17 Thread Matthew Knepley
On Mon, Feb 17, 2020 at 8:56 AM Yuyun Yang wrote: > Hello, > > I actually have a question about the usage of DMDA since I'm quite new to > this. I wonder if the DMDA suite of functions can be directly called on > vectors created from VecCreate? Or the vectors have to be formed by >

Re: [petsc-users] Matrix-free method in PETSc

2020-02-17 Thread Yuyun Yang
Hello, I actually have a question about the usage of DMDA since I'm quite new to this. I wonder if the DMDA suite of functions can be directly called on vectors created from VecCreate? Or the vectors have to be formed by DMDACreateGlobalVector? I'm also not sure about what the dof and stencil

Re: [petsc-users] Forming a matrix from vectors

2020-02-17 Thread Matthew Knepley
On Mon, Feb 17, 2020 at 4:24 AM Jose E. Roman wrote: > I would use MatDenseGetColumn() and VecGetArrayRead() to get the two > pointers and then copy the values with a loop. > I would do as Jose says to get it working. After you verify it, we could show you how to avoid a copy. Thanks,

Re: [petsc-users] Forming a matrix from vectors

2020-02-17 Thread Jose E. Roman
I would use MatDenseGetColumn() and VecGetArrayRead() to get the two pointers and then copy the values with a loop. Jose > El 17 feb 2020, a las 9:35, Eda Oktay escribió: > > Hello all, > > I am trying to form a matrix whose columns are eigenvectors I have calculated > before U =

[petsc-users] Forming a matrix from vectors

2020-02-17 Thread Eda Oktay
Hello all, I am trying to form a matrix whose columns are eigenvectors I have calculated before U = [v1,v2,v3]. Is there any easy way of forming this matrix? My matrix should be parallel and I have created vectors as below, where nev i s the number of requested eigenvalues. So each V[i]