Hi,
Could anyone tell me why 2d momentum boundary conditions donot work. I do define :
#define EAST_M2RADIATION
#define EAST_M2NUDGING
in cppdefs.h, but they don't show up in running log file. While if I defined EAST_M2GRADIENT, it shows up its working.
Thanks in andvance!
feng
2D momentum boundary conditions missing in running log
There is a permanent solution to this problem
There is a permanent solution to this problem practiced in UCLA and Agrif codes for the last 7+ years: create a mechanism for automatic tracking of the status of each CPP switch in "cppdefs.h" by automatically generating an analog of Rutgers "checkdefs.F" (known as "check_switches1.F" in UCLA and Agrif code).
That takes care of the situation that if several years from now somebody introduces a brand new CPP switch to activate a brand new algorithm or option and defines and undefines that switch in "cppdefs.h", and (as it happens all the time) DOES NOT BOTHER to create a corresponding entry in "checkdefs.F", the status of that switch will be AUTOMATICALLY reflected in both log file and as a signature in netcdf files created by the roms code.
This can be adapted for Rutgers codes as well.
To see how it works, get "cppcheck.F" from
and compile it using fortran compiler you normally use to compile the rest of your ROMS. The result of this compilation should be named as "cppcheck".
Then go to directory where file "cppdefs.h" is located and execute "cppcheck." (no argument needed, just type ./cppcheck). That command gives some output on the screen, which is purely for information, and it also creates file "check_switches1.F", which is a fortran code. Study this file, and you will see that an automatically generated analog of your "checkdefs.F", which is guaranteed to be consistent with current status of "cppdefs.h".
The actual mechanism for self-documentation works as follows:
your Makefile should contain the following nests with proper dependencies
with [Tab] character in front of $(LDR) and /cppcheck. And, of course, check_switches1.F is included into source code list and the subroutine is actually called somewhere in the beginning (in UCLA/Agrif is is called from "init_scalars" along with other sanity checking routines).
The rationale for the dependencies above is as follows: whenever you touch cppdefs.h, check_switches1.F is regenerated automatically, and because it is in source list, it will be compiled in into roms executable. Upon execution "check_switches1" does two things
string "cpps" of length "max_opt_size" is declared in file "strings.h" as follows
and must be visible by the rest of the code.
"MPI_master_only" is a CPP-macro defined in "globaldefs.h" as
which basically restricts writing to the string to MPI-node 0, if you run MPI code, and is nothing in OpenMP mode. (#ifdef MPI is analogous to Hernan's #ifdef DISTRIBUTE)
That takes care of the situation that if several years from now somebody introduces a brand new CPP switch to activate a brand new algorithm or option and defines and undefines that switch in "cppdefs.h", and (as it happens all the time) DOES NOT BOTHER to create a corresponding entry in "checkdefs.F", the status of that switch will be AUTOMATICALLY reflected in both log file and as a signature in netcdf files created by the roms code.
This can be adapted for Rutgers codes as well.
To see how it works, get "cppcheck.F" from
Code: Select all
http://www.atmos.ucla.edu/~alex/ROMS/cppcheck.F
Then go to directory where file "cppdefs.h" is located and execute "cppcheck." (no argument needed, just type ./cppcheck). That command gives some output on the screen, which is purely for information, and it also creates file "check_switches1.F", which is a fortran code. Study this file, and you will see that an automatically generated analog of your "checkdefs.F", which is guaranteed to be consistent with current status of "cppdefs.h".
The actual mechanism for self-documentation works as follows:
your Makefile should contain the following nests with proper dependencies
Code: Select all
cppcheck: cppcheck.o
$(LDR) $(FFLAGS) $(LDFLAGS) -o cppcheck cppcheck.o
check_switches1.F: cppcheck cppdefs.h
./cppcheck
The rationale for the dependencies above is as follows: whenever you touch cppdefs.h, check_switches1.F is regenerated automatically, and because it is in source list, it will be compiled in into roms executable. Upon execution "check_switches1" does two things
- it writes on the screen the name of each active CPP switch (so your log file reflects what was defined and what was not, and
- it generates string called "cpps" which consists record of activated CPP-switches. This string should be written as a global attribute into all netcdf files created by your roms.
string "cpps" of length "max_opt_size" is declared in file "strings.h" as follows
Code: Select all
integer max_opt_size
parameter (max_opt_size=2048)
character*(max_opt_size) cpps, srcs, kwds
common /strings/ cpps, srcs, kwds
"MPI_master_only" is a CPP-macro defined in "globaldefs.h" as
Code: Select all
#ifdef MPI
# define MPI_master_only if (mynode.eq.0)
#else
# define MPI_master_only
#endif