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