1 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_set_climsalt.F,v 1.1.6.4 2003/02/13 19:28:38 dimitri Exp $ |
2 |
|
3 |
#include "EXF_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine exf_set_climsalt( |
7 |
O mycurrenttime |
8 |
I , mycurrentiter |
9 |
I , mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE exf_set_climsalt |
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_climsalt |
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_CLIMSALT_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 ( climsaltfile .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 climsalt |
73 |
call exf_GetFFieldRec( |
74 |
I climsaltstartdate, climsaltperiod |
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( climsaltfile, exf_clim_iprec |
83 |
& , exf_clim_yftype, nr |
84 |
& , climsalt1, count0, mythid |
85 |
& ) |
86 |
if (exf_clim_yftype .eq. 'RL') then |
87 |
call exf_filter_rl( climsalt1, climsaltmask, mythid ) |
88 |
else |
89 |
call exf_filter_rs( climsalt1, climsaltmask, mythid ) |
90 |
end if |
91 |
endif |
92 |
|
93 |
if (( first ) .or. ( changed )) then |
94 |
call exf_SwapFFields_3d( climsalt0, climsalt1, mythid ) |
95 |
|
96 |
call mdsreadfield( climsaltfile, exf_clim_iprec |
97 |
& , exf_clim_yftype, nr |
98 |
& , climsalt1, count1, mythid |
99 |
& ) |
100 |
if (exf_clim_yftype .eq. 'RL') then |
101 |
call exf_filter_rl( climsalt1, climsaltmask, mythid ) |
102 |
else |
103 |
call exf_filter_rs( climsalt1, climsaltmask, 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-oly,sny+oly |
112 |
do i = 1-olx,snx+olx |
113 |
|
114 |
c Interpolate linearly onto the current time. |
115 |
climsalt(i,j,k,bi,bj) = |
116 |
& fac * climsalt0(i,j,k,bi,bj) + |
117 |
& (exf_one - fac) * climsalt1(i,j,k,bi,bj) |
118 |
|
119 |
enddo |
120 |
enddo |
121 |
enddo |
122 |
enddo |
123 |
enddo |
124 |
|
125 |
endif |
126 |
|
127 |
#endif /* ALLOW_CLIMSALT_RELAXATION */ |
128 |
|
129 |
end |
130 |
|
131 |
|
132 |
subroutine exf_init_climsalt( |
133 |
I mythid |
134 |
& ) |
135 |
|
136 |
c ================================================================== |
137 |
c SUBROUTINE exf_init_climsalt |
138 |
c ================================================================== |
139 |
c |
140 |
c o |
141 |
c |
142 |
c started: Ralf.Giering@FastOpt.de 25-Mai-2000 |
143 |
c |
144 |
c ================================================================== |
145 |
c SUBROUTINE exf_init_climsalt |
146 |
c ================================================================== |
147 |
|
148 |
implicit none |
149 |
|
150 |
c == global variables == |
151 |
|
152 |
#include "EEPARAMS.h" |
153 |
#include "SIZE.h" |
154 |
|
155 |
#include "exf_fields.h" |
156 |
#include "exf_param.h" |
157 |
#include "exf_clim_fields.h" |
158 |
|
159 |
c == routine arguments == |
160 |
|
161 |
integer mythid |
162 |
|
163 |
#ifdef ALLOW_CLIMSALT_RELAXATION |
164 |
|
165 |
c == local variables == |
166 |
|
167 |
integer bi, bj |
168 |
integer i, j, k |
169 |
|
170 |
c == end of interface == |
171 |
|
172 |
do bj = mybylo(mythid), mybyhi(mythid) |
173 |
do bi = mybxlo(mythid), mybxhi(mythid) |
174 |
do k=1,nr |
175 |
do j = 1, sny |
176 |
do i = 1, snx |
177 |
climsalt (i,j,k,bi,bj) = 0. _d 0 |
178 |
climsalt0(i,j,k,bi,bj) = 0. _d 0 |
179 |
climsalt1(i,j,k,bi,bj) = 0. _d 0 |
180 |
enddo |
181 |
enddo |
182 |
enddo |
183 |
enddo |
184 |
enddo |
185 |
|
186 |
#endif /* ALLOW_CLIMSALT_RELAXATION */ |
187 |
|
188 |
end |