Hi all,
For the linear solver, if I use the standard 7-point differencing scheme
and use 2-point boundary conditions, it works fine. But when I change the
boundary condition, involving 3-point differencing form at the boundary,
such as x[i+2]-2*x[i+1]+x[i]=0, assuming i is boundary point number, I
always get the errors like
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Inserting a new nonzero into matrix
My boundary code is as follows.
if(i==0) {
v[0] = 1.0; col[0].i = i;
v[1] = -2.0; col[1].i = i+1;
v[2] = 1.0; col[2].i = i+2;
MatSetValuesStencil(appctx->A,1,&row,3,col,v,INSERT_VALUES);
}
Does anyone have some suggestions? Thank you very much in advance.
--
Best regards,
Feng