Re: [petsc-users] Use Vectors and Scalars in MatNest matrices

2022-11-14 Thread Mark Adams
Not exactly. But you can make a Mat for each. Mark On Mon, Nov 14, 2022 at 8:59 AM Thomas Hisch wrote: > Hi! > > I would like to ask if it is possible to create a MatNest matrix that > contains matrices, vectors and scalars. > > My (jacobian) matrix looks like the following > > [[A, B, a, b], >

Re: [petsc-users] Use Vectors and Scalars in MatNest matrices

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 8:59 AM Thomas Hisch wrote: > Hi! > > I would like to ask if it is possible to create a MatNest matrix that > contains matrices, vectors and scalars. > No, You would turn everything into a type of matrix, but you can get the effect you want. Vectors can be easily used to

[petsc-users] Use Vectors and Scalars in MatNest matrices

2022-11-14 Thread Thomas Hisch
Hi! I would like to ask if it is possible to create a MatNest matrix that contains matrices, vectors and scalars. My (jacobian) matrix looks like the following [[A, B, a, b], [C, D, c, d], [e, f, g, h]] where A-D are sparse square matrices, a-d are dense column vectors, e, f are sparse row

Re: [petsc-users] Use Vectors and Scalars in MatNest matrices

2022-11-14 Thread Thomas Hisch
On Mon, Nov 14, 2022 at 3:06 PM Matthew Knepley wrote: > > On Mon, Nov 14, 2022 at 8:59 AM Thomas Hisch wrote: >> >> Hi! >> >> I would like to ask if it is possible to create a MatNest matrix that >> contains matrices, vectors and scalars. > > > No, You would turn everything into a type of

[petsc-users] Kokkos backend for Mat and Vec diverging when running on CUDA device.

2022-11-14 Thread Fackler, Philip via petsc-users
This is an issue I've brought up before (and discussed in-person with Richard). I wanted to bring it up again because I'm hitting the limits of what I know to do, and I need help figuring this out. The problem can be reproduced using Xolotl's "develop" branch built against a petsc build with

[petsc-users] Using multiple MPI ranks with COO interface crashes in some cases

2022-11-14 Thread Fackler, Philip via petsc-users
In Xolotl's "feature-petsc-kokkos" branch, I have moved our code to use the COO interface for preallocating and setting values in the Jacobian matrix. I have found that with some of our test cases, using more than one MPI rank results in a crash. Way down in the preconditioner code in petsc a

Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Barry Smith
Very sorry for wasting so much of your time. The PCFIELDSPLIT generally will not work with BAIJ matrices because the MatCreateSubMatrix() for BAIJ requires indexing by block in the matrix. Your code should work if you use MPIAIJ matrices. Note you can still use MatSetValuesBlocked() with

Re: [petsc-users] Reference element in DMPlexComputeCellGeometryAffineFEM

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 4:19 PM Blaise Bourdin wrote: > Replying to myself so that it gets into the googles: > > The reference tetrahedron used by DMPlexComputeCellGeometryAffineFEM has > vertices at (-1,1,-1), (-1,-1,-1), (1, -1, -1) and (-1,-1,1). > It is (-1, -1, -1) -- (-1, 1, -1) -- (1,

Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Barry Smith
Can you clarify what you mean? For some classes of problems, PCFIELDSPLIT can be a very efficacious preconditioner; for example when certain fields have very different mathematical structure than others. In those cases it is worth using AIJ and PCFIELDSPLIT instead of keeping BAIJ. > On

Re: [petsc-users] On PCFIELDSPLIT and its implementation

2022-11-14 Thread Edoardo alinovi
Thanks Barry, Your help is always much appreciated! I'll try this out asap. I have ended using baij because I have read the section "solving block matrices" and I was thinking that baij was the only way to use fieldsplit! Completely misunderstood then! Il Lun 14 Nov 2022, 20:34 Barry Smith ha

Re: [petsc-users] Reference element in DMPlexComputeCellGeometryAffineFEM

2022-11-14 Thread Blaise Bourdin
Replying to myself so that it gets into the googles: The reference tetrahedron used by DMPlexComputeCellGeometryAffineFEM has vertices at (-1,1,-1), (-1,-1,-1), (1, -1, -1) and (-1,-1,1). Blaise   On Nov 10, 2022, at 6:42 PM, Matthew Knepley wrote: On Thu, Nov 10,

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Junchao Zhang
On Mon, Nov 14, 2022 at 8:05 PM Mohammad Ali Yaqteen wrote: > I am sorry for the trouble but I don’t understand its usage. Like I want > to read Vec xr. I am giving it to a pointer array. How would I access the > values of the vector? Could you please briefly explain? > Suppose you have a vector

Re: [petsc-users] Using multiple MPI ranks with COO interface crashes in some cases

2022-11-14 Thread Barry Smith
Mat of type (null) Either the entire matrix (header) data structure has gotten corrupted or the matrix type was never set. Can you run with valgrind to see if there is any memory corruption? > On Nov 14, 2022, at 1:24 PM, Fackler, Philip via petsc-users > wrote: > > In Xolotl's

Re: [petsc-users] Using multiple MPI ranks with COO interface crashes in some cases

2022-11-14 Thread Junchao Zhang
Hi, Philip, Can you tell me instructions to build Xolotl to reproduce the error? --Junchao Zhang On Mon, Nov 14, 2022 at 12:24 PM Fackler, Philip via petsc-users < petsc-users@mcs.anl.gov> wrote: > In Xolotl's "feature-petsc-kokkos" branch, I have moved our code to use > the COO interface for

[petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
I am using the following procedure to read from Vec, but it keeps giving me the same values! I was told that using VecGetValues gives wrog output. If not this, then what function should be used to read the contents of a vector? for (int i = 0; i < nconv; i++) {

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 7:50 PM Mohammad Ali Yaqteen wrote: > I am using Eigen library to which I have to write these vector values from > PETSc Vec. tdof is the length of the vector that I need and ei is the > number of value in as an index: > > PetscIntei[tdof]; > PetscScalar eveci[tdof];

Re: [petsc-users] Kokkos backend for Mat and Vec diverging when running on CUDA device.

2022-11-14 Thread Junchao Zhang
Hi, Philip, Sorry to hear that. It seems you could run the same code on CPUs but not no GPUs (with either petsc/Kokkos backend or petsc/cuda backend, is it right? --Junchao Zhang On Mon, Nov 14, 2022 at 12:13 PM Fackler, Philip via petsc-users < petsc-users@mcs.anl.gov> wrote: > This is an

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 7:39 PM Mohammad Ali Yaqteen wrote: > I am using the following procedure to read from Vec, but it keeps giving > me the same values! I was told that using VecGetValues gives wrog output. > By who? It does not give the wrong output. You do not show where in the code you

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
I am sorry for the trouble but I don’t understand its usage. Like I want to read Vec xr. I am giving it to a pointer array. How would I access the values of the vector? Could you please briefly explain? From: Matthew Knepley Sent: Tuesday, November 15, 2022 9:54 AM To: Mohammad Ali Yaqteen

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
I am using Eigen library to which I have to write these vector values from PETSc Vec. tdof is the length of the vector that I need and ei is the number of value in as an index: PetscIntei[tdof]; PetscScalar eveci[tdof]; for (int i = 0; i < tdof; i++) ei[i] = i; if (nconv>0) {