1 |
adcroft |
1.16 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/do_the_model_io.F,v 1.15 2000/04/05 19:04:13 adcroft Exp $ |
2 |
cnh |
1.1 |
|
3 |
cnh |
1.11 |
#include "CPP_OPTIONS.h" |
4 |
cnh |
1.1 |
|
5 |
adcroft |
1.15 |
SUBROUTINE DO_THE_MODEL_IO( |
6 |
|
|
I forceOutput, myCurrentTime, myIter, myThid) |
7 |
cnh |
1.1 |
C /==========================================================\ |
8 |
|
|
C | SUBROUTINE DO_THE_MODEL_IO | |
9 |
|
|
C | o Controlling routine for IO in model main time-stepping | |
10 |
|
|
C | loop. | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C | Many systems do not have thread safe IO so it is easier | |
13 |
|
|
C | to lump everything together and do dumping of fields | |
14 |
|
|
C | and updating of forcing terms in a single place. | |
15 |
|
|
C | The approach to IO used here is that writes are only | |
16 |
|
|
C | performed by thread 1 and that a process only writes out | |
17 |
cnh |
1.10 |
C | its data ( it does not know about anyone elses data!) | |
18 |
cnh |
1.1 |
C | Reading on the other hand is assumed to be from a file | |
19 |
|
|
C | containing all the data for all the processes. Only the | |
20 |
|
|
C | portion of data of interest to this process is actually | |
21 |
|
|
C | loaded. To work well this assumes the existence of some | |
22 |
|
|
C | reliable tool to join datasets together at the end of a | |
23 |
cnh |
1.10 |
C | run - see joinds.p | |
24 |
cnh |
1.1 |
C \==========================================================/ |
25 |
adcroft |
1.12 |
IMPLICIT NONE |
26 |
cnh |
1.1 |
|
27 |
|
|
C == Global variables === |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
#include "DYNVARS.h" |
32 |
|
|
#include "CG2D.h" |
33 |
|
|
|
34 |
cnh |
1.3 |
LOGICAL DIFFERENT_MULTIPLE |
35 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
36 |
|
|
|
37 |
cnh |
1.1 |
C == Routine arguments == |
38 |
adcroft |
1.15 |
C forceOutput - If .TRUE. then force I/O, indepenent of other tests |
39 |
cnh |
1.1 |
C myThid - Thread number for this instance of the routine. |
40 |
|
|
C myIter - Iteration number |
41 |
cnh |
1.3 |
C myCurrentTime - Current time of simulation ( s ) |
42 |
adcroft |
1.15 |
LOGICAL forceOutput |
43 |
cnh |
1.1 |
INTEGER myThid |
44 |
|
|
INTEGER myIter |
45 |
adcroft |
1.13 |
_RL myCurrentTime |
46 |
cnh |
1.1 |
|
47 |
|
|
C == Local variables == |
48 |
|
|
|
49 |
cnh |
1.10 |
C-- Generaly only thread 1 does IO here. It can not start until |
50 |
|
|
C-- all threads fields are ready. |
51 |
cnh |
1.6 |
IF ( |
52 |
cnh |
1.10 |
& DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime, |
53 |
|
|
& myCurrentTime-deltaTClock) |
54 |
cnh |
1.6 |
& ) THEN |
55 |
|
|
|
56 |
cnh |
1.3 |
_BARRIER |
57 |
cnh |
1.1 |
|
58 |
cnh |
1.3 |
C-- Write "text-plots" of certain fields |
59 |
cnh |
1.10 |
CALL PLOT_FIELD_XYZRL( uVel , 'Current uVel ' , |
60 |
|
|
& Nr, myIter, myThid ) |
61 |
|
|
CALL PLOT_FIELD_XYZRL( vVel , 'Current vVel ' , |
62 |
|
|
& Nr, myIter, myThid ) |
63 |
|
|
CALL PLOT_FIELD_XYZRL( theta, 'Current theta ' , |
64 |
|
|
& Nr, myIter, myThid ) |
65 |
|
|
CALL PLOT_FIELD_XYRL( cg2d_x, 'Current cg2d_x ' , |
66 |
|
|
& myIter, myThid ) |
67 |
adcroft |
1.13 |
|
68 |
cnh |
1.3 |
ENDIF |
69 |
|
|
|
70 |
|
|
C-- Write model state to binary file |
71 |
adcroft |
1.15 |
CALL WRITE_STATE( forceOutput, myCurrentTime, myIter, myThid ) |
72 |
cnh |
1.5 |
|
73 |
adcroft |
1.16 |
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
74 |
|
|
C-- Do time averages |
75 |
|
|
IF (taveFreq.GT.0.) THEN |
76 |
|
|
CALL WRITE_TIME_AVERAGES( myCurrentTime, myIter, myThid ) |
77 |
|
|
ENDIF |
78 |
|
|
#endif |
79 |
|
|
|
80 |
|
|
#ifdef ALLOW_GMREDI |
81 |
|
|
C-- Do KPP diagnostics. |
82 |
|
|
IF (use_GMRedi) |
83 |
|
|
& CALL GMREDI_DIAGS( myCurrentTime, myIter, myThid ) |
84 |
|
|
#endif |
85 |
|
|
|
86 |
|
|
#ifdef ALLOW_KPP |
87 |
|
|
C-- Do KPP diagnostics. |
88 |
|
|
IF (use_KPPmixing) |
89 |
|
|
& CALL KPP_DO_DIAGS( myCurrentTime, myIter, myThid ) |
90 |
|
|
#endif |
91 |
|
|
|
92 |
cnh |
1.1 |
RETURN |
93 |
|
|
END |
94 |
|
|
|