Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] aeos_v1_0.tar.gz(17 Kbytes)
Manuscript Title: DNAD, a Simple Tool for Automatic Differentiation of Fortran Codes Using Dual Numbers
Authors: Wenbin Yu, Maxwell Blair
Program title: DNAD
Catalogue identifier: AEOS_v1_0
Distribution format: tar.gz
Journal reference: Comput. Phys. Commun. 184(2013)1446
Programming language: Fortran 90/95/2003.
Computer: All computers with a modern FORTRAN compiler.
Operating system: All platforms with a modern FORTRAN compiler.
Keywords: Automatic differentiation, Fortran, Sensitivity analysis.
Classification: 4.12, 6.2.

Nature of problem:
Sensitivities of outputs with respect to inputs of a Fortran code are often needed in physics, chemistry, and engineering. The author of the analysis code may no longer be available and the user may not have a deep knowledge of the code. Thus a simple tool is necessary to automatically differentiate the code with very minimum change to the source codes. This can be achieved using dual number arithmetic and operator loading.

Solution method:
A new data type is defined with the first scalar component holding the function value and the second array component holding the first derivatives. All the basic operations and functions are overloaded with the new definitions according to the dual number arithmetic. To differentiate an existing code, all real numbers should be replaced with this new data type and the input/output of the code should also be modified accordingly.

Running time:
For each additional independent variable, DNAD takes less than one time of the running time of the original analysis code. However the actual running time depends on the compiler, the computer, and the operations involved in the code to be differentiated.