Re: [petsc-users] MPIAIJ MatMult and non conforming object sizes

2024-09-05 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Thank you both for your response. From: Barry Smith Date: Thursday, 5 September 2024 at 23:19 To: Chockalingam, Karthikeyan (STFC,DL,HC) Cc: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] MPIAIJ MatMult and non conforming object sizes You can use MatCreateVecs() to create vectors sized

Re: [petsc-users] MPIAIJ MatMult and non conforming object sizes

2024-09-05 Thread Barry Smith
You can use MatCreateVecs() to create vectors sized properly for both x and y in y = Ax when A is not square. > On Sep 5, 2024, at 5:20 PM, Karthikeyan Chockalingam - STFC UKRI via > petsc-users wrote: > > Hello, > > I am unsure why the program crashes even while running the code seriall

Re: [petsc-users] MPIAIJ MatMult and non conforming object sizes

2024-09-05 Thread Junchao Zhang
It is triggered by PetscCheck(mat->rmap->N == y->map->N, PetscObjectComm((PetscObject)mat), PETSC_ERR_ARG_SIZ, "Mat mat,Vec y: global dim %" PetscInt_FMT " %" PetscInt_FMT, mat->rmap->N, y->map->N); The error says in your y = Ax, A has 40 rows but y has 25. Generally, VecDuplicate(par_xcoord,&par

[petsc-users] MPIAIJ MatMult and non conforming object sizes

2024-09-05 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Hello, I am unsure why the program crashes even while running the code serially petscErr = MatCreate(mesh.comm().get(), &par_G); petscErr = MatSetType(par_G, MATMPIAIJ); petscErr = MatSetSizes(par_G, local_num_rows, local_num_cols, total_num_rows, total_num_cols); PetscInt d_nz = 2;