(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

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.

2. Relevant equations

Initial condition:

C(x, t=0) = 0 mg/L

C(x=0, t) = 100 mg/L

dc/dx(X=L, t) = 0

3. 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?

tim(n)=dt*(n-1)

r=0.

do i=1,ndx

do j=1,ndx

r(i)=r(i)+d(i,j)*conc(j,n)

end do

r(i)=r(i)+q(i) ! This is the known RHS matrix elements

end do

call tridag ! This solves the banded tridiagonal matrix using the Thomas algorithm - see my class notes

end do

open(10,file='CNimplicitFTCS.xls',status='unknown')

write(10,100)(tim(n)/86400.,n=1,nts,10)

100 format('X,',2x,10000('t=',f8.4,','))

do i=1,ndx

x=dx*(i-1)

write(10,110)x,(conc(i,n),n=1,nts,10)

110 format(f10.1,',',10000(f8.4,','))

end do

stop

end program main

**Physics Forums - The Fusion of Science and Community**

# Fortran 95 - ADE Implicit Scheme Tridag. Matrix

Know someone interested in this topic? Share a link to this question via email,
Google+,
Twitter, or
Facebook

Have something to add?

- Similar discussions for: Fortran 95 - ADE Implicit Scheme Tridag. Matrix

Loading...

**Physics Forums - The Fusion of Science and Community**