!  heat_flow program to determine the temperature of the ground
!  around a tank full of LNG.
 
!  Look at 200 points, each a quarter foot apart, going away from the tank.
 
      dimension u(200), unew(200)
      data u/200*60.0/   ! Initial temperature of 60 degrees
      tc = 2.6           ! The termal conductivity (or K) of the ground
      c = 0.2            ! The heat capacity or specific heat
      rho = 132.0        ! The density of the ground
      h = .25            ! The stepsize in feet for this calculation
      timestep = .25     ! The timestep in hours
      temperature = -258.0  ! The temperature of LNG
 
      r = tc*timestep/(c*rho*h*h)  ! a constant, the coefficient of first term
      n = 200  ! The number of points and equations.
 
      nm = n-1  ! n minus 1
      part = 1.0 - 2.0*r   ! The coefficient of u^j_i
 
      do j = 1, 1000
        unew(1) = r*temperature+part*u(1)+r*u(2)  ! boundary condition
        do i = 2, nm
          unew(i) = r*u(i-1)+part*u(i)+r*u(i+1)
        enddo
        u(n) = r*u(nm)+part*u(n)+r*u(n)
        do k = 1, nm
          u(k) = unew(k)
        enddo
      enddo
 
      print 5,u
    5 format (4f14.4)
      stop
      end