Resource Center

Advanced Search
Technical Papers
Working Papers
Research Memoranda
GTAP-L Mailing List
CGE Books/Articles
Important References
Submit New Resource

GTAP Resources: Resource Display

GTAP Resource #1708

"Using GEMPACK Subroutines in your Fortran Programs "
by Harrison, Jill, Mark Horridge and Ken Pearson

General-purpose software packages such as GEMPACK provide tools which allow modellers to concentrate on the economic issues without needing to write their own software. However, it may occasionally be necessary to write programs to carry out some specialised tasks which cannot be carried out using the general-purpose tools provided. Even then, programmers with access to a Source-code version of GEMPACK can make use of the many Fortran routines supplied with GEMPACK.

This paper gives an introduction to using GEMPACK subroutines in writing your own Fortran programs. It gives a brief overview of some of the ideas behind the GEMPACK code such as error handling and to some of the routines available for opening, reading and writing Header Array files. By using standard GEMPACK routines, you can avoid knowing, in great detail, the structure of GEMPACK file types such as Header Array files.

We provide and describe in detail two typical programs which illustrate the techniques involved. The first program reads data from a non-GEMPACK text file, modifies it and then writes the modified data to a Header Array file. The second program reads some simulation results from Header Array files and calculates and writes arrays showing the differences between these results.

The example programs we provide have been chosen because these are two of the tasks for which it may occasionally be necessary to write programs. However, because we want to emphasise how you can use the existing GEMPACK routines to do much of your work, we have chosen to present somewhat simplified versions of the actual tasks which may confront a modeller. For example, in the first example program,
a) we present rather simple versions of the complexities which may be necessary in order to read and modify data taken from a non-GEMPACK source.
b) we read, modify and write only one array (whereas a real-life program would probably have to deal with several arrays).
As well as the two example programs, we provide information as to where you can find the source code for different GEMPACK subroutines, how they are organised and how you can compile and link your programs to the GEMPACK libraries.

We also provide templates MODELPRG for a main program (see section 4) and MODELSUB for a subroutine (see section 5). These contain the standard declarations and calls. When we develop a new main program or subroutine, we always start from these. We recommend that you do the same.

Once you have become familiar with the material here, you will be in a good position to understand the code in any of the GEMPACK utility programs (those described in GEMPACK document GPD-4).

Resource Details (Export Citation) GTAP Keywords
Category: 2005 Conference Paper
Status: Published
By/In: Presented at the 8th Annual Conference on Global Economic Analysis, Lübeck, Germany
Date: 2005
Created: Pearson, K. (4/28/2005)
Updated: Batta, G. (1/28/2014)
Visits: 3,055
No keywords have been specified.

If you have trouble accessing any of the attachments below due to disability, please contact the authors listed above.

Public Access
  File format Using GEMPACK Subroutines   (221.6 KB)   Replicated: 0 time(s)

Restricted Access
No documents have been attached.

Special Instructions
Associated files can be found at

Comments (0 posted)
You must log in before entering comments.

No comments have been posted.