"Jin, Shuangshuang" <Shuangshuang.Jin at pnnl.gov> writes:
> As a test, I changed the line ? f[1] = (x[1]*x[1]*x[1]/3 - x[1])-x[0];? to
> ?f[1] = (PetscRealPart(x[1])*PetscRealPart(x[1])*PetscRealPart(x[1])/3 -
> PetscRealPart(x[1]))-PetscRealPart(x[0]);?, and it runs with the same results
> as I run ex19.c alone.
>
> However, I don?t understand why I only need to change this line but leave
> nothing else such as the line before it ?f[0] = xdot[0] + x[1];? unchanged?
You were just missing an overload.
> And can anyone please tell me in ex19.c what does this part of code do?
>
> PetscErrorCode ierr;
>
> PetscFunctionBegin;
> {
> const PetscReal
> A[3][3] = {{0,0,0},
> {0.41421356237309504880,0,0},
> {0.75,0.25,0}},
> At[3][3] = {{0,0,0},
> {0.12132034355964257320,0.29289321881345247560,0},
>
> {0.20710678118654752440,0.50000000000000000000,0.29289321881345247560}};
> ierr =
> TSARKIMEXRegister("myark2",2,3,&At[0][0],PETSC_NULL,PETSC_NULL,&A[0][0],PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL,0,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
> }
> PetscFunctionReturn(0);
>
> It seems to me an initialization of the A matrix. But I looked into
> TSARKIMEXRegister, still couldn?t understand how it works.
This registers an additive Runge-Kutta IMEX method by providing its
"Butcher table". Don't worry about this unless you are designing
integration methods. This method, and many others are already in the
library.