# SNES Problem

Nils Erik Svangård nilserik at gmail.com
Fri Mar 31 02:53:58 CST 2006

```This might be a stupid question:
I create a Vec using
VecCreateSeq(comm_self,size,X,ierr)
I fill the X vector with PetscScalar values using

PetscScalar lx_v(0:1)
PetscOffset lx_i
call VecGetArray(X,lx_v,lx_i,ierr)
call SetValues(lx_v(lx_i),ierr)
call VecRestoreArray(X,lx_v,lx_i,ierr)

And set values puts the PetscScalars in th right place:

PetscScalar      xx(7,1:549000)

do x=1,NKL-1
do y=1,NJL-1
do z=1,NIL-1
L=x+NIL*(y-1)+NIL*NJL*(z-1)
xx(1,L)=RO(L)
xx(2,L)=RU(L)
xx(3,L)=RV(L)
xx(4,L)=RW(L)
xx(5,L)=ET(L)
xx(6,L)=RQ(L)
xx(7,L)=REPS(L)
end do
end do
end do

Now the Vec object have lots of values  and I want to solve the system
of non-linear equations. SNES does this by using a approximated
jacobian and doing some newtonsteps.
I dont understand how SNES can use the values in the Vec without
knowing which values are connected, now there is 7 diffrent arrays in
3 dimensions in the Vec.
I hope this question wasnt to blurry.
/nisse

On 3/30/06, Matthew Knepley <knepley at gmail.com> wrote:
>
>
>
> On 3/29/06, Nils Erik Svangård <nilserik at gmail.com> wrote:
> > Barry,
>
> You wrote this a couple of mails back:
>
>   SNES works by computing p = -approxinv(J)*F(uold) and
> then does a line search on unew = uold + lambda*p to get the
> new u. First it uses a test value of 1 for lambda so it
> tries to compute F(uold + p). It is possible that uold + p
> has some "non-physical" values in it.
>
> Does SNES do the same thing when -snes_mf is used?
>
>    Yes, the line search is independent of the Jacobian approximation.
>
>      Matt
>
>
> > /nisse
> >
> > On 3/20/06, Barry Smith <bsmith at mcs.anl.gov > wrote:
> > >
> > >    Nisse,
> > >
> > >     Is there any way you can bundle everything up so you could send
> > > it to me and I could easily compile it and make? This approach to
> > > trying to discover the problem is taking too long.
> > >
> > >     Barry
> >
>
>
> --
> "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec
> Guiness

--
Nils-Erik Svangård
E-Mail: nilserik at gmail.com
MSN: schweingaard at hotmail.com
Skype: schweingaard
Mobil: +46-(0)70-3612178

```