From c4533dafbaf9218225fb5514515ac5876085b974 Mon Sep 17 00:00:00 2001 From: Stefano Serafin <stefano.serafin@univie.ac.at> Date: Sat, 4 Mar 2023 19:51:19 +0000 Subject: [PATCH] WRF.md added conditional compilation --- WRF.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/WRF.md b/WRF.md index b82d939..deedb45 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 -- GitLab