/[MITgcm]/MITgcm/pkg/cfc/cfc_atmos.F
ViewVC logotype

Contents of /MITgcm/pkg/cfc/cfc_atmos.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download)
Mon Jun 10 02:51:47 2013 UTC (10 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.4: +90 -45 lines
- more flexible reading of Atmos CFC (number of records no longer hard-coded)
- move in separated header file (CFC_ATMOS.h) time-serie arrays of Atmos CFC

1 C $Header: /u/gcmpack/MITgcm/pkg/cfc/cfc_atmos.F,v 1.4 2006/08/02 22:51:24 jmc Exp $
2 C $Name: $
3
4 #include "GCHEM_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: CFC_ATMOS
8 C !INTERFACE:
9 SUBROUTINE CFC_ATMOS( myThid )
10
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE CFC_ATMOS
14 C | o read in time-series of atmoshperic CFC
15 C *==========================================================*
16
17 C !USES:
18 IMPLICIT NONE
19
20 C === Global variables ===
21 #include "SIZE.h"
22 #include "EEPARAMS.h"
23 #include "PARAMS.h"
24 #include "CFC.h"
25 #include "CFC_ATMOS.h"
26
27 C !INPUT/OUTPUT PARAMETERS:
28 C === Routine arguments ===
29 C myThid :: My Thread Id. number
30 INTEGER myThid
31 CEOP
32
33 #ifdef ALLOW_CFC
34 C !FUNCTIONS:
35 INTEGER ILNBLNK
36 EXTERNAL ILNBLNK
37
38 C !LOCAL VARIABLES:
39 C msgBuf :: message buffer
40 INTEGER iUnit, i, it, iL
41 LOGICAL exst
42 _RL tmpVar(5)
43 CHARACTER*(MAX_LEN_MBUF) msgBuf
44
45 _BEGIN_MASTER( myThid )
46
47 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
68 C assign a free unit number as the I/O channel for this subroutine
69 CALL MDSFINDUNIT( iUnit, myThid )
70 OPEN(iUnit,FILE=atmCFC_inpFile(1:iL),STATUS='old')
71 C skip 6 descriptor lines
72 DO i =1,6
73 READ(iUnit,*)
74 ENDDO
75 C Read in CFC11 and CFC12, N and S Hemisphere time histories
76 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
102 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 ENDDO
118
119 WRITE(msgBuf,'(A)')
120 & 'CFC_ATMOS: Setting atmos CFC time series: done'
121 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
122 & SQUEEZE_RIGHT, myThid )
123
124 _END_MASTER(myThid)
125
126 C-- Everyone else must wait for the parameters to be loaded
127 _BARRIER
128
129 #endif /* ALLOW_CFC */
130
131 RETURN
132 END

  ViewVC Help
Powered by ViewVC 1.1.22