program swid_flow !Governing Flow Equation: d^2h/dx^2+d^2h/dy^2=S/T*(dh/dt)-R/T !Initial Condition: h(x,y,t=0)=-i*x+ho !Boundary Conditions: !Stress Period 1: d^2h/dx^2+d^2h/dy^2=0 !h(x=0,y,0=maxit) exit numit=numit+1 maxerr=0. do i=2,row-1 do j=2,col-1 phead(i,j)=lhead(i,j) lhead(i,j)=(1.-omega)*lhead(i,j)+omega*(lhead(i,j+1)+lhead(i,j-1)+lhead(i+1,j)+lhead(i-1,j))/4. error=abs(phead(i,j)-lhead(i,j)) if(error>maxerr) then maxerr=error end if end do end do end do ! Output write(*,*) "Heads (Initial)" write(*,10) ((ihead(i,j),j=1,row,5),i=1,col,5) 10 format(1x,11f8.2) write(*,*) "Heads (Stress Period 1 [0-1 days])" write(*,20) ((lhead(i,j),j=1,row,5),i=1,col,5) 20 format(1x,11f8.2) write(*,30) numit, maxerr 30 format(" numit: ",i8,/," maxerr: ",f8.5/) open(unit=1000, file='swid_flow_out.txt') ! Open new or overwrite old output file write(1000,100) ((lhead(i,j),j=1,row),i=1,col) 100 format(1x,51f10.4) ! Stress period 2: injection pumping, transient flow with source, explicit scheme, d^2h/dx^2+d^2h/dy^2=S/T*(dh/dt)-R/T !Finite Difference Equation: h[i,j,n+1]=1/A*(A*h[i,j,n]+(hbar-h[i,j,n])+(delx*dely*R)/(4*T)) !Where A=(delx*dely*S)/(4*T*delt) & hbar=(h[i+1,j,n]+h[i-1,j,n]+h[i,j+1,n]+h[i,j-1,n])/4 ! Fill old (time=n) and new heads (time=n+1) with heads from stress period 1, new heads will be overwritten as time marches on ! Define do i=1,row do j= 1, col hold(i,j)=lhead(i,j) hnew(i,j)=lhead(i,j) end do end do do i=1,row do j=1,col R(i,j)=0. end do end do R(26,26)=Q/(delx*dely) ! Turn ON injection pump nend=3125 time=t1 kount1=0 kount2=11 Vo=0. Vi=0. ! Compute & Output write(*,*) "Heads with Time (Stress Period 2 [1-1.3125 days])" write(*,40)"Heads","Time" 40 format(/,44x,a5,48x,a4/) do n=1,nend do i=2,row-1 do j=2,col-1 A=(delx*dely*S)/(4.*T*delt) hbar=(hold(i,j+1)+hold(i,j-1)+hold(i+1,j)+hold(i-1,j))/4. hnew(i,j)=1./A*(A*hold(i,j)+(hbar-hold(i,j))+(delx*dely*R(i,j))/(4.*T)) end do end do Vo=((((hnew(26,26)-hnew(26,26+1)))/delx)*(K))*b*delx*delt& +((((hnew(26,26)-hnew(26,26-1)))/delx)*(K))*b*delx*delt& +((((hnew(26,26)-hnew(26+1,26)))/delx)*(K))*b*dely*delt& +((((hnew(26,26)-hnew(26-1,26)))/delx)*(K))*b*dely*delt& +Vo Vi=Q*delt+Vi do i=2,row-1 do j=2,col-1 hold(i,j)=hnew(i,j) end do end do time=time+delt kount1=1+kount1 if(kount1==kount2) then write(*,50) (hnew(26,j),j=1,col,5),time 50 format(1x,11f8.2,1f12.4) write(1000,200) (hnew(26,j),j=1,col),time 200 format(1x,51f10.4,1f12.4) kount1=0 end if end do stab=(T*delt)/(S*delx*dely) Mb=(1.+(Vo-Vi)/Vi)*100. write(*,60) stab, Vi, Vo, Mb 60 format(" stab: ",f8.5,/," Vi: ",f8.5/," Vo: ",f8.5/," Mb: ",f8.5/) ! Stress period 3: stop pumping, transient flow with source decay, explicit scheme, d^2h/dx^2+d^2h/dy^2=S/T*(dh/dt)-0/T !Finite Difference Equation: h[i,j,n+1]=1/A*(A*h[i,j,n]+(hbar-h[i,j,n])+(delx*dely*R)/(4*T)) !Where A=(delx*dely*S)/(4*T*delt) & hbar=(h[i+1,j,n]+h[i-1,j,n]+h[i,j+1,n]+h[i,j-1,n])/4 ! Fill old (time=n) and new heads (time=n+1) with heads from stress period 2, new heads will be overwritten as time marches on ! Define do i=1,row do j= 1, col hold(i,j)=hnew(i,j) hnew(i,j)=hnew(i,j) end do end do do i=1,row do j=1,col R(i,j)=0. end do end do R(26,26)=0.0 ! Turn OFF injection pump nend=10000-3125 time=t2 kount1=0 kount2=21 ! Compute & Output write(*,*) "Heads with Time (Stress Period 3 [1.3125-2 days])" write(*,70)"Heads","Time" ! 70 format(/,44x,a5,48x,a4/) do n=1,nend do i=2,row-1 do j=2,col-1 A=(delx*dely*S)/(4.*T*delt) hbar=(hold(i,j+1)+hold(i,j-1)+hold(i+1,j)+hold(i-1,j))/4. hnew(i,j)=1./A*(A*hold(i,j)+(hbar-hold(i,j))+(delx*dely*R(i,j))/(4.*T)) end do end do do i=2,row-1 do j=2,col-1 hold(i,j)=hnew(i,j) end do end do time=time+delt kount1=1+kount1 if(kount1==kount2) then write(*,80) (hnew(26,j),j=1,col,5),time 80 format(1x,11f8.2,1f12.4) write(1000,300) (hnew(26,j),j=1,col),time 300 format(1x,51f10.4,1f12.4) kount1=0 end if end do stab=(T*delt)/(S*delx*dely) write(*,90) stab 90 format(" stab: ",f8.5) close(1000) end program swid_flow