1 |
cnh |
1.3 |
C $Header: /u/gcmpack/models/MITgcmUV/verification/aim.5l_Equatorial_Channel/code/ini_depths.F,v 1.2 2001/02/02 21:36:31 adcroft Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CStartOfInterface |
7 |
|
|
SUBROUTINE INI_DEPTHS( myThid ) |
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | SUBROUTINE INI_DEPTHS | |
10 |
|
|
C | o Initialise map of model depths | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C | The depths of the bottom of the model is specified in | |
13 |
|
|
C | terms of an XY map with one depth for each column of | |
14 |
|
|
C | grid cells. Depths do not have to coincide with the | |
15 |
|
|
C | model levels. The model lopping algorithm makes it | |
16 |
|
|
C | possible to represent arbitrary depths. | |
17 |
|
|
C | The mode depths map also influences the models topology | |
18 |
|
|
C | By default the model domain wraps around in X and Y. | |
19 |
|
|
C | This default doubly periodic topology is "supressed" | |
20 |
|
|
C | if a depth map is defined which closes off all wrap | |
21 |
|
|
C | around flow. | |
22 |
|
|
C \==========================================================/ |
23 |
|
|
IMPLICIT NONE |
24 |
|
|
|
25 |
|
|
C === Global variables === |
26 |
|
|
#include "SIZE.h" |
27 |
|
|
#include "EEPARAMS.h" |
28 |
|
|
#include "PARAMS.h" |
29 |
|
|
#include "GRID.h" |
30 |
|
|
|
31 |
|
|
C == Routine arguments == |
32 |
|
|
C myThid - Number of this instance of INI_DEPTHS |
33 |
|
|
INTEGER myThid |
34 |
|
|
CEndOfInterface |
35 |
|
|
|
36 |
|
|
C == Local variables == |
37 |
|
|
C iG, jG - Global coordinate index |
38 |
|
|
C bi,bj - Loop counters |
39 |
|
|
C I,J,K |
40 |
|
|
C Hdefault - default r-coordinate of the lower boundary (=ground) |
41 |
|
|
C (=minus(Total_depth) in the ocean model) |
42 |
|
|
C (=Total Pressure at Sea Level in the atmos model) |
43 |
|
|
C oldPrec - Temporary used in controlling binary input dataset precision |
44 |
|
|
INTEGER iG, jG |
45 |
|
|
INTEGER bi, bj |
46 |
|
|
INTEGER I, J, K |
47 |
|
|
_RL Hdefault |
48 |
|
|
|
49 |
|
|
_BARRIER |
50 |
|
|
IF ( bathyFile .EQ. ' ' ) THEN |
51 |
|
|
C Set up a flat bottom box with doubly periodic topology. |
52 |
|
|
C H is the basic variable from which other terms are derived. It |
53 |
|
|
C is the term that would be set from an external file for a |
54 |
|
|
C realistic problem. |
55 |
|
|
Hdefault = rF(1) |
56 |
|
|
IF (.NOT. groundAtK1) THEN |
57 |
|
|
DO K = 1, Nr |
58 |
|
|
Hdefault = Hdefault - rkfac*drF(K) |
59 |
|
|
ENDDO |
60 |
|
|
ENDIF |
61 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
62 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
63 |
|
|
DO j=1,sNy |
64 |
|
|
DO i=1,sNx |
65 |
|
|
iG = myXGlobalLo-1+(bi-1)*sNx+I |
66 |
|
|
jG = myYGlobalLo-1+(bj-1)*sNy+J |
67 |
|
|
C Default depth of full domain |
68 |
|
|
H(i,j,bi,bj) = Hdefault |
69 |
|
|
C Test for eastern edge |
70 |
|
|
C IF ( iG .EQ. nX ) H(i,j,bi,bj) = 0. |
71 |
|
|
C Test for northern edge |
72 |
|
|
IF ( jG .EQ. nY ) H(i,j,bi,bj) = 0. |
73 |
|
|
C H(i,j,bi,bj) = 0. |
74 |
|
|
ENDDO |
75 |
|
|
ENDDO |
76 |
|
|
ENDDO |
77 |
|
|
ENDDO |
78 |
|
|
ELSE |
79 |
|
|
_BEGIN_MASTER( myThid ) |
80 |
|
|
C Read the bathymetry using the mid-level I/O pacakage read_write_rec |
81 |
|
|
C The 0 is the "iteration" argument. The 1 is the record number. |
82 |
|
|
CALL READ_REC_XY_RS( bathyFile, H, 1, 0, myThid ) |
83 |
|
|
C Read the bathymetry using the mid-level I/O pacakage read_write_fld |
84 |
|
|
C The 0 is the "iteration" argument. The ' ' is an empty suffix |
85 |
|
|
C CALL READ_FLD_XY_RS( bathyFile, ' ', H, 0, myThid ) |
86 |
|
|
C Read the bathymetry using the low-level I/O package |
87 |
|
|
C CALL MDSREADFIELD( bathyFile, readBinaryPrec, |
88 |
|
|
C & 'RS', 1, H, 1, myThid ) |
89 |
|
|
_END_MASTER(myThid) |
90 |
|
|
ENDIF |
91 |
|
|
|
92 |
|
|
_EXCH_XY_R4( H, myThid ) |
93 |
|
|
|
94 |
|
|
IF (usingSphericalPolarGrid) THEN |
95 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
96 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
97 |
|
|
DO j=1-Oly,sNy+Oly |
98 |
|
|
DO i=1-Olx,sNx+Olx |
99 |
|
|
IF (abs(yC(I,J,bi,bj)).GE.90.) H(I,J,bi,bj)=0. |
100 |
|
|
ENDDO |
101 |
|
|
ENDDO |
102 |
|
|
ENDDO |
103 |
|
|
ENDDO |
104 |
|
|
ENDIF |
105 |
|
|
C |
106 |
|
|
CALL PLOT_FIELD_XYRS(H,'Model depths (ini_depths)',1,myThid) |
107 |
|
|
C |
108 |
|
|
RETURN |
109 |
|
|
END |