The problem statement is to use Fortran 95 to code a forward time, centered space numerical solution to the 1-D (x-direction) Advection-Dispersion Equation:
dc/dt = u(dc/dx) + D(d2c/dx2) - kc
where c is the concentration of contaminant, u is the advecting velocity, D is the dispersion coefficient, and k is the decay rate.
I am trying to figure out why the following code is writing the solutions out in excel without including the final time step at 0.5 days and the final spatial interval at x = 20,000 meters.
C(x, t=0) = 0 mg/L
C(x=0, t) = 100 mg/L
dc/dx(X=L, t) = 0
The Attempt at a Solution
I decided not to post the whole code because I did not write the program, so it may not make complete sense. If it doesn't make sense or more coding information is needed, just let me know.
nts is the total number of time steps all the way up to 0.5 days where dt =100 sec.
ndx is the total number of spatial intervals all the way up to L = 20,000 m and dx = 200 m
do n=1,nts-1 ! change from nts-1 to nts to account for last missing time step?
r(i)=r(i)+q(i) ! This is the known RHS matrix elements
call tridag ! This solves the banded tridiagonal matrix using the Thomas algorithm - see my class notes
end program main