1 |
C $Header: /u/gcmpack/MITgcm/pkg/gmredi/gmredi_readparms.F,v 1.11 2005/07/29 18:24:35 edhill Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GMREDI_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE GMREDI_READPARMS( myThid ) |
7 |
C /==========================================================\ |
8 |
C | SUBROUTINE GMREDI_READPARMS | |
9 |
C | o Routine to initialize GM/Redi variables and constants. | |
10 |
C |==========================================================| |
11 |
C | Initialize GM/Redi parameters, read in data.gmredi | |
12 |
C \==========================================================/ |
13 |
IMPLICIT NONE |
14 |
|
15 |
C === Global variables === |
16 |
#include "SIZE.h" |
17 |
#include "EEPARAMS.h" |
18 |
#include "PARAMS.h" |
19 |
#include "GRID.h" |
20 |
#include "GMREDI.h" |
21 |
|
22 |
C === Routine arguments === |
23 |
INTEGER myThid |
24 |
|
25 |
#ifdef ALLOW_GMREDI |
26 |
|
27 |
C-- GM/Redi parameter |
28 |
C GM_Small_Number :: epsilon used in computing the slope |
29 |
C GM_slopeSqCutoff :: slope^2 cut-off value |
30 |
NAMELIST /GM_PARM01/ |
31 |
& GM_AdvForm, GM_AdvSeparate, |
32 |
& GM_isopycK, |
33 |
& GM_background_K, |
34 |
& GM_taper_scheme, |
35 |
& GM_maxSlope, |
36 |
& GM_Kmin_horiz, |
37 |
& GM_Small_Number, GM_slopeSqCutoff, |
38 |
& GM_Visbeck_alpha, |
39 |
& GM_Visbeck_length, |
40 |
& GM_Visbeck_depth, |
41 |
& GM_Visbeck_maxval_K, |
42 |
& GM_Scrit, |
43 |
& GM_Sd, |
44 |
& GM_MNC |
45 |
c & GM_dumpFreq, |
46 |
c & GM_taveFreq |
47 |
|
48 |
C === Local variables === |
49 |
C msgBuf - Informational/error meesage buffer |
50 |
C iUnit - Work variable for IO unit number |
51 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
52 |
INTEGER iUnit |
53 |
|
54 |
C-- GMREDI_READPARMS has been called so we know that |
55 |
C the package is active. |
56 |
GMRediIsOn = .TRUE. |
57 |
|
58 |
_BEGIN_MASTER(myThid) |
59 |
|
60 |
C-- Default values GM/Redi |
61 |
GM_AdvForm = .FALSE. |
62 |
GM_AdvSeparate = .FALSE. |
63 |
GM_isopycK = -999. |
64 |
GM_background_K = 0. |
65 |
GM_maxslope = 1.0D-2 |
66 |
GM_Kmin_horiz = 0. |
67 |
GM_Small_Number = 1. _d -12 |
68 |
GM_slopeSqCutoff = 1. _d +48 |
69 |
GM_taper_scheme = ' ' |
70 |
GM_Scrit = 0.004 |
71 |
GM_Sd = 0.001 |
72 |
GM_MNC = useMNC |
73 |
|
74 |
C-- Default values GM/Redi I/O control |
75 |
c GM_dumpFreq = -1. |
76 |
c GM_taveFreq = -1. |
77 |
|
78 |
C-- Default values Visbeck |
79 |
GM_Visbeck_alpha = 0. |
80 |
GM_Visbeck_length = 200.D3 |
81 |
GM_Visbeck_depth = 1000.D0 |
82 |
GM_Visbeck_maxval_K = 2500.D0 |
83 |
|
84 |
WRITE(msgBuf,'(A)') ' GM_READPARMS: opening data.gmredi' |
85 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
86 |
& SQUEEZE_RIGHT , 1) |
87 |
CALL OPEN_COPY_DATA_FILE( |
88 |
I 'data.gmredi', 'GM_READPARMS', |
89 |
O iUnit, |
90 |
I myThid ) |
91 |
|
92 |
C Read parameters from open data file |
93 |
READ(UNIT=iUnit,NML=GM_PARM01) |
94 |
WRITE(msgBuf,'(A)') ' GM_READPARMS: finished reading data.gmredi' |
95 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
96 |
& SQUEEZE_RIGHT , 1) |
97 |
C Close the open data file |
98 |
CLOSE(iUnit) |
99 |
|
100 |
C Default value for GM_isopycK is equal to GM_background_K : |
101 |
IF (GM_isopycK.EQ.-999.) GM_isopycK = GM_background_K |
102 |
|
103 |
C Some constants |
104 |
GM_rMaxSlope=0. |
105 |
if (GM_maxSlope.ne.0.) GM_rMaxSlope=1. / GM_maxSlope |
106 |
|
107 |
IF (GM_AdvForm) THEN |
108 |
GM_skewflx = 0. |
109 |
GM_advect = 1. |
110 |
GM_ExtraDiag = GM_Visbeck_alpha.NE.0. .OR. GM_isopycK.NE.0. |
111 |
ELSE |
112 |
GM_skewflx = 1. |
113 |
GM_advect = 0. |
114 |
GM_ExtraDiag = GM_isopycK.NE.GM_background_K |
115 |
ENDIF |
116 |
|
117 |
C Make sure that we locally honor the global MNC on/off flag |
118 |
GM_MNC = GM_MNC .AND. useMNC |
119 |
#ifndef ALLOW_MNC |
120 |
C Fix to avoid running without getting any output: |
121 |
GM_MNC = .FALSE. |
122 |
#endif |
123 |
GM_MDSIO = (.NOT. GM_MNC) .OR. outputTypesInclusive |
124 |
|
125 |
_END_MASTER(myThid) |
126 |
|
127 |
C-- Everyone else must wait for the parameters to be loaded |
128 |
_BARRIER |
129 |
|
130 |
#ifdef ALLOW_MNC |
131 |
IF (useMNC) THEN |
132 |
CALL GMREDI_MNC_INIT( myThid ) |
133 |
ENDIF |
134 |
#endif /* ALLOW_MNC */ |
135 |
|
136 |
#endif /* ALLOW_GMREDI */ |
137 |
|
138 |
RETURN |
139 |
END |