1 |
C $Header: /u/gcmpack/MITgcm/pkg/ebm/ebm_readparms.F,v 1.5 2017/08/09 15:23:38 mlosch Exp $ |
2 |
C $Name: $ |
3 |
#include "EBM_OPTIONS.h" |
4 |
|
5 |
CBOP 0 |
6 |
C !ROUTINE: EBM_READPARMS |
7 |
|
8 |
C !INTERFACE: |
9 |
SUBROUTINE EBM_READPARMS( myThid ) |
10 |
|
11 |
C !DESCRIPTION: |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE EBM_READPARMS |
14 |
C | o Routine to read in parameters from file data.ebm |
15 |
C *==========================================================* |
16 |
|
17 |
C !USES: |
18 |
IMPLICIT NONE |
19 |
C === Global variables === |
20 |
#include "SIZE.h" |
21 |
#include "EEPARAMS.h" |
22 |
#include "PARAMS.h" |
23 |
#include "GRID.h" |
24 |
#ifdef ALLOW_EBM |
25 |
#include "EBM.h" |
26 |
#endif |
27 |
|
28 |
C !INPUT PARAMETERS: |
29 |
C myThid :: my Thread Id number |
30 |
INTEGER myThid |
31 |
CEOP |
32 |
|
33 |
#ifdef ALLOW_EBM |
34 |
C !LOCAL VARIABLES: |
35 |
C msgBuf :: Informational/error message buffer |
36 |
C errIO :: IO error flag |
37 |
C iUnit :: Work variable for IO unit number |
38 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
39 |
INTEGER errIO, iUnit |
40 |
|
41 |
C-- Namelist |
42 |
NAMELIST /EBM_PARM01/ |
43 |
& tauThetaZonRelax, |
44 |
& scale_runoff, |
45 |
& RunoffFile |
46 |
|
47 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
48 |
|
49 |
IF ( .NOT.useEBM ) THEN |
50 |
C- PKG ebm is not used |
51 |
_BEGIN_MASTER(myThid) |
52 |
C- Track pkg activation status: |
53 |
C print a (weak) warning if data.ebm is found |
54 |
CALL PACKAGES_UNUSED_MSG( 'useEBM', ' ', ' ' ) |
55 |
_END_MASTER(myThid) |
56 |
RETURN |
57 |
ENDIF |
58 |
|
59 |
_BEGIN_MASTER(myThid) |
60 |
|
61 |
WRITE(msgBuf,'(A)') ' EBM_READPARMS: opening data.ebm' |
62 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
63 |
& SQUEEZE_RIGHT, myThid ) |
64 |
errIO = 0 |
65 |
CALL OPEN_COPY_DATA_FILE( |
66 |
I 'data.ebm', 'EBM_READPARMS', |
67 |
O iUnit, |
68 |
I myThid ) |
69 |
|
70 |
C-- set default |
71 |
tauThetaZonRelax = 0. |
72 |
scale_runoff = 1. |
73 |
RunoffFile = ' ' |
74 |
|
75 |
C----------------------------------------------------------------------- |
76 |
|
77 |
C-- Read settings from model parameter file "data.ebm". |
78 |
READ( UNIT=iUnit, NML=EBM_PARM01 ) |
79 |
c READ( UNIT=iUnit, NML=EBM_PARM01, IOSTAT=errIO ) |
80 |
IF ( errIO .LT. 0 ) THEN |
81 |
WRITE(msgBuf,'(A)') 'S/R EBM_READPARMS' |
82 |
CALL PRINT_ERROR( msgBuf, myThid ) |
83 |
WRITE(msgBuf,'(A)') 'Error reading numerical model ' |
84 |
CALL PRINT_ERROR( msgBuf, myThid ) |
85 |
WRITE(msgBuf,'(A)') 'parameter file "data.ebm"' |
86 |
CALL PRINT_ERROR( msgBuf, myThid ) |
87 |
WRITE(msgBuf,'(A)') 'Problem in namelist EBM_PARM01' |
88 |
CALL PRINT_ERROR( msgBuf, myThid ) |
89 |
STOP 'ABNORMAL END: S/R EBM_READPARMS' |
90 |
ENDIF |
91 |
C Close the open data file |
92 |
#ifdef SINGLE_DISK_IO |
93 |
CLOSE(iUnit) |
94 |
#else |
95 |
CLOSE(iUnit,STATUS='DELETE') |
96 |
#endif /* SINGLE_DISK_IO */ |
97 |
|
98 |
WRITE(msgBuf,'(A)') ' EBM_READPARMS: finished reading data.ebm' |
99 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
100 |
& SQUEEZE_RIGHT, myThid ) |
101 |
|
102 |
C-- Set other parameters |
103 |
IF ( tauThetaZonRelax .NE. 0. _d 0 ) THEN |
104 |
IF ( tauThetaClimRelax.NE.0. _d 0 ) THEN |
105 |
WRITE(msgBuf,'(2A)') 'EBM_READPARMS: ', |
106 |
& 'tauThetaClimRelax > 0 AND tauThetaZonRelax > 0' |
107 |
CALL PRINT_ERROR( msgBuf, myThid ) |
108 |
WRITE(msgBuf,'(2A)') 'EBM_READPARMS: ', |
109 |
& 'cannot relax Temp. to 2-d map AND ZonAver SST' |
110 |
CALL PRINT_ERROR( msgBuf, myThid ) |
111 |
STOP 'ABNORMAL END: S/R EBM_READPARMS' |
112 |
ELSE |
113 |
WRITE(msgBuf,'(2A)') ' EBM_READPARMS: ', |
114 |
& 'set tauThetaClimRelax to tauThetaZonRelax value' |
115 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
116 |
& SQUEEZE_RIGHT, myThid ) |
117 |
tauThetaClimRelax = tauThetaZonRelax |
118 |
ENDIF |
119 |
ENDIF |
120 |
C- Set latitude boundaries used in EBM |
121 |
latBnd(1) = 0. _d 0 |
122 |
latBnd(2) = 35. _d 0 |
123 |
latBnd(3) = 85. _d 0 |
124 |
|
125 |
_END_MASTER(myThid) |
126 |
|
127 |
C-- Everyone else must wait for the parameters to be loaded |
128 |
_BARRIER |
129 |
|
130 |
#endif /* ALLOW_EBM */ |
131 |
|
132 |
RETURN |
133 |
END |