Re: [petsc-users] Modify matrix nonzero structure

2024-05-28 Thread Barry Smith
Great. > On May 28, 2024, at 9:33 PM, Adrian Croucher > wrote: > > Thanks again Barry, it's working fine for me now too. > > - Adrian > > On 29/05/24 1:27 pm, Barry Smith wrote: >> >>There was a bug in my fix for parallel which I have fixed. You will need >> to >> >>git fetch >

Re: [petsc-users] Modify matrix nonzero structure

2024-05-28 Thread Adrian Croucher
Thanks again Barry, it's working fine for me now too. - Adrian On 29/05/24 1:27 pm, Barry Smith wrote:    There was a bug in my fix for parallel which I have fixed. You will need to    git fetch    git checkout main    git branch -D barry/2024-05-27/fix-bug-baij-setvaluesblocked/release    

Re: [petsc-users] Modify matrix nonzero structure

2024-05-28 Thread Barry Smith
There was a bug in my fix for parallel which I have fixed. You will need to git fetch git checkout main git branch -D barry/2024-05-27/fix-bug-baij-setvaluesblocked/release git checkout barry/2024-05-27/fix-bug-baij-setvaluesblocked/release I get the same results with your ex

Re: [petsc-users] Modify matrix nonzero structure

2024-05-28 Thread Adrian Croucher
hi Barry, Thanks, that change has fixed the error on 2 ranks for me. When I run on 3 ranks, there is no error, but it doesn't actually add the extra values in to the matrix. Do you see that behaviour too? - Adrian On 29/05/24 4:33 am, Barry Smith wrote:    Adrian,    I could reproduce wit

Re: [petsc-users] Modify matrix nonzero structure

2024-05-28 Thread Barry Smith
Adrian, I could reproduce with 3 MPI ranks. Another error I had to fix. I also added a test example SInce I rebased the branch you will need to do something like git fetch git checkout main git branch -D barry/2024-05-27/fix-bug-baij-setvaluesblocked/release git checkou

Re: [petsc-users] Modify matrix nonzero structure

2024-05-27 Thread Adrian Croucher
Hmm, that's a bit weird. I haven't modified the test code - I checked the file date to make sure. I also tried deleting my PETSc build dir and rebuilding it, then rebuilding the test code. I still get the error if I run on 2 ranks with -dm_mat_type (or -mat_type) baij or mpibaij, but it's fine

Re: [petsc-users] Modify matrix nonzero structure

2024-05-27 Thread Barry Smith
When I run the exact code you sent with two ranks and—mat_type mpibaij, it runs as expected. If you modified the code in any way to demonstrate the bug, please send the modified code. > On May 27, 2024, at 9:37 PM, Adrian Croucher > wrote: > > hi Barry, > > On 28/05/24 7:46 am, Barry S

Re: [petsc-users] Modify matrix nonzero structure

2024-05-27 Thread Adrian Croucher
hi Barry, On 28/05/24 7:46 am, Barry Smith wrote:    Thanks for reporting this. It is a bug. I have a fixed branch *barry/2024-05-27/fix-bug-baij-setvaluesblocked/release * and associated merge request https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/7578__;!!G_uCfs

Re: [petsc-users] Modify matrix nonzero structure

2024-05-27 Thread Barry Smith
Thanks for reporting this. It is a bug. I have a fixed branch barry/2024-05-27/fix-bug-baij-setvaluesblocked/release and associated merge request https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/7578__;!!G_uCfscf7eWS!fqfhE-8CI9FL_VmWzwZRznl4gJgsMBvTJLtOwy_-xlB0_E7e

Re: [petsc-users] Modify matrix nonzero structure

2024-05-26 Thread Adrian Croucher
hi, I've been trying creating a matrix with DMCreateMatrix() and then adding extra blocks of nonzeros into it using MatSetValuesBlocked(), but getting some unexpected results if I set the matrix type to BAIJ. It seems to behave as expected if I use matrix type AIJ. I've attached a minimal ex

Re: [petsc-users] Modify matrix nonzero structure

2024-05-20 Thread Matthew Knepley
On Sun, May 19, 2024 at 11:25 PM Barry Smith wrote: > Certainly missing Jacobian entries can dramatically change the Newton > direction and hence the convergence. Even if the optimal (in time) setup > skips some Jacobian entries it is always good to have runs with all the > entries to see the "be

Re: [petsc-users] Modify matrix nonzero structure

2024-05-19 Thread Barry Smith
Certainly missing Jacobian entries can dramatically change the Newton direction and hence the convergence. Even if the optimal (in time) setup skips some Jacobian entries it is always good to have runs with all the entries to see the "best possible" convergence. Barry > On May 19, 2024,

Re: [petsc-users] Modify matrix nonzero structure

2024-05-19 Thread Adrian Croucher
Great, it sounds like this might be easier than I expected. Thanks very much. Did you have any thoughts on my diagnosis of the problem (the poor nonlinear solver convergence being caused by missing Jacobian elements representing interaction between the sources)? - Adrian On 20/05/24 12:41 p

Re: [petsc-users] Modify matrix nonzero structure

2024-05-19 Thread Matthew Knepley
On Sun, May 19, 2024 at 8:25 PM Barry Smith wrote: > You can call MatSetOption(mat,MAT_NEW_NONZERO_LOCATION_ERR) then insert > the new values. If it is just a handful of new insertions the extra time > should be small. Making a copy of the matrix won't give you a new matrix > that is any faster t

Re: [petsc-users] Modify matrix nonzero structure

2024-05-19 Thread Barry Smith
You can call MatSetOption(mat,MAT_NEW_NONZERO_LOCATION_ERR) then insert the new values. If it is just a handful of new insertions the extra time should be small. Making a copy of the matrix won't give you a new matrix that is any faster to insert into so best to just use the same matrix

[petsc-users] Modify matrix nonzero structure

2024-05-19 Thread Adrian Croucher
hi, I have a Jacobian matrix created using DMCreateMatrix(). What would be the best way to add extra nonzero entries into it? I'm guessing that DMCreateMatrix() allocates the storage so the nonzero structure can't really be easily modified.  ZjQcmQRYFpfptBannerStart Thi