1 |
heimbach |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_readers.F,v 1.4 2006/02/15 20:01:51 heimbach Exp $ |
2 |
heimbach |
1.1 |
|
3 |
|
|
#include "COST_CPPOPTIONS.h" |
4 |
|
|
|
5 |
|
|
|
6 |
heimbach |
1.4 |
subroutine cost_readers( irec, mythid ) |
7 |
heimbach |
1.1 |
|
8 |
|
|
c ================================================================== |
9 |
heimbach |
1.4 |
c SUBROUTINE cost_readers |
10 |
heimbach |
1.1 |
c ================================================================== |
11 |
|
|
c |
12 |
|
|
c o Read a given record of the ERS SSH data. |
13 |
|
|
c |
14 |
|
|
c started: Christian Eckert eckert@mit.edu 25-May-1999 |
15 |
|
|
c |
16 |
|
|
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
17 |
|
|
c |
18 |
|
|
c - Restructured the code in order to create a package |
19 |
|
|
c for the MITgcmUV. |
20 |
|
|
c |
21 |
|
|
c ================================================================== |
22 |
heimbach |
1.4 |
c SUBROUTINE cost_readers |
23 |
heimbach |
1.1 |
c ================================================================== |
24 |
|
|
|
25 |
|
|
implicit none |
26 |
|
|
|
27 |
|
|
c == global variables == |
28 |
|
|
|
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "SIZE.h" |
31 |
|
|
#include "PARAMS.h" |
32 |
|
|
#include "GRID.h" |
33 |
|
|
|
34 |
|
|
#include "cal.h" |
35 |
|
|
#include "ecco_cost.h" |
36 |
|
|
|
37 |
|
|
c == routine arguments == |
38 |
|
|
|
39 |
|
|
integer irec |
40 |
|
|
integer mythid |
41 |
|
|
|
42 |
|
|
#ifdef ALLOW_SSH_ERSANOM_COST_CONTRIBUTION |
43 |
|
|
c == local variables == |
44 |
|
|
|
45 |
|
|
integer bi,bj |
46 |
|
|
integer i,j,k |
47 |
|
|
integer itlo,ithi |
48 |
|
|
integer jtlo,jthi |
49 |
|
|
integer jmin,jmax |
50 |
|
|
integer imin,imax |
51 |
|
|
integer sshrec |
52 |
|
|
integer difftime(4) |
53 |
|
|
integer middate(4) |
54 |
|
|
integer noffset |
55 |
|
|
_RL diffsecs |
56 |
|
|
_RL spval |
57 |
|
|
_RL factor |
58 |
|
|
|
59 |
heimbach |
1.2 |
cnew( |
60 |
|
|
integer il |
61 |
|
|
_RL daytime |
62 |
|
|
integer dayiter |
63 |
|
|
integer daydate(4) |
64 |
|
|
integer yday, ymod |
65 |
|
|
integer md, dd, sd, ld, wd |
66 |
|
|
character*(80) fnametmp |
67 |
|
|
logical exst |
68 |
|
|
cnew) |
69 |
|
|
|
70 |
|
|
c == external functions == |
71 |
|
|
|
72 |
|
|
integer ilnblnk |
73 |
|
|
external ilnblnk |
74 |
|
|
|
75 |
heimbach |
1.1 |
c == end of interface == |
76 |
|
|
|
77 |
|
|
jtlo = mybylo(mythid) |
78 |
|
|
jthi = mybyhi(mythid) |
79 |
|
|
itlo = mybxlo(mythid) |
80 |
|
|
ithi = mybxhi(mythid) |
81 |
|
|
jmin = 1 |
82 |
|
|
jmax = sny |
83 |
|
|
imin = 1 |
84 |
|
|
imax = snx |
85 |
|
|
|
86 |
|
|
factor = 0.01 |
87 |
|
|
spval = -9990. |
88 |
|
|
|
89 |
heimbach |
1.2 |
cnew( |
90 |
|
|
daytime = FLOAT(secondsperday*(irec-1)) |
91 |
|
|
dayiter = hoursperday*(irec-1) |
92 |
|
|
call cal_getdate( dayiter, daytime, daydate, mythid ) |
93 |
|
|
call cal_convdate( daydate,yday,md,dd,sd,ld,wd,mythid ) |
94 |
|
|
ymod = ersstartdate(1)/10000 |
95 |
|
|
|
96 |
|
|
if ( ymod .EQ. yday ) then |
97 |
|
|
middate(1) = modelstartdate(1) |
98 |
|
|
else |
99 |
|
|
middate(1) = yday*10000+100+1 |
100 |
|
|
endif |
101 |
|
|
middate(2) = 0 |
102 |
heimbach |
1.1 |
middate(3) = modelstartdate(3) |
103 |
|
|
middate(4) = modelstartdate(4) |
104 |
|
|
|
105 |
heimbach |
1.2 |
call cal_TimePassed( middate, daydate, difftime, mythid ) |
106 |
heimbach |
1.1 |
call cal_ToSeconds( difftime, diffsecs, mythid ) |
107 |
heimbach |
1.2 |
sshrec = int(diffsecs/ersperiod) + 1 |
108 |
heimbach |
1.1 |
|
109 |
heimbach |
1.2 |
il=ilnblnk(ersfile) |
110 |
|
|
write(fnametmp(1:80),'(2a,i4)') |
111 |
|
|
& ersfile(1:il), '_', yday |
112 |
|
|
inquire( file=fnametmp, exist=exst ) |
113 |
|
|
if (.NOT. exst) then |
114 |
|
|
write(fnametmp(1:80),'(a)') ersfile(1:il) |
115 |
|
|
sshrec = irec |
116 |
heimbach |
1.1 |
endif |
117 |
heimbach |
1.2 |
|
118 |
|
|
cnew) |
119 |
|
|
|
120 |
|
|
|
121 |
|
|
call mdsreadfield( fnametmp, cost_iprec, cost_yftype, 1, ersobs, |
122 |
|
|
& sshrec, mythid ) |
123 |
|
|
|
124 |
|
|
|
125 |
heimbach |
1.1 |
do bj = jtlo,jthi |
126 |
|
|
do bi = itlo,ithi |
127 |
|
|
k = 1 |
128 |
|
|
do j = jmin,jmax |
129 |
|
|
do i = imin,imax |
130 |
|
|
if (_hFacC(i,j,k,bi,bj) .eq. 0.) then |
131 |
|
|
ersmask(i,j,bi,bj) = 0. _d 0 |
132 |
|
|
else |
133 |
|
|
ersmask(i,j,bi,bj) = 1. _d 0 |
134 |
|
|
endif |
135 |
|
|
if (ersobs(i,j,bi,bj) .le. spval) then |
136 |
|
|
ersmask(i,j,bi,bj) = 0. _d 0 |
137 |
|
|
endif |
138 |
|
|
if (abs(ersobs(i,j,bi,bj)) .lt. 1.d-8 ) then |
139 |
|
|
ersmask(i,j,bi,bj) = 0. _d 0 |
140 |
|
|
endif |
141 |
|
|
|
142 |
|
|
cph( |
143 |
|
|
cph print *, 'WARNING: SPECIFIC SETUP FOR ECCO' |
144 |
|
|
cph below statement could be replaced by following |
145 |
|
|
cph to make it independnet of Nr: |
146 |
|
|
cph |
147 |
|
|
cph if ( rC(K) .GT. -1000. ) then |
148 |
|
|
cph) |
149 |
|
|
c set tpmask=0 in areas shallower than 1000m |
150 |
|
|
if (_hFacC(i,j,13,bi,bj) .eq. 0.) then |
151 |
|
|
ersmask(i,j,bi,bj) = 0. _d 0 |
152 |
|
|
endif |
153 |
|
|
|
154 |
|
|
ersmask(i,j,bi,bj) = ersmask(i,j,bi,bj)*frame(i,j) |
155 |
heimbach |
1.5 |
ersobs(i,j,bi,bj) = ersmask(i,j,bi,bj)*factor* |
156 |
|
|
& ( ersobs(i,j,bi,bj) - |
157 |
|
|
& ( ersintercept + ersslope*irec*hoursperday ) ) |
158 |
heimbach |
1.1 |
enddo |
159 |
|
|
enddo |
160 |
|
|
enddo |
161 |
|
|
enddo |
162 |
|
|
|
163 |
|
|
#endif |
164 |
|
|
|
165 |
|
|
return |
166 |
|
|
end |
167 |
|
|
|