Skip to content
Snippets Groups Projects
Commit 07a37350 authored by Stefano Serafin's avatar Stefano Serafin
Browse files

WRF.md conditional compilation

parent c4533daf
No related branches found
No related tags found
No related merge requests found
......@@ -333,9 +333,64 @@ 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.
For instance, in `dyn_em/module_initialize_ideal.F`:
```
#ifdef MTN
DO j=max(ys,jds),min(ye,jde-1)
DO i=max(xs,ids),min(xe,ide-1)
grid%ht(i,j) = mtn_ht * 0.25 * &
( 1. + COS ( 2*pi/(xe-xs) * ( i-xs ) + pi ) ) * &
( 1. + COS ( 2*pi/(ye-ys) * ( j-ys ) + pi ) )
ENDDO
ENDDO
#endif
#ifdef EW_RIDGE
DO j=max(ys,jds),min(ye,jde-1)
DO i=ids,ide
grid%ht(i,j) = mtn_ht * 0.50 * &
( 1. + COS ( 2*pi/(ye-ys) * ( j-ys ) + pi ) )
ENDDO
ENDDO
#endif
#ifdef NS_RIDGE
DO j=jds,jde
DO i=max(xs,ids),min(xe,ide-1)
grid%ht(i,j) = mtn_ht * 0.50 * &
( 1. + COS ( 2*pi/(xe-xs) * ( i-xs ) + pi ) )
ENDDO
ENDDO
#endif
#ifdef NS_VALLEY
DO i=ids,ide
DO j=jds,jde
grid%ht(i,j) = mtn_ht
ENDDO
ENDDO
xs=ids !-1
xe=xs + 20000./config_flags%dx
DO j=jds,jde
DO i=max(xs,ids),min(xe,ide-1)
grid%ht(i,j) = mtn_ht - mtn_ht * 0.50 * &
( 1. + COS ( 2*pi/(xe-xs) * ( i-xs ) + pi ) )
ENDDO
ENDDO
#endif
```
To control conditional compilation:
1. Search for the variable `ARCHFLAGS` in `configure.wrf`
2. Add the desired define statement at the bottom
```
ARCHFLAGS = $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \
$(ARCH_LOCAL) \
$(DA_ARCHFLAGS) \
-DDM_PARALLEL \
...
-DNMM_NEST=$(WRF_NMM_NEST) \
-DNS_VALLEY
```
## Customizing model output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment