Re: [petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Alexander Lindsay
After talking with Fande, I don't think my proposal is a good one. Whereas MatSetValues makes it clear that you must call through to MatAssemblyBegin/MatAssemblyEnd after use, there is no such indication for MatZeroRows. Probably most users expect to be able to go onto preconditioning after MatZero

Re: [petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Alexander Lindsay
Especially if the user has requested to keep their nonzero pattern, is there any harm in calling MatAssembly with FLUSH instead of FINAL? Are there users relying on MatZeroValues being their final assembly? On Thu, Jul 15, 2021 at 8:51 AM Alexander Lindsay wrote: > On Thu, Jul 15, 2021 at 8:46 A

Re: [petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Alexander Lindsay
On Thu, Jul 15, 2021 at 8:46 AM Fande Kong wrote: > "if (a->keepnonzeropattern)" branch does not change ilen so that > A->ops->assemblyend will be fine. It would help if you made sure that > elements have been inserted for these rows before you call MatZeroRows. > So this is the crux of the prob

Re: [petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Fande Kong
"if (a->keepnonzeropattern)" branch does not change ilen so that A->ops->assemblyend will be fine. It would help if you made sure that elements have been inserted for these rows before you call MatZeroRows. However, I am not sure it is necessary to call A->ops->assemblyend if we already require a

[petsc-users] parallel HDF5 output of DMDA data with dof>1

2021-07-15 Thread Matteo Semplice
Hi. When I write (HDF5 viewer) a vector associated to a DMDA with 1 dof, the output is independent of the number of cpus used. However, for a DMDA with dof=2, the output seems to be correct when I run on 1 or 2 cpus, but is scrambled when I run with 4 cpus. Judging from the ranges of the dat

Re: [petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Stefano Zampini
Alexander Do you have a small code to reproduce the issue? Below is the output using a PETSc example (src/mat/tests/ex11). The pattern is kept. kl-18448:tests szampini$ ./ex11 Mat Object: 1 MPI processes type: seqaij row 0: (0, 5.) row 1: (0, -1.) (1, 4.) (2, -1.) (6, -1.) row 2: (2, 5

[petsc-users] MatZeroRows changes my sparsity pattern

2021-07-15 Thread Alexander Lindsay
My interpretation of the documentation page of MatZeroRows is that if I've set MAT_KEEP_NONZERO_PATTERN to true, then my sparsity pattern shouldn't be changed by a call to it, e.g. a->imax should not change. However, at least for sequential matrices, MatAssemblyEnd is called with MAT_FINAL_ASSEMBLY

Re: [petsc-users] output DMDA to hdf5 file?

2021-07-15 Thread Matteo Semplice
Il 15/07/21 14:26, Matthew Knepley ha scritto: On Thu, Jul 15, 2021 at 8:20 AM Matteo Semplice mailto:matteo.sempl...@uninsubria.it>> wrote: Il 15/07/21 14:15, Matthew Knepley ha scritto: On Thu, Jul 15, 2021 at 6:39 AM Matteo Semplice mailto:matteo.sempl...@uninsubria.it>> wrot

Re: [petsc-users] output DMDA to hdf5 file?

2021-07-15 Thread Matthew Knepley
On Thu, Jul 15, 2021 at 8:20 AM Matteo Semplice < matteo.sempl...@uninsubria.it> wrote: > > Il 15/07/21 14:15, Matthew Knepley ha scritto: > > On Thu, Jul 15, 2021 at 6:39 AM Matteo Semplice < > matteo.sempl...@uninsubria.it> wrote: > >> >> Il 12/07/21 17:51, Matthew Knepley ha scritto: >> >> On M

Re: [petsc-users] output DMDA to hdf5 file?

2021-07-15 Thread Matteo Semplice
Il 15/07/21 14:15, Matthew Knepley ha scritto: On Thu, Jul 15, 2021 at 6:39 AM Matteo Semplice mailto:matteo.sempl...@uninsubria.it>> wrote: Il 12/07/21 17:51, Matthew Knepley ha scritto: On Mon, Jul 12, 2021 at 11:40 AM Matteo Semplice mailto:matteo.sempl...@uninsubria.it>> wro

Re: [petsc-users] output DMDA to hdf5 file?

2021-07-15 Thread Matthew Knepley
On Thu, Jul 15, 2021 at 6:39 AM Matteo Semplice < matteo.sempl...@uninsubria.it> wrote: > > Il 12/07/21 17:51, Matthew Knepley ha scritto: > > On Mon, Jul 12, 2021 at 11:40 AM Matteo Semplice < > matteo.sempl...@uninsubria.it> wrote: > >> Dear all, >> >> I am experimenting with hdf5+xdmf outpu

Re: [petsc-users] output DMDA to hdf5 file?

2021-07-15 Thread Matteo Semplice
Il 12/07/21 17:51, Matthew Knepley ha scritto: On Mon, Jul 12, 2021 at 11:40 AM Matteo Semplice mailto:matteo.sempl...@uninsubria.it>> wrote: Dear all,     I am experimenting with hdf5+xdmf output. At https://www.xdmf.org/index.php/XDMF_Model_and_Format