[petsc-users] SNESSetConvergenceTest
Jed Brown
jed at jedbrown.org
Tue Feb 25 15:49:45 CST 2014
Sorry about dropping this email; thanks for being persistent.
Dharmendar Reddy <dharmareddy84 at gmail.com> writes:
> Hello,
> I think, i found the cause of the crashes. It is due to _cb
> defined in zsnesf.c and a particular usage pattern.
>
> Here is how it is:
> The code has snes object wrapped inside a fortran data type (Solver_t)
>
> Say i have two solver objects:
> type(solver_t) :: solver1
> type(solver_t) :: solver2
>
> I first use solver1 to solve an equation where i do not use DM
>
> In the snes in Solver1 , i set function first and then jacobian.
>
> Now, ths static struct _cb in zsnsef has:
> _cb = {function = 1000, test = 0, destroy = 0, jacobian = 1001,
> monitor = 0, mondestroy = 0, gs = 0}
>
>
> Now i call the second solver with DM, where is set the function and
> jacobain via DMSetFxn/Jac
>
> Then i call snessetconvergenceset
>
> _cb not takes the value :
>
> _cb = {function = 1000, test = 1002, destroy = 0, jacobian = 1001,
> monitor = 0, mondestroy = 0, gs = 0}
>
> but the snes hdr has num_fortrancallback[0] = 1
Which SNES header (the first or second solve)?
PetscObjectSetFortranCallback should have increased the size.
> leading to an error: at line 262 in src/sys/objects/inherit.c
> if (PetscUnlikely(cid >=
> PETSC_SMALLEST_FORTRAN_CALLBACK+obj->num_fortrancallback[cbtype]))
> SETERRQ(obj->comm,PETSC_ERR_ARG_CORRUPT,"Fortran callback not set on
> this object");
I would really like to open this up in a debugger, but I can't compile
your code,
maxIt = PETSC_DEFAULT_INTEGER
@@ -857,7 +857,7 @@ program testDMSolver
use EquationUtils_m
use precision_m
implicit none
-#include 'finclude/petsc.h90'
+#include "finclude/petsc.h90"
! Vairables for DM based solver
type(Eqn_t) :: Eqn
PetscErrorCode :: ierr
Solver.F90:734.2:
this%self => this
1
Error: Different types in pointer assignment at (1); attempted assignment of CLASS(eqn_t) to TYPE(eqn_t)
Solver.F90:786.11:
call test%init(PETSC_COMM_SELF,'test',i2,i2,ierr,solverCtx,&
1
Error: Found no matching specific binding for the call to the GENERIC 'init' at (1)
Solver.F90:856.6:
use SolverTest_m
1
Fatal Error: Can't open module file 'solvertest_m.mod' for reading at (1): No such file or directory
Would it be possible to reduce this test case enough to build
stand-alone and contribute it as a test?
> There is another scenario where my code hangs, i noted it as case (2)
> [line 968 in solver.F90] in the comments of the attached test case.
>
> i have attahced the logs for each of the three cases considered.
>
> why cannot _cb reside inside the snes object ?
How would you copy the callbacks between objects if each object could
number them differently?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140225/a9b473d2/attachment.pgp>
More information about the petsc-users
mailing list