weird C-preprocessing Options issue

Facts, news, and guidance about ROMS software

Moderators: arango, robertson

Post Reply
Message
Author
rduran
Posts: 152
Joined: Fri Jan 08, 2010 7:22 pm
Location: Theiss Research

weird C-preprocessing Options issue

#1 Unread post by rduran »

I have a weird thing going on. It does not happen with roms 3.0 but it does with roms 3.5


My cppdefs.h is:

================================
#define OREGON_OBC /* Oregon, open boundary conditions (AK: 7

#if defined OREGON_OBC

/*
** Options for the Oregon case: Open BC
*/
#define UV_ADV /* turn ON advection terms: default is thi
#define UV_VIS2 /* turn ON Laplacian horizontal mixing */
#define UV_COR /* turn ON Coriolis term */
#define DIAGNOSTICS_UV /* turn ON for mometum diagnostics
#undef UV_LDRAG /* turn ON linear bottom friction */
#define UV_QDRAG /* turn ON quadratic bottom friction */
#define TS_PSOURCE /* turn ON point Sources/Sinks */
#define UV_PSOURCE /* turn ON point Sources/Sinks */
#define T_PASSIVE /* turn ON inert passive tracers */
#define TS_U3HADVECTION /* 3rd-order upstream horiz. advection */
#define TS_C4VADVECTION/* 4th-order centered vertical advection */
#define TS_DIF2 /* Laplacian horizontal mixing OFF 2d*/
#define SALINITY /* using salinity */
#define NONLIN_EOS /* define if using nonlinear equation of state */
#define DJ_GRADPS /* Splines density Jacobian (Shchepetkin, 2000) */
#define SOLVE3D /* solving 3D primitive equations */
#define MASKING /* there is land in the domain */
#define SPLINES /* parabolic splines reconstruction */
#undef MIX_S_UV /* mixing along constant S-surfaces */
#define MIX_GEO_UV /* mixing on geopotential (constant Z) surfaces */
#undef MIX_S_TS /* mixing along constant S-surfaces */
#define MIX_ISO_TS /* mixing on epineutral (constant RHO) surfaces */
#define MY25_MIXING /* Activate Mellor/Yamada Level-2.5 closure */
#undef GLS_MIXING /* Generic Length-Scale mixing */
#undef CANUTO_A /* Canuto A-stability function formulation */
#undef AVERAGES
#define NUDGING_COFF
#define ANA_NUDGCOEF
#define ANA_HMIXCOEF
#undef SSH_TIDES
#undef UV_TIDES
#define RADIATION_2D /* Tangential phase speed in radiation conditions */
#define TCLM_NUDGING /* Nudging tracers climatology */
#undef ZCLM_NUDGING /* Nudging SSH climatology */
#undef M3CLM_NUDGING /* Nudging 3D momentum climatology */
#undef M2CLM_NUDGING /* Nudging 2D momentum climatology */
#define TCLIMATOLOGY /* Processing tracers climatology */
#undef ZCLIMATOLOGY /* Processing SSH climatology */
#undef M2CLIMATOLOGY /* Processing 2D momentum climatology */
#undef M3CLIMATOLOGY /* Processing 3D momentum climatology */
#undef PERIODIC_BOUNDARIES
#ifdef PERIODIC_BOUNDARIES
#define WESTERN_WALL
#define NS_PERIODIC
#endif
#define OPEN_BOUNDARIES
#ifdef OPEN_BOUNDARIES
#define SPONGE /* Enhanced viscosity/diffusion areas */
#undef WEST_FSCHAPMAN /* Western edge, free-surface, CLAMPED condition*/
#define WEST_FSRADIATION /* Western edge, free-surface, radiation condition */
#define WEST_FSNUDGING /* Western edge, free-surface, nudging term */
#define WEST_M2FLATHER /* Western edge, 2D momentum, Flather condition */
#undef WEST_M2RADIATION /* Western edge, 2D momentum, radiation condition */
#undef WEST_M2NUDGING /* Western edge, 2D momentum, nudging term */
#define WEST_M3RADIATION /* Western edge, 3D momentum, radiation condition */
#define WEST_M3NUDGING /* Western edge, 3D momentum, nudging term */
#define WEST_TRADIATION /* Western edge, tracers, radiation condition */
#define WEST_TNUDGING /* Western edge, tracers, passive/active nudging term */
#define WEST_KRADIATION /* Western edge, TKE, radiation condition */
#undef NORTH_FSCHAPMAN /* Northern edge, free-surface, CLAMPED condition*/
#define NORTH_FSRADIATION /* Northern edge, free-surface, radiation condition */
#define NORTH_FSNUDGING /* Northern edge, free-surface, nudging term */
#define NORTH_M2FLATHER /* Northern edge, 2D momentum, Flather condition */
#undef NORTH_M2RADIATION /* Northern edge, 2D momentum, radiation condition */
#undef NORTH_M2NUDGING /* Northern edge, 2D momentum, nudging term */
#define NORTH_M3RADIATION /* Northern edge, 3D momentum, radiation condition */
#define NORTH_M3NUDGING /* Northern edge, 3D momentum, nudging term */
#define NORTH_TRADIATION /* Northern edge, tracers, radiation condition */
#define NORTH_TNUDGING /* Northern edge, tracers, passive/active nudging term */
#define NORTH_KRADIATION /* Northern edge, TKE, radiation condition */
#undef SOUTH_FSCHAPMAN /* Southern edge, free-surface, CLAMPED condition*/
#define SOUTH_FSRADIATION /* Southern edge, free-surface, radiation condition */
#define SOUTH_FSNUDGING /* Southern edge, free-surface, nudging term */
#define SOUTH_M2FLATHER /* Southern edge, 2D momentum, Flather condition */
#undef SOUTH_M2RADIATION /* Southern edge, 2D momentum, radiation condition */
#undef SOUTH_M2NUDGING /* Southern edge, 2D momentum, nudging term */
#define SOUTH_M3RADIATION /* Southern edge, 3D momentum, radiation condition */
#define SOUTH_M3NUDGING /* Southern edge, 3D momentum, nudging term */
#define SOUTH_TRADIATION /* Southern edge, tracers, radiation condition */
#define SOUTH_TNUDGING /* Southern edge, tracers, passive/active nudging term */
#define SOUTH_KRADIATION /* Southern edge, TKE, radiation condition */
#endif
#undef BULK_FLUXES
#ifdef BULK_FLUXES
# define LONGWAVE /* Compute net longwave radiation internally */
# define ANA_PAIR
# define ANA_RAIN
#endif
# undef ANA_FSOBC
# undef ANA_M2OBC
# undef ANA_STFLUX
# undef ANA_SSFLUX
# define ANA_BTFLUX
# define ANA_BSFLUX
# undef ANA_SMFLUX
#else
CPPDEFS - Choose an appropriate ROMS application.
#endif
================================

If I then run the model my "Activated C-preprocessing Options" are:


================================
ANA_BSFLUX Analytical kinematic bottom salinity flux.
ANA_BTFLUX Analytical kinematic bottom temperature flux.
ASSUMED_SHAPE Using assumed-shape arrays.
DIAGNOSTICS_UV Computing and writing momentum diagnostic terms.
DJ_GRADPS Parabolic Splines density Jacobian (Shchepetkin, 2002).
DOUBLE_PRECISION Double precision arithmetic.
MASKING Land/Sea masking.
MIX_ISO_TS Mixing of tracers along isopycnal surfaces.
MIX_GEO_UV Mixing of momentum along geopotential surfaces.
MPI MPI distributed-memory configuration.
MY25_MIXING Mellor/Yamada Level-2.5 mixing closure.
NONLINEAR Nonlinear Model.
NONLIN_EOS Nonlinear Equation of State for seawater.
NORTH_FSNUDGING Northern edge, free-surface, passive/active outflow/inflow.
NORTH_FSRADIATION Northern edge, free-surface, radiation condition.
NORTH_M2FLATHER Northern edge, 2D momentum, Flather condition.
NORTH_M3NUDGING Northern edge, 3D momentum, passive/active outflow/inflow.
NORTH_M3RADIATION Northern edge, 3D momentum, radiation condition.
NORTH_KRADIATION Northern edge, TKE fields, radiation condition.
NORTH_TNUDGING Northern edge, tracers, passive/active outflow/inflow.
NORTH_TRADIATION Northern edge, tracers, radiation condition.
POWER_LAW Power-law shape time-averaging barotropic filter.
PROFILE Time profiling activated .
K_GSCHEME Third-order upstream advection of TKE fields.
RADIATION_2D Use tangential phase speed in radiation conditions.
!RST_SINGLE Double precision fields in restart NetCDF file.
SALINITY Using salinity.
SOLVE3D Solving 3D Primitive Equations.
SOUTH_FSNUDGING Southern edge, free-surface, passive/active outflow/inflow.
SOUTH_FSRADIATION Southern edge, free-surface, radiation condition.
SOUTH_M2FLATHER Southern edge, 2D momentum, Flather condition.
SOUTH_M3NUDGING Southern edge, 3D momentum, passive/active outflow/inflow.
SOUTH_M3RADIATION Southern edge, 3D momentum, radiation condition.
SOUTH_KRADIATION Southern edge, TKE fields, radiation condition.
SOUTH_TNUDGING Southern edge, tracers, passive/active outflow/inflow.
SOUTH_TRADIATION Southern edge, tracers, radiation condition.
SPLINES Conservative parabolic spline reconstruction.
SPONGE Enhanced horizontal mixing in the sponge areas.
TCLIMATOLOGY Processing tracer climatology data.
TCLM_NUDGING Nudging toward tracer climatology.
T_PASSIVE Advecting and diffusing inert passive tracer.
TS_C4HADVECTION Fourth-order centered horizontal advection of tracers.
TS_C4VADVECTION Fourth-order centered vertical advection of tracers.
TS_DIF2 Harmonic mixing of tracers.
TS_PSOURCE Tracers point sources and sinks.
UV_ADV Advection of momentum.
UV_COR Coriolis term.
UV_U3HADVECTION Third-order upstream horizontal advection of 3D momentum.
UV_C4VADVECTION Fourth-order centered vertical advection of momentum.
UV_QDRAG Quadratic bottom stress.
UV_PSOURCE Mass point sources and sinks.
UV_VIS2 Harmonic mixing of momentum.
VAR_RHO_2D Variable density barotropic mode.
WEST_FSNUDGING Western edge, free-surface, passive/active outflow/inflow.
WEST_FSRADIATION Western edge, free-sruface, radiation condition.
WEST_M2FLATHER Western edge, 2D momentum, Flather condition.
WEST_M3NUDGING Western edge, 3D momentum, passive/active outflow/inflow.
WEST_M3RADIATION Western edge, 3D momentum, radiation condition.
WEST_KRADIATION Western edge, TKE fields, radiation condition.
WEST_TNUDGING Western edge, tracers, passive/active outflow/inflow.
WEST_TRADIATION Western edge, tracers, radiation condition.
================================

The option in red in cppdefs.h is missing in my "Activated C-preprocessing Options" and the options in red in my "Activated C-preprocessing Options" are missing in my cppdefs.h

And as I mentioned when I ran this setup with roms 3.0 the options worked as they should ...

How can that happen? What did I miss?

Rodrigo.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: weird C-preprocessing Options issue

#2 Unread post by kate »

The key here is to look in the globaldefs.h file. There are chunks:

Code: Select all

#ifdef SOLVE3D
# if !(defined ADJOINT || defined TANGENT)
#   define VAR_RHO_2D
# endif
#endif
and

Code: Select all

#ifdef TS_U3ADV_SPLIT
# define DIFF_3DCOEF
# ifdef TS_U3HADVECTION
#  undef TS_U3HADVECTION
# endif
# ifndef TS_C4HADVECTION
#  define TS_C4HADVECTION
# endif
# ifndef TS_C4VADVECTION
#  define TS_C4VADVECTION
# endif
# ifndef TS_DIF4
#  define TS_DIF4
# endif
# ifdef TS_DIF2
#  undef TS_DIF2
# endif
# ifdef TS_SMAGORINSKY
#  undef TS_SMAGORINSKY
# endif
#endif
I wouldn't worry about the VAR_RHO bit. I don't understand why the second block was invoked, but maybe you can figure it out on your end.

rduran
Posts: 152
Joined: Fri Jan 08, 2010 7:22 pm
Location: Theiss Research

Re: weird C-preprocessing Options issue

#3 Unread post by rduran »

Thanks Kate, good to know globaldefs.h does these kind of things. Im not sure how

Code: Select all

#ifdef TS_U3ADV_SPLIT
would prove positive (and that was the only define TS_C4VADVECTION part that I found) , but I did find the problem to be solved when I commented the diagnostics_uv line properly ...

Post Reply