diff --git a/WRF.md b/WRF.md index b82d939af5e214242c4837d71efb6c0fea5b1cde..deedb45739053cb2bf184312ccc4bad1126e95d6 100644 --- a/WRF.md +++ b/WRF.md @@ -325,6 +325,18 @@ However, we describe the typical workflow of the compilation, for anyone that wi ## Conditional compilation +Most Fortran compilers allow passing the source code through a C preprocessor (CPP; sometimes also called the Fortran preprocessor, FPP) to allow for conditional compilation. In the C programming language, there are some directives that make it possible to compile selectively portions of the source code. + +In the WRF source code, Fortran files have an .F extension. cpp will parse these files and create corresponding .f90 files. The .f90 files will then be compiled by the Fortran compiler. + +This means: +1. When editing the source code, always work on the .F files, otherwise changes will be lost on the next compilation. +2. In the .F files, it is possible to include `#ifdef` and `#ifndef` directives for conditional compilation. + +To control conditional compilation: +1. Search for the variable `ARCHFLAGS` in `configure.wrf` +2. Add the desired define statement at the bottom + ## Customizing model output ## Adding namelist variables