4 |
#include "PACKAGES_CONFIG.h" |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
6 |
|
|
7 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
CBOP |
CBOP |
9 |
C !ROUTINE: DO_THE_MODEL_IO |
C !ROUTINE: DO_THE_MODEL_IO |
10 |
|
|
11 |
C !INTERFACE: |
C !INTERFACE: |
12 |
SUBROUTINE DO_THE_MODEL_IO( myTime, myIter, myThid ) |
SUBROUTINE DO_THE_MODEL_IO( |
13 |
C !DESCRIPTION: \bv |
I myTime, |
14 |
C *==========================================================* |
I myIter, |
15 |
C | SUBROUTINE DO_THE_MODEL_IO |
I myThid ) |
16 |
C | o Controlling routine for IO in model main time-stepping |
|
17 |
C | loop. |
C !DESCRIPTION: |
18 |
C *==========================================================* |
C This is the controlling routine for IO in the model main |
19 |
C | Many systems do not have thread safe IO so it is easier |
C time--stepping loop. Many systems do not have thread safe IO so it |
20 |
C | to lump everything together and do dumping of fields |
C is easier to lump everything together and do dumping of fields and |
21 |
C | and updating of forcing terms in a single place. |
C updating of forcing terms in a single place. The approach to IO |
22 |
C | The approach to IO used here is that writes are only |
C used here is that writes are only performed by thread 1 and that a |
23 |
C | performed by thread 1 and that a process only writes out |
C process only writes out its data (it does not know about anyone |
24 |
C | its data ( it does not know about anyone elses data!) |
C elses data!) Reading on the other hand is assumed to be from a |
25 |
C | Reading on the other hand is assumed to be from a file |
C file containing all the data for all the processes. Only the |
26 |
C | containing all the data for all the processes. Only the |
C portion of data of interest to this process is actually loaded. To |
27 |
C | portion of data of interest to this process is actually |
C work well this assumes the existence of some reliable tool to join |
28 |
C | loaded. To work well this assumes the existence of some |
C datasets together at the end of a run -- see joinds. |
|
C | reliable tool to join datasets together at the end of a |
|
|
C | run - see joinds.p |
|
|
C *==========================================================* |
|
|
C \ev |
|
29 |
|
|
30 |
C !USES: |
C !USES: |
31 |
IMPLICIT NONE |
IMPLICIT NONE |
|
C == Global variables === |
|
32 |
#include "SIZE.h" |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
34 |
#include "PARAMS.h" |
#include "PARAMS.h" |
35 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
|
|
|
|
|
|
36 |
LOGICAL DIFFERENT_MULTIPLE |
LOGICAL DIFFERENT_MULTIPLE |
37 |
EXTERNAL DIFFERENT_MULTIPLE |
EXTERNAL DIFFERENT_MULTIPLE |
38 |
|
|
39 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
|
C == Routine arguments == |
|
40 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
41 |
C myIter - Iteration number |
C myIter - Iteration number |
42 |
C myTime - Current time of simulation ( s ) |
C myTime - Current time of simulation ( s ) |
43 |
INTEGER myThid |
INTEGER myThid |
44 |
INTEGER myIter |
INTEGER myIter |
45 |
_RL myTime |
_RL myTime |
|
|
|
46 |
CEOP |
CEOP |
47 |
|
|
|
C-- Generaly only thread 1 does IO here. It can not start until |
|
|
C-- all threads fields are ready. |
|
|
IF (debugMode) THEN |
|
|
IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime, myTime-deltaTClock) |
|
|
& ) THEN |
|
48 |
|
|
49 |
_BARRIER |
C Generaly only thread 1 does IO here. It can not start until |
50 |
|
C all threads fields are ready. |
51 |
|
IF (debugMode) THEN |
52 |
|
IF ( DIFFERENT_MULTIPLE(dumpFreq,myTime, myTime-deltaTClock) |
53 |
|
& ) THEN |
54 |
|
|
55 |
C-- Write "text-plots" of certain fields |
_BARRIER |
|
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
|
|
& Nr, myIter, myThid ) |
|
|
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
|
|
& Nr, myIter, myThid ) |
|
|
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
|
|
& Nr, myIter, myThid ) |
|
|
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
|
|
& myIter, myThid ) |
|
56 |
|
|
57 |
ENDIF |
C Write "text-plots" of certain fields |
58 |
|
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
59 |
|
& Nr, myIter, myThid ) |
60 |
|
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
61 |
|
& Nr, myIter, myThid ) |
62 |
|
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
63 |
|
& Nr, myIter, myThid ) |
64 |
|
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
65 |
|
& myIter, myThid ) |
66 |
|
|
67 |
|
ENDIF |
68 |
ENDIF |
ENDIF |
69 |
|
|
70 |
C-- Write model state to binary file |
C Write model state to binary file |
71 |
CALL WRITE_STATE( myTime, myIter, myThid ) |
CALL WRITE_STATE( myTime, myIter, myThid ) |
72 |
|
|
73 |
#ifdef ALLOW_TIMEAVE |
#ifdef ALLOW_TIMEAVE |
74 |
C-- Do time averages |
C Do time averages |
75 |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
IF (taveFreq.GT.0. .AND. myIter.NE.nIter0 ) THEN |
76 |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
CALL TIMEAVE_STATV_WRITE( myTime, myIter, myThid ) |
77 |
#ifdef ALLOW_PTRACERS |
#ifdef ALLOW_PTRACERS |
78 |
IF ( usePTRACERS ) |
IF ( usePTRACERS ) |
79 |
& CALL PTRACERS_STATV_WRITE( myTime, myIter, myThid ) |
& CALL PTRACERS_STATV_WRITE( myTime, myIter, myThid ) |
80 |
#endif |
#endif |
81 |
ENDIF |
ENDIF |
82 |
#endif |
#endif |
86 |
#endif |
#endif |
87 |
|
|
88 |
#ifdef ALLOW_AIM |
#ifdef ALLOW_AIM |
89 |
C-- Do AIM time averages |
C Do AIM time averages |
90 |
IF ( useAIM ) |
IF ( useAIM ) |
91 |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
& CALL AIM_WRITE_TAVE( myTime, myIter, myThid ) |
92 |
#endif |
#endif |
93 |
#ifdef ALLOW_LAND |
#ifdef ALLOW_LAND |
94 |
C-- Do LAND time averages |
C Do LAND time averages |
95 |
IF ( useLAND ) |
IF ( useLAND ) |
96 |
& CALL LAND_WRITE_DIAGS( myTime, myIter, myThid ) |
& CALL LAND_WRITE_DIAGS( myTime, myIter, myThid ) |
97 |
#endif |
#endif |
98 |
|
|
99 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
100 |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
IF (useOBCS .AND. myIter.NE.nIter0 ) |
101 |
& CALL OBCS_DIAGS( myTime, myIter, myThid ) |
& CALL OBCS_DIAGS( myTime, myIter, myThid ) |
102 |
#endif |
#endif |
103 |
|
|
104 |
#ifdef ALLOW_GMREDI |
#ifdef ALLOW_GMREDI |
105 |
C-- Do KPP diagnostics. |
C Do KPP diagnostics. |
106 |
IF (useGMRedi .AND. myIter.NE.nIter0 ) |
IF (useGMRedi .AND. myIter.NE.nIter0 ) |
107 |
& CALL GMREDI_DIAGS( myTime, myIter, myThid ) |
& CALL GMREDI_DIAGS( myTime, myIter, myThid ) |
108 |
#endif |
#endif |
109 |
|
|
110 |
#ifdef ALLOW_KPP |
#ifdef ALLOW_KPP |
111 |
C-- Do KPP diagnostics. |
C Do KPP diagnostics. |
112 |
IF (useKPP .AND. myIter.NE.nIter0 ) |
IF (useKPP .AND. myIter.NE.nIter0 ) |
113 |
& CALL KPP_DO_DIAGS( myTime, myIter, myThid ) |
& CALL KPP_DO_DIAGS( myTime, myIter, myThid ) |
114 |
#endif |
#endif |
115 |
|
|
116 |
#ifdef ALLOW_PP81 |
#ifdef ALLOW_PP81 |
117 |
C-- Do PP81 diagnostics. |
C Do PP81 diagnostics. |
118 |
IF (usePP81 .AND. myIter.NE.nIter0 ) |
IF (usePP81 .AND. myIter.NE.nIter0 ) |
119 |
& CALL PP81_DO_DIAGS( myTime, myIter, myThid ) |
& CALL PP81_DO_DIAGS( myTime, myIter, myThid ) |
120 |
#endif |
#endif |
121 |
|
|
122 |
#ifdef ALLOW_MY82 |
#ifdef ALLOW_MY82 |
123 |
C-- Do MY82 diagnostics. |
C Do MY82 diagnostics. |
124 |
IF (useMY82 .AND. myIter.NE.nIter0 ) |
IF (useMY82 .AND. myIter.NE.nIter0 ) |
125 |
& CALL MY82_DO_DIAGS( myTime, myIter, myThid ) |
& CALL MY82_DO_DIAGS( myTime, myIter, myThid ) |
126 |
#endif |
#endif |
127 |
|
|
128 |
#ifdef ALLOW_SBO |
#ifdef ALLOW_SBO |
129 |
C-- Do SBO diagnostics. |
C Do SBO diagnostics. |
130 |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
IF (useSBO .AND. myIter.NE.nIter0 ) THEN |
131 |
CALL SBO_CALC ( myTime, myIter, myThid ) |
CALL SBO_CALC ( myTime, myIter, myThid ) |
132 |
CALL SBO_DIAGS( myTime, myIter, myThid ) |
CALL SBO_DIAGS( myTime, myIter, myThid ) |
133 |
ENDIF |
ENDIF |
134 |
#endif |
#endif |
135 |
|
|
136 |
#ifdef ALLOW_SEAICE |
#ifdef ALLOW_SEAICE |
137 |
IF ( useSEAICE ) THEN |
IF ( useSEAICE ) THEN |
138 |
CALL SEAICE_DO_DIAGS( myTime, myIter, myThid ) |
CALL SEAICE_DO_DIAGS( myTime, myIter, myThid ) |
139 |
ENDIF |
ENDIF |
140 |
#endif /* ALLOW_SEAICE */ |
#endif /* ALLOW_SEAICE */ |
141 |
|
|
142 |
#ifdef ALLOW_BULK_FORCE |
#ifdef ALLOW_BULK_FORCE |
143 |
C-- Do bulkf diagnostics. |
C Do bulkf diagnostics. |
144 |
IF (useBulkForce .AND. myIter.NE.nIter0 ) |
IF (useBulkForce .AND. myIter.NE.nIter0 ) |
145 |
& CALL BULKF_DIAGS( myTime, myIter, myThid ) |
& CALL BULKF_DIAGS( myTime, myIter, myThid ) |
146 |
#endif |
#endif |
147 |
|
|
148 |
#ifdef ALLOW_THSICE |
#ifdef ALLOW_THSICE |
149 |
C-- Do seaice diagnostics. |
C Do seaice diagnostics. |
150 |
IF (useThSIce) |
IF (useThSIce) |
151 |
& CALL THSICE_DIAGS( myTime, myIter, myThid ) |
& CALL THSICE_DIAGS( myTime, myIter, myThid ) |
152 |
#endif |
#endif |
153 |
|
|
154 |
cswdptr --- add --- |
cswdptr --- add --- |
162 |
|
|
163 |
#ifdef COMPONENT_MODULE |
#ifdef COMPONENT_MODULE |
164 |
IF ( useCoupler ) |
IF ( useCoupler ) |
165 |
& CALL CPL_WRITE_DIAGS( myTime, myIter, myThid ) |
& CALL CPL_WRITE_DIAGS( myTime, myIter, myThid ) |
166 |
#endif |
#endif |
167 |
|
|
168 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |