Project Status
16 August 2011
An Xgear compatible Fortran version of DELOAD has been created, based on the original HMC version, but including deuterium chemistry. DELOAD reads the species and rates files and generates an output file 'odes_xgear.f', the Fortran code for the subroutine DIFFUN, which is compiled as part of Xgear. At each iteration over time DIFFUN calculates the rate of each reaction, and the rate of change of number density of each species. DELOAD includes the subroutine DECOMP, which calculates the elemental composition and mass of each species.
Two more hard coded parameters have now been removed from the Fortran source code: the underlying D/H ratio; and the dust grain albedo in the far UV (used in calculating the rate for cosmic ray photon induced photoreactions). These parameters can now be specified on the command line or via a configuration file. It also transpires that the parameter for the density of sites on a grain surface is not used anywhere in the HMC code that Xgear is based on. This parameter appears related to depletion onto dust grains, so is being retained, so that depletion may be included at some point in the future.
17 February 2011
A number of additional special parameters can now be specified in an Xgear configuration file. These include reaction rate parameters that can not be defined in standard rate files, such as deuterium fractionation reactions, the N+ + H2 reaction and error control parameters. The following shell environment variables can be set to define directory locations: Xgear and its resources including the help file; output data directories; parameter configuration files; species and initial abundances files; reaction rates files.
18 November 2010
The Fortran function HMC has now been successfully modified so that all the parameter values that were hard coded are now passed to HMC from the C coded main function. This uses six nested for loops in the Xgear C wrapper, so that each model is run by passing its set of parameter values to an instance of the HMC function, which in turn runs the DNEWGEAR integrator. Screen output has been tidied up and the output files are now written to a data sub-directory that is named using the range of parameter values specified. A numerical suffix is incremented if the sub-directory already exists. Individual output data files are named using the parameters of each specific model run. It now remains to tidy up a few minor loose ends and do extensive testing.
5 September 2010
I have finally got round to successfully compiling and linking Xgear with gcc and gfortran under Linux (CentOS 5.3 64-bit) running on a Parallels virtual machine on my MacBook Pro.
Tim Jenness of the JAC in Hawaii has kindly directed my attention to Starlink's CNF and F77 Manual for Mixed Language Programming in Fortran and C, which tells a programmer how to mix program segments written in Fortran and C in a portable way using the CNF package. It provides information on several levels from a quick how to get started cookbook, down to machine-specific details. The CNF package comprises two sets of software which ease the task of writing portable programs in a mixture of Fortran and C. F77 is a set of C macros for handling the Fortran/C subroutine linkage in a portable way, and CNF is a set of functions to handle the difference between Fortran and C character strings, logical values and pointers to dynamically allocated memory.
11 March 2010
The Xgear C wrapper can now successfully call the Fortran function FRED() and load the rate and species files into memory. Working out the correct way to call a Fortran function from C proved to be non-trivial, as although there is some documentation out on the web, most of it is neither clear or free of contradictions (see my notes on Calling Fortran functions from C).
I am using the latest versions of gcc and gfortran for compilation and linking under OS X Snow Leopard (I will test with gcc/gfortran under Linux soon).
We are presenting a poster (The Xgear Project - A New Era for Astrochemical Modelling?) at the RAS National Astronomy Meeting at the University of Glasgow on 12-16 April 2010.
Sample output from Xgear showing that rate and species files have loaded into memory successfully.
16 December 2009
The basic wrapper has been completed and tested. It processes command line arguments and/or loads parameters from an external configuration file. Parameter arguments and values are tested for consistency. Default parameter values as well as sensible minimum and maximum values are defined in xgear.h. Sample configuration and help files have also been created.
The next tasks are: loading the rate and species files by calling the function FRED() from the Xgear wrapper; removing all hard coded parameters from the function HMC and modifying it to accept the 13 parameter variables each time it is called; creating nested for loops in the Xgear wrapper so that each model is run by passing its set of parameter values to HMC.

