1 |
adcroft |
1.2 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/write_state.F,v 1.1 1999/05/05 18:32:35 adcroft Exp $ |
2 |
adcroft |
1.1 |
#include "CPP_OPTIONS.h" |
3 |
|
|
|
4 |
|
|
C-- File read_write.F: Routines to handle mid-level I/O interface. |
5 |
|
|
C-- Contents |
6 |
|
|
C-- o WRITE_STATE - Write out model state. |
7 |
|
|
|
8 |
|
|
CStartofinterface |
9 |
|
|
SUBROUTINE WRITE_STATE ( forceOutput, myCurrentTime, |
10 |
|
|
& myIter, myThid ) |
11 |
|
|
C /==========================================================\ |
12 |
|
|
C | SUBROUTINE WRITE_STATE | |
13 |
|
|
C | o Controlling routine for IO to dump model state. | |
14 |
|
|
C |==========================================================| |
15 |
|
|
C | Write model state files for post-processing. This file | |
16 |
|
|
C | includes code for diagnosing W and RHO for output. | |
17 |
|
|
C \==========================================================/ |
18 |
|
|
IMPLICIT NONE |
19 |
|
|
|
20 |
|
|
C == Global variables === |
21 |
|
|
#include "SIZE.h" |
22 |
|
|
#include "EEPARAMS.h" |
23 |
|
|
#include "PARAMS.h" |
24 |
|
|
#include "DYNVARS.h" |
25 |
|
|
#include "CG2D.h" |
26 |
|
|
#ifdef ALLOW_NONHYDROSTATIC |
27 |
|
|
#include "CG3D.h" |
28 |
|
|
#include "GW.h" |
29 |
|
|
#endif |
30 |
|
|
|
31 |
|
|
LOGICAL DIFFERENT_MULTIPLE |
32 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
33 |
|
|
INTEGER IO_ERRCOUNT |
34 |
|
|
EXTERNAL IO_ERRCOUNT |
35 |
|
|
|
36 |
|
|
C == Routine arguments == |
37 |
|
|
C myThid - Thread number for this instance of the routine. |
38 |
|
|
C myIter - Iteration number |
39 |
|
|
C myCurrentTime - Current time of simulation ( s ) |
40 |
|
|
LOGICAL forceOutput |
41 |
adcroft |
1.2 |
_RL myCurrentTime |
42 |
adcroft |
1.1 |
INTEGER myThid |
43 |
|
|
INTEGER myIter |
44 |
|
|
CEndofinterface |
45 |
|
|
|
46 |
|
|
C == Local variables == |
47 |
|
|
C suff - Hold suffix part of a filename |
48 |
|
|
C beginIOErrCount - Begin and end IO error counts |
49 |
|
|
C endIOErrCount |
50 |
|
|
C msgBuf - Error message buffer |
51 |
|
|
INTEGER beginIOErrCount |
52 |
|
|
INTEGER endIOErrCount |
53 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
54 |
|
|
CHARACTER*(MAX_LEN_MBUF) suff |
55 |
|
|
CHARACTER*(80) fName |
56 |
|
|
|
57 |
|
|
IF ( |
58 |
|
|
& ( DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime, |
59 |
|
|
& myCurrentTime-deltaTClock) .AND. myCurrentTime.NE.startTime ) |
60 |
|
|
& .OR. forceOutput |
61 |
|
|
& ) THEN |
62 |
|
|
|
63 |
|
|
C-- Going to really do some IO. Make everyone except master thread wait. |
64 |
|
|
_BARRIER |
65 |
|
|
_BEGIN_MASTER( myThid ) |
66 |
|
|
|
67 |
|
|
WRITE(suff,'(I10.10)') myIter |
68 |
|
|
|
69 |
|
|
C-- Write model fields |
70 |
|
|
CALL WRITE_FLD_XYZ_RL( 'U.',suff,uVel,myIter,myThid) |
71 |
|
|
CALL WRITE_FLD_XYZ_RL( 'V.',suff,vVel,myIter,myThid) |
72 |
|
|
CALL WRITE_FLD_XYZ_RL( 'T.',suff,theta,myIter,myThid) |
73 |
|
|
CALL WRITE_FLD_XYZ_RL( 'S.',suff,salt,myIter,myThid) |
74 |
|
|
CALL WRITE_FLD_XY_RL( 'PS.',suff,cg2d_x,myIter,myThid) |
75 |
|
|
|
76 |
|
|
#ifdef ALLOW_NONHYDROSTATIC |
77 |
|
|
IF (nonHydroStatic) THEN |
78 |
|
|
CALL WRITE_FLD_XYZ_RL( 'PNH.',suff,cg3d_x,myIter,myThid) |
79 |
|
|
ENDIF |
80 |
|
|
CALL WRITE_FLD_XYZ_RL( 'W.',suff,wVel,myIter,myThid) |
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
_END_MASTER( myThid ) |
84 |
|
|
_BARRIER |
85 |
|
|
|
86 |
|
|
ENDIF |
87 |
|
|
|
88 |
|
|
RETURN |
89 |
|
|
END |