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 "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,deltaTClock) |
68 |
& .OR. myTime.EQ.endTime |
69 |
& .OR. myTime.EQ.startTime |
70 |
& ) THEN |
71 |
IF ( dumpFreq .EQ. 0.0 ) THEN |
72 |
iRec = 1 |
73 |
ELSE |
74 |
iRec = NINT ( (myTime-startTime) / dumpFreq + 1. ) |
75 |
ENDIF |
76 |
|
77 |
C-- Going to really do some IO. Make everyone except master thread wait. |
78 |
_BARRIER |
79 |
_BEGIN_MASTER( myThid ) |
80 |
|
81 |
C-- Write model fields |
82 |
il=ilnblnk( myFile ) |
83 |
write(localfile(1:80),'(80a)') ' ' |
84 |
write(localfile(1:80),'(2a)') myFile(1:il),'.' |
85 |
|
86 |
#ifdef MULTIPLE_RECORD_STATE_FILES |
87 |
|
88 |
C Write each snap-shot as a new record in one file per variable |
89 |
C - creates relatively few files but these files can become huge |
90 |
CALL WRITE_REC_XYZ_RL( localfile, myField,iRec,myIter,myThid) |
91 |
|
92 |
#else /* MULTIPLE_RECORD_STATE_FILES */ |
93 |
|
94 |
C Write each snap-shot as a new file (original and default method) |
95 |
C - creates many files but for large configurations is easier to |
96 |
C transfer analyse a particular snap-shots |
97 |
WRITE(suff,'(I10.10)') myIter |
98 |
STOP 'WRITE_FLD_XYZ_RL CALL INCORRECT - CONTACT SUPPORT' |
99 |
C CALL WRITE_FLD_XYZ_RL( localfile,suff,myField,myIter,myThid) |
100 |
|
101 |
#endif /* MULTIPLE_RECORD_STATE_FILES */ |
102 |
|
103 |
_END_MASTER( myThid ) |
104 |
_BARRIER |
105 |
|
106 |
ENDIF |
107 |
|
108 |
RETURN |
109 |
END |