1 |
#include "EXF_CPPOPTIONS.h" |
2 |
|
3 |
subroutine exf_set_gen( |
4 |
& genfile, genstartdate, genperiod, exf_inscal_gen, |
5 |
& genfld, gen0, gen1, genmask, |
6 |
#ifdef USE_EXF_INTERPOLATION |
7 |
& gen_lon0, gen_lon_inc, gen_lat0, gen_lat_inc, |
8 |
& gen_nlon, gen_nlat, |
9 |
#endif |
10 |
& mycurrenttime, mycurrentiter, mythid ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE exf_set_gen |
14 |
c ================================================================== |
15 |
c |
16 |
c o set external forcing gen |
17 |
c |
18 |
c started: Ralf.Giering@FastOpt.de 25-Mai-2000 |
19 |
c changed: heimbach@mit.edu 10-Jan-2002 |
20 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
21 |
c heimbach@mit.edu: totally re-organized exf_set_... |
22 |
c replaced all routines by one generic routine |
23 |
|
24 |
c ================================================================== |
25 |
c SUBROUTINE exf_set_gen |
26 |
c ================================================================== |
27 |
|
28 |
implicit none |
29 |
|
30 |
c == global variables == |
31 |
|
32 |
#include "EEPARAMS.h" |
33 |
#include "SIZE.h" |
34 |
#include "GRID.h" |
35 |
|
36 |
#include "exf_param.h" |
37 |
#include "exf_constants.h" |
38 |
|
39 |
c == routine arguments == |
40 |
|
41 |
integer genstartdate(4) |
42 |
_RL genperiod |
43 |
_RL exf_inscal_gen |
44 |
_RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
45 |
_RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
46 |
_RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
47 |
character*1 genmask |
48 |
character*(128) genfile |
49 |
_RL mycurrenttime |
50 |
integer mycurrentiter |
51 |
integer mythid |
52 |
#ifdef USE_EXF_INTERPOLATION |
53 |
_RL gen_lon0, gen_lon_inc |
54 |
_RL gen_lat0, gen_lat_inc(MAX_LAT_INC) |
55 |
INTEGER gen_nlon, gen_nlat |
56 |
#endif |
57 |
|
58 |
c == local variables == |
59 |
|
60 |
logical first, changed |
61 |
integer count0, count1 |
62 |
_RL fac |
63 |
|
64 |
integer bi, bj |
65 |
integer i, j |
66 |
|
67 |
c == end of interface == |
68 |
|
69 |
if ( genfile .NE. ' ' ) then |
70 |
|
71 |
c get record numbers and interpolation factor for gen |
72 |
call exf_GetFFieldRec( |
73 |
I genstartdate, genperiod |
74 |
O , fac, first, changed |
75 |
O , count0, count1 |
76 |
I , mycurrenttime, mycurrentiter, mythid |
77 |
& ) |
78 |
|
79 |
if ( first ) then |
80 |
#ifdef USE_EXF_INTERPOLATION |
81 |
call new_interp( genfile, exf_iprec |
82 |
& , gen1, count0, xC, yC |
83 |
& , gen_lon0,gen_lon_inc |
84 |
& , gen_lat0,gen_lat_inc |
85 |
& , gen_nlon,gen_nlat,mythid |
86 |
& ) |
87 |
#else |
88 |
call mdsreadfield( genfile, exf_iprec, exf_yftype, 1 |
89 |
& , gen1, count0, mythid |
90 |
& ) |
91 |
#endif |
92 |
|
93 |
if (exf_yftype .eq. 'RL') then |
94 |
call exf_filter_rl( gen1, genmask, mythid ) |
95 |
else |
96 |
call exf_filter_rs( gen1, genmask, mythid ) |
97 |
end if |
98 |
endif |
99 |
|
100 |
if (( first ) .or. ( changed )) then |
101 |
call exf_SwapFFields( gen0, gen1, mythid ) |
102 |
|
103 |
#ifdef USE_EXF_INTERPOLATION |
104 |
call new_interp( genfile, exf_iprec |
105 |
& , gen1, count1, xC, yC |
106 |
& , gen_lon0,gen_lon_inc |
107 |
& , gen_lat0,gen_lat_inc |
108 |
& , gen_nlon,gen_nlat,mythid |
109 |
& ) |
110 |
#else |
111 |
call mdsreadfield( genfile, exf_iprec, exf_yftype, 1 |
112 |
& , gen1, count1, mythid |
113 |
& ) |
114 |
#endif |
115 |
|
116 |
if (exf_yftype .eq. 'RL') then |
117 |
call exf_filter_rl( gen1, genmask, mythid ) |
118 |
else |
119 |
call exf_filter_rs( gen1, genmask, mythid ) |
120 |
end if |
121 |
endif |
122 |
|
123 |
c Loop over tiles. |
124 |
do bj = mybylo(mythid),mybyhi(mythid) |
125 |
do bi = mybxlo(mythid),mybxhi(mythid) |
126 |
do j = 1,sny |
127 |
do i = 1,snx |
128 |
|
129 |
c Interpolate linearly onto the current time. |
130 |
|
131 |
genfld(i,j,bi,bj) = exf_inscal_gen * ( |
132 |
& fac * gen0(i,j,bi,bj) + |
133 |
& (exf_one - fac) * gen1(i,j,bi,bj) ) |
134 |
|
135 |
enddo |
136 |
enddo |
137 |
enddo |
138 |
enddo |
139 |
|
140 |
endif |
141 |
|
142 |
end |
143 |
|
144 |
|
145 |
|
146 |
subroutine exf_init_gen ( |
147 |
& genconst, genfld, gen0, gen1, mythid ) |
148 |
|
149 |
c ================================================================== |
150 |
c SUBROUTINE exf_init_gen |
151 |
c ================================================================== |
152 |
c |
153 |
c o |
154 |
c |
155 |
c started: Ralf.Giering@FastOpt.de 25-Mai-2000 |
156 |
c changed: heimbach@mit.edu 10-Jan-2002 |
157 |
c heimbach@mit.edu: totally re-organized exf_set_... |
158 |
c replaced all routines by one generic routine |
159 |
c |
160 |
c ================================================================== |
161 |
c SUBROUTINE exf_init_gen |
162 |
c ================================================================== |
163 |
|
164 |
implicit none |
165 |
|
166 |
c == global variables == |
167 |
|
168 |
#include "EEPARAMS.h" |
169 |
#include "SIZE.h" |
170 |
|
171 |
#include "exf_param.h" |
172 |
|
173 |
c == routine arguments == |
174 |
|
175 |
_RL genconst |
176 |
_RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
177 |
_RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
178 |
_RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
179 |
integer mythid |
180 |
|
181 |
c == local variables == |
182 |
|
183 |
integer bi, bj |
184 |
integer i, j |
185 |
|
186 |
c == end of interface == |
187 |
|
188 |
do bj = mybylo(mythid), mybyhi(mythid) |
189 |
do bi = mybxlo(mythid), mybxhi(mythid) |
190 |
do j = 1, sny |
191 |
do i = 1, snx |
192 |
genfld(i,j,bi,bj) = genconst |
193 |
gen0(i,j,bi,bj) = 0. _d 0 |
194 |
gen1(i,j,bi,bj) = 0. _d 0 |
195 |
enddo |
196 |
enddo |
197 |
enddo |
198 |
enddo |
199 |
|
200 |
end |