1 |
C $Header: /u/gcmpack/MITgcm/pkg/offline/offline_readparms.F,v 1.10 2013/07/07 22:25:13 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "OFFLINE_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE OFFLINE_READPARMS( myThid ) |
7 |
C *==========================================================* |
8 |
C | SUBROUTINE OFFLINE_READPARMS |
9 |
C | o Routine to initialize OFFLINE variables and constants. |
10 |
C *==========================================================* |
11 |
C | Initialize OFFLINE parameters, read in data.off |
12 |
C *==========================================================* |
13 |
IMPLICIT NONE |
14 |
|
15 |
C === Global variables === |
16 |
#include "SIZE.h" |
17 |
#include "EEPARAMS.h" |
18 |
#include "PARAMS.h" |
19 |
#include "OFFLINE.h" |
20 |
#include "OFFLINE_SWITCH.h" |
21 |
|
22 |
C === Routine arguments === |
23 |
INTEGER myThid |
24 |
|
25 |
C === Local variables === |
26 |
C msgBuf :: Informational/error message buffer |
27 |
C iUnit :: Work variable for IO unit number |
28 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
29 |
INTEGER iUnit |
30 |
C Retired main data.offline file parameters |
31 |
CHARACTER*(MAX_LEN_FNAM) KPP_ghatFile |
32 |
|
33 |
C-- Bulk Formula parameter |
34 |
NAMELIST /OFFLINE_PARM01/ |
35 |
& UvelFile, VvelFile, WvelFile, ThetFile, SaltFile, |
36 |
& GMwxFile, GMwyFile, GMwzFile, |
37 |
& ConvFile, KPP_DiffSFile, KPP_ghatKFile, |
38 |
& HFluxFile, SFluxFile, IceFile, |
39 |
& KPP_ghatFile |
40 |
|
41 |
NAMELIST /OFFLINE_PARM02/ |
42 |
& offlineIter0, offlineOffsetIter, |
43 |
& deltaToffline, offlineForcingPeriod, |
44 |
& offlineForcingCycle, offlineLoadPrec |
45 |
|
46 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
47 |
|
48 |
IF ( .NOT.useOffLine ) THEN |
49 |
C- pkg OFFLINE is not used |
50 |
_BEGIN_MASTER(myThid) |
51 |
C- Track pkg activation status: |
52 |
C print a (weak) warning if data.off is found |
53 |
CALL PACKAGES_UNUSED_MSG( 'useOffLine', ' ', 'off' ) |
54 |
_END_MASTER(myThid) |
55 |
RETURN |
56 |
ENDIF |
57 |
|
58 |
_BEGIN_MASTER(myThid) |
59 |
|
60 |
WRITE(msgBuf,'(A)') ' OFFLINE_READPARMS: opening data.off' |
61 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
62 |
& SQUEEZE_RIGHT, myThid ) |
63 |
|
64 |
CALL OPEN_COPY_DATA_FILE( |
65 |
I 'data.off', 'OFFLINE_READPARMS', |
66 |
O iUnit, |
67 |
I myThid ) |
68 |
|
69 |
C-- Default values for params in OFFLINE_PARM01 : |
70 |
UvelFile = ' ' |
71 |
VvelFile = ' ' |
72 |
WvelFile = ' ' |
73 |
ThetFile = ' ' |
74 |
SaltFile = ' ' |
75 |
GMwxFile = ' ' |
76 |
GMwyFile = ' ' |
77 |
GMwzFile = ' ' |
78 |
ConvFile = ' ' |
79 |
KPP_DiffSFile= ' ' |
80 |
KPP_ghatKFile= ' ' |
81 |
KPP_ghatFile = 'KPP_ghatFile has been replaced by KPP_ghatKFile' |
82 |
HFluxFile= ' ' |
83 |
SFluxFile= ' ' |
84 |
IceFile = ' ' |
85 |
|
86 |
C-- Read parameters from open data file |
87 |
READ(UNIT=iUnit,NML=OFFLINE_PARM01) |
88 |
|
89 |
IF ( KPP_ghatFile .NE. |
90 |
& 'KPP_ghatFile has been replaced by KPP_ghatKFile' ) THEN |
91 |
c nRetired = nRetired+1 |
92 |
WRITE(msgBuf,'(A,A)') 'S/R OFFLINE_READPARMS: "KPP_ghatFile"', |
93 |
& ' is no longer allowed in file "data.off"' |
94 |
CALL PRINT_ERROR( msgBuf, myThid ) |
95 |
WRITE(msgBuf,'(A,A)') 'S/R OFFLINE_READPARMS: read instead ', |
96 |
& 'the product ghat*diffKz from file "KPP_ghatKFile"' |
97 |
CALL PRINT_ERROR( msgBuf, myThid ) |
98 |
STOP 'ABNORMAL END: S/R OFFLINE_READPARMS' |
99 |
ENDIF |
100 |
|
101 |
C-- Default values for params in OFFLINE_PARM02 : |
102 |
deltaToffline=deltaTclock |
103 |
offlineIter0=nIter0 !initial offline field timestep |
104 |
offlineOffsetIter=0 !offset |
105 |
offlineForcingPeriod=2592000. |
106 |
offlineForcingCycle=31104000. |
107 |
offlineLoadPrec=readBinaryPrec |
108 |
|
109 |
C-- Read parameters from open data file |
110 |
READ(UNIT=iUnit,NML=OFFLINE_PARM02) |
111 |
|
112 |
WRITE(msgBuf,'(A)') |
113 |
& ' OFFLINE_READPARMS: finished reading data.off' |
114 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
115 |
& SQUEEZE_RIGHT, myThid ) |
116 |
|
117 |
C-- Close the open data file |
118 |
CLOSE(iUnit) |
119 |
|
120 |
C-- derive other parameters: |
121 |
offlineLoadGMRedi = ( GMwxFile .NE. ' ' ) |
122 |
& .OR.( GMwyFile .NE. ' ' ) |
123 |
& .OR.( GMwzFile .NE. ' ' ) |
124 |
offlineLoadKPP = ( KPP_DiffSFile .NE. ' ' ) |
125 |
& .OR.( KPP_ghatKFile .NE. ' ' ) |
126 |
offlineLoadConvec = ( ConvFile .NE. ' ' ) |
127 |
|
128 |
_END_MASTER(myThid) |
129 |
|
130 |
C-- Everyone else must wait for the parameters to be loaded |
131 |
_BARRIER |
132 |
|
133 |
RETURN |
134 |
END |