subroutine ic(ax,ay,xmax,ymax,jdim,jmax,ldim,lmax,x,y,io,u) c General information: c Subroutine ic sets the initial condition for the convection c equation c u_t + ax u_x + ay u_y = 0 c on a rectangular domain. c The present implementation of ic requires an exact solution c function exa(x,y,t,ax,ay). c The initial data for u are set equal to this exact solution at c time zero. c Copyright 1997 Leon van Dommelen c Version 1.0 Leon van Dommelen 1/10/97 c Arguments: c Avoid typos: implicit none c Input: components of the convection velocity in the x and y directions: double precision ax,ay c Input: x- and y-sizes of the rectangular domain: double precision xmax,ymax c Input: declared maximum indices in the x- and y-directions: integer jdim,ldim c Input: actual maximum indices in the x- and y-directions: integer jmax,lmax c Input: the x- and y-values of the mesh points: double precision x(0:jdim),y(0:ldim) c Input: Fortran I/O unit to do output on: integer io c Output: the initial values of the dependent variable u: double precision u(0:jdim,0:ldim) c External variables and info for compiling or changing subroutine ic: c Subroutine ic requires a separate function c exa(x,y,t,ax,ay) c to return the exact solution at position (x,y) and time t. double precision exa external exa c Local variables: c Indices in the x- and y-directions: integer j,l c Constants, defined to simplify changing precision: double precision zero parameter (zero=0.d0) c Executable statements: c Set the initial values according to the exact solution: do 200 j=0,jmax do 100 l=0,lmax u(j,l)=exa(x(j),y(l),zero,ax,ay) 100 continue 200 continue c All done: goto 900 c Exit: 900 return end