Re: [petsc-users] Newton line search options

2022-07-29 Thread Tang, Qi
Thanks, Lawrence. I did see that book. Is nleqerr generally better than bt or l2? I seem to see someone claims that. Qi On Jul 29, 2022, at 3:27 PM, Lawrence Mitchell wrote:  On Fri, 29 Jul 2022 at 18:36, Tang, Qi mailto:tan...@msu.edu>> wrote: Thanks, Matt. This one is very helpful Ther

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Barry, So adding the call to MatSetBlockSize to the preallocator does fix the error, but that is not necessary if I simply replace the call to MatPreallocaterPreallocate with a call to MatMPIAIJSetPreallocation. And it’s confusing to me especially in light of this exchange a couple months ago

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Barry Smith
Because you create the DMDA with a dof of 3, this triggers any matrices it creates and the localtoglobalmapping object it creates to have a block size of three. The error you are seeing is that a localtoglobal with a block size of 3 cannot be attached to a matrix with a block size of 1. T

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Why do I have to set the block size to 3? I’m not trying to create a block matrix. In fact just a couple months ago I was told I don’t have block matrices and I had to remove calls to set the block size: https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2022-May/046094.html This works fine w

Re: [petsc-users] Newton line search options

2022-07-29 Thread Lawrence Mitchell
On Fri, 29 Jul 2022 at 18:36, Tang, Qi wrote: > Thanks, Matt. This one is very helpful > There's also the Deuflhard book on the affine covariant linesearch (snes_linesearch_type nleqerr) Lawrence >

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Barry Smith
I'm hoping that it is as simple as that you did not set the block size of your newly created matrix to 3? > On Jul 29, 2022, at 4:04 PM, Randall Mackie wrote: > > Hi Barry, > > It seems like this should be trivial to get working but so far I’ve been > unsuccessful. > Most likely I’m doin

Re: [petsc-users] MatPrealloctor

2022-07-29 Thread Randall Mackie
Hi Barry,It seems like this should be trivial to get working but so far I’ve been unsuccessful.Most likely I’m doing something wrong but I have no idea what that is.I’ve attached a little test program that fails with the errors:[0]PETSC ERROR: - Error Message ---

Re: [petsc-users] Newton line search options

2022-07-29 Thread Tang, Qi
Thanks, Matt. This one is very helpful On Jul 29, 2022, at 9:24 AM, Matthew Knepley wrote:  On Thu, Jul 28, 2022 at 6:16 PM Tang, Qi mailto:tan...@msu.edu>> wrote: Hi, Is there some in depth review on different options related to line search of snes newtonls? Our solvers are sensitive to th

Re: [petsc-users] Import Matlab matrix

2022-07-29 Thread Ahmed Mansur
Thanks a lot. On Fri, Jul 29, 2022 at 12:11 PM Barry Smith wrote: > > If you already have Matlab matrices that were saved with, for example, > > save example.mat A > > It may be possible to use MatLoad() directly on them using > the PETSCVIEWERHDF5 viewer type (and not need to use the > PetscB

Re: [petsc-users] Import Matlab matrix

2022-07-29 Thread Barry Smith
If you already have Matlab matrices that were saved with, for example, save example.mat A It may be possible to use MatLoad() directly on them using the PETSCVIEWERHDF5 viewer type (and not need to use the PetscBinaryWrite()). Please read the full manual page https://petsc.org/release/docs/m

Re: [petsc-users] Import Matlab matrix

2022-07-29 Thread Jed Brown
You can use share/petsc/matlab/PetscBinaryWrite.m. matlab> PetscBinaryWrite('matrix.petsc', sparse(A)) Then load it with MatLoad in PETSc. Ahmed Mansur writes: > How to import a sparse matrix from Matlab using C++ and PETSC , if anyone > has any example code, thanks

[petsc-users] Import Matlab matrix

2022-07-29 Thread Ahmed Mansur
How to import a sparse matrix from Matlab using C++ and PETSC , if anyone has any example code, thanks

Re: [petsc-users] Newton line search options

2022-07-29 Thread Matthew Knepley
On Thu, Jul 28, 2022 at 6:16 PM Tang, Qi wrote: > Hi, > > Is there some in depth review on different options related to line search > of snes newtonls? Our solvers are sensitive to the choices there, and I > could not understand why one works better than the other or how to tune > those options.