[petsc-users] Changing TSAdapt

Barry Smith bsmith at mcs.anl.gov
Thu Dec 11 22:44:22 CST 2014


   Miguel,

    Thanks for reporting this, you have found a bug in our code. When we changed the adapt type we did not zero out the function pointers for the old basic adaptor hence they were improperly called when the object was finally destroyed at the end.

   I've attached a patch. Once you apply this simply run

    make gnumake

   in the PETSc root directory, recompile your code and run it again and it should successfully end.

  Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ts-adapt.patch
Type: application/octet-stream
Size: 821 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141211/a1f50656/attachment-0001.obj>
-------------- next part --------------

> On Dec 11, 2014, at 4:06 PM, Miguel Angel Salazar de Troya <salazardetroya at gmail.com> wrote:
> 
> Hi 
> 
> I'm trying to use the same TS twice, the first time using the basic TSAdaptType, then I change it to none like this:
> 
> TSAdapt adapt;
> TSGetAdapt(ts,&adapt);
> TSAdaptSetType(adapt,"none");
> 
> However, when I destroy the TS, I get this error:
> 
> 0x00007ffff605c4f2 in VecDestroy (v=0x28) at /home/miguel/petsc/src/vec/vec/interface/vector.c:423
> 423	  if (!*v) PetscFunctionReturn(0);
> (gdb) backtrace
> #0  0x00007ffff605c4f2 in VecDestroy (v=0x28) at /home/miguel/petsc/src/vec/vec/interface/vector.c:423
> #1  0x00007ffff6f330a5 in TSAdaptDestroy_Basic (adapt=0xfdacd0) at /home/miguel/petsc/src/ts/adapt/impls/basic/adaptbasic.c:66
> #2  0x00007ffff6f2c433 in TSAdaptDestroy (adapt=0xfccbc8) at /home/miguel/petsc/src/ts/adapt/interface/tsadapt.c:238
> #3  0x00007ffff6f03093 in TSDestroy (ts=0x7fffffffdd80) at /home/miguel/petsc/src/ts/interface/ts.c:1906
> 
> 
> It's trying to destroy the TSAdaptDestroy_Basic, but I think it was already destroyed when I changed the TSAdaptType to none, is this true? How can I effectively change the TSAdaptType without having this error?
> 
> Thanks
> Miguel
> 
> -- 
> Miguel Angel Salazar de Troya
> Graduate Research Assistant
> Department of Mechanical Science and Engineering
> University of Illinois at Urbana-Champaign
> (217) 550-2360
> salaza11 at illinois.edu
> 



More information about the petsc-users mailing list