1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_set_climtemp.F,v 1.8 2004/03/17 23:08:09 dimitri Exp $ |
2 |
|
3 |
#include "EXF_OPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine exf_set_climtemp( |
7 |
O mycurrenttime |
8 |
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 |
c changed: heimbach@mit.edu 08-Feb-2002 |
25 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
26 |
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 |
#include "exf_clim_fields.h" |
41 |
|
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 |
integer year0, year1 |
59 |
|
60 |
c == end of interface == |
61 |
|
62 |
if ( climtempfile .NE. ' ' ) then |
63 |
|
64 |
if ( climtempperiod .EQ. 0 ) then |
65 |
|
66 |
c record numbers are assumed 1 to 12 corresponding to |
67 |
c Jan. through Dec. |
68 |
call cal_GetMonthsRec( |
69 |
O fac, first, changed, |
70 |
O count0, count1, |
71 |
I mycurrenttime, mycurrentiter, mythid |
72 |
& ) |
73 |
|
74 |
else |
75 |
|
76 |
c get record numbers and interpolation factor for climtemp |
77 |
call exf_GetFFieldRec( |
78 |
I climtempstartdate, climtempperiod |
79 |
I , climtempstartdate1, climtempstartdate2 |
80 |
I , .false. |
81 |
O , fac, first, changed |
82 |
O , count0, count1, year0, year1 |
83 |
I , mycurrenttime, mycurrentiter, mythid |
84 |
& ) |
85 |
|
86 |
endif |
87 |
|
88 |
if ( first ) then |
89 |
call mdsreadfield( climtempfile, exf_clim_iprec |
90 |
& , exf_clim_yftype, nr |
91 |
& , climtemp1, count0, mythid |
92 |
& ) |
93 |
if (exf_clim_yftype .eq. 'RL') then |
94 |
call exf_filter_rl( climtemp1, climtempmask, mythid ) |
95 |
else |
96 |
call exf_filter_rs( climtemp1, climtempmask, mythid ) |
97 |
end if |
98 |
endif |
99 |
|
100 |
if (( first ) .or. ( changed )) then |
101 |
call exf_SwapFFields_3d( climtemp0, climtemp1, mythid ) |
102 |
|
103 |
call mdsreadfield( climtempfile, exf_clim_iprec |
104 |
& , exf_clim_yftype, nr |
105 |
& , climtemp1, count1, mythid |
106 |
& ) |
107 |
if (exf_clim_yftype .eq. 'RL') then |
108 |
call exf_filter_rl( climtemp1, climtempmask, mythid ) |
109 |
else |
110 |
call exf_filter_rs( climtemp1, climtempmask, mythid ) |
111 |
end if |
112 |
endif |
113 |
|
114 |
c Loop over tiles. |
115 |
do bj = mybylo(mythid),mybyhi(mythid) |
116 |
do bi = mybxlo(mythid),mybxhi(mythid) |
117 |
do k = 1,nr |
118 |
do j = 1,sny |
119 |
do i = 1,snx |
120 |
|
121 |
c Set to freezing temperature if less |
122 |
if (climtemp0(i,j,k,bi,bj) .lt. climtempfreeze) |
123 |
& climtemp0(i,j,k,bi,bj) = climtempfreeze |
124 |
if (climtemp1(i,j,k,bi,bj) .lt. climtempfreeze) |
125 |
& climtemp1(i,j,k,bi,bj) = climtempfreeze |
126 |
|
127 |
c Interpolate linearly onto the current time. |
128 |
climtemp(i,j,k,bi,bj) = |
129 |
& fac * climtemp0(i,j,k,bi,bj) + |
130 |
& (exf_one - fac) * climtemp1(i,j,k,bi,bj) |
131 |
|
132 |
enddo |
133 |
enddo |
134 |
enddo |
135 |
enddo |
136 |
enddo |
137 |
|
138 |
endif |
139 |
|
140 |
#endif /* ALLOW_CLIMTEMP_RELAXATION */ |
141 |
|
142 |
end |
143 |
|
144 |
|
145 |
subroutine exf_init_climtemp( |
146 |
I mythid |
147 |
& ) |
148 |
|
149 |
c ================================================================== |
150 |
c SUBROUTINE exf_init_climtemp |
151 |
c ================================================================== |
152 |
c |
153 |
c o |
154 |
c |
155 |
c started: Ralf.Giering@FastOpt.de 25-Mai-2000 |
156 |
c |
157 |
c ================================================================== |
158 |
c SUBROUTINE exf_init_climtemp |
159 |
c ================================================================== |
160 |
|
161 |
implicit none |
162 |
|
163 |
c == global variables == |
164 |
|
165 |
#include "EEPARAMS.h" |
166 |
#include "SIZE.h" |
167 |
|
168 |
#include "exf_fields.h" |
169 |
#include "exf_param.h" |
170 |
#include "exf_clim_fields.h" |
171 |
|
172 |
c == routine arguments == |
173 |
|
174 |
integer mythid |
175 |
|
176 |
#ifdef ALLOW_CLIMTEMP_RELAXATION |
177 |
|
178 |
c == local variables == |
179 |
|
180 |
integer bi, bj |
181 |
integer i, j, k |
182 |
|
183 |
c == end of interface == |
184 |
|
185 |
do bj = mybylo(mythid), mybyhi(mythid) |
186 |
do bi = mybxlo(mythid), mybxhi(mythid) |
187 |
do k=1,nr |
188 |
do j = 1, sny |
189 |
do i = 1, snx |
190 |
climtemp (i,j,k,bi,bj) = 0. _d 0 |
191 |
climtemp0(i,j,k,bi,bj) = 0. _d 0 |
192 |
climtemp1(i,j,k,bi,bj) = 0. _d 0 |
193 |
enddo |
194 |
enddo |
195 |
enddo |
196 |
enddo |
197 |
enddo |
198 |
|
199 |
#endif /* ALLOW_CLIMTEMP_RELAXATION */ |
200 |
|
201 |
end |