Ticket #214: globaldefs.h

File globaldefs.h, 28.3 KB (added by m.hadfield, 16 years ago)
Line 
1/*
2** Include file "globaldef.h"
3**
4** svn $Id: globaldefs.h 216 2008-08-08 18:35:19Z arango $
5********************************************************** Hernan G. Arango ***
6** Copyright (c) 2002-2008 The ROMS/TOMS Group Alexander F. Shchepetkin **
7** Licensed under a MIT/X style license **
8** See License_ROMS.txt **
9*******************************************************************************
10** **
11** WARNING: This file contains a set of predetermined macro definitions **
12** ======= which are inserted into the individual files by C-preprocessor. **
13** It is strongly recommended to NOT modify any of the definitions below. **
14** **
15*******************************************************************************
16*/
17
18/*
19** Set assumed-shape array switch. Imported arrays with dummy
20** arguments that takes the shape of the actual argument passed
21** to it. If off, all the arrays are explicit-shape. In some
22** computer explicit-shape arrays slow down performacnce because
23** the arrays are copied when passed by arguments.
24*/
25
26#if !((defined G95 && defined I686) || defined UNICOS_SN)
27# define ASSUMED_SHAPE
28#endif
29
30/*
31** Set internal distributed-memory switch.
32*/
33
34#if defined MPI
35# define DISTRIBUTE
36#endif
37
38/*
39** Turn ON/OFF time profiling.
40*/
41
42#define PROFILE
43
44/*
45** Set default time-averaging filter for barotropic fields.
46**
47*/
48
49#ifdef SOLVE3D
50# undef COSINE2
51# define POWER_LAW
52#endif
53
54/*
55** Turn ON/OFF switch to include/disregard the difference between
56** rho0 and surface density in the computation of baroclinic pressure
57** term.
58*/
59
60#define RHO_SURF
61
62/*
63** Activate criteria for isopycnic diffusion of tracer as maximum
64** density slope or minimum density stratification. Choose only
65** one option. If neither option is activated, the default criteria
66** is used in the algorithm.
67*/
68
69#if defined MIX_ISO_TS && (defined TS_DIF2 || defined TS_DIF4)
70# undef MAX_SLOPE
71# undef MIN_STRAT
72#endif
73
74/*
75** Turn ON/OFF double precision for real type variables and
76** associated intrinsic functions.
77*/
78
79#define DOUBLE_PRECISION
80
81/*
82** Turn ON masking when wetting and drying is activated.
83*/
84
85#if !defined MASKING && defined WET_DRY
86# define MASKING
87#endif
88
89/*
90** Define macro for the first 2D time-step.
91*/
92
93#ifdef SOLVE3D
94# define FIRST_2D_STEP iif(ng).eq.1
95#else
96# define FIRST_2D_STEP iic(ng).eq.ntfirst(ng)
97#endif
98
99/*
100** Set number of ghost-points in the halo region.
101*/
102
103#if defined TS_MPDATA || defined UV_VIS4
104# define GHOST_POINTS 3
105# if defined DISTRIBUTE || defined EW_PERIODIC || defined NS_PERIODIC
106# define THREE_GHOST
107# endif
108#else
109# define GHOST_POINTS 2
110#endif
111
112/*
113** Define global grid lower and upper bounds in the I- and
114** J-directions. These values are a function of periodicity.
115** They are used in both shared- and distributed-memory
116** configurations.
117*/
118
119#ifdef EW_PERIODIC
120# ifdef NS_PERIODIC
121# define LOWER_BOUND_I -GHOST_POINTS
122# define UPPER_BOUND_I Im(ng)+GHOST_POINTS
123# define LOWER_BOUND_J -GHOST_POINTS
124# define UPPER_BOUND_J Jm(ng)+GHOST_POINTS
125# else
126# define LOWER_BOUND_I -GHOST_POINTS
127# define UPPER_BOUND_I Im(ng)+GHOST_POINTS
128# define LOWER_BOUND_J 0
129# define UPPER_BOUND_J Jm(ng)+1
130# endif
131#else
132# ifdef NS_PERIODIC
133# define LOWER_BOUND_I 0
134# define UPPER_BOUND_I Im(ng)+1
135# define LOWER_BOUND_J -GHOST_POINTS
136# define UPPER_BOUND_J Jm(ng)+GHOST_POINTS
137# else
138# define LOWER_BOUND_I 0
139# define UPPER_BOUND_I Im(ng)+1
140# define LOWER_BOUND_J 0
141# define UPPER_BOUND_J Jm(ng)+1
142# endif
143#endif
144#define XI_DIM LOWER_BOUND_I:UPPER_BOUND_I
145#define ETA_DIM LOWER_BOUND_J:UPPER_BOUND_J
146#define GLOBAL_2D_ARRAY XI_DIM,ETA_DIM
147#define PRIVATE_1D_SCRATCH_ARRAY IminS:ImaxS
148#define PRIVATE_2D_SCRATCH_ARRAY IminS:ImaxS,JminS:JmaxS
149
150/*
151** Set switch for distributed-memory applications to gather and scatter
152** I/O data in 2D slabs. This is necessary on some platforms to conserve
153** memory.
154*/
155
156#if defined DISTRIBUTE
157# if defined UNICOS_SN
158# define INLINE_2DIO
159# endif
160#endif
161
162/*
163** Remove OpenMP directives in serial and distributed memory
164** Applications. This definition will be used in conjunction with
165** the pearl script "cpp_clean" to remove the full directive.
166*/
167
168#if !defined _OPENMP
169# define OMP !
170#endif
171
172/*
173** Set tile variable for distributed- or shared-memory configurations.
174*/
175
176#ifdef DISTRIBUTE
177# define TILE MyRank
178#else
179# define TILE tile
180#endif
181
182/*
183** The following definitions contain fortran logical expressions
184** equivalent to the question: ''Am I the thread working on a tile
185** which is adjacent to the WESTERN, EASTERN, SOUTHERN, or NORTHERN
186** edges of the model domain?'' These logical expressions are used to
187** update domain boundaries and corners.
188*/
189
190#define WESTERN_EDGE Istr.eq.1
191#define EASTERN_EDGE Iend.eq.Lm(ng)
192#define SOUTHERN_EDGE Jstr.eq.1
193#define NORTHERN_EDGE Jend.eq.Mm(ng)
194#define SOUTH_WEST_CORNER (Istr.eq.1).and.(Jstr.eq.1)
195#define NORTH_WEST_CORNER (Istr.eq.1).and.(Jend.eq.Mm(ng))
196#define SOUTH_EAST_CORNER (Iend.eq.Lm(ng)).and.(Jstr.eq.1)
197#define NORTH_EAST_CORNER (Iend.eq.Lm(ng)).and.(Jend.eq.Mm(ng))
198
199/*
200** The following definitions are fortran logical expressions use
201** to update global variables while avoiding mutual overlap between
202** threads in shared-memory configurations.
203*/
204
205#ifdef DISTRIBUTE
206# define SOUTH_WEST_TEST .true.
207# define NORTH_WEST_TEST .true.
208# define SOUTH_EAST_TEST .true.
209# define NORTH_EAST_TEST .true.
210#else
211# define SOUTH_WEST_TEST (Istr.eq.1).and.(Jstr.eq.1)
212# define NORTH_WEST_TEST (Istr.eq.1).and.(Jend.eq.Mm(ng))
213# define SOUTH_EAST_TEST (Iend.eq.Lm(ng)).and.(Jstr.eq.1)
214# define NORTH_EAST_TEST (Iend.eq.Lm(ng)).and.(Jend.eq.Mm(ng))
215#endif
216
217/*
218** Choice of double/single precision for real type variables and
219** associated intrinsic functions.
220*/
221
222#if (defined CRAY || defined CRAYT3E) && !defined CRAYX1
223# ifdef DOUBLE_PRECISION
224# undef DOUBLE_PRECISION
225# endif
226#endif
227
228#ifdef DOUBLE_PRECISION
229# ifdef DISTRIBUTE
230# define PDNAUPD pdnaupd
231# define PDNEUPD pdneupd
232# define PDSAUPD pdsaupd
233# define PDSEUPD pdseupd
234# define PDNORM2 pdnorm2
235# else
236# define DNAUPD dnaupd
237# define DNEUPD dneupd
238# define DSAUPD dsaupd
239# define DSEUPD dseupd
240# define DNRM2 dnrm2
241# endif
242# define DAXPY daxpy
243# define DSTEQR dsteqr
244#else
245# ifdef DISTRIBUTE
246# define PDNAUPD psnaupd
247# define PDNEUPD psneupd
248# define PDSAUPD pssaupd
249# define PDSEUPD psseupd
250# define PDNORM2 psnorm2
251# else
252# define DNAUPD snaupd
253# define DNEUPD sneupd
254# define DSAUPD ssaupd
255# define DSEUPD sseupd
256# define DNRM2 snrm2
257# endif
258# define DAXPY saxpy
259# define DSTEQR ssteqr
260#endif
261
262/*
263** Set tangent, tl_ioms and adjoint switches.
264*/
265
266#if defined CONVOLUTION || defined CORRELATION || \
267 defined GRADIENT_CHECK || defined FT_EIGENMODES || \
268 defined FORCING_SV || defined INNER_PRODUCT || \
269 defined IS4DVAR || defined IS4DVAR_OLD || \
270 defined OBS_SENSITIVITY || defined OPT_PERTURBATION || \
271 defined OPT_OBSERVATIONS || defined R_SYMMETRY || \
272 defined RPM_DRIVER || defined SANITY_CHECK || \
273 defined TLM_CHECK || defined TLM_DRIVER || \
274 defined W4DPSAS || defined W4DVAR
275# define TANGENT
276#endif
277#if defined AD_SENSITIVITY || defined ADM_DRIVER || \
278 defined AFT_EIGENMODES || defined CONVOLUTION || \
279 defined CORRELATION || defined GRADIENT_CHECK || \
280 defined FORCING_SV || defined INNER_PRODUCT || \
281 defined IS4DVAR || defined IS4DVAR_OLD || \
282 defined OBS_SENSITIVITY || defined OPT_PERTURBATION || \
283 defined OPT_OBSERVATIONS || defined R_SYMMETRY || \
284 defined SANITY_CHECK || defined SO_SEMI || \
285 defined S4DVAR || defined TLM_CHECK || \
286 defined W4DPSAS || defined W4DVAR
287# define ADJOINT
288#endif
289#if defined PICARD_TEST || defined RPM_DRIVER || \
290 defined W4DVAR
291# define TL_IOMS
292#endif
293#if !defined ANA_PERTURB && \
294 (defined CORRELATION || defined SANITY_CHECK || \
295 defined R_SYMMETRY)
296# define ANA_PERTURB
297#endif
298
299/*
300** Turn off nonlinear model switch.
301*/
302
303#define NONLINEAR
304#if defined AD_SENSITIVITY || defined ADM_DRIVER || \
305 defined AFT_EIGENMODES || defined FT_EIGENMODES || \
306 defined INNER_PRODUCT || defined OPT_OBSERVATIONS || \
307 defined OPT_PERTURBATION || defined PICARD_TEST || \
308 defined RPM_DRIVER || defined SANITY_CHECK || \
309 defined SO_SEMI || defined TLM_DRIVER
310# undef NONLINEAR
311#endif
312
313/*
314** Activate bacroclinic pressure gradient response due to the
315** perturbation of free-surface in the presence of stratification
316** and bathymetry. This option does not pass the sanity check
317** in adjoint and tangent linear applications.
318*/
319
320#ifdef SOLVE3D
321# if !(defined ADJOINT || defined TANGENT)
322# define VAR_RHO_2D
323# endif
324#endif
325
326/*
327** Set output index for multi-time levels variables.
328*/
329
330#ifdef SOLVE3D
331# if defined TANGENT || defined TL_IOMS
332# define TKOUT kstp(ng)
333# define KOUT kstp(ng)
334# define NOUT nrhs(ng)
335# else
336# define KOUT kstp(ng)
337# define NOUT nrhs(ng)
338# endif
339#else
340# if defined TANGENT || defined TL_IOMS
341# define TKOUT kstp(ng)
342# endif
343# define KOUT knew(ng)
344#endif
345
346/*
347** Set internal switch for the need of a propagator driver.
348*/
349
350#if defined AFT_EIGENMODES || defined ENSEMBLE || \
351 defined FORCING_SV || defined FT_EIGENMODES || \
352 defined OPT_PERTURBATION || defined PSEUDOSPECTRA || \
353 defined SO_SEMI || defined SO_TRACE || \
354 defined STOCHASTIC_OPT
355# define PROPAGATOR
356#endif
357
358/*
359** Activate checkpointing switch for GST analysis. This requires
360** a modified ARPACK library for symmetric (*saupd, *seupd) and
361** non-symmetric (*naupd, *neupd) drivers.
362*/
363
364#ifdef PROPAGATOR
365# define CHECKPOINTING
366#endif
367
368/*
369** Activate processing of forward vertical mixing.
370**
371*/
372
373#if !defined FORWARD_MIXING && \
374 (defined TANGENT || defined TL_IOMS || \
375 defined ADJOINT) && \
376 (defined LMD_MIXING || defined GLS_MIXING || \
377 defined MY25_MIXING)
378# define FORWARD_MIXING
379#endif
380
381/*
382** Set internal switches for all the 4DVAR schemes.
383*/
384
385#if !defined WEAK_CONSTRAINT && \
386 (defined R_SYMMETRY || defined W4DVAR || \
387 defined CONVOLUTION || defined W4DPSAS)
388# define WEAK_CONSTRAINT
389#endif
390#if !(defined WEAK_CONSTRAINT || defined IOM) && \
391 defined RPM_RELAXATION
392# undef RPM_RELAXATION
393#endif
394#if defined CONVOLUTION || defined CORRELATION || \
395 defined GRADIENT_CHECK || defined IOM || \
396 defined IS4DVAR || defined IS4DVAR_OLD || \
397 defined OBS_SENSITIVITY || defined OPT_OBSERVATIONS || \
398 defined S4DVAR || defined TLM_CHECK || \
399 defined WEAK_CONSTRAINT
400# define FOUR_DVAR
401#endif
402#if !defined WEAK_CONSTRAINT && defined FOUR_DVAR
403# define CONVOLVE
404#endif
405#if defined IS4DVAR || defined IS4DVAR_OLD
406# define BACKGROUND
407#endif
408
409/*
410** Activate internal switch to process 4DVAR observations.
411*/
412
413#if defined GRADIENT_CHECK || defined IOM || \
414 defined IS4DVAR || defined IS4DVAR_OLD || \
415 defined OBS_SENSITIVITY || defined S4DVAR || \
416 defined TLM_CHECK || defined VERIFICATION || \
417 defined W4DPSAS || defined W4DVAR
418# define OBSERVATIONS
419#endif
420
421#if defined GRADIENT_CHECK || defined IS4DVAR || \
422 defined IS4DVAR_OLD || defined OBS_SENSITIVITY || \
423 defined R_SYMMETRY || defined TLM_CHECK || \
424 defined W4DPSAS || defined W4DVAR
425# define TLM_OBS
426#endif
427
428/*
429** Check S4DVar normalization switches.
430*/
431
432#if !(defined ENERGY1_NORM || defined ENERGY2_NORM || \
433 defined ENERGY3_NORM)
434# undef N2NORM_PROFILE
435#endif
436
437/*
438** Activate reading and writting of the basic sate.
439*/
440
441#if !defined FORWARD_READ && \
442 (defined IS4DVAR || defined IS4DVAR_OLD || \
443 defined OBS_SENSITIVITY || defined S4DVAR || \
444 defined W4DPSAS || defined W4DVAR)
445# define FORWARD_READ
446#endif
447#if !defined FORWARD_WRITE && \
448 (defined IS4DVAR || defined IS4DVAR_OLD || \
449 defined OBS_SENSITIVITY || defined S4DVAR || \
450 defined W4DPSAS || defined W4DVAR)
451# define FORWARD_WRITE
452#endif
453
454/*
455** Set internal weak constraint switches.
456*/
457
458#if defined WEAK_CONSTRAINT || defined IOM
459# define IMPULSE
460#endif
461
462/*
463** Set in internal switch to activate computation of nonlinear
464** equation of state expnasion polynomial T-derivatives.
465*/
466
467#if defined LMD_SKPP || defined LMD_BKPP || defined BULK_FLUXES || \
468 defined TANGENT || defined TL_IOMS || defined ADJOINT
469# define EOS_TDERIVATIVE
470#endif
471
472/*
473** If splines, deactivate horizontal and vertical smoothing of
474** Richardson number horizontally and/or vertically.
475*/
476
477#ifdef SPLINES
478# if defined LMD_MIXING
479# undef RI_HORAVG
480# undef RI_VERAVG
481# endif
482#endif
483
484/*
485** Activate internal switch for the computation of the Brunt-Vaisala
486** frequency.
487*/
488
489#if defined BVF_MIXING || defined LMD_MIXING || defined LMD_SKPP || \
490 defined LMD_BKPP || defined GLS_MIXING || defined MY25_MIXING
491# define BV_FREQUENCY
492#endif
493
494/*
495** Activate switch for processing climatology data.
496*/
497
498#if (defined ZCLIMATOLOGY && !defined ANA_SSH) || \
499 (defined M2CLIMATOLOGY && !defined ANA_M2CLIMA) || \
500 (defined TCLIMATOLOGY && !defined ANA_TCLIMA) || \
501 (defined M3CLIMATOLOGY && !defined ANA_M3CLIMA)
502# define CLM_FILE
503#endif
504#if defined ZCLIMATOLOGY || defined M2CLIMATOLOGY || \
505 defined TCLIMATOLOGY || defined M3CLIMATOLOGY || \
506 defined ZCLM_NUDGING || defined M2CLM_NUDGING || \
507 defined TCLM_NUDGING || defined M3CLM_NUDGING
508# define CLIMATOLOGY
509#endif
510
511/*
512** Activate internal switch for bottom boundary layer closure.
513*/
514
515#if defined SSW_BBL || defined MB_BBL || defined SG_BBL
516# define BBL_MODEL
517#endif
518
519/*
520** Activate internal switch for imposing REFDIF as a
521** monochromatic wave driver.
522*/
523
524#if defined REFDIF_COUPLING && defined SVENDSEN_ROLLER
525# define MONO_ROLLER
526#endif
527
528/*
529** Activate internal switch to set-up nudging coefficients.
530*/
531
532#if defined ZCLM_NUDGING || defined M2CLM_NUDGING || \
533 defined TCLM_NUDGING || defined M3CLM_NUDGING || \
534 defined WEST_FSNUDGING || defined EAST_FSNUDGING || \
535 defined SOUTH_FSNUDGING || defined NORTH_FSNUDGING || \
536 defined WEST_M2NUDGING || defined EAST_M2NUDGING || \
537 defined SOUTH_M2NUDGING || defined NORTH_M2NUDGING || \
538 defined WEST_TNUDGING || defined EAST_TNUDGING || \
539 defined SOUTH_TNUDGING || defined NORTH_TNUDGING || \
540 defined WEST_M3NUDGING || defined EAST_M3NUDGING || \
541 defined SOUTH_M3NUDGING || defined NORTH_M3NUDGING
542# define NUDGING_COFF
543#endif
544
545/*
546** Internal switches to deactivate calling boundary conditions
547** during initialization of 2D state variables. Basically,
548** we need to apply only non-radiation type boundary conditions.
549*/
550
551#if defined WEST_M2RADIATION || defined WEST_M2FLATHER || \
552 defined EAST_M2RADIATION || defined EAST_M2FLATHER || \
553 defined SOUTH_M2RADIATION || defined SOUTH_M2FLATHER || \
554 defined NORTH_M2RADIATION || defined NORTH_M2FLATHER
555# define OBC_M2RADIATION
556#endif
557
558#if defined WEST_FSRADIATION || defined WEST_FSCHAPMAN || \
559 defined EAST_FSRADIATION || defined EAST_FSCHAPMAN || \
560 defined SOUTH_FSRADIATION || defined SOUTH_FSCHAPMAN || \
561 defined NORTH_FSRADIATION || defined NORTH_FSCHAPMAN
562# define OBC_FSRADIATION
563#endif
564
565/*
566** Activate internal switches requiring open boundary data.
567*/
568
569#if (defined WEST_M2RADIATION && defined WEST_M2NUDGING) || \
570 defined WEST_M2FLATHER || defined WEST_M2CLAMPED
571# define WEST_M2OBC
572#endif
573#if (defined EAST_M2RADIATION && defined EAST_M2NUDGING) || \
574 defined EAST_M2FLATHER || defined EAST_M2CLAMPED
575# define EAST_M2OBC
576#endif
577#if (defined SOUTH_M2RADIATION && defined SOUTH_M2NUDGING) || \
578 defined SOUTH_M2FLATHER || defined SOUTH_M2CLAMPED
579# define SOUTH_M2OBC
580#endif
581#if (defined NORTH_M2RADIATION && defined NORTH_M2NUDGING) || \
582 defined NORTH_M2FLATHER || defined NORTH_M2CLAMPED
583# define NORTH_M2OBC
584#endif
585
586#if (defined WEST_FSRADIATION && defined WEST_FSNUDGING) || \
587 defined WEST_M2FLATHER || defined WEST_FSCLAMPED
588# define WEST_FSOBC
589#endif
590#if (defined EAST_FSRADIATION && defined EAST_FSNUDGING) || \
591 defined EAST_M2FLATHER || defined EAST_FSCLAMPED
592# define EAST_FSOBC
593#endif
594#if (defined SOUTH_FSRADIATION && defined SOUTH_FSNUDGING) || \
595 defined SOUTH_M2FLATHER || defined SOUTH_FSCLAMPED
596# define SOUTH_FSOBC
597#endif
598#if (defined NORTH_FSRADIATION && defined NORTH_FSNUDGING) || \
599 defined NORTH_M2FLATHER || defined NORTH_FSCLAMPED
600# define NORTH_FSOBC
601#endif
602
603#if defined FSOBC_REDUCED && \
604 !(defined WEST_M2REDUCED || defined EAST_M2REDUCED || \
605 defined NORTH_M2REDUCED || defined SOUTH_M2REDUCED || \
606 defined WEST_M2FLATHER || defined EAST_M2FLATHER || \
607 defined NORTH_M2FLATHER || defined SOUTH_M2FLATHER)
608# undef FSOBC_REDUCED
609#endif
610
611#if (defined WEST_M3RADIATION && defined WEST_M3NUDGING) || \
612 defined WEST_M3CLAMPED
613# define WEST_M3OBC
614#endif
615#if (defined EAST_M3RADIATION && defined EAST_M3NUDGING) || \
616 defined EAST_M3CLAMPED
617# define EAST_M3OBC
618#endif
619#if (defined SOUTH_M3RADIATION && defined SOUTH_M3NUDGING) || \
620 defined SOUTH_M3CLAMPED
621# define SOUTH_M3OBC
622#endif
623#if (defined NORTH_M3RADIATION && defined NORTH_M3NUDGING) || \
624 defined NORTH_M3CLAMPED
625# define NORTH_M3OBC
626#endif
627
628#if (defined WEST_TRADIATION && defined WEST_TNUDGING) || \
629 defined WEST_TCLAMPED
630# define WEST_TOBC
631#endif
632#if (defined EAST_TRADIATION && defined EAST_TNUDGING) || \
633 defined EAST_TCLAMPED
634# define EAST_TOBC
635#endif
636#if (defined SOUTH_TRADIATION && defined SOUTH_TNUDGING) || \
637 defined SOUTH_TCLAMPED
638# define SOUTH_TOBC
639#endif
640#if (defined NORTH_TRADIATION && defined NORTH_TNUDGING) || \
641 defined NORTH_TCLAMPED
642# define NORTH_TOBC
643#endif
644
645#ifdef SOLVE3D
646# if defined WEST_FSOBC || defined EAST_FSOBC || \
647 defined SOUTH_FSOBC || defined NORTH_FSOBC || \
648 defined WEST_M2OBC || defined EAST_M2OBC || \
649 defined SOUTH_M2OBC || defined NORTH_M2OBC || \
650 defined WEST_M3OBC || defined EAST_M3OBC || \
651 defined SOUTH_M3OBC || defined NORTH_M3OBC || \
652 defined WEST_TOBC || defined EAST_TOBC || \
653 defined SOUTH_TOBC || defined NORTH_TOBC
654# define OBC
655# endif
656#else
657# if defined WEST_FSOBC || defined EAST_FSOBC || \
658 defined SOUTH_FSOBC || defined NORTH_FSOBC || \
659 defined WEST_M2OBC || defined EAST_M2OBC || \
660 defined SOUTH_M2OBC || defined NORTH_M2OBC
661# define OBC
662# endif
663#endif
664
665/*
666** Define internal flag indicating processing of input boundary
667** NetCDF file.
668*/
669
670#if (!defined ANA_FSOBC && \
671 (defined WEST_FSOBC || defined EAST_FSOBC || \
672 defined SOUTH_FSOBC || defined NORTH_FSOBC)) || \
673 (!defined ANA_M2OBC && \
674 (defined WEST_M2OBC || defined EAST_M2OBC || \
675 defined SOUTH_M2OBC || defined NORTH_M2OBC)) || \
676 (!defined ANA_M3OBC && \
677 (defined WEST_M3OBC || defined EAST_M3OBC || \
678 defined SOUTH_M3OBC || defined NORTH_M3OBC)) || \
679 (!defined ANA_TOBC && \
680 (defined WEST_TOBC || defined EAST_TOBC || \
681 defined SOUTH_TOBC || defined NORTH_TOBC))
682# define OBC_DATA
683#endif
684
685/*
686** Activate internal switches for volume conservation at open boundary.
687*/
688
689#if defined WEST_VOLCONS || defined EAST_VOLCONS || \
690 defined NORTH_VOLCONS || defined SOUTH_VOLCONS
691# define OBC_VOLCONS
692#endif
693
694/*
695** Activate assimilation switches.
696*/
697
698#if defined ASSIMILATION_SSH || defined ASSIMILATION_SST || \
699 defined ASSIMILATION_T || defined ASSIMILATION_UVsur || \
700 defined ASSIMILATION_UV
701# define ASSIMILATION
702#endif
703#if defined NUDGING_SSH || defined NUDGING_SST || \
704 defined NUDGING_T || defined NUDGING_UVsur || \
705 defined NUDGING_UV
706# define NUDGING
707#endif
708
709/*
710** Check if it is meaningful to write out time-averaged vertical
711** mixing coefficients.
712*/
713
714#if !defined LMD_MIXING && !defined MY25_MIXING && !defined GLS_MIXING
715# if defined AVERAGES
716# if defined AVERAGES_AKV
717# undef AVERAGES_AKV
718# endif
719# if defined AVERAGES_AKT
720# undef AVERAGES_AKT
721# endif
722# if defined AVERAGES_AKS && !defined SALINITY
723# undef AVERAGES_AKS
724# endif
725# endif
726#endif
727#if defined AVERAGES_NEARSHORE && !defined NEARSHORE_MELLOR
728# undef AVERAGES_NEARSHORE
729#endif
730
731/*
732** Activate internal biology option when using any type of biological
733** module.
734*/
735
736#if defined BIO_FASHAM || defined ECOSIM || \
737 defined NEMURO || defined NPZD_FRANKS || \
738 defined NPZD_POWELL
739# define BIOLOGY
740#endif
741
742/*
743** Define internal option to couple to other models.
744**
745*/
746
747#if defined WRF_COUPLING
748# define AIR_OCEAN
749#endif
750
751#if defined REFDIF_COUPLING || defined SWAN_COUPLING
752# define WAVES_OCEAN
753#endif
754
755#if defined AIR_OCEAN || defined WAVES_OCEAN
756# define MODEL_COUPLING
757#endif
758
759/*
760** Define internal option to process wave data.
761*/
762
763#if defined BBL_MODEL || defined NEARSHORE_MELLOR || \
764 defined WAVES_OCEAN
765# define WAVES_DIR
766#endif
767
768#if defined BBL_MODEL && \
769 !(defined SSW_CALC_UB || defined MB_CALC_UB || \
770 defined SG_CALC_UB)
771# define WAVES_UB
772#endif
773
774#if (defined BBL_MODEL && !defined WAVES_UB) || \
775 defined NEARSHORE_MELLOR || \
776 defined ZOS_HSIG || defined COARE_TAYLOR_YELLAND || \
777 defined BEDLOAD_SOULSBY || defined WAVES_OCEAN
778# define WAVES_HEIGHT
779#endif
780
781#if (!defined DEEPWATER_WAVES && \
782 (defined COARE_TAYLOR_YELLAND || defined COARE_OOST)) || \
783 defined NEARSHORE_MELLOR || \
784 defined BEDLOAD_SOULSBY || defined WAVES_OCEAN
785# define WAVES_LENGTH
786#endif
787
788#if defined COARE_TAYLOR_YELLAND || defined COARE_OOST || \
789 defined WAVES_OCEAN
790# define WAVES_TOP_PERIOD
791#endif
792
793#if defined BBL_MODEL || defined WAVES_OCEAN
794# define WAVES_BOT_PERIOD
795#endif
796
797#if !defined WAVES_OCEAN && \
798 ((defined BULK_FLUXES && defined COARE_TAYLOR_YELLAND) || \
799 (defined BULK_FLUXES && defined COARE_OOST) || \
800 defined SVENDSEN_ROLLER || defined TKE_WAVEDISS || \
801 defined WAVES_DIR || defined WAVES_BOT_PERIOD || \
802 defined WAVES_HEIGHT || defined WAVES_TOP_PERIOD || \
803 defined WAVES_LENGTH)
804# define WAVE_DATA
805#endif
806
807/*
808** Define internal option for bedload treatment.
809*/
810
811#if defined BEDLOAD_MPM || defined BEDLOAD_SOULSBY
812# define BEDLOAD
813#endif
814
815/*
816** Define internal flag indicating processing of input forcing
817** NetCDF file.
818*/
819
820#ifdef SOLVE3D
821# ifdef BULK_FLUXES
822# ifdef ANA_SMFLUX
823# undef ANA_SMFLUX
824# endif
825# ifdef ANA_STFLUX
826# undef ANA_STFLUX
827# endif
828# endif
829# if !defined ANA_BTFLUX || \
830 (!defined AIR_OCEAN && \
831 !defined BULK_FLUXES && !defined ANA_SMFLUX) || \
832 (!defined BULK_FLUXES && !defined ANA_STFLUX) || \
833 ( defined SALINITY && !defined ANA_SSFLUX) || \
834 ( defined BULK_FLUXES && !defined LONGWAVE) || \
835 ( defined BULK_FLUXES && !defined ANA_PAIR) || \
836 ( defined BULK_FLUXES && !defined ANA_TAIR) || \
837 ( defined BULK_FLUXES && !defined ANA_HUMIDITY) || \
838 ( defined BULK_FLUXES && !defined ANA_CLOUD) || \
839 ( defined BULK_FLUXES && !defined ANA_RAIN) || \
840 ( defined BULK_FLUXES && !defined ANA_WINDS) || \
841 ( defined BULK_FLUXES && !defined ANA_SRFLUX) || \
842 ( defined LMD_SKPP && !defined ANA_SRFLUX) || \
843 ( defined SOLAR_SOURCE && !defined ANA_SRFLUX) || \
844 ( defined BBL_MODEL && (!defined ANA_WWAVE && \
845 !defined WAVES_OCEAN)) || \
846 ( defined BIOLOGY && !defined ANA_SPFLUX) || \
847 ( defined BIOLOGY && !defined ANA_BPFLUX) || \
848 ( defined SEDIMENT && !defined ANA_SPFLUX) || \
849 ( defined SEDIMENT && !defined ANA_BPFLUX) || \
850 ( defined WAVE_DATA && (!defined ANA_WWAVE && \
851 !defined WAVES_OCEAN))
852# define FRC_FILE
853# endif
854#else
855# if !defined ANA_SMFLUX
856# define FRC_FILE
857# endif
858#endif
859
860/*
861** Check if processing timeless data.
862*/
863
864#if (!defined ANA_PSOURCE && \
865 (defined UV_PSOURCE || defined TS_PSOURCE || \
866 defined Q_PSOURCE)) || \
867 (defined SSH_TIDES || defined UV_TIDES)
868# define TIMELESS_DATA
869#endif
870
871/*
872** Check analytical initial conditions options.
873*/
874
875#if defined ANA_BIOLOGY && !defined BIOLOGY
876# undef ANA_BIOLOGY
877#endif
878#if defined ANA_PASSIVE && !defined T_PASSIVE
879# undef ANA_PASSIVE
880#endif
881#if defined ANA_SEDIMENT && !(defined SEDIMENT || defined BBL_MODEL)
882# undef ANA_SEDIMENT
883#endif
884#if !defined ANA_INITIAL || \
885 ( defined BIOLOGY && !defined ANA_BIOLOGY) || \
886 ( defined T_PASSIVE && !defined ANA_PASSIVE) || \
887 ( defined SEDIMENT && !defined ANA_SEDIMENT) || \
888 ( defined BBL_MODEL && !defined ANA_SEDIMENT)
889# define INI_FILE
890#endif
891
892/*
893** Define internal shortwave radiation option. Undefine analytical
894** shortwave option if not needed.
895*/
896
897#if defined LMD_SKPP || defined SOLAR_SOURCE || \
898 defined BULK_FLUXES || defined BIOLOGY
899# define SHORTWAVE
900#endif
901#if !defined SHORTWAVE && defined ANA_SRFLUX
902# undef ANA_SRFLUX
903#endif
904#if !defined SHORTWAVE && defined DIURNAL_SRFLUX
905# undef DIURNAL_SRFLUX
906#endif
907
908/*
909** Define internal clouds option. Undefine analytical
910** shortwave option if not needed.
911*/
912
913#if (defined BULK_FLUXES && defined LONGWAVE) || defined ECOSIM || \
914 (defined ANA_SRFLUX && defined ALBEDO)
915# define CLOUDS
916#endif
917#if !defined CLOUDS && defined ANA_CLOUD
918# undef ANA_CLOUD
919#endif
920
921/*
922** Check if it is meaningful to write out momentum/tracer diagnostics
923** and activate internal diagnostics option.
924*/
925
926#if !defined SOLVE3D || defined TS_FIXED
927# if defined DIAGNOSTICS_TS
928# undef DIAGNOSTICS_TS
929# endif
930#endif
931#if !defined BIO_FASHAM && defined DIAGNOSTICS_BIO
932# undef DIAGNOSTICS_BIO
933#endif
934#if defined DIAGNOSTICS_BIO || defined DIAGNOSTICS_TS || \
935 defined DIAGNOSTICS_UV
936# define DIAGNOSTICS
937#endif
938
939/*
940** Activate switch to modify MAIN3D to allow perfect restart. To
941** achieve this, the call to OUTPUT needs to be before to RHS3D.
942** Therefore, and additional routine (set_zeta) is needed to set
943** the free-surface to its time-averaged value. This strategy
944** needs to be tested in the TLM, RPM, and ADM.
945*/
946
947#if !(defined ADJOINT || defined TANGENT || defined TL_IOMS)
948# define SET_ZETA
949#endif
950
951/*
952** Check if any analytical expression is defined.
953*/
954
955#if defined ANA_BIOLOGY || defined ANA_BPFLUX || \
956 defined ANA_BSFLUX || defined ANA_BTFLUX || \
957 defined ANA_CLOUD || defined ANA_DIAG || \
958 defined ANA_FSOBC || defined ANA_GRID || \
959 defined ANA_HUMIDITY || defined ANA_INITIAL || \
960 defined ANA_M2CLIMA || defined ANA_M2OBC || \
961 defined ANA_M3CLIMA || defined ANA_M3OBC || \
962 defined ANA_MASK || defined ANA_PAIR || \
963 defined ANA_PASSIVE || defined ANA_PERTURB || \
964 defined ANA_PSOURCE || defined ANA_RAIN || \
965 defined ANA_SEDIMENT || defined ANA_SMFLUX || \
966 defined ANA_SPFLUX || defined ANA_SPINNING || \
967 defined ANA_SRFLUX || defined ANA_SSFLUX || \
968 defined ANA_SSH || defined ANA_SSS || \
969 defined ANA_SST || defined ANA_STFLUX || \
970 defined ANA_TAIR || defined ANA_TCLIMA || \
971 defined ANA_TOBC || defined ANA_VMIX || \
972 defined ANA_WINDS || defined ANA_WWAVE || \
973 defined DIFF_GRID || defined NUDGING_COFF || \
974 defined SPONGE || defined VISC_GRID
975# define ANALYTICAL
976#endif
977
978/*
979** If splitting 3rd-order upstream bias horizontal advection of
980** tracer, activate other needed flags.
981*/
982
983#ifdef TS_U3ADV_SPLIT
984# define DIFF_3DCOEF
985# ifdef TS_U3HADVECTION
986# undef TS_U3HADVECTION
987# endif
988# ifndef TS_C4HADVECTION
989# define TS_C4HADVECTION
990# endif
991# ifndef TS_C4VADVECTION
992# define TS_C4VADVECTION
993# endif
994# ifndef TS_DIF4
995# define TS_DIF4
996# endif
997# ifdef TS_DIF2
998# undef TS_DIF2
999# endif
1000# ifdef TS_SMAGORINSKY
1001# undef TS_SMAGORINSKY
1002# endif
1003#endif
1004
1005/*
1006** If splitting 3rd-order upstream bias horizontal advection of
1007** momentum, activate other needed flags.
1008*/
1009
1010#ifdef UV_U3ADV_SPLIT
1011# define VISC_3DCOEF
1012# ifndef UV_C4ADVECTION
1013# define UV_C4ADVECTION
1014# endif
1015# ifndef UV_VIS4
1016# define UV_VIS4
1017# endif
1018# ifdef UV_VIS2
1019# undef UV_VIS2
1020# endif
1021# ifdef UV_SMAGORINSKY
1022# undef UV_SMAGORINSKY
1023# endif
1024#endif
1025
1026/*
1027** Define internal switch for Smagorinsky-like mixing.
1028*/
1029
1030#if !defined DIFF_3DCOEF && defined TS_SMAGORINSKY
1031# define DIFF_3DCOEF
1032#endif
1033#if !defined VISC_3DCOEF && defined UV_SMAGORINSKY
1034# define VISC_3DCOEF
1035#endif