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