1 |
C $Header: /u/u0/gcmpack/MITgcm/model/src/write_myfield.F,v 1.1 2004/03/24 21:39:44 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
#undef MULTIPLE_RECORD_STATE_FILES |
8 |
|
9 |
CBOP |
10 |
C !ROUTINE: WRITE_MYFIELD |
11 |
C !INTERFACE: |
12 |
SUBROUTINE WRITE_MYFIELD ( |
13 |
& myField, myFile, myTime, myIter, myThid ) |
14 |
C !DESCRIPTION: \bv |
15 |
C *==========================================================* |
16 |
C | SUBROUTINE WRITE_MYFIELD |
17 |
C | o Template routine for probing one array at dumpFreq rate |
18 |
C | place call to this routine into code |
19 |
C *==========================================================* |
20 |
C | Write model state files for post-processing. This file |
21 |
C | includes code for diagnosing W and RHO for output. |
22 |
C | File write_state.F: Routines to handle mid-level I/O |
23 |
C | interface. |
24 |
C | Adapted from S/R WRITE_STATE |
25 |
C *==========================================================* |
26 |
C \ev |
27 |
|
28 |
C !USES: |
29 |
IMPLICIT NONE |
30 |
C == Global variables === |
31 |
#include "SIZE.h" |
32 |
#include "EEPARAMS.h" |
33 |
#include "PARAMS.h" |
34 |
#include "DYNVARS.h" |
35 |
#include "GRID.h" |
36 |
#include "EOS.h" |
37 |
LOGICAL DIFFERENT_MULTIPLE |
38 |
EXTERNAL DIFFERENT_MULTIPLE |
39 |
INTEGER IO_ERRCOUNT |
40 |
EXTERNAL IO_ERRCOUNT |
41 |
|
42 |
C !INPUT/OUTPUT PARAMETERS: |
43 |
C == Routine arguments == |
44 |
C myThid - Thread number for this instance of the routine. |
45 |
C myIter - Iteration number |
46 |
C myTime - Current time of simulation ( s ) |
47 |
_RL myField(sNx,sNy,Nr,nSx,nSy) |
48 |
_RL myTime |
49 |
INTEGER myThid |
50 |
INTEGER myIter |
51 |
CHARACTER*(*) myFile |
52 |
|
53 |
C !LOCAL VARIABLES: |
54 |
C == Local variables == |
55 |
CHARACTER*(MAX_LEN_MBUF) suff |
56 |
CHARACTER*(80) localfile |
57 |
INTEGER iRec, il |
58 |
|
59 |
c == external == |
60 |
|
61 |
integer ilnblnk |
62 |
external ilnblnk |
63 |
|
64 |
CEOP |
65 |
|
66 |
IF ( |
67 |
& DIFFERENT_MULTIPLE(dumpFreq,myTime, |
68 |
& myTime-deltaTClock) .OR. |
69 |
& myTime.EQ.endTime .OR. |
70 |
& myTime.EQ.startTime |
71 |
& ) THEN |
72 |
IF ( dumpFreq .EQ. 0.0 ) THEN |
73 |
iRec = 1 |
74 |
ELSE |
75 |
iRec = int ( (myTime-startTime) / dumpFreq +1.5 ) |
76 |
ENDIF |
77 |
|
78 |
C-- Going to really do some IO. Make everyone except master thread wait. |
79 |
_BARRIER |
80 |
_BEGIN_MASTER( myThid ) |
81 |
|
82 |
C-- Write model fields |
83 |
il=ilnblnk( myFile ) |
84 |
write(localfile(1:80),'(80a)') ' ' |
85 |
write(localfile(1:80),'(2a)') myFile(1:il),'.' |
86 |
|
87 |
#ifdef MULTIPLE_RECORD_STATE_FILES |
88 |
|
89 |
C Write each snap-shot as a new record in one file per variable |
90 |
C - creates relatively few files but these files can become huge |
91 |
CALL WRITE_REC_XYZ_RL( localfile, myField,iRec,myIter,myThid) |
92 |
|
93 |
#else /* MULTIPLE_RECORD_STATE_FILES */ |
94 |
|
95 |
C Write each snap-shot as a new file (original and default method) |
96 |
C - creates many files but for large configurations is easier to |
97 |
C transfer analyse a particular snap-shots |
98 |
WRITE(suff,'(I10.10)') myIter |
99 |
STOP 'WRITE_FLD_XYZ_RL CALL INCORRECT - CONTACT SUPPORT' |
100 |
C CALL WRITE_FLD_XYZ_RL( localfile,suff,myField,myIter,myThid) |
101 |
|
102 |
#endif /* MULTIPLE_RECORD_STATE_FILES */ |
103 |
|
104 |
_END_MASTER( myThid ) |
105 |
_BARRIER |
106 |
|
107 |
ENDIF |
108 |
|
109 |
RETURN |
110 |
END |