<div dir="ltr"><div>Dear all</div><div><br></div>I get a segmentation fault when I call TSDestroy. Without TSDestroy the code runs fine. I have included portion of my code below.<div><br></div><div><div>subroutine runts(ctx)</div><div>   use userdata</div><div>   use comdata</div><div>   use mtsdata</div><div>   implicit none</div><div>#include <petsc/finclude/petsc.h90></div><div>   type(tsdata) :: ctx</div><div>   ! Local variables</div><div>   integer,parameter :: h = 100 ! File id for history file</div><div>   TS                :: ts</div><div>   Vec               :: u</div><div>   PetscErrorCode    :: ierr</div><div>   external          :: RHSFunction, Monitor</div><div><br></div><div>   call VecDuplicate(ctx%p%v_res, u, ierr); CHKERRQ(ierr)</div><div><br></div><div>   ! Copy initial condition into u</div><div>   call VecCopy(ctx%p%v_u, u, ierr); CHKERRQ(ierr)</div><div><br></div><div>   call TSCreate(PETSC_COMM_WORLD, ts, ierr); CHKERRQ(ierr)</div><div>   call TSSetProblemType(ts, TS_NONLINEAR, ierr); CHKERRQ(ierr)</div><div>   call TSSetRHSFunction(ts, PETSC_NULL_OBJECT, RHSFunction, ctx, ierr); CHKERRQ(ierr)</div><div>   call TSSetInitialTimeStep(ts, 0.0, dtg, ierr); CHKERRQ(ierr)</div><div>   call TSSetType(ts, TSRK, ierr); CHKERRQ(ierr);</div><div>   call TSSetDuration(ts, itmax, tfinal, ierr); CHKERRQ(ierr);</div><div>   call TSSetExactFinalTime(ts, TS_EXACTFINALTIME_MATCHSTEP, ierr); CHKERRQ(ierr);</div><div>   call TSMonitorSet(ts, Monitor, ctx, PETSC_NULL_OBJECT, ierr); CHKERRQ(ierr)</div><div>   call TSSetSolution(ts, u, ierr); CHKERRQ(ierr)</div><div>   call TSSetFromOptions(ts, ierr); CHKERRQ(ierr)</div><div>   call TSSetUp(ts, ierr); CHKERRQ(ierr)</div><div><br></div><div>   call TSSolve(ts, u, ierr); CHKERRQ(ierr)</div><div><br></div><div>   call VecCopy(u, ctx%p%v_u, ierr); CHKERRQ(ierr)</div><div>   call VecDestroy(u, ierr); CHKERRQ(ierr)</div><div>   call TSDestroy(ts, ierr); CHKERRQ(ierr)</div><div><br></div><div>end subroutine runts</div></div><div><br></div><div>Thanks</div><div>praveen</div></div>