1 |
C $Header: $ |
2 |
|
3 |
#include "GMREDI_OPTIONS.h" |
4 |
|
5 |
SUBROUTINE GMREDI_INIT( myThid ) |
6 |
C /==========================================================\ |
7 |
C | SUBROUTINE GMREDI_INIT | |
8 |
C | o Routine to initialize GM/Redi variables and constants. | |
9 |
C |==========================================================| |
10 |
C | Initialize GM/Redi parameters, read in data.gmredi | |
11 |
C \==========================================================/ |
12 |
IMPLICIT NONE |
13 |
|
14 |
C === Global variables === |
15 |
#include "SIZE.h" |
16 |
#include "EEPARAMS.h" |
17 |
#include "PARAMS.h" |
18 |
#include "GRID.h" |
19 |
#include "GMREDI.h" |
20 |
#include "GMREDI_DIAGS.h" |
21 |
|
22 |
C === Routine arguments === |
23 |
C myThid - Number of this instance of KPP_INIT |
24 |
INTEGER myThid |
25 |
|
26 |
#ifdef ALLOW_GMREDI |
27 |
|
28 |
C-- GM/Redi parameter |
29 |
NAMELIST /GM_PARM01/ |
30 |
& GM_background_K, |
31 |
& GM_taper_scheme, |
32 |
& GM_maxSlope, |
33 |
& GM_Visbeck_alpha, |
34 |
& GM_Visbeck_length, |
35 |
& GM_Visbeck_depth, |
36 |
& GM_Visbeck_maxval_K, |
37 |
& GM_Scrit, |
38 |
& GM_Sd |
39 |
|
40 |
C === Local variables === |
41 |
C msgBuf - Informational/error meesage buffer |
42 |
C iUnit - Work variable for IO unit number |
43 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
44 |
INTEGER iUnit |
45 |
INTEGER k,bi,bj |
46 |
|
47 |
_BEGIN_MASTER(myThid) |
48 |
|
49 |
WRITE(msgBuf,'(A)') ' GM_INIT: opening data.gmredi' |
50 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
51 |
& SQUEEZE_RIGHT , 1) |
52 |
|
53 |
|
54 |
CALL OPEN_COPY_DATA_FILE( |
55 |
I 'data.gmredi', 'GM_INIT', |
56 |
O iUnit, |
57 |
I myThid ) |
58 |
|
59 |
C-- Default values GM/Redi |
60 |
GM_background_K = 0. |
61 |
GM_maxslope = 1.0D-2 |
62 |
GM_taper_scheme = ' ' |
63 |
GM_Scrit=0.004 |
64 |
GM_Sd=0.001 |
65 |
|
66 |
#ifdef GM_VISBECK_VARIABLE_K |
67 |
C-- Default values Visbeck |
68 |
GM_Visbeck_alpha = 0. |
69 |
GM_Visbeck_length = 200.D3 |
70 |
GM_Visbeck_depth = 1000.D0 |
71 |
GM_Visbeck_maxval_K = 2500.D0 |
72 |
#endif |
73 |
|
74 |
|
75 |
C-- Read parameters from open data file |
76 |
READ(UNIT=iUnit,NML=GM_PARM01) |
77 |
|
78 |
C Some constants |
79 |
GM_rMaxSlope=0. |
80 |
if (GM_maxSlope.ne.0.) GM_rMaxSlope=1. / GM_maxSlope |
81 |
|
82 |
#ifndef GM_VISBECK_VARIABLE_K |
83 |
C Make sure we are not trying to use something that is unavailable |
84 |
IF (GM_Visbeck_alpha .NE. 0.) THEN |
85 |
WRITE(msgBuf,'(A)') |
86 |
& ' GM_INIT: Visbeck variables used in data.gmredi' |
87 |
CALL PRINT_ERROR( msgBuf, 1 ) |
88 |
WRITE(msgBuf,'(A)') |
89 |
& ' GM_INIT: without #define GM_VISBECK_VARIABLE_K' |
90 |
CALL PRINT_ERROR( msgBuf, 1 ) |
91 |
STOP 'ABNORMAL END: S/R GM_INIT' |
92 |
ENDIF |
93 |
#endif |
94 |
|
95 |
WRITE(msgBuf,'(A)') ' GM_INIT: finished reading data.gmredi' |
96 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
97 |
& SQUEEZE_RIGHT , 1) |
98 |
|
99 |
C-- Close the open data file |
100 |
CLOSE(iUnit) |
101 |
_END_MASTER(myThid) |
102 |
|
103 |
C-- Everyone else must wait for the parameters to be loaded |
104 |
_BARRIER |
105 |
|
106 |
|
107 |
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
108 |
C Initialize averages to zero |
109 |
DO bj = myByLo(myThid), myByHi(myThid) |
110 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
111 |
DO k=1,Nr |
112 |
CALL TIMEAVER_INI_XYZ(GM_Kwx_T,bi,bj,K,myThid) |
113 |
CALL TIMEAVER_INI_XYZ(GM_Kwy_T,bi,bj,K,myThid) |
114 |
CALL TIMEAVER_INI_XYZ(GM_Kwz_T,bi,bj,K,myThid) |
115 |
GM_TimeAve(k,bi,bj)=0. |
116 |
ENDDO |
117 |
#ifdef GM_VISBECK_VARIABLE_K |
118 |
CALL TIMEAVER_INI_XY(Visbeck_K_T, bi,bj,myThid) |
119 |
#endif |
120 |
ENDDO |
121 |
ENDDO |
122 |
#endif /* INCLUDE_DIAGNOSTICS_INTERFACE_CODE */ |
123 |
|
124 |
#endif /* ALLOW_GMREDI */ |
125 |
|
126 |
return |
127 |
end |