#!/bin/csh # Usage: make_movie nw cfl i_fd_type # The three required arguments are: nw - the number of points per wave, # cfl - the cfl number, and i_fd_type - an integer flag that sets the # differencing type: 1 forward, 0 central, -1 backward. These three # arguments are passed to the wave program. # Remove any lingering frames from prior runs /bin/rm -f frame.* >& /dev/null # Check for valid input for i_fd_type and set the character variable # fd_type for file naming purposes below if ($3 == 1) then set fd_type = f else if ($3 == 0) then set fd_type = c else if ($3 == -1) then set fd_type = b else echo "bad input for i_fd_type" echo "$3" exit(1) endif # Run the wave program to generate the frames.dat data file. # Output sent to the screen is captured in the variable output. # The sixth field in the screen output is the number of frames; # this value is stored in the variable n_frames. set output = (`echo "$1 $2 $3" | wave`) set n_frames = $output[6] # Enter the loop to produce the still images. It is necessary # to name the first nine as frame.01, frame.02, etc. set count=1 while($count <= $n_frames) echo "$count" | extract_frames > /dev/null gnuplot frames.plt if ($count < 10) then set number = "0$count" else set number = $count endif mv frame.gif frame.$number @ count++ end # Remove the frame.dat file /bin/rm -f frame.dat # Calculate the inter-frame delay @ delay = 500 / $n_frames echo "n_frames, delay = $n_frames, $delay" # Use gifsicle to assemble the frames into a movie file echo " " echo "gifsicle -d $delay -O2 frame.* > $1_$2_$fd_type.gif" echo " " gifsicle -d $delay -O2 frame.* > $1_$2_$fd_type.gif # Remove the still image files (you may want to comment # this line out while debugging) /bin/rm -f frame.*