[petsc-users] Segmentation fault due to TSDestroy

Praveen C cpraveen at gmail.com
Sat Mar 18 08:21:20 CDT 2017


Dear all

I get a segmentation fault when I call TSDestroy. Without TSDestroy the
code runs fine. I have included portion of my code below.

subroutine runts(ctx)
   use userdata
   use comdata
   use mtsdata
   implicit none
#include <petsc/finclude/petsc.h90>
   type(tsdata) :: ctx
   ! Local variables
   integer,parameter :: h = 100 ! File id for history file
   TS                :: ts
   Vec               :: u
   PetscErrorCode    :: ierr
   external          :: RHSFunction, Monitor

   call VecDuplicate(ctx%p%v_res, u, ierr); CHKERRQ(ierr)

   ! Copy initial condition into u
   call VecCopy(ctx%p%v_u, u, ierr); CHKERRQ(ierr)

   call TSCreate(PETSC_COMM_WORLD, ts, ierr); CHKERRQ(ierr)
   call TSSetProblemType(ts, TS_NONLINEAR, ierr); CHKERRQ(ierr)
   call TSSetRHSFunction(ts, PETSC_NULL_OBJECT, RHSFunction, ctx, ierr);
CHKERRQ(ierr)
   call TSSetInitialTimeStep(ts, 0.0, dtg, ierr); CHKERRQ(ierr)
   call TSSetType(ts, TSRK, ierr); CHKERRQ(ierr);
   call TSSetDuration(ts, itmax, tfinal, ierr); CHKERRQ(ierr);
   call TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP, ierr);
CHKERRQ(ierr);
   call TSMonitorSet(ts, Monitor, ctx, PETSC_NULL_OBJECT, ierr);
CHKERRQ(ierr)
   call TSSetSolution(ts, u, ierr); CHKERRQ(ierr)
   call TSSetFromOptions(ts, ierr); CHKERRQ(ierr)
   call TSSetUp(ts, ierr); CHKERRQ(ierr)

   call TSSolve(ts, u, ierr); CHKERRQ(ierr)

   call VecCopy(u, ctx%p%v_u, ierr); CHKERRQ(ierr)
   call VecDestroy(u, ierr); CHKERRQ(ierr)
   call TSDestroy(ts, ierr); CHKERRQ(ierr)

end subroutine runts

Thanks
praveen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170318/28822696/attachment.html>


More information about the petsc-users mailing list