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