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