1 |
jmc |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/cfc/cfc_atmos.F,v 1.4 2006/08/02 22:51:24 jmc Exp $ |
2 |
jmc |
1.4 |
C $Name: $ |
3 |
stephd |
1.1 |
|
4 |
|
|
#include "GCHEM_OPTIONS.h" |
5 |
|
|
|
6 |
jmc |
1.5 |
CBOP |
7 |
|
|
C !ROUTINE: CFC_ATMOS |
8 |
|
|
C !INTERFACE: |
9 |
stephd |
1.1 |
SUBROUTINE CFC_ATMOS( myThid ) |
10 |
jmc |
1.5 |
|
11 |
|
|
C !DESCRIPTION: \bv |
12 |
jmc |
1.4 |
C *==========================================================* |
13 |
|
|
C | SUBROUTINE CFC_ATMOS |
14 |
jmc |
1.5 |
C | o read in time-series of atmoshperic CFC |
15 |
jmc |
1.4 |
C *==========================================================* |
16 |
jmc |
1.5 |
|
17 |
|
|
C !USES: |
18 |
stephd |
1.1 |
IMPLICIT NONE |
19 |
|
|
|
20 |
|
|
C === Global variables === |
21 |
|
|
#include "SIZE.h" |
22 |
|
|
#include "EEPARAMS.h" |
23 |
|
|
#include "PARAMS.h" |
24 |
|
|
#include "CFC.h" |
25 |
jmc |
1.5 |
#include "CFC_ATMOS.h" |
26 |
stephd |
1.1 |
|
27 |
jmc |
1.5 |
C !INPUT/OUTPUT PARAMETERS: |
28 |
|
|
C === Routine arguments === |
29 |
|
|
C myThid :: My Thread Id. number |
30 |
stephd |
1.1 |
INTEGER myThid |
31 |
jmc |
1.5 |
CEOP |
32 |
stephd |
1.1 |
|
33 |
jmc |
1.4 |
#ifdef ALLOW_CFC |
34 |
jmc |
1.5 |
C !FUNCTIONS: |
35 |
|
|
INTEGER ILNBLNK |
36 |
|
|
EXTERNAL ILNBLNK |
37 |
jmc |
1.4 |
|
38 |
jmc |
1.5 |
C !LOCAL VARIABLES: |
39 |
mlosch |
1.2 |
C msgBuf :: message buffer |
40 |
jmc |
1.5 |
INTEGER iUnit, i, it, iL |
41 |
|
|
LOGICAL exst |
42 |
|
|
_RL tmpVar(5) |
43 |
mlosch |
1.2 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
44 |
stephd |
1.1 |
|
45 |
jmc |
1.5 |
_BEGIN_MASTER( myThid ) |
46 |
jmc |
1.4 |
|
47 |
jmc |
1.5 |
C read in CFC atmospheric timeseries data |
48 |
|
|
iL = ILNBLNK(atmCFC_inpFile) |
49 |
|
|
IF ( iL.EQ.0 ) THEN |
50 |
|
|
WRITE(msgBuf,'(A)') |
51 |
|
|
& 'CFC_ATMOS: File-name missing for atmos CFC time-series' |
52 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
53 |
|
|
STOP 'ABNORMAL END: S/R CFC_ATMOS' |
54 |
|
|
ENDIF |
55 |
|
|
INQUIRE( FILE=atmCFC_inpFile(1:iL), EXIST=exst ) |
56 |
|
|
IF (exst) THEN |
57 |
|
|
WRITE(msgBuf,'(3A)') |
58 |
|
|
& 'CFC_ATMOS: opening file "', atmCFC_inpFile(1:iL), '"' |
59 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
60 |
|
|
& SQUEEZE_RIGHT, myThid ) |
61 |
|
|
ELSE |
62 |
|
|
WRITE(msgBuf,'(3A)') |
63 |
|
|
& 'CFC_ATMOS: File "', atmCFC_inpFile(1:iL),'" does not exist!' |
64 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
65 |
|
|
STOP 'ABNORMAL END: S/R CFC_ATMOS' |
66 |
|
|
ENDIF |
67 |
jmc |
1.4 |
|
68 |
|
|
C assign a free unit number as the I/O channel for this subroutine |
69 |
jmc |
1.5 |
CALL MDSFINDUNIT( iUnit, myThid ) |
70 |
|
|
OPEN(iUnit,FILE=atmCFC_inpFile(1:iL),STATUS='old') |
71 |
stephd |
1.1 |
C skip 6 descriptor lines |
72 |
|
|
DO i =1,6 |
73 |
jmc |
1.5 |
READ(iUnit,*) |
74 |
stephd |
1.1 |
ENDDO |
75 |
|
|
C Read in CFC11 and CFC12, N and S Hemisphere time histories |
76 |
jmc |
1.5 |
it = 0 |
77 |
|
|
DO WHILE ( it.LE.ACFCrecSize ) |
78 |
|
|
READ(iUnit,*,END=1001) (tmpVar(i),i=1,5) |
79 |
|
|
it = it + 1 |
80 |
|
|
IF ( it .LE. ACFCrecSize ) THEN |
81 |
|
|
ACFCyear(it) = tmpVar(1) |
82 |
|
|
ACFC11(it,1) = tmpVar(2) |
83 |
|
|
ACFC12(it,1) = tmpVar(3) |
84 |
|
|
ACFC11(it,2) = tmpVar(4) |
85 |
|
|
ACFC12(it,2) = tmpVar(5) |
86 |
|
|
ENDIF |
87 |
|
|
ENDDO |
88 |
|
|
IF ( it.GT.ACFCrecSize ) THEN |
89 |
|
|
CLOSE(iUnit) |
90 |
|
|
WRITE(msgBuf,'(3A)') |
91 |
|
|
& 'CFC_ATMOS: length of file "',atmCFC_inpFile(1:iL),'"' |
92 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
93 |
|
|
WRITE(msgBuf,'(2A,I9)') 'CFC_ATMOS: exceeds max num', |
94 |
|
|
& ' of records: ACFCrecSize=', ACFCrecSize |
95 |
|
|
CALL PRINT_ERROR( msgBuf, myThid ) |
96 |
|
|
STOP 'ABNORMAL END: S/R CFC_ATMOS' |
97 |
|
|
ENDIF |
98 |
|
|
1001 CONTINUE |
99 |
|
|
CLOSE(iUnit) |
100 |
|
|
ACFCnRec = it |
101 |
stephd |
1.1 |
|
102 |
jmc |
1.5 |
C-- Print values to check: |
103 |
|
|
WRITE(msgBuf,'(A,I8,A)') |
104 |
|
|
& 'CFC_ATMOS: read', ACFCnRec, ' (=ACFCnRec) time records :' |
105 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
106 |
|
|
& SQUEEZE_RIGHT, myThid ) |
107 |
|
|
WRITE(msgBuf,'(A)') |
108 |
|
|
& ' year , cfc11_N, cfc12_N, cfc11_S, cfc12_S' |
109 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
110 |
|
|
& SQUEEZE_RIGHT, myThid ) |
111 |
|
|
DO it = 1,ACFCnRec |
112 |
|
|
WRITE(msgBuf,'(F7.1,4F9.2)') |
113 |
|
|
& ACFCyear(it), ACFC11(it,1),ACFC12(it,1), |
114 |
|
|
& ACFC11(it,2),ACFC12(it,2) |
115 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
116 |
|
|
& SQUEEZE_RIGHT, myThid ) |
117 |
stephd |
1.1 |
ENDDO |
118 |
jmc |
1.5 |
|
119 |
|
|
WRITE(msgBuf,'(A)') |
120 |
|
|
& 'CFC_ATMOS: Setting atmos CFC time series: done' |
121 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
122 |
|
|
& SQUEEZE_RIGHT, myThid ) |
123 |
jmc |
1.4 |
|
124 |
stephd |
1.1 |
_END_MASTER(myThid) |
125 |
|
|
|
126 |
jmc |
1.4 |
C-- Everyone else must wait for the parameters to be loaded |
127 |
|
|
_BARRIER |
128 |
stephd |
1.1 |
|
129 |
jmc |
1.4 |
#endif /* ALLOW_CFC */ |
130 |
stephd |
1.1 |
|
131 |
|
|
RETURN |
132 |
|
|
END |