1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "PACKAGES_CONFIG.h" |
5 |
|
#include "CPP_OPTIONS.h" |
6 |
|
|
7 |
|
CBOP |
8 |
|
C !ROUTINE: DO_THE_MODEL_IO |
9 |
|
C !INTERFACE: |
10 |
SUBROUTINE DO_THE_MODEL_IO(myCurrentTime, myIter, myThid) |
SUBROUTINE DO_THE_MODEL_IO(myCurrentTime, myIter, myThid) |
11 |
C /==========================================================\ |
C !DESCRIPTION: \bv |
12 |
C | SUBROUTINE DO_THE_MODEL_IO | |
C *==========================================================* |
13 |
C | o Controlling routine for IO in model main time-stepping | |
C | SUBROUTINE DO_THE_MODEL_IO |
14 |
C | loop. | |
C | o Controlling routine for IO in model main time-stepping |
15 |
C |==========================================================| |
C | loop. |
16 |
C | Many systems do not have thread safe IO so it is easier | |
C *==========================================================* |
17 |
C | to lump everything together and do dumping of fields | |
C | Many systems do not have thread safe IO so it is easier |
18 |
C | and updating of forcing terms in a single place. | |
C | to lump everything together and do dumping of fields |
19 |
C | The approach to IO used here is that writes are only | |
C | and updating of forcing terms in a single place. |
20 |
C | performed by thread 1 and that a process only writes out | |
C | The approach to IO used here is that writes are only |
21 |
C | its data ( since it doen't know about anyone elses data!)| |
C | performed by thread 1 and that a process only writes out |
22 |
C | Reading on the other hand is assumed to be from a file | |
C | its data ( it does not know about anyone elses data!) |
23 |
C | containing all the data for all the processes. Only the | |
C | Reading on the other hand is assumed to be from a file |
24 |
C | portion of data of interest to this process is actually | |
C | containing all the data for all the processes. Only the |
25 |
C | loaded. To work well this assumes the existence of some | |
C | portion of data of interest to this process is actually |
26 |
C | reliable tool to join datasets together at the end of a | |
C | loaded. To work well this assumes the existence of some |
27 |
C | run. | |
C | reliable tool to join datasets together at the end of a |
28 |
C | Notes | |
C | run - see joinds.p |
29 |
C | ===== | |
C *==========================================================* |
30 |
C | We allow thread 2-nThreads to continue whilst thread 1 | |
C \ev |
|
C | does IO. The assumption is that the other threads won't | |
|
|
C | do anything to update their interior regions before | |
|
|
C | thread 1 has finished writing them out. | |
|
|
C \==========================================================/ |
|
31 |
|
|
32 |
|
C !USES: |
33 |
|
IMPLICIT NONE |
34 |
C == Global variables === |
C == Global variables === |
35 |
#include "SIZE.h" |
#include "SIZE.h" |
36 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
37 |
#include "PARAMS.h" |
#include "PARAMS.h" |
38 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
39 |
#include "CG2D.h" |
|
40 |
|
|
41 |
LOGICAL DIFFERENT_MULTIPLE |
LOGICAL DIFFERENT_MULTIPLE |
42 |
EXTERNAL DIFFERENT_MULTIPLE |
EXTERNAL DIFFERENT_MULTIPLE |
43 |
|
|
44 |
|
C !INPUT/OUTPUT PARAMETERS: |
45 |
C == Routine arguments == |
C == Routine arguments == |
46 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
47 |
C myIter - Iteration number |
C myIter - Iteration number |
48 |
C myCurrentTime - Current time of simulation ( s ) |
C myCurrentTime - Current time of simulation ( s ) |
49 |
INTEGER myThid |
INTEGER myThid |
50 |
INTEGER myIter |
INTEGER myIter |
51 |
REAL myCurrentTime |
_RL myCurrentTime |
52 |
|
|
53 |
|
CEOP |
54 |
|
|
55 |
|
C-- Generaly only thread 1 does IO here. It can not start until |
56 |
|
C-- all threads fields are ready. |
57 |
|
IF ( |
58 |
|
& DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime, |
59 |
|
& myCurrentTime-deltaTClock) |
60 |
|
& ) THEN |
61 |
|
|
|
C == Local variables == |
|
|
C suff - Hold suffix part of a filename |
|
|
CHARACTER*(MAX_LEN_FNAM) suff |
|
|
|
|
|
|
|
|
C-- Generaly only thread 1 does IO here. It can't start until everyone's |
|
|
C-- fields are ready. |
|
|
IF ( MOD(myIter,1000) .EQ. 0 ) THEN |
|
62 |
_BARRIER |
_BARRIER |
63 |
|
|
64 |
|
IF (debugMode) THEN |
65 |
C-- Write "text-plots" of certain fields |
C-- Write "text-plots" of certain fields |
66 |
CALL PLOT_FIELD_XYZR8( uVel , 'uVel ' , Nz, myIter, myThid ) |
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
67 |
CALL PLOT_FIELD_XYZR8( vVel , 'vVel ' , Nz, myIter, myThid ) |
& Nr, myIter, myThid ) |
68 |
CALL PLOT_FIELD_XYZR8( theta, 'Theta ' , Nz, myIter, myThid ) |
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
69 |
CALL PLOT_FIELD_XYZR8( rho, 'rho ' , Nz, myIter, myThid ) |
& Nr, myIter, myThid ) |
70 |
CALL PLOT_FIELD_XYR8( cg2d_x, 'cg2d_x ' , myIter, myThid ) |
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
71 |
|
& Nr, myIter, myThid ) |
72 |
|
CALL PLOT_FIELD_XYRL( etaN , 'Current etaN ' , |
73 |
|
& myIter, myThid ) |
74 |
|
ENDIF |
75 |
|
|
76 |
ENDIF |
ENDIF |
77 |
|
|
78 |
C-- Write model state to binary file |
C-- Write model state to binary file |
79 |
CALL WRITE_STATE( myCurrentTime, myIter, myThid ) |
CALL WRITE_STATE( myCurrentTime, myIter, myThid ) |
80 |
C WRITE(suff,'(I10.10)') myIter |
|
81 |
C CALL DFILE_SET_RW |
#ifdef ALLOW_TIMEAVE |
82 |
C CALL DFILE_SET_CONT_ON_ERROR |
C-- Do time averages |
83 |
C CALL WRITE_FLD_XYZ( 'U.',suff, uVel) |
ceh3 should this have an IF ( useTIMEAVE ) THEN |
84 |
C CALL WRITE_FLD_XYZ( 'V.',suff, vVel) |
IF (taveFreq.GT.0.) THEN |
85 |
C CALL WRITE_FLD_XYZ( 'T.',suff, theta) |
CALL TIMEAVE_STATV_WRITE( myCurrentTime, myIter, myThid ) |
86 |
C CALL WRITE_FLD_XYZ( 'S.',suff, salt) |
cswdptr -- add --- |
87 |
C CALL WRITE_FLD_XYZ( 'W.',suff, IO_tmp3d) |
#ifdef ALLOW_PTRACERS |
88 |
C CALL WRITE_FLD_XYZ('RHO.',suff, IO_tmp3d) |
ceh3 this needs an IF ( usePTRACERS ) THEN |
89 |
C CALL WRITE_FLD_XYZ( 'PH.',suff, IO_tmp3d) |
CALL PTRACERS_STATV_WRITE( myCurrentTime, myIter, myThid ) |
90 |
C CALL WRITE_FLD_XY ( 'PS.',suff, IO_tmp2d) |
#endif |
91 |
|
cswdptr -- end add --- |
92 |
C-- Write model checkpoint files |
ENDIF |
93 |
C nCheck = 1,2,...nCheckLev, 1,2,...nCheckLev, etc... |
#endif |
94 |
C CALL WRITE_CHECKPOINT( myIter, myThid ) |
#ifdef ALLOW_AIM |
95 |
C nCheck = MOD(nCheck,nCheckLev)+1 |
C-- Do AIM time averages |
96 |
C suff = checkPtSuff(nCheck) |
IF (useAIM) |
97 |
C CALL DFILE_SET_RW |
& CALL AIM_WRITE_TAVE( myCurrentTime, myIter, myThid ) |
98 |
C CALL DFILE_SET_CONT_ON_ERROR |
#endif |
99 |
C CALL WRITE_FLD_XYZ( 'uVel.',suff,uVel ) |
#ifdef ALLOW_LAND |
100 |
C CALL WRITE_FLD_XYZ( 'vVel.',suff,vVel ) |
C-- Do LAND time averages |
101 |
C CALL WRITE_FLD_XYZ( 'theta.',suff,theta ) |
IF (useLAND) |
102 |
C CALL WRITE_FLD_XYZ( 'salt.',suff,salt ) |
& CALL LAND_WRITE_TAVE( myCurrentTime, myIter, myThid ) |
103 |
C CALL WRITE_FLD_XY ('cg2d_x.',suff,cg2d_x) |
#endif |
104 |
C CALL WRITE_FLD_XYZ( 'gu.',suff,gu ) |
|
105 |
C CALL WRITE_FLD_XYZ( 'gv.',suff,gv ) |
#ifdef ALLOW_OBCS |
106 |
C CALL WRITE_FLD_XYZ( 'gunm1.',suff,gunm1 ) |
IF (useOBCS) |
107 |
C CALL WRITE_FLD_XYZ( 'gvnm1.',suff,gvnm1 ) |
& CALL OBCS_DIAGS( myCurrentTime, myIter, myThid ) |
108 |
|
#endif |
109 |
_BARRIER |
|
110 |
C |
#ifdef ALLOW_GMREDI |
111 |
|
C-- Do KPP diagnostics. |
112 |
|
IF (useGMRedi) |
113 |
|
& CALL GMREDI_DIAGS( myCurrentTime, myIter, myThid ) |
114 |
|
#endif |
115 |
|
|
116 |
|
#ifdef ALLOW_KPP |
117 |
|
C-- Do KPP diagnostics. |
118 |
|
IF (useKPP) |
119 |
|
& CALL KPP_DO_DIAGS( myCurrentTime, myIter, myThid ) |
120 |
|
#endif |
121 |
|
|
122 |
|
#ifdef ALLOW_SBO |
123 |
|
C-- Do SBO diagnostics. |
124 |
|
IF (useSBO) THEN |
125 |
|
CALL SBO_CALC ( myCurrentTime, myIter, myThid ) |
126 |
|
CALL SBO_DIAGS( myCurrentTime, myIter, myThid ) |
127 |
|
ENDIF |
128 |
|
#endif |
129 |
|
|
130 |
|
#ifdef ALLOW_BULK_FORCE |
131 |
|
C-- Do bulkf diagnostics. |
132 |
|
IF (useBulkforce) |
133 |
|
& CALL BULKF_DIAGS( myCurrentTime, myIter, myThid ) |
134 |
|
#endif |
135 |
|
|
136 |
|
#ifdef ALLOW_THERM_SEAICE |
137 |
|
C-- Do seaice diagnostics. |
138 |
|
IF (useThermSeaice) |
139 |
|
& CALL ICE_DIAGS( myCurrentTime, myIter, myThid ) |
140 |
|
#endif |
141 |
|
|
142 |
|
cswdptr --- add --- |
143 |
|
#ifdef ALLOW_GCHEM |
144 |
|
ceh3 ??? why is one package depending upon another here? |
145 |
|
C-- Do ptracer diagnostics. |
146 |
|
IF (usePTRACERS) |
147 |
|
& CALL GCHEM_DIAGS( myCurrentTime, myIter, myThid ) |
148 |
|
#endif |
149 |
|
cswdptr -- end add --- |
150 |
|
|
151 |
RETURN |
RETURN |
152 |
END |
END |
153 |
|
|