1 |
C $Header: /u/gcmpack/MITgcm/model/src/do_statevars_diags.F,v 1.5 2005/01/28 01:00:13 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 myIter :: Iteration number |
38 |
C myThid :: Thread number for this instance of the routine. |
39 |
_RL myTime |
40 |
INTEGER seqFlag |
41 |
INTEGER myIter |
42 |
INTEGER myThid |
43 |
CEOP |
44 |
|
45 |
#ifdef ALLOW_DIAGNOSTICS |
46 |
C !LOCAL VARIABLES: |
47 |
C == Local variables == |
48 |
C selectVars :: select which group of dianostics variables to fill-in |
49 |
C = 1 :: fill-in diagnostics for tracer variables only |
50 |
C = 2 :: fill-in diagnostics for momentum variables only |
51 |
C = 3 :: fill-in diagnostics for momentum & tracer variables |
52 |
C bi,bj :: tile indices |
53 |
INTEGER selectVars |
54 |
INTEGER bi, bj |
55 |
|
56 |
C-- Fill-in Diagnostics pkg storage array (for state-variables) |
57 |
IF ( usediagnostics ) THEN |
58 |
|
59 |
C- select which group of state-var diagnostics to fill-in, |
60 |
C depending on: where this S/R is called from (seqFlag) |
61 |
C and stagger/synchronous TimeStep |
62 |
selectVars = 0 |
63 |
IF ( staggerTimeStep ) THEN |
64 |
IF ( seqFlag.EQ.0 ) selectVars = 2 |
65 |
IF ( seqFlag.EQ.1 ) selectVars = 1 |
66 |
ELSE |
67 |
IF ( seqFlag.EQ.0 ) selectVars = 3 |
68 |
ENDIF |
69 |
CALL DIAGNOSTICS_FILL_STATE(selectVars, myThid) |
70 |
|
71 |
#ifdef ALLOW_PTRACERS |
72 |
IF ( (selectVars.EQ.1 .OR. selectVars.EQ.3) |
73 |
& .AND. usePTRACERS ) THEN |
74 |
CALL PTRACERS_DIAGNOSTICS_FILL(myThid) |
75 |
ENDIF |
76 |
#endif |
77 |
|
78 |
#ifdef ALLOW_THSICE |
79 |
IF ( seqFlag.EQ.0 .AND. useThSIce ) THEN |
80 |
DO bj=myByLo(myThid),myByHi(myThid) |
81 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
82 |
CALL THSICE_DIAGNOSTICS_FILL( myTime,myIter, bi,bj, myThid ) |
83 |
ENDDO |
84 |
ENDDO |
85 |
ENDIF |
86 |
#endif /* ALLOW_THSICE */ |
87 |
|
88 |
ENDIf |
89 |
#endif /* ALLOW_DIAGNOSTICS */ |
90 |
|
91 |
RETURN |
92 |
END |