Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-13 Thread Stefano Zampini
Run make allfortranstubs to generate the fortran interfaces, then make On Sat, May 13, 2023, 13:35 Edoardo alinovi wrote: > Hello Barry, > > I have seen you guys merged in main the minimum tolerance stuff. > > After compiling that branch, I have tried to > call KSPSetMinimumIterations(this%ksp,

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-13 Thread Edoardo alinovi
Hello Barry, I have seen you guys merged in main the minimum tolerance stuff. After compiling that branch, I have tried to call KSPSetMinimumIterations(this%ksp, this%minIter, ierr), but the compiler cannot find the function. I have included this module as standard practice: #include "petsc/finc

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-09 Thread Edoardo alinovi
Mega! This is gonna be useful for many people :) Il Mar 9 Mag 2023, 00:54 Barry Smith ha scritto: > > See https://gitlab.com/petsc/petsc/-/merge_requests/6436 with commit > barry/2023-05-08/add-ksp-min-its > > > > On May 7, 2023, at 2:22 PM, Edoardo alinovi > wrote: > > Hello Barry, > > Mega

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-08 Thread Barry Smith
See https://gitlab.com/petsc/petsc/-/merge_requests/6436 with commit barry/2023-05-08/add-ksp-min-its > On May 7, 2023, at 2:22 PM, Edoardo alinovi wrote: > > Hello Barry, > > Mega! Thank you Berry much for providing me with a working example! I ended > up in writing this: > >

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Edoardo alinovi
Thanks Barry, I have fixed the error. Indeed, It's odd it is working. Compiler magic I guess!

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Barry Smith
> On May 7, 2023, at 2:22 PM, Edoardo alinovi wrote: > > Hello Barry, > > Mega! Thank you Berry much for providing me with a working example! I ended > up in writing this: > > call KSPConvergedDefault(ksp, n, rnorm, flag, PETSC_NULL_FUNCTION, > ierr) This should not work. The argum

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Edoardo alinovi
Hello Barry, Mega! Thank you Berry much for providing me with a working example! I ended up in writing this: *call KSPConvergedDefault(ksp, n, rnorm, flag, PETSC_NULL_FUNCTION, ierr)if (n

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Barry Smith
Working example in https://gitlab.com/petsc/petsc/-/merge_requests/6430 > On May 7, 2023, at 11:47 AM, Barry Smith wrote: > > > Note, you must call the default test on iteration 0. This is how it > determines the initial residual for relative residual tests etc. > > I recommend not

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Barry Smith
Note, you must call the default test on iteration 0. This is how it determines the initial residual for relative residual tests etc. I recommend not having the if () test at all. Instead, always call the default convergence test first and then change the flag value it provides if needed b

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Barry Smith
The code will not work as written because KSPConvergedDefault() requires a context created with KSPConvergedDefaultCreate(). Here is a starting point for what you need, in main integer*8 defaultctx extern MyKSPConverged, KSPConvergedDefaultDestroy KSPDefaultConvergedCreate(default

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Matthew Knepley
On Sun, May 7, 2023 at 10:02 AM Edoardo alinovi wrote: > Thanks, > > Is this a reasonable thing to do if I want to replicate what KSP is doing > by default? > Yes. The other option is to pass along 'dummy' Thanks, Matt -- What most experimenters take for granted before they begin their

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Edoardo alinovi
Thanks, Is this a reasonable thing to do if I want to replicate what KSP is doing by default?

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Matthew Knepley
On Sun, May 7, 2023 at 9:42 AM Edoardo alinovi wrote: > Hi Matt, > > h, what if I do: > > KSPConvergedDefault(ksp, n, rnorm, flag, PETSC_NULL_FUNCTION, ierr) > > That looks to behave OK, but I am not sure about what I am doing -.- > You are saying that no convergence context was passed in

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Edoardo alinovi
Hi Matt, h, what if I do: KSPConvergedDefault(ksp, n, rnorm, flag, PETSC_NULL_FUNCTION, ierr) That looks to behave OK, but I am not sure about what I am doing -.- Cheers

Re: [petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Matthew Knepley
On Sun, May 7, 2023 at 9:21 AM Edoardo alinovi wrote: > Hello guys, > > Today I am about to write a custom convergence test for KSP doing the > following job: > > - if the number of ksp iterations is less than a given threshold, iterate > until that threshold is met > - if the number of ksp itera

[petsc-users] Help with KSPSetConvergenceTest

2023-05-07 Thread Edoardo alinovi
Hello guys, Today I am about to write a custom convergence test for KSP doing the following job: - if the number of ksp iterations is less than a given threshold, iterate until that threshold is met - if the number of ksp iterations is bigger than the threshold, use the standard convergence check