[petsc-users] help about my first petsc program

Barry Smith bsmith at mcs.anl.gov
Mon Jun 28 13:44:13 CDT 2010


On Jun 28, 2010, at 1:21 PM, Xuan YU wrote:

> 
> On Jun 23, 2010, at 1:17 PM, Jed Brown wrote:
> 
>> On Wed, 23 Jun 2010 12:45:37 -0400, Xuan YU <xxy113 at psu.edu> wrote:
>>> I changed dt=0.4 and the Monitor function, so GL doesn't work.
>> 
>> Choosing a smaller dt (only an initial value in this case) fixes that
>> problem, but I still see some difficulties unless I give
>> -ts_gl_max_order 2 (seems like I don't have enough stabilization for the
>> higher-order error estimators).  But feel free to keep using the simpler
>> methods, I'm sure they will be more predictable.
>> 
>>> PetscErrorCode Monitor(TS ts,PetscInt step,PetscReal time,Vec u, void
>>> *ctx)
>>> {
>>>  PetscScalar *y;
>>>  PetscReal dt;
>>>  TSGetTimeStep(ts,&dt);
>>>  VecGetArray(u,&y);
>>>  PetscPrintf(PETSC_COMM_WORLD,"At t =%e  y =%e  %e  %e,
>>> \n",time,y[0],y[1],y[2]);
>>>  VecRestoreArray(u,&y);
>>>  if(step>0)dt=time*9;
>>>  TSSetTimeStep(ts,dt);
>>>  return 0;
>>> }
>> 
>> TSGL has an adaptive controller, based on a local error estimator.  It
>> surely won't work right if the monitor changes it (because it doesn't
>> happen in the correct place; GL can't change the step size arbitrarily,
>> it needs to know the size of the next step when it "completes" the
>> current one).  You should be able to TSGLAdaptRegisterDynamic() you own
>> adaptive scheme, there is currently NONE, SIZE (only step size, not
>> order), and BOTH (default).  If you do this, and it works better than
>> the builtin ones, let me know and I'll add it to the library.
>> 
>>> Why Petsc is faster than cvode? How fast it will be?
>> 
>> It might not be faster, but at least you can get back CVODE as a runtime
>> option.  And since PETSc offers a lot more preconditioning options, you
>> can probably beat it that way.  Whether PETSc-native integrators
>> (e.g. TSTHETA, TSGL) are faster or not is very problem dependent.
>> 
>> Jed
>> 
> 
> 
> I have successfully solve my problem with TS. But it is slower than Cvode. I don't know how to choose preconditioner.

  -pc_type asm or whatever preconditioner you want to use. Run with -help to see the options


> I only found preconditioner option in SNES. Is that means I should use SNES to solve my problem?

   NO

   Barry

> 
> Many thanks!
> 
> 
> Xuan YU
> xxy113 at psu.edu
> 
> 
> 
> 



More information about the petsc-users mailing list