Index and description of example Fortran programs used in the course


The following is a listing and description of the example programs used in Comp Sci 201 (Fortran).


Program name:

What it does:

add.fAdds 2 numbers
add2.fadd.f using SUBROUTINEs and a MODULE
aorder.fDemonstrates the storage order of a Multi-dimensional array, also the use of the EQUIVALENCE statement.
arith.fDemonstrates the arithmetic assignments such as order of operations and mixed mode operations. Also uses the DATA statement
arithp.fDemonstrates the arithmetic assigments using parentheses and the PARAMETER statement.
array1.fDemonstrates use of arrays for data analysis-max, min, and average and use of formatted output.
array1s.fSame as array1.f except uses subroutines for data analysis. Demonstrates how to pass arrays between the main program and subprograms.
array2.fDemonstrates the use of arrays with Fortran 90 specifications.
array2s.fSame as array2.f except it uses subroutines for data analysis and Fortran90 size declarations.
array2se.fSame as array2.fand array2s.f except it uses subroutines and Fortran 77 array size declarations.
array2sf.fAnother rewrite of array2.f.
array3.fDemonstrates the use of the ALLOCATE statement for declaring arrays of unknown size.
array3a.fProgram very similar to array3.f but examines the input data file to determine the size of the input array. Examines input file array3a.in.
array3as.fSame program as array3a.f except it demonstrates the use of the ALLOCATE statement with subroutines.
array3b.fAnother use of the ALLOCATE statement determining the size from the input file. Uses the input file array3b.in.
array3c.fAnother array program for arrays of unknown size using Fortran 77's PARAMETER statement rather than ALLOCATE.
array3e.fArray program which demonstrates the MISUSE of the ALLOCATE statement.
associated.fDemonstrates the use of pointers and targets and tests their association.
clobber.fIllustrates the pitfalls of poorly indexing arrays.
debug.fHeat Transfer Coefficient program with errors which need to be fixed.
debug1.fDemonstrates the debugging process.
dimtest.fTests the DIM option for the Fortran 90 intrinsic functions sum, minval, and maxval for use with arrays. Associated with sample output dimtest.out.
dual-errors.fExample of the use of the INTERFACE structure creating a generic function interface.
dual-interface.fDemonstrates the use of the INTERFACE structure which creates a generic function which can be used with both real and integer values.
errors.fProgram with several errors due to the poor location of statements.
format.fDemonstrates the many uses of the Format statement. Generates sample file format.out.
funspeed.fProgram similar to speed.f which uses functions to do all of the calculations.
gp-int1Demonstrates use of gnuplot to graph data from two input files. Sample gnuplot input file.
gp-int2Another sample gnuplot input file.
gp-int3" " "
grades1.fProgram which uses arrays and subroutines to calculate and store grades. Associated with grades.in.
htcoef.fProgram which calculates approximate heat transfer coefficients for a 1 inch pipe for several Reynolds numbers.
htcoef1.fSame as htcoef.f except it calls a function to do the calculations.
htcoef2.fSame as htcoef.f except it demonstrates the fact that variables of the same name in the main program and subprograms can have different values.
htcoef3.fProgram very similar to htcoef1.f and htcoef2.f which uses an exponentiation trick to increase the speed.
iftests.fShows the many uses of the IF statement.
inter1.fDemonstrates 2 simple methods of interpolation (linear and cubic) for smoothly joining results from 2 disjoint regions.
inter2.fSame as inter1.f except interpolates different data.
inter3.fSimilar to inter1.f and inter2.f but uses a weighted transition.
interface.fDemonstrates the use of the INTERFACE structure which allows the use of FUNCTIONS with arrays.
linint1.fSubroutine which interpolates y-values given an x-value and a table of y-values.
linint2.fSubroutine similar to linint1.f but uses tables of x and y values.
linint3.fSubroutine similar to linint1.f and linint2.f but more efficient.
linint4.fSubroutine similar to linint1.f , linint2.f, and linint3.f but even more efficient.
mathinSample file of Mathematica commands.
matprod.fMultiplies two matrices together.
module.fDemonstrates the use of the MODULE structure within a main program and its subprograms.
newton1.fSample program using NEWTON ITERATION to solve an equation.
newton2.fMore complicated version of newton1.f which uses statement functions and do loops.
noadv.fDemonstrates the use of the NO ADVANCE option on READ and WRITE.
pawsum.fArray program which uses MAX, MIN, implied DO loops, DATA statements, and other Fortran 90 constructs.
plot1.fPlots sine function.
plot2.fProgram similar to plot1.f except subroutines are used. Illustrates EXTERNAL and INTRINSIC statements
pointers.fDemonstrates the use of pointers to manipulate sections of arrays. Generates the file pointers.out
ranges.fDisplays the smallest and largest absolute values that can be represented with each of several data types. Uses Fortran 90 statements TINY and HUGE.
secant.fUses secant iteration to find the roots of an equation. Compares solution to Newton Iteration of same equation.
sifunc.fIntroduction to the statement function.
speed.fTimes three different methods of calculating the dot product of long vectors.
speedf.fProgram similar to speed.f.
sums.fDemonstrates the Fortran 90 SUM function with the MASK option.
trig.fCalculates the SIN and COS of an angle given in degrees.
where.fDemonstrates the use of WHERE, ELSE WHERE, and END WHERE.
Ordinary Differential Equation Programs
fall.fCalculates the dynamics of a falling body.
fall1.fProgram similar to fall.f but introduces MODULES.
fall2.fCalculates the dynamics of a falling body attached to a spring.
fall3.fProgram similar to fall2.f but give an answer that is second order accurate (proportional to dt**2)
odeint.fDemonstrates the use of Runge-Kutta, Adams-Bashford, and Adams-Moulton methods for solving ODEs
Curvefit Programs
quad.fPerforms a Quadratic spline fit to a specified data file (with .txt extension)
rholiq.fSubroutine which evaluates the density of Freon and its derivatives with respect to other properties.
satprs.fFunction which evaluates the saturation pressure of Freon as a function of saturation temperature.
thcl.fFunction which evaluates the liquid thermal conductivity of Freon as a function of enthalpy.
viscl.fFunction which evaluates the liquid dynamic viscosity as a function of liquid enthalpy and pressure.
Integration Programs
trapezoid.fProgram which demonstrates the Trapezoidal rule of integration.
trapz1.fProgram similar to trapezoid.f which uses the file trapcom.h through an INCLUDE statement .
trapz2.fProgram similar to trapezoid.f which uses a MODULE.
Programs using Character Variables
charvar.fProgram which demonstrates the use of character variables in Fortran 77.
charvr90.fProgram whic demonstrates the use of character variables in Fortran 90.
Programs associated with Least Squares Fit
gendata.fCreates fake experimental data with a random error.
lin1.fProgram which tests linear equation solvers and sets up a 6x6 system of linear equations. Generates the file lin1.out
lsq.fProgram which performs a least squares fit of a quadratic equation to given data. This particular program gives the location of a falling object at various times. Associated with the file fall.data
lsq2.fProgram similar to lsq.f which takes advantage of Fortran 90 statements.
lsq3.fProgram similar to lsq.f which uses code that is optimized for parallel or vector processors.
quadfit.fProgram which takes data from two arrays and fits them to a quadratic equation.
Programs associated with Sorting Data
drvsort.fProgram which drives sorting subroutines.
sort1.fExample of a SELECTION SORT using Fortran 90.
sort2.fExample of a BUBBLE SORT.
sort3.fExample of an INSERTION SORT.
sort3a.fExample of an INSERTION SORT using Fortran 90 Functions.
sorthalf.fSorts an array also making the same interchanges in an auxiliary array. Array can be sorted in increasing or decreasing order.
sortoutTest of all sorting subroutines.

Back to the 201 homepage.