1 |
C $Header: /u/gcmpack/MITgcm/model/src/do_statevars_diags.F,v 1.11 2007/09/04 16:49:44 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
|
8 |
CBOP |
9 |
C !ROUTINE: DO_STATEVARS_DIAGS |
10 |
C !INTERFACE: |
11 |
SUBROUTINE DO_STATEVARS_DIAGS( myTime, seqFlag, myIter, myThid ) |
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE DO_STATEVARS_DIAGS |
15 |
C | o Controlling routine for state variables diagnostics |
16 |
C *==========================================================* |
17 |
C | Computing diagnostics of the model state (state-variables) |
18 |
C | is done at this level ; |
19 |
C | by contrast, other diagnostics (fluxes, tendencies) |
20 |
C | remain within the computation sequence. |
21 |
C *==========================================================* |
22 |
C \ev |
23 |
|
24 |
C !USES: |
25 |
IMPLICIT NONE |
26 |
C == Global variables === |
27 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "PARAMS.h" |
30 |
|
31 |
C !INPUT/OUTPUT PARAMETERS: |
32 |
C == Routine arguments == |
33 |
C myTime :: Current time of simulation ( s ) |
34 |
C seqFlag :: flag that indicate where this S/R is called from: |
35 |
C :: =0 called from the beginning of forward_step |
36 |
C :: =1 called from the middle of forward_step |
37 |
C :: =2 called from the end of forward_step |
38 |
C myIter :: Iteration number |
39 |
C myThid :: Thread number for this instance of the routine. |
40 |
_RL myTime |
41 |
INTEGER seqFlag |
42 |
INTEGER myIter |
43 |
INTEGER myThid |
44 |
CEOP |
45 |
|
46 |
#ifdef ALLOW_DIAGNOSTICS |
47 |
C !LOCAL VARIABLES: |
48 |
C == Local variables == |
49 |
C selectVars :: select which group of dianostics variables to fill-in |
50 |
C = 1 :: fill-in diagnostics for tracer variables only |
51 |
C = 2 :: fill-in diagnostics for momentum variables only |
52 |
C = 3 :: fill-in diagnostics for momentum & tracer variables |
53 |
C = 4 :: fill-in state variable tendency diagnostics the second time |
54 |
C bi,bj :: tile indices |
55 |
INTEGER selectVars |
56 |
#if defined(ALLOW_THSICE) || defined(ALLOW_LAND) |
57 |
INTEGER bi, bj |
58 |
#endif |
59 |
|
60 |
C-- Fill-in Diagnostics pkg storage array (for state-variables) |
61 |
IF ( usediagnostics ) THEN |
62 |
|
63 |
C- select which group of state-var diagnostics to fill-in, |
64 |
C depending on: where this S/R is called from (seqFlag) |
65 |
C and stagger/synchronous TimeStep |
66 |
selectVars = 0 |
67 |
IF ( staggerTimeStep ) THEN |
68 |
IF ( seqFlag.EQ.0 ) selectVars = 2 |
69 |
IF ( seqFlag.EQ.1 ) selectVars = 1 |
70 |
ELSE |
71 |
IF ( seqFlag.EQ.0 ) selectVars = 3 |
72 |
ENDIF |
73 |
IF ( seqFlag.EQ.2 ) selectVars = 4 |
74 |
CALL DIAGNOSTICS_FILL_STATE(selectVars, myThid) |
75 |
|
76 |
#ifdef ALLOW_PTRACERS |
77 |
IF ( (selectVars.EQ.1 .OR. selectVars.EQ.3) |
78 |
& .AND. usePTRACERS ) THEN |
79 |
CALL PTRACERS_DIAGNOSTICS_STATE( myThid ) |
80 |
ENDIF |
81 |
#endif |
82 |
|
83 |
#ifdef ALLOW_SEAICE |
84 |
IF ( seqFlag.EQ.0 .AND. useSEAICE ) THEN |
85 |
CALL SEAICE_DIAGNOSTICS_STATE( myTime, myIter, myThid ) |
86 |
ENDIF |
87 |
#endif /* ALLOW_SEAICE */ |
88 |
|
89 |
#ifdef ALLOW_THSICE |
90 |
IF ( seqFlag.EQ.0 .AND. useThSIce ) THEN |
91 |
DO bj=myByLo(myThid),myByHi(myThid) |
92 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
93 |
CALL THSICE_DIAGNOSTICS_STATE( myTime,myIter,bi,bj,myThid ) |
94 |
ENDDO |
95 |
ENDDO |
96 |
ENDIF |
97 |
#endif /* ALLOW_THSICE */ |
98 |
|
99 |
#ifdef ALLOW_LAND |
100 |
IF ( seqFlag.EQ.0 .AND. useLand ) THEN |
101 |
DO bj=myByLo(myThid),myByHi(myThid) |
102 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
103 |
CALL LAND_DIAGNOSTICS_STATE( myTime,myIter, bi,bj, myThid ) |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDIF |
107 |
#endif /* ALLOW_LAND */ |
108 |
|
109 |
#ifdef ALLOW_MYPACKAGE |
110 |
IF ( seqFlag.EQ.0 .AND. useMYPACKAGE ) THEN |
111 |
CALL MYPACKAGE_DIAGNOSTICS_STATE( myTime, myIter, myThid ) |
112 |
ENDIF |
113 |
#endif /* ALLOW_MYPACKAGE */ |
114 |
|
115 |
ENDIf |
116 |
#endif /* ALLOW_DIAGNOSTICS */ |
117 |
|
118 |
RETURN |
119 |
END |