About SNES solver of TS objects

tsjb00 tsjb00 at hotmail.com
Fri Sep 12 16:53:36 CDT 2008


Many thanks for your reply! The code I tried was very similar to the code in:
ts/examples/tutorials/ex7.c
except that I changed the r.h.s. function.
 
The code related to TS:
    ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
    ierr = TSSetProblemType(ts,TS_NONLINEAR);CHKERRQ(ierr);
    ierr = TSSetRHSFunction(ts,FormFunction,&appctx);CHKERRQ(ierr);
 
    ierr = DAGetColoring(appctx.da,IS_COLORING_GLOBAL,&iscoloring);CHKERRQ(ierr);
    ierr = MatFDColoringCreate(J,iscoloring,&matfdcoloring);CHKERRQ(ierr);
    ierr = ISColoringDestroy(iscoloring);CHKERRQ(ierr);
    ierr = MatFDColoringSetFunction(matfdcoloring,(PetscErrorCode (*)(void))FormFunction,&appctx);CHKERRQ(ierr);
    ierr = MatFDColoringSetFromOptions(matfdcoloring);CHKERRQ(ierr);
    ierr = TSSetRHSJacobian(ts,J,J,TSDefaultComputeJacobianColor,matfdcoloring);CHKERRQ(ierr);
 
    dt = appctx.dtmin;
    ierr = TSSetInitialTimeStep(ts,0.0,dt);CHKERRQ(ierr);
     ierr = TSSetType(ts,TS_BEULER);CHKERRQ(ierr);
 
Then I tried to add the snes monitor:
  PetscViewerASCIIOpen(PETSC_COMM_WORLD,"snes.log",&rviewer);
   ierr = TSGetSNES(ts,&ts_snes);
   ierr = SNESMonitorSet(ts_snes,SNESMonitorDefault,&rviewer,PETSC_NULL);
I got the snes.log with long lines which started with countless blank/space and ended at the very end with the SNES iteration info.  As a result, the file took a lot of memory space even with one line of outputs.
 
Please let me know if I did something wrong.
 
Have a nice weekend!
 
 
_________________________________________________________________
新版手机MSN,满足你多彩需求!参加抢鲜体验活动,领取特色奖品!
http://mobile.msn.com.cn/




More information about the petsc-users mailing list