1 |
C $Header: /u/gcmpack/MITgcm/model/src/check_pickup.F,v 1.2 2007/10/29 18:18:26 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
c#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
CBOP |
9 |
C !ROUTINE: CHECK_PICKUP |
10 |
C !INTERFACE: |
11 |
SUBROUTINE CHECK_PICKUP( |
12 |
I missFldList, |
13 |
I nMissing, nbFields, |
14 |
I myIter, myThid ) |
15 |
|
16 |
C !DESCRIPTION: |
17 |
C Check that fields that are needed to restart have been read. |
18 |
C In case some fields are missing, stop if pickupStrictlyMatch=T |
19 |
C or try, if possible, to restart without the missing field. |
20 |
|
21 |
C !USES: |
22 |
IMPLICIT NONE |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "RESTART.h" |
27 |
c#include "DYNVARS.h" |
28 |
c#include "SURFACE.h" |
29 |
c#ifdef ALLOW_GENERIC_ADVDIFF |
30 |
c# include "GAD.h" |
31 |
c#endif |
32 |
c#ifdef ALLOW_NONHYDROSTATIC |
33 |
c#include "NH_VARS.h" |
34 |
c#endif |
35 |
c#ifdef ALLOW_MNC |
36 |
c#include "MNC_PARAMS.h" |
37 |
c#endif |
38 |
|
39 |
C !INPUT/OUTPUT PARAMETERS: |
40 |
C missFldList :: List of missing fields (attempted to read but not found) |
41 |
C nMissing :: Number of missing fields (attempted to read but not found) |
42 |
C nbFields :: number of fields in pickup file (read from meta file) |
43 |
C myIter :: Iteration number |
44 |
C myThid :: my Thread Id. number |
45 |
CHARACTER*(8) missFldList(*) |
46 |
INTEGER nMissing |
47 |
INTEGER nbFields |
48 |
INTEGER myIter |
49 |
INTEGER myThid |
50 |
CEOP |
51 |
|
52 |
C !FUNCTIONS |
53 |
INTEGER ILNBLNK |
54 |
EXTERNAL ILNBLNK |
55 |
|
56 |
C !LOCAL VARIABLES: |
57 |
INTEGER j |
58 |
INTEGER ioUnit |
59 |
INTEGER warnCnts |
60 |
LOGICAL stopFlag |
61 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
62 |
|
63 |
ioUnit = errorMessageUnit |
64 |
|
65 |
c IF (pickup_read_mdsio) THEN |
66 |
_BEGIN_MASTER( myThid ) |
67 |
|
68 |
IF ( nbFields.GE.1 ) THEN |
69 |
C- flag startFromPickupAB2 is becoming obsolete with new way to read |
70 |
C pickup file: cancel its effect (from initialisation) by resetting |
71 |
C start-AB parameters: |
72 |
tempStartAB = nIter0 |
73 |
saltStartAB = nIter0 |
74 |
mom_StartAB = nIter0 |
75 |
nHydStartAB = nIter0 |
76 |
ENDIF |
77 |
|
78 |
IF ( nMissing.GE.1 ) THEN |
79 |
stopFlag = .FALSE. |
80 |
warnCnts = nMissing |
81 |
DO j=1,nMissing |
82 |
C- Case where missing field is not essential or can be recomputed |
83 |
IF ( missFldList(j).EQ.'dEtaHdt ' |
84 |
& .AND. .NOT.useRealFreshWaterFlux ) THEN |
85 |
warnCnts = warnCnts - 1 |
86 |
IF ( .NOT.pickupStrictlyMatch ) THEN |
87 |
WRITE(msgBuf,'(4A)') ' CHECK_PICKUP: ', |
88 |
& 'no RealFreshWaterFlux => can restart without "dEtaHdt "' |
89 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
90 |
ENDIF |
91 |
C- Old pickup for which special code takes care of missing fields |
92 |
ELSEIF ( missFldList(j).EQ.'dEtaHdt ' |
93 |
& .AND.usePickupBeforeC54 ) THEN |
94 |
C- with RealFreshWaterFlux, needs dEtaHdt to restart when: |
95 |
C * synchronousTimeStep & usingPCoords => needs PmEpR for surf-forcing |
96 |
C <- present code might be wrong if usePickupBeforeC54 and LinFS |
97 |
C * synchronousTimeStep & nonlinFreeSurf > 0 => needs PmEpR for surf-forcing |
98 |
C * select_rStar <> 0 => needs dEtaHdt for 1rst Integr_continuity |
99 |
IF ( .NOT.pickupStrictlyMatch ) THEN |
100 |
WRITE(msgBuf,'(4A)') '** WARNINGS ** CHECK_PICKUP: ', |
101 |
& 'restart as before C54 without "dEtaHdt "' |
102 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
103 |
ENDIF |
104 |
|
105 |
C- fields used only to speed-up solver(s) convergence: |
106 |
C (no serious problems expected if missing, but get a non-perfect restart) |
107 |
ELSEIF ( missFldList(j).EQ.'EtaN ' |
108 |
& .AND. rigidLid ) THEN |
109 |
IF ( .NOT.pickupStrictlyMatch ) THEN |
110 |
WRITE(msgBuf,'(4A)') '** WARNINGS ** CHECK_PICKUP: ', |
111 |
& 'restart with 1rst guess == 0 for CG2D solver' |
112 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
113 |
ENDIF |
114 |
ELSEIF ( missFldList(j).EQ.'Phi_NHyd' ) THEN |
115 |
IF ( .NOT.pickupStrictlyMatch ) THEN |
116 |
WRITE(msgBuf,'(4A)') '** WARNINGS ** CHECK_PICKUP: ', |
117 |
& 'restart with 1rst guess == 0 for CG3D solver' |
118 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
119 |
ENDIF |
120 |
ELSEIF ( missFldList(j).EQ.'AddMass ' |
121 |
& .AND. selectAddFluid.EQ.2 ) THEN |
122 |
IF ( .NOT.pickupStrictlyMatch ) THEN |
123 |
WRITE(msgBuf,'(4A)') '** WARNINGS ** CHECK_PICKUP: ', |
124 |
& 'restart with AddMass == 0' |
125 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
126 |
ENDIF |
127 |
|
128 |
C- Absolutely needed fields: |
129 |
ELSEIF ( missFldList(j).EQ.'Uvel ' .OR. |
130 |
& missFldList(j).EQ.'Vvel ' .OR. |
131 |
& missFldList(j).EQ.'Theta ' .OR. |
132 |
& missFldList(j).EQ.'Salt ' .OR. |
133 |
& missFldList(j).EQ.'EtaN ' ) THEN |
134 |
stopFlag = .TRUE. |
135 |
WRITE(msgBuf,'(4A)') 'CHECK_PICKUP: ', |
136 |
& 'cannot restart without field "',missFldList(j),'"' |
137 |
CALL PRINT_ERROR( msgBuf, myThid ) |
138 |
|
139 |
C- fields needed for restart (alternative not presently implemented) |
140 |
ELSEIF ( missFldList(j).EQ.'PhiHyd ' .OR. |
141 |
& missFldList(j).EQ.'AddMass ' .OR. |
142 |
& missFldList(j).EQ.'dEtaHdt ' .OR. |
143 |
& missFldList(j).EQ.'EtaH ' ) THEN |
144 |
stopFlag = .TRUE. |
145 |
WRITE(msgBuf,'(4A)') 'CHECK_PICKUP: ', |
146 |
& 'cannot currently restart without field "',missFldList(j),'"' |
147 |
CALL PRINT_ERROR( msgBuf, myThid ) |
148 |
|
149 |
C- fields with alternative in place to restart without: |
150 |
C- (but get a non-perfect restart) |
151 |
ELSEIF ( missFldList(j).EQ.'GuNm1 ' .OR. |
152 |
& missFldList(j).EQ.'GvNm1 ' ) THEN |
153 |
mom_StartAB = 0 |
154 |
ELSEIF ( missFldList(j).EQ.'GuNm2 ' .OR. |
155 |
& missFldList(j).EQ.'GvNm2 ' ) THEN |
156 |
mom_StartAB = MIN( mom_startAB, 1 ) |
157 |
ELSEIF ( missFldList(j).EQ.'GtNm1 ' .OR. |
158 |
& missFldList(j).EQ.'TempNm1 ' ) THEN |
159 |
tempStartAB = 0 |
160 |
ELSEIF ( missFldList(j).EQ.'GtNm2 ' .OR. |
161 |
& missFldList(j).EQ.'TempNm2 ' ) THEN |
162 |
tempStartAB = MIN( tempStartAB, 1 ) |
163 |
ELSEIF ( missFldList(j).EQ.'GsNm1 ' .OR. |
164 |
& missFldList(j).EQ.'SaltNm1 ' ) THEN |
165 |
saltStartAB = 0 |
166 |
ELSEIF ( missFldList(j).EQ.'GsNm2 ' .OR. |
167 |
& missFldList(j).EQ.'SaltNm2 ' ) THEN |
168 |
saltStartAB = MIN( saltStartAB, 1 ) |
169 |
ELSEIF ( missFldList(j).EQ.'GwNm1 ' ) THEN |
170 |
nHydStartAB = 0 |
171 |
|
172 |
ELSE |
173 |
C- not recognized fields: |
174 |
stopFlag = .TRUE. |
175 |
WRITE(msgBuf,'(4A)') 'CHECK_PICKUP: ', |
176 |
& 'missing field "',missFldList(j),'" not recognized' |
177 |
CALL PRINT_ERROR( msgBuf, myThid ) |
178 |
ENDIF |
179 |
ENDDO |
180 |
|
181 |
IF ( stopFlag ) THEN |
182 |
STOP 'ABNORMAL END: S/R CHECK_PICKUP' |
183 |
ELSEIF ( pickupStrictlyMatch ) THEN |
184 |
WRITE(msgBuf,'(4A)') 'CHECK_PICKUP: ', |
185 |
& 'try with " pickupStrictlyMatch=.FALSE.,"', |
186 |
& ' in file: "data", NameList: "PARM03"' |
187 |
CALL PRINT_ERROR( msgBuf, myThid ) |
188 |
STOP 'ABNORMAL END: S/R CHECK_PICKUP' |
189 |
ELSEIF ( warnCnts .GT. 0 ) THEN |
190 |
WRITE(msgBuf,'(4A)') '** WARNINGS ** CHECK_PICKUP: ', |
191 |
& 'Will get only an approximated Restart' |
192 |
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
193 |
IF ( mom_StartAB.LT.nIter0 .OR. |
194 |
& nHydStartAB.LT.nIter0 .OR. |
195 |
& tempStartAB.LT.nIter0 .OR. |
196 |
& saltStartAB.LT.nIter0 ) THEN |
197 |
WRITE(msgBuf,'(2(A,I10))') |
198 |
& ' Continue with mom_StartAB =', mom_StartAB, |
199 |
& ' ; nHydStartAB =', nHydStartAB |
200 |
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
201 |
WRITE(msgBuf,'(2(A,I10))') |
202 |
& ' with tempStartAB =', tempStartAB, |
203 |
& ' ; saltStartAB =', saltStartAB |
204 |
CALL PRINT_MESSAGE(msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
205 |
ENDIF |
206 |
ENDIF |
207 |
|
208 |
ENDIF |
209 |
|
210 |
_END_MASTER( myThid ) |
211 |
c ENDIF |
212 |
|
213 |
RETURN |
214 |
END |