Unsteady Heat Conduction in a Bar

This page allows you to download all subroutines you need to compile and link a program that computes unsteady heat conduction in a bar. You may first want to create a separate directory to hold the various files.

Procedure:

First choose the files you want by selecting them from the list below, and saving them (typically using 'Save as' from the 'File' menu.)

Under Unix, the command 'make' will then compile the source code and produce the executable file. For example, the make file for program 'ftcs.f' creates the executable file 'ftcs'. To run it, enter 'ftcs'. Make sure no errors occur during compilation, of course.

If you want to try different methods, boundary conditions, etcetera, simply get them from this page and run 'make' again.

If you do not see what you want, download the template and write your own! (For finite difference methods, select a similar method and adapt it.)


Select a finite difference procedure:

  1. Program ftcs.f, input file ftcs.in, and Unix makefile. Forward-time, central space formula.
  2. Program cn.f, input file cn.in, and Unix makefile. Crank-Nicholson scheme.
  3. Program bt2cs.f, input file bt2cs.in, and Unix makefile. Second-order backward-time. central space method.

Select a subroutine for the initial data:

  1. Version exact/init_u.f. Takes the initial data from the exact solution.
  2. Template template/init_u.f. A template to create your own initial data.

Select a boundary condition for the left end of the bar:

  1. Version diri_exa/bc_1.f. Sets a Dirichlet boundary condition according to the exact solution.
  2. Version period/bc_1.f. Maintains the left end of a periodic boundary condition. Combine with boundary condition number 2 for the right end.
  3. Version insul_mi/bc_1.f. Sets an insulated-end (Neumann) boundary condition using a mirror point.
  4. Version insul_st/bc_1.f. Sets an insulated-end (Neumann) boundary condition using staggering.
  5. Template template/bc_1.f. A template to create your own left end boundary condition.

Select a boundary condition for the right end of the bar:

  1. Version diri_exa/bc_2.f. Sets a Dirichlet boundary condition according to an exact solution.
  2. Version period/bc_2.f. Maintains the right end of a periodic boundary condition. Combine with boundary condition number 2 for the left end.
  3. Version insul_mi/bc_2.f. Sets an insulated-end (Neumann) boundary condition using a mirror point.
  4. Version insul_st/bc_2.f. Sets an insulated-end (Neumann) boundary condition using staggering.
  5. Template template/bc_2.f. A template to create your own right end boundary condition.

Select a subroutine for output:

  1. Version cexa/out.f, with input file cexa.in. Performs output using an exact solution as comparison. Computes the Fourier coefficients where possible.
  2. Template template/out.f, with input file out.in. A template to create your own output.
Note: the plot files generated will be compatible with the plot program ~dommelen/bin/xyplot on the SUNs (where ~ = /home/e14).

Select an exact solution:

  1. Version none/u_exa.f. Select this file if you do not use an exact solution. This makes it impossible for any subroutine to use the exact solution by mistake.
  2. Version d_const/u_exa.f, with input file d_const.in. The exact solution corresponding to a constant initial temperature with zero-temperature boundary conditions.
  3. Version d_triang/u_exa.f, with input file d_triang.in. The exact solution corresponding to a triangular initial temperature profile with zero-temperature boundary conditions. (Faster decaying initial Fourier coefficients than the constant case.)
  4. Version d_para/u_exa.f, with input file d_para.in. The exact solution corresponding to a parabolic initial temperature profile with zero temperature boundary conditions. (Faster decaying initial Fourier coefficients than the triangular case.)
  5. Version d_smooth/u_exa.f, with input file d_smooth.in. The infinitely smooth exact solution corresponding to zero temperature boundary conditions and a smooth initial temperature profile that is anti-symmetric around the boundaries. (Exponentially decaying initial Fourier coefficients.)
  6. Version n_linear/u_exa.f, with input file n_linear.in. The exact solution corresponding to a linear initial temperature profile with insulated boundaries.
  7. Version pd_saw/u_exa.f, with input file pd_saw.in. The exact solution for a ring-shaped bar corresponding to a sawtooth initial temperature profile.
  8. Version p_smooth/u_exa.f, with input file p_smooth.in. The exact solution for a ring-shaped bar corresponding to an infinitely smooth initial temperature profile.
  9. Template template/u_exa.f. A template to create your own exact solution.

You also need:

  1. Mesh initialization subroutine init_x.f. Initializes the mesh point positions.
  2. Utility subroutines util.f. A collection of utility subroutines.
  3. Tridiagonal solver tridia.f. A subroutine to solve a tridiagonal system of equations. (For implicit methods.)
  4. Subroutine to satisfy the boundary conditions satis2.f. Combines three tridiagonal solutions that do not satisfy the boundary conditions into one that does. (For implicit methods.)

Return to my home page.
Comments: dommelen@eng.famu.fsu.edu