1 |
C $Header: /u/gcmpack/MITgcm/pkg/smooth/smooth_readparms.F,v 1.7 2017/01/10 15:37:49 gforget Exp $ |
2 |
C $Name: BASE $ |
3 |
|
4 |
#include "SMOOTH_OPTIONS.h" |
5 |
|
6 |
subroutine smooth_readparms( myThid ) |
7 |
|
8 |
C *==========================================================* |
9 |
C | SUBROUTINE smooth_readparms |
10 |
C | o Routine that reads the pkg/smooth namelist from data.smooth |
11 |
C *==========================================================* |
12 |
|
13 |
implicit none |
14 |
|
15 |
c == global variables == |
16 |
|
17 |
#include "EEPARAMS.h" |
18 |
#include "SIZE.h" |
19 |
#include "GRID.h" |
20 |
#include "PARAMS.h" |
21 |
|
22 |
#include "SMOOTH.h" |
23 |
|
24 |
c == routine arguments == |
25 |
|
26 |
integer myThid |
27 |
|
28 |
c == local variables == |
29 |
C msgBuf - Informational/error message buffer |
30 |
C iUnit - Work variable for IO unit number |
31 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
32 |
INTEGER iUnit, num_file, num_var |
33 |
integer smoothOpNb |
34 |
|
35 |
c == end of interface == |
36 |
|
37 |
c-- Read the namelist input. |
38 |
namelist /smooth_nml/ |
39 |
& smooth2Dnbt, |
40 |
& smooth2Dtype, |
41 |
& smooth2Dsize, |
42 |
& smooth2D_Lx0, |
43 |
& smooth2D_Ly0, |
44 |
& smooth2Dfilter, |
45 |
& smooth3Dnbt, |
46 |
& smooth3DtypeH, |
47 |
& smooth3DsizeH, |
48 |
& smooth3DtypeZ, |
49 |
& smooth3DsizeZ, |
50 |
& smooth3D_Lx0, |
51 |
& smooth3D_Ly0, |
52 |
& smooth3D_Lz0, |
53 |
& smooth3Dfilter |
54 |
|
55 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
56 |
|
57 |
IF ( .NOT.useSMOOTH ) THEN |
58 |
C- pkg SMOOTH is not used |
59 |
_BEGIN_MASTER(myThid) |
60 |
C- Track pkg activation status: |
61 |
C print a (weak) warning if data.smooth is found |
62 |
CALL PACKAGES_UNUSED_MSG( 'useSMOOTH', ' ', ' ' ) |
63 |
_END_MASTER(myThid) |
64 |
RETURN |
65 |
ENDIF |
66 |
|
67 |
_BEGIN_MASTER( myThid ) |
68 |
|
69 |
c-- Set default values. |
70 |
DO smoothOpNb=1,smoothOpNbMax |
71 |
smooth2Dnbt(smoothOpNb)=0 |
72 |
smooth2D_Lx0(smoothOpNb)=0. _d 0 |
73 |
smooth2D_Ly0(smoothOpNb)=0. _d 0 |
74 |
smooth2Dtype(smoothOpNb)=0 |
75 |
smooth2Dsize(smoothOpNb)=0 |
76 |
smooth2Dfilter(smoothOpNb)=0 |
77 |
|
78 |
smooth3Dnbt(smoothOpNb)=0 |
79 |
smooth3D_Lx0(smoothOpNb)=0. _d 0 |
80 |
smooth3D_Ly0(smoothOpNb)=0. _d 0 |
81 |
smooth3D_Lz0(smoothOpNb)=0. _d 0 |
82 |
smooth3DtypeH(smoothOpNb)=0 |
83 |
smooth3DsizeH(smoothOpNb)=0 |
84 |
smooth3DtypeZ(smoothOpNb)=0 |
85 |
smooth3DsizeZ(smoothOpNb)=0 |
86 |
smooth3Dfilter(smoothOpNb)=0 |
87 |
ENDDO |
88 |
|
89 |
C-- Read settings from model parameter file "data.smooth". |
90 |
WRITE(msgBuf,'(A)') 'SMOOTH_READPARMS: opening data.smooth' |
91 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
92 |
& SQUEEZE_RIGHT , 1) |
93 |
|
94 |
CALL OPEN_COPY_DATA_FILE( |
95 |
I 'data.smooth', 'SMOOTH_READPARMS', |
96 |
O iUnit, |
97 |
I myThid ) |
98 |
|
99 |
READ( iUnit, nml = smooth_nml ) |
100 |
|
101 |
WRITE(msgBuf,'(2A)') 'SMOOTH_READPARMS: ', |
102 |
& 'finished reading data.smooth' |
103 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
104 |
& SQUEEZE_RIGHT , 1) |
105 |
|
106 |
#ifdef SINGLE_DISK_IO |
107 |
CLOSE(iUnit) |
108 |
#else |
109 |
CLOSE(iUnit,STATUS='DELETE') |
110 |
#endif /* SINGLE_DISK_IO */ |
111 |
|
112 |
C-- Print pkg/smooth settings to standard output: |
113 |
WRITE(msgBuf,'(A)') |
114 |
&'// =======================================================' |
115 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
116 |
& SQUEEZE_RIGHT , 1) |
117 |
WRITE(msgBuf,'(A)') '// pkg/smooth configuration' |
118 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
119 |
& SQUEEZE_RIGHT , 1) |
120 |
WRITE(msgBuf,'(A)') |
121 |
&'// =======================================================' |
122 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
123 |
& SQUEEZE_RIGHT , 1) |
124 |
|
125 |
DO smoothOpNb=1,smoothOpNbMax |
126 |
IF (smooth2Dtype(smoothOpNb).NE.0) THEN |
127 |
WRITE(msgBuf,'(A,I2,I6,2f6.0)') 'smooth 2D parameters: ', |
128 |
& smoothOpNb,smooth2Dnbt(smoothOpNb), |
129 |
& smooth2D_Lx0(smoothOpNb),smooth2D_Ly0(smoothOpNb) |
130 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
131 |
& SQUEEZE_RIGHT , 1) |
132 |
ENDIF |
133 |
ENDDO |
134 |
|
135 |
DO smoothOpNb=1,smoothOpNbMax |
136 |
IF ((smooth3DtypeZ(smoothOpNb).NE.0).OR. |
137 |
& (smooth3DtypeH(smoothOpNb).NE.0)) then |
138 |
WRITE(msgBuf,'(A,I2,I6,3f6.0)') 'smooth 3D parameters: ', |
139 |
& smoothOpNb,smooth3Dnbt(smoothOpNb), |
140 |
& smooth3D_Lx0(smoothOpNb),smooth3D_Ly0(smoothOpNb), |
141 |
& smooth3D_Lz0(smoothOpNb) |
142 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
143 |
& SQUEEZE_RIGHT , 1) |
144 |
ENDIF |
145 |
ENDDO |
146 |
|
147 |
WRITE(msgBuf,'(A)') |
148 |
&'// =======================================================' |
149 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
150 |
& SQUEEZE_RIGHT , 1) |
151 |
WRITE(msgBuf,'(A)') '// End of pkg/smooth config. summary' |
152 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
153 |
& SQUEEZE_RIGHT , 1) |
154 |
WRITE(msgBuf,'(A)') |
155 |
&'// =======================================================' |
156 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
157 |
& SQUEEZE_RIGHT , 1) |
158 |
WRITE(msgBuf,'(A)') ' ' |
159 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
160 |
& SQUEEZE_RIGHT , 1) |
161 |
|
162 |
_END_MASTER( myThid ) |
163 |
|
164 |
C-- Everyone else must wait for the parameters to be loaded |
165 |
_BARRIER |
166 |
|
167 |
RETURN |
168 |
END |