1 |
heimbach |
1.10 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_set_climtemp.F,v 1.9 2004/10/11 16:41:01 heimbach Exp $ |
2 |
heimbach |
1.1 |
|
3 |
edhill |
1.7 |
#include "EXF_OPTIONS.h" |
4 |
heimbach |
1.1 |
|
5 |
|
|
|
6 |
|
|
subroutine exf_set_climtemp( |
7 |
heimbach |
1.3 |
O mycurrenttime |
8 |
heimbach |
1.1 |
I , mycurrentiter |
9 |
|
|
I , mythid |
10 |
|
|
& ) |
11 |
|
|
|
12 |
|
|
c ================================================================== |
13 |
|
|
c SUBROUTINE exf_set_climtemp |
14 |
|
|
c ================================================================== |
15 |
|
|
c |
16 |
|
|
c o Get the current climatological sea surface salinity field. |
17 |
|
|
c |
18 |
|
|
c started: Christian Eckert eckert@mit.edu 27-Aug-1999 |
19 |
|
|
c changed: Christian Eckert eckert@mit.edu 11-Jan-2000 |
20 |
|
|
c - Restructured the code in order to create a package |
21 |
|
|
c for the MITgcmUV. |
22 |
|
|
c Christian Eckert eckert@mit.edu 12-Feb-2000 |
23 |
|
|
c - Changed Routine names (package prefix: exf_) |
24 |
heimbach |
1.3 |
c changed: heimbach@mit.edu 08-Feb-2002 |
25 |
dimitri |
1.5 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
26 |
heimbach |
1.1 |
c |
27 |
|
|
c ================================================================== |
28 |
|
|
c SUBROUTINE exf_set_climtemp |
29 |
|
|
c ================================================================== |
30 |
|
|
|
31 |
|
|
implicit none |
32 |
|
|
|
33 |
|
|
#include "EEPARAMS.h" |
34 |
|
|
#include "SIZE.h" |
35 |
|
|
#include "GRID.h" |
36 |
|
|
|
37 |
|
|
#include "exf_param.h" |
38 |
|
|
#include "exf_constants.h" |
39 |
|
|
#include "exf_clim_param.h" |
40 |
heimbach |
1.3 |
#include "exf_clim_fields.h" |
41 |
heimbach |
1.1 |
|
42 |
|
|
c == routine arguments == |
43 |
|
|
|
44 |
|
|
_RL mycurrenttime |
45 |
|
|
integer mycurrentiter |
46 |
|
|
integer mythid |
47 |
|
|
|
48 |
|
|
#ifdef ALLOW_CLIMTEMP_RELAXATION |
49 |
|
|
|
50 |
|
|
c == local variables == |
51 |
|
|
|
52 |
|
|
logical first, changed |
53 |
|
|
integer count0, count1 |
54 |
|
|
_RL fac |
55 |
|
|
|
56 |
|
|
integer bi, bj |
57 |
|
|
integer i, j, k |
58 |
heimbach |
1.9 |
integer year0, year1 |
59 |
heimbach |
1.1 |
|
60 |
|
|
c == end of interface == |
61 |
|
|
|
62 |
dimitri |
1.5 |
if ( climtempfile .NE. ' ' ) then |
63 |
|
|
|
64 |
dimitri |
1.8 |
if ( climtempperiod .EQ. 0 ) then |
65 |
|
|
|
66 |
heimbach |
1.2 |
c record numbers are assumed 1 to 12 corresponding to |
67 |
|
|
c Jan. through Dec. |
68 |
dimitri |
1.8 |
call cal_GetMonthsRec( |
69 |
|
|
O fac, first, changed, |
70 |
|
|
O count0, count1, |
71 |
|
|
I mycurrenttime, mycurrentiter, mythid |
72 |
|
|
& ) |
73 |
|
|
|
74 |
|
|
else |
75 |
|
|
|
76 |
heimbach |
1.1 |
c get record numbers and interpolation factor for climtemp |
77 |
dimitri |
1.8 |
call exf_GetFFieldRec( |
78 |
|
|
I climtempstartdate, climtempperiod |
79 |
heimbach |
1.9 |
I , climtempstartdate1, climtempstartdate2 |
80 |
|
|
I , .false. |
81 |
dimitri |
1.8 |
O , fac, first, changed |
82 |
heimbach |
1.9 |
O , count0, count1, year0, year1 |
83 |
dimitri |
1.8 |
I , mycurrenttime, mycurrentiter, mythid |
84 |
|
|
& ) |
85 |
|
|
|
86 |
|
|
endif |
87 |
heimbach |
1.1 |
|
88 |
dimitri |
1.5 |
if ( first ) then |
89 |
|
|
call mdsreadfield( climtempfile, exf_clim_iprec |
90 |
|
|
& , exf_clim_yftype, nr |
91 |
|
|
& , climtemp1, count0, mythid |
92 |
|
|
& ) |
93 |
heimbach |
1.10 |
do k = 1, Nr |
94 |
|
|
if (exf_clim_yftype .eq. 'RL') then |
95 |
|
|
call exf_filter_rl( |
96 |
|
|
& climtemp1(1-Olx,1-Oly,k,1,1), |
97 |
|
|
& climtempmask, mythid ) |
98 |
|
|
else |
99 |
|
|
call exf_filter_rs( |
100 |
|
|
& climtemp1(1-Olx,1-Oly,k,1,1), |
101 |
|
|
& climtempmask, mythid ) |
102 |
|
|
end if |
103 |
|
|
enddo |
104 |
dimitri |
1.5 |
endif |
105 |
|
|
|
106 |
|
|
if (( first ) .or. ( changed )) then |
107 |
|
|
call exf_SwapFFields_3d( climtemp0, climtemp1, mythid ) |
108 |
|
|
|
109 |
|
|
call mdsreadfield( climtempfile, exf_clim_iprec |
110 |
|
|
& , exf_clim_yftype, nr |
111 |
|
|
& , climtemp1, count1, mythid |
112 |
|
|
& ) |
113 |
heimbach |
1.10 |
do k = 1, Nr |
114 |
|
|
if (exf_clim_yftype .eq. 'RL') then |
115 |
|
|
call exf_filter_rl( |
116 |
|
|
& climtemp1(1-Olx,1-Oly,k,1,1), |
117 |
|
|
& climtempmask, mythid ) |
118 |
|
|
else |
119 |
|
|
call exf_filter_rs( |
120 |
|
|
& climtemp1(1-Olx,1-Oly,k,1,1), |
121 |
|
|
& climtempmask, mythid ) |
122 |
|
|
end if |
123 |
|
|
enddo |
124 |
dimitri |
1.5 |
endif |
125 |
heimbach |
1.1 |
|
126 |
dimitri |
1.5 |
c Loop over tiles. |
127 |
|
|
do bj = mybylo(mythid),mybyhi(mythid) |
128 |
|
|
do bi = mybxlo(mythid),mybxhi(mythid) |
129 |
|
|
do k = 1,nr |
130 |
|
|
do j = 1,sny |
131 |
|
|
do i = 1,snx |
132 |
|
|
|
133 |
|
|
c Set to freezing temperature if less |
134 |
|
|
if (climtemp0(i,j,k,bi,bj) .lt. climtempfreeze) |
135 |
|
|
& climtemp0(i,j,k,bi,bj) = climtempfreeze |
136 |
|
|
if (climtemp1(i,j,k,bi,bj) .lt. climtempfreeze) |
137 |
|
|
& climtemp1(i,j,k,bi,bj) = climtempfreeze |
138 |
|
|
|
139 |
|
|
c Interpolate linearly onto the current time. |
140 |
|
|
climtemp(i,j,k,bi,bj) = |
141 |
|
|
& fac * climtemp0(i,j,k,bi,bj) + |
142 |
|
|
& (exf_one - fac) * climtemp1(i,j,k,bi,bj) |
143 |
|
|
|
144 |
|
|
enddo |
145 |
|
|
enddo |
146 |
|
|
enddo |
147 |
|
|
enddo |
148 |
|
|
enddo |
149 |
heimbach |
1.1 |
|
150 |
|
|
endif |
151 |
|
|
|
152 |
|
|
#endif /* ALLOW_CLIMTEMP_RELAXATION */ |
153 |
|
|
|
154 |
|
|
end |
155 |
|
|
|
156 |
|
|
|
157 |
|
|
subroutine exf_init_climtemp( |
158 |
|
|
I mythid |
159 |
|
|
& ) |
160 |
|
|
|
161 |
|
|
c ================================================================== |
162 |
|
|
c SUBROUTINE exf_init_climtemp |
163 |
|
|
c ================================================================== |
164 |
|
|
c |
165 |
|
|
c o |
166 |
|
|
c |
167 |
|
|
c started: Ralf.Giering@FastOpt.de 25-Mai-2000 |
168 |
|
|
c |
169 |
|
|
c ================================================================== |
170 |
|
|
c SUBROUTINE exf_init_climtemp |
171 |
|
|
c ================================================================== |
172 |
|
|
|
173 |
|
|
implicit none |
174 |
|
|
|
175 |
|
|
c == global variables == |
176 |
|
|
|
177 |
|
|
#include "EEPARAMS.h" |
178 |
|
|
#include "SIZE.h" |
179 |
heimbach |
1.10 |
#include "PARAMS.h" |
180 |
heimbach |
1.1 |
|
181 |
|
|
#include "exf_fields.h" |
182 |
|
|
#include "exf_param.h" |
183 |
|
|
#include "exf_clim_fields.h" |
184 |
|
|
|
185 |
|
|
c == routine arguments == |
186 |
|
|
|
187 |
|
|
integer mythid |
188 |
|
|
|
189 |
|
|
#ifdef ALLOW_CLIMTEMP_RELAXATION |
190 |
|
|
|
191 |
|
|
c == local variables == |
192 |
|
|
|
193 |
|
|
integer bi, bj |
194 |
|
|
integer i, j, k |
195 |
|
|
|
196 |
|
|
c == end of interface == |
197 |
|
|
|
198 |
|
|
do bj = mybylo(mythid), mybyhi(mythid) |
199 |
|
|
do bi = mybxlo(mythid), mybxhi(mythid) |
200 |
|
|
do k=1,nr |
201 |
|
|
do j = 1, sny |
202 |
|
|
do i = 1, snx |
203 |
heimbach |
1.10 |
climtemp (i,j,k,bi,bj) = tRef(k) |
204 |
heimbach |
1.1 |
climtemp0(i,j,k,bi,bj) = 0. _d 0 |
205 |
|
|
climtemp1(i,j,k,bi,bj) = 0. _d 0 |
206 |
|
|
enddo |
207 |
|
|
enddo |
208 |
|
|
enddo |
209 |
|
|
enddo |
210 |
|
|
enddo |
211 |
|
|
|
212 |
|
|
#endif /* ALLOW_CLIMTEMP_RELAXATION */ |
213 |
|
|
|
214 |
|
|
end |