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