Next: Java Version Up: FROG POND CODE Previous: FROG POND CODE

## Fortran Version

```#	Throw pebbles into pond.  Watch waves.     n=pond_size
#%
from par: integer n1:n=100, n2:n=n, n3:nframes=150
subroutine splash( n,nframes)
integer	 i,j,k,    n,nframes,   iseed
real    velocity, viscosity, rand01
temporary real    now(n,n), old(n,n), new(n,n), laplacian(n,n), sum(n,n)
velocity= .20
iseed = 1995					# Random numbers for stone toss.
viscosity = .15
do i=1,n {  do j=1,n {  now(i,j)=0;  old(i,j)=0;  new(i,j)=0 }}
do k=1, nframes {
i = 1 + rand01(iseed)*n
j = 1 + rand01(iseed)*n				 # To a random location
if( mod( k-1,10)==0)   now(i,j) = now(i,j)+1.    #       throw a pebble.
do i=1,n
do j=1,n
sum(i,j) = now(i,j) - viscosity * old(i,j)
do i=2,n-1
do j=2,n-1
laplacian(i,j) = sum(i-1,j  ) - 2*sum(i,j) + sum(i+1,j  ) +
sum(i  ,j-1) - 2*sum(i,j) + sum(i  ,j+1)
do i=2,n-1
do j=2,n-1
new(i,j) = -old(i,j) + 2*now(i,j) + velocity * laplacian(i,j)
call srite('out',new,n*n*4)
do i=1,n{  do j=1,n {  old(i,j) = now(i,j) }}
do i=1,n{  do j=1,n {  now(i,j) = new(i,j) }}	    # clock tick
do i=1,n{  do j=1,n {  new(i,j) = 0.       }}
}
return; end
```

Next: Java Version Up: FROG POND CODE Previous: FROG POND CODE
Stanford Exploration Project
11/12/1997