program driver c c Sample driver routine for claw1 c This program solves the 1D shallow water equations c with bottom topography. c c The initial conditions are set in the routine ic c c If method(5) = 1: c The Riemann problem is solved in rp1sw and source terms src1sw c are used for the bottom terms c c c If method(5) = 0: c The Riemann problem is solved in rp1swt which incorporates the c source term corrections. c c c The solution is output by the routine out1 c This routine is called nout times at equal time increments. c c data is read in from a file called 'data' c c c Author: Randall J. LeVeque c Version of January, 1998 c c c implicit double precision (a-h,o-z) external bc1ex0,rp1sw,rp1swt,src1sw parameter (maxmx = 500) parameter (meqn = 2) parameter (mwaves = 2) parameter (mbc = 2) parameter (maux = 1) parameter (mwork = 8064) c dimension q(1-mbc:maxmx+mbc, meqn) dimension aux(1-mbc:maxmx+mbc, maux) dimension qwork(1-mbc:maxmx+mbc, meqn) dimension work(mwork) dimension x(1-mbc:maxmx+mbc) dimension mthlim(mwaves),method(7),dtv(5),cflv(4),nv(2) common /param/ grav common /cdx/ dx common /ceps/ eps c open(10,file='fort.info',status='unknown',form='formatted') open(11,file='fort.nplot',status='unknown',form='formatted') open(20,file='fort.x',status='unknown',form='formatted') open(21,file='fort.H',status='unknown',form='formatted') c grav = 1.d0 write(6,*) 'input dx' read(5,*) dx write(6,*) 'input dt, tend, nout' read(5,*) dt,tend,nout write(6,*) 'input method(1), method(2)' read(5,*) method(1), method(2) write(6,*) 'input mthlim(1:2)' read(5,*) (mthlim(mw), mw=1,mwaves) write(6,*) 'input method(5)' read(5,*) method(5) write(6,*) 'input eps' read(5,*) eps c t0 = 0.d0 cflv(1) = 1.0d0 !# largest cfl to allow before rejecting step cflv(2) = 0.9d0 !# desired cfl dtv(1) = dt !# dt to try in first step dtv(2) = 1.d6 !# no explicit limit on dt nv(1) = 5000 !# maximum number of time steps allowed method(4) = 0 !# don't print dt and cfl every time step method(6) = 0 !# no capa array method(7) = maux !# aux array c c # set grid and initial conditions c c # domain is 0 <= x <= 1: ax = 0.d0 bx = 1.d0 mx= (bx-ax + 1d-12)/dx c do 10 i=1,mx x(i) = ax + (i-0.5d0) * dx write(20,1020) x(i) 1020 format(e16.6) 10 continue c call ic(maxmx,meqn,mbc,mx,x,dx,q,aux) c c # output initial data to unit 100 call out1(maxmx,meqn,mbc,mx,x,q,0.d0,100) c dtout = (tend - t0)/dfloat(nout) do 100 n=1,nout tstart = t0 + (n-1) * dtout tend = t0 + n*dtout c c # main call to claw1........................ c if (method(5).eq.1) then call claw1(maxmx,meqn,mwaves,mbc,mx, & q,aux,dx,tstart,tend,dtv,cflv,nv,method,mthlim, & work,mwork,info,bc1ex0,rp1sw,src1sw) else call claw1(maxmx,meqn,mwaves,mbc,mx, & q,aux,dx,tstart,tend,dtv,cflv,nv,method,mthlim, & work,mwork,info,bc1ex0,rp1swt,src1sw) endif c c dtv(1) = dtv(5) !# set dt to start next call c call out1(maxmx,meqn,mbc,mx,x,q,tend,100+n) c write(10,1010) tend,info,dtv(3),dtv(4),dtv(5), & cflv(2),cflv(3),nv(2) 1010 format('tend =',d15.4,/, & 'info =',i5,/,'smallest dt =',d15.4,/,'largest dt =', & d15.4,/,'last dt =',d15.4,/,'largest cfl =', & d15.4,/,'last cfl =',d15.4,/,'steps taken =',i4,/) c write(6,6001) nv(2),tend,info 6001 format('CLAW1 returning after ',i3,' steps, t =',e10.5, & ' info =',i3,/) c if (info .ne. 0) then write(6,*) 'ERROR in claw1... info =', info go to 200 endif 100 continue c 200 continue write(11,1101) nout c 1101 format(i5) stop end