Cookiecutter-QDYN

A cookiecutter template for a Fortran project using QDYN.

Prerequisites

You must have cookiecutter installed. Run e.g.

pip install cookiecutter

Note that the QDYN development-venv also has the cookiecutter executable installed.

Usage

Assuming you have a checkout of the qdyn repository in your home directory, run

cookiecutter $HOME/qdyn/cookiecutter

from anywhere. You will be prompted for the project variables (see below), and a project will be generated based on your choices.

See cookiecutter --help for additional options. In particular, --output-dir determines the parent of the resulting project folder, and --no-input runs cookiecutter in a non-interactive mode, where you may specify the project variables directly on the command line. For example,

cookiecutter --no-input --output-dir $HOME $HOME/qdyn/cookiecutter project_name=myproject prog_name=myproject_prop

will generate a project in ~/myproject with myproject_prop as the name of the main executable.

Project Variables

  • project_name (default: hello_world_proj):
    Name of the output folder.

  • prog_name (default: hello_world):
    Name of the main program.

  • use_module (y or n, default: y):
    Whether to use an “auxiliary” module. All global variables will be defined in this module. This means that routines defined in the module can use them as global variables (“module variables”). Also, variables and routines can be shared between multiple programs.

  • module_name (default: global):
    If use_module is y, the name of the module file. The module file <module_name>.f90 (or <module_name>.F90) will be created. The name of the module inside the module file will be <module_name>_mod, i.e. have the _mod suffice. The main program will contain a line use <module_name>_mod. If use_module is n, the value of module_name will be ignored.

  • use_precompiler (y or n, default: n):
    Whether or not you will want to use pre-compiler variables in your program/module. By convention, Fortran code that uses pre-compiler variables uses the upper-case .F90 extension. Choosing this option as y will simply rename all *.f90 files to have the .F90 extension.