FORTRAN Programs for the Simulation of Electrochemical Systems
Please read the following before downloading our programs.

These programs are copyright John Newman 1998. 

You may make a copy of this program which you may personally and freely use in its unaltered form.  You may make changes for your own personal use to dualfoil.f's material database located in subroutines ekin (electrodes) and prop (electrolytes).  You may distribute this program subject to the conditions that it stays free of charge and that any duplication of this program must be essentially unaltered and must include this notice.  We make no warranties, expressed or implied, that this program is free of errors or that it will meet the requirements of your application. The author and publisher disclaim all liability for direct or consequential damages resulting from use of this program.


BAND(J) subroutine

dualfoil5.1.f program for lithium ion, sodium ion, and nickel-metal hydride battery simulation
input file for lithium ion battery simulation input file for nickel-metal hydride battery simulation input file with activation energies for lithium-ion battery simulation

Instruction manual for how to use dualfoil.f (Manual for Version 4)
Instruction manual for how to use dualfoil5.f (Manual for Version 5)

Version updated February 27, 2008. Several major changes have been made in going to dualfoil 5.1
- Subroutine guess has been removed
- Convergence has been improved and the dV/dt trigger has been removed
- fj(j) for cutting off part of the electrode has been removed
- The variables have been renamed
- A grid resistance, RG, has been added
- An error in the dualfoil5.f impedance calculation for anode and cathode has been corrected; the dualfoil5.f full-cell impedance was correct
- The equation structure for impedance mode has been made general, facilitating future additions
- We have improved the output formatting
- We have improved the logic of the multiple-particle selection section

Version updated October 17, 2007. Two small changes have been made to Dualfoil 5.0.
- The value of the stoichiometric parameter x in the input file was changed from x=0.99 to x=0.60. This results in an anode-limited cell upon discharge.
- An error that prevented the use of a lithium metal anode was corrected.

Version updated August 14, 2007, has a series of major modifications which are detailed at the top of the code and in the additional instruction manual posted above.

Version updated May 17, 2005. Introduction of an upper and lower cutoff potential.
Note: old verions of the input file are not compatible with the new version.
The previous version of Dualfoil (July 15, 2003) used a single cutoff potential, which caused problems when a user attempted to charge the cell following a discharge. For example, if the global cutoff potential was set to 3.0V and the cell discharged beneath that value, upon charging the cutoff potential would be triggered when the cell potential exceeded 3.0V. The revised version of dualfoil.f uses two global cutoff potentials, one that serves as an upper bound and one that serves as a lower bound. has been modified to allow the user to specify two cutoff potentials.

Version updated July 15, 2003. Program now runs either impedance or constant current/potential.
Make imp=1 in for the impedance option, in not use imp=0.
Has been run under g77, f77, mf77, and Visual Fortran.

car2.f program to simulate battery performance in a hybrid electric vehicle
specg general input file for program car2.f

Need to find a Fortran compiler?

For Windows (98, NT, 2000, and XP):
1.  Download the MinGW precompiled binary, made available by courtesy of the GNU project:
(about 10 MB) mingwv2.exe

2.  Double-click on it to run the installer.  It will install the fortran compiler g77 as well as compilers for
other languages such as c.

3.  Now go to the DOS prompt (also called command prompt).  Go to the root directory (C:)
and edit the file AUTOEXEC.BAT (warning: messing up this particular file can incapacitate your PC) to add the line:
PATH=C:\folder\bin;%PATH%; where \folder is the directory where you put mingw.  Restart your computer to activate this new path file.  Newer Windows versions require you to go to start→ control panel→ System→ Advanced→ Environmental variables and adding the path in the appropriate section.  Warnings about your PC being incapacitated apply.  Come to think about it, these warnings almost always apply.

4.  The compiler is run from the DOS prompt by typing: g77 filename.f  where filename is the name of your fortran file. This should create an output file called a.exe.

5.  You can execute this by typing: a

For more information about compilers for other operating systems, see the GNU website at

Find all this a bit too complicated?  Why not use Visual Fortran?  Did we mention that they charge a “small” fee?

Questions and comments can be sent to Professor Newman, newman (at)