[petsc-users] random vector

Hong Zhang hzhang at mcs.anl.gov
Mon Jul 9 08:51:32 CDT 2012


Benjamin:

>
>
> 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:
>

This is intended. You can use option ' -random_seed <seed>' to change it.
See
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscRandomGetSeed.html

Hong

>
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120709/d5ccf5ed/attachment.html>


More information about the petsc-users mailing list