-
Notifications
You must be signed in to change notification settings - Fork 8
Code organization and design philosophy
Michael Dietze edited this page Jan 6, 2014
·
1 revision
The ED code is mostly written in Fortran 90, with very few file handling utilities that are written in C language. New contributions to the code should be all written in standard Fortran 90 language, since ED has a unique data structure which is not easily ported to different languages.
The main ED directory (.../EDBRAMS/ED) is divided in three subfolders:
- src: The source code directory;
- build: The compilation instructions;
- run: The directory containing a sample ED2IN namelist.
The source code directory, in turn, is divided in several sub-folders:
- driver : The main ED drivers. This directory contains the main program, and subroutines that organize the model initialization and the time step call.
- dynamics : Contains most subroutines that drive the ecosystem dynamics at various time steps.
- include : Contains some header files used by the very few functions written in C;
- init : Contains subroutines that will initialize various model variables and parameters;
- io : Contains the functions and subroutines that read and write files;
- memory : Contains all modules with the model global variables, and some functions that allocate and deallocate the global variables;
- mpi : Contains all the message-passing interface procedures needed for a parallel run.
- utils : Contains subroutines that don't really fit into any of the previous directories.
- preproc : Not part of the main code, it contains some basic tools needed to convert ASCII datasets into HDF5. For conversions from re-analysis to HDF5, we suggest using RAPP.
The build directory has only one sub-folder, bin, where all the compilation tools are located. The compilation instruction is organized in the following files:
- paths.mk : This will set up all the folder structure for the compiler. In most cases, ED_ROOT is the only variable that needs to be changed;
- objects.mk : This file contains the list of all objects to be compiled. This shouldn't be changed unless a new file is added;
- rules.mk : This file contains the instructions on how to compile each object. Unless you are adding code that is in a new file, this should not be changed.
- dependency.mk : This file is automatically generated each time the code is compiled.
- 2ndcomp.sh : This file is used for interface check (model debugging). This doesn't need to be changed unless a new code file is added.
- Makefile : This is the main instruction file, which will handle the compilation. Normally this file shouldn't be changed.
- include.mk.opt : This is the file that must be changed to account for compilation options and library paths for MPI and HDF5. The default distribution contains a few examples for different compilers.