[petsc-users] random vector

Benjamin Sanderse B.Sanderse at cwi.nl
Mon Jul 9 07:53:56 CDT 2012


Hello all,

I am trying to solve a Poisson equation several times with random right-hand side vectors in order to do parallel scalability tests.
Here is part of the code that I use to generate a random vector:


PetscRandom    :: rctx

...

do I = 1,n


call PetscRandomCreate(PETSC_COMM_WORLD,rctx,ierr); CHKERRQ(ierr)
call VecSetRandom(f,rctx,ierr); CHKERRQ(ierr)
call PetscRandomDestroy(rctx,ierr); CHKERRQ(ierr)

call VecView(f,PETSC_VIEWER_STDOUT_WORLD,ierr); CHKERRQ(ierr)

call Poisson

end do


It appears that f does not change during the execution of the do-loop. In fact its value is even always the same for I=1 when I run the code several times. Apparently I am missing something. Can anybody help?

Regards,


Benjamin


More information about the petsc-users mailing list