c=========================================================== c c vswave: Generates time-series of profiles of c left-moving "wave" (f(t+x) = constant) and outputs c profiles via 'vsxynt' interface. c c=========================================================== program gpwave implicit none integer i4arg integer maxn parameter ( maxn = 10 000 ) real*8 f real*8 x(maxn), y(maxn) integer i, j, n, nx, & nt real*8 h, t, dt n = i4arg(1,-1) if( n .lt. 1 .or. n .gt. maxn ) goto 900 nx = n nt = n h = 1.0d0 / (nx - 1) x(1) = 0.0d0 do j = 1 , nx - 1 x(j+1) = x(j) + h end do t = 0.0d0 dt = 1.0d0 / (nt - 1) do i = 1 , nt do j = 1 , nx c----------------------------------------------------------- c Define y(x,t) c----------------------------------------------------------- y(j) = f(mod((x(j) + t),1.0d0)) end do c----------------------------------------------------------- c Output data via 'vsxynt' interface. c----------------------------------------------------------- call vsxynt('wave',t,x,y,nx) t = t + dt end do stop 900 continue write(0,*) 'usage: vswave ' stop end c=========================================================== c Gaussian function. c=========================================================== double precision function f(x) implicit none real*8 x f = exp(-((x-0.5d0)/0.1d0)**2) return end