1 |
jmc |
1.1 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PTRACERS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: PTRACERS_CHECK_PICKUP |
9 |
|
|
C !INTERFACE: |
10 |
|
|
SUBROUTINE PTRACERS_CHECK_PICKUP( |
11 |
|
|
I missFldList, |
12 |
|
|
I nMissing, nbFields, |
13 |
|
|
I myIter, myThid ) |
14 |
|
|
|
15 |
|
|
C !DESCRIPTION: |
16 |
|
|
C Check that fields that are needed to restart have been read. |
17 |
|
|
C In case some fields are missing, stop if pickupStrictlyMatch=T |
18 |
|
|
C or try, if possible, to restart without the missing field. |
19 |
|
|
|
20 |
|
|
C !USES: |
21 |
|
|
IMPLICIT NONE |
22 |
|
|
#include "SIZE.h" |
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
|
|
#include "PTRACERS_SIZE.h" |
26 |
|
|
#include "PTRACERS_PARAMS.h" |
27 |
|
|
#include "PTRACERS_RESTART.h" |
28 |
|
|
|
29 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
30 |
|
|
C missFldList :: List of missing fields (attempted to read but not found) |
31 |
|
|
C nMissing :: Number of missing fields (attempted to read but not found) |
32 |
|
|
C nbFields :: number of fields in pickup file (read from meta file) |
33 |
|
|
C myIter :: Iteration number |
34 |
|
|
C myThid :: my Thread Id. number |
35 |
|
|
CHARACTER*(8) missFldList(*) |
36 |
|
|
INTEGER nMissing |
37 |
|
|
INTEGER nbFields |
38 |
|
|
INTEGER myIter |
39 |
|
|
INTEGER myThid |
40 |
|
|
CEOP |
41 |
|
|
|
42 |
|
|
C !FUNCTIONS |
43 |
|
|
INTEGER ILNBLNK |
44 |
|
|
EXTERNAL ILNBLNK |
45 |
|
|
|
46 |
|
|
C !LOCAL VARIABLES: |
47 |
|
|
INTEGER i, iTracer |
48 |
|
|
INTEGER j |
49 |
|
|
INTEGER ioUnit |
50 |
|
|
INTEGER warnCnts |
51 |
|
|
LOGICAL stopFlag |
52 |
|
|
CHARACTER*(8) fldName |
53 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
54 |
|
|
|
55 |
|
|
ioUnit = errorMessageUnit |
56 |
|
|
|
57 |
|
|
_BEGIN_MASTER( myThid ) |
58 |
|
|
|
59 |
|
|
IF ( nMissing.GE.1 ) THEN |
60 |
|
|
stopFlag = .FALSE. |
61 |
|
|
warnCnts = nMissing |
62 |
|
|
DO j=1,nMissing |
63 |
|
|
fldName = missFldList(j) |
64 |
|
|
iTracer = 1 |
65 |
|
|
C- passive tracer field is always needed: |
66 |
|
|
IF ( fldName(1:3).EQ.'pTr' .AND. |
67 |
|
|
& fldName(6:8).EQ.' ' ) THEN |
68 |
|
|
C find the corresponding pTracer: |
69 |
|
|
iTracer = 0 |
70 |
|
|
DO i=1,PTRACERS_numInUse |
71 |
|
|
IF ( iTracer.EQ.0 .AND. |
72 |
|
|
& fldName(4:5).EQ.PTRACERS_ioLabel(i) ) iTracer = i |
73 |
|
|
ENDDO |
74 |
|
|
IF ( iTracer.GT.0 ) THEN |
75 |
|
|
stopFlag = .TRUE. |
76 |
|
|
WRITE(msgBuf,'(2A,I4,3A)') 'PTRACERS_CHECK_PICKUP: ', |
77 |
|
|
& 'cannot restart without tracer ',iTracer, |
78 |
|
|
& ' field "',fldName,'"' |
79 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
80 |
|
|
ENDIF |
81 |
|
|
|
82 |
|
|
C- fields with alternative in place to restart without: |
83 |
|
|
C- (but get a non-perfect restart) |
84 |
|
|
ELSEIF ( fldName(1:4).EQ.'gPtr' .AND. |
85 |
|
|
& fldName(7:8).EQ.'m1' ) THEN |
86 |
|
|
C find the corresponding pTracer: |
87 |
|
|
iTracer = 0 |
88 |
|
|
DO i=1,PTRACERS_numInUse |
89 |
|
|
IF ( iTracer.EQ.0 .AND. |
90 |
|
|
& fldName(5:6).EQ.PTRACERS_ioLabel(i) ) iTracer = i |
91 |
|
|
ENDDO |
92 |
|
|
IF ( iTracer.GT.0 ) THEN |
93 |
|
|
PTRACERS_startAB(iTracer) = 0 |
94 |
|
|
WRITE(msgBuf,'(2A,I4)') |
95 |
|
|
& '** WARNINGS ** PTRACERS_CHECK_PICKUP: ', |
96 |
|
|
& 'tracer Tendency is missing for pTr# :',iTracer |
97 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
98 |
|
|
ENDIF |
99 |
|
|
IF ( iTracer.GT.0 .AND. |
100 |
|
|
& .NOT.pickupStrictlyMatch .AND. .NOT.stopFlag ) THEN |
101 |
|
|
WRITE(msgBuf,'(4A)') |
102 |
|
|
& '** WARNINGS ** PTRACERS_CHECK_PICKUP: ', |
103 |
|
|
& '1rst time-step will use simple Euler time-stepping' |
104 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
105 |
|
|
ENDIF |
106 |
|
|
|
107 |
|
|
ELSE |
108 |
|
|
C- unrecognized field: |
109 |
|
|
iTracer = 0 |
110 |
|
|
ENDIF |
111 |
|
|
|
112 |
|
|
C- unrecognized field or tracer: |
113 |
|
|
IF ( iTracer.EQ.0 ) THEN |
114 |
|
|
stopFlag = .TRUE. |
115 |
|
|
WRITE(msgBuf,'(4A)') 'PTRACERS_CHECK_PICKUP: ', |
116 |
|
|
& 'missing field "',missFldList(j),'" not recognized' |
117 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
118 |
|
|
ENDIF |
119 |
|
|
ENDDO |
120 |
|
|
|
121 |
|
|
IF ( stopFlag ) THEN |
122 |
|
|
STOP 'ABNORMAL END: S/R PTRACERS_CHECK_PICKUP' |
123 |
|
|
ELSEIF ( pickupStrictlyMatch ) THEN |
124 |
|
|
WRITE(msgBuf,'(4A)') 'PTRACERS_CHECK_PICKUP: ', |
125 |
|
|
& 'try with " pickupStrictlyMatch=.FALSE.,"', |
126 |
|
|
& ' in file: "data", NameList: "PARM03"' |
127 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
128 |
|
|
STOP 'ABNORMAL END: S/R PTRACERS_CHECK_PICKUP' |
129 |
|
|
ELSEIF ( warnCnts .GT. 0 ) THEN |
130 |
|
|
WRITE(msgBuf,'(4A)') '** WARNINGS ** PTRACERS_CHECK_PICKUP: ', |
131 |
|
|
& 'Will get only an approximated Restart' |
132 |
|
|
CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid ) |
133 |
|
|
ENDIF |
134 |
|
|
|
135 |
|
|
ENDIF |
136 |
|
|
|
137 |
|
|
_END_MASTER( myThid ) |
138 |
|
|
|
139 |
|
|
RETURN |
140 |
|
|
END |