About SNES solver of TS objects

Hong Zhang hzhang at mcs.anl.gov
Wed Sep 17 10:28:02 CDT 2008



On Wed, 17 Sep 2008, Lisandro Dalcin wrote:

> BTW, perhaps you should do the same in TSGetKSP(). What do you think?

Yes. It is pushed to petsc-dev.

Hong

>
> 2008/9/17 Hong Zhang <hzhang at mcs.anl.gov>:
>>
>> TSGetSNES() must be called after TSSetType(),
>> otherwise the nonlinear context 'snes' is
>> being created.
>> Attached please find updated ex7.c, which
>> illustrates how to set uer-defined SNESMonitor().
>>
>> This example is pushed to petsc-dev.
>> I also added an error flag in petsc-dev to prevent
>> calling of TSGetSNES() before TSSetType().
>> Thanks for reporting the problem!
>>
>> Best,
>>
>> Hong
>>
>> On Fri, 12 Sep 2008, tsjb00 wrote:
>>
>>>
>>> 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/
>>>
>>>
>
>
>
> -- 
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>
>


More information about the petsc-dev mailing list