[MITgcm-devel] unsafe common block FFIELDS

Jean-Michel Campin jmc at ocean.mit.edu
Thu Nov 20 10:06:27 EST 2003


Hi, 

I think that with the "new" way to set package configuration and
CPP options, this part is now "unsafe" (was not very clean before,
but was safe as long as all #define were in CPP_OPTIONS.h):

file: FFIELDS.h :

>       COMMON /FFIELDS/
>      &                 fu
>      &               , fv
>      &               , Qnet
>      &               , Qsw
>      &               , dQdT
>      &               , EmPmR
>      &               , saltFlux
>      &               , SST
>      &               , SSS

with few lines later:

> #ifdef SHORTWAVE_HEATING
>       _RS  Qsw      (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
> #else
>       _RS  Qsw      (1,1,1,1)
> #endif

Because "define SHORTWAVE_HEATING" is set in CPP_OPTIONS.h
according to the status of  "ALLOW_KPP", strange things could
happen if one includes FFIELDS.h in a S/R but forgets to add
PACKAGES_CONFIG.h :
Some compiler will not complain, but when running the model, 
this particular S/R will cause problems because any variable 
after Qsw in the common bloc FFIELDS will be shifted (to almost 1 array)
so that SST becomes SSS and so on.

Jean-Michel



More information about the MITgcm-devel mailing list