1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getsurfacefluxes.F,v 1.14 2012/07/31 16:08:16 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
|
6 |
subroutine exf_GetSurfaceFluxes( |
7 |
I mytime, |
8 |
I myiter, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE exf_GetSurfaceFluxes |
14 |
c ================================================================== |
15 |
c |
16 |
c o Mid-level routine for enabling the use of flux fields as control |
17 |
c variables. |
18 |
c |
19 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
20 |
c |
21 |
c changed: Christian Eckert eckert@mit.edu 14-Jan-2000 |
22 |
c - Restructured the code in order to create a package |
23 |
c for the MITgcmUV. |
24 |
c |
25 |
c Christian Eckert eckert@mit.edu 12-Feb-2000 |
26 |
c - Changed Routine names (package prefix: exf_) |
27 |
c |
28 |
c mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002 |
29 |
c |
30 |
c ================================================================== |
31 |
c SUBROUTINE exf_GetSurfaceFluxes |
32 |
c ================================================================== |
33 |
|
34 |
implicit none |
35 |
|
36 |
c == global variables == |
37 |
#include "EEPARAMS.h" |
38 |
#include "SIZE.h" |
39 |
#include "PARAMS.h" |
40 |
#include "GRID.h" |
41 |
|
42 |
#include "EXF_FIELDS.h" |
43 |
#include "EXF_PARAM.h" |
44 |
#ifdef ALLOW_AUTODIFF |
45 |
# include "CTRL_SIZE.h" |
46 |
# include "ctrl.h" |
47 |
# include "ctrl_dummy.h" |
48 |
#endif |
49 |
|
50 |
c == routine arguments == |
51 |
|
52 |
_RL mytime |
53 |
integer myiter |
54 |
integer mythid |
55 |
|
56 |
c == global variables == |
57 |
|
58 |
#ifdef ALLOW_ROTATE_UV_CONTROLS |
59 |
_RL tmpUE(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
60 |
_RL tmpVN(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
61 |
_RL tmpUX(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
62 |
_RL tmpVY(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
63 |
integer i,j,bi,bj |
64 |
#endif |
65 |
|
66 |
|
67 |
c == end of interface == |
68 |
|
69 |
#ifdef ALLOW_HFLUX_CONTROL |
70 |
call ctrl_get_gen ( |
71 |
& xx_hflux_file, xx_hfluxstartdate, xx_hfluxperiod, |
72 |
& maskc, hflux, xx_hflux0, xx_hflux1, xx_hflux_dummy, |
73 |
& xx_hflux_remo_intercept, xx_hflux_remo_slope, |
74 |
& mytime, myiter, mythid ) |
75 |
#endif |
76 |
|
77 |
#ifdef ALLOW_SFLUX_CONTROL |
78 |
call ctrl_get_gen ( |
79 |
& xx_sflux_file, xx_sfluxstartdate, xx_sfluxperiod, |
80 |
& maskc, sflux, xx_sflux0, xx_sflux1, xx_sflux_dummy, |
81 |
& xx_sflux_remo_intercept, xx_sflux_remo_slope, |
82 |
& mytime, myiter, mythid ) |
83 |
#endif |
84 |
|
85 |
IF ( .NOT.useAtmWind ) THEN |
86 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
87 |
|
88 |
#ifdef ALLOW_USTRESS_CONTROL |
89 |
call ctrl_get_gen ( |
90 |
& xx_tauu_file, xx_tauustartdate, xx_tauuperiod, |
91 |
& maskw, ustress, xx_tauu0, xx_tauu1, xx_tauu_dummy, |
92 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
93 |
& mytime, myiter, mythid ) |
94 |
#endif |
95 |
|
96 |
#ifdef ALLOW_VSTRESS_CONTROL |
97 |
call ctrl_get_gen ( |
98 |
& xx_tauv_file, xx_tauvstartdate, xx_tauvperiod, |
99 |
& masks, vstress, xx_tauv0, xx_tauv1, xx_tauv_dummy, |
100 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
101 |
& mytime, myiter, mythid ) |
102 |
#endif |
103 |
|
104 |
#else |
105 |
|
106 |
#if defined(ALLOW_USTRESS_CONTROL) && defined(ALLOW_VSTRESS_CONTROL) |
107 |
|
108 |
do bj = mybylo(mythid),mybyhi(mythid) |
109 |
do bi = mybxlo(mythid),mybxhi(mythid) |
110 |
do j = 1-oly,sny+oly |
111 |
do i = 1-olx,snx+olx |
112 |
tmpUE(i,j,bi,bj) = 0. _d 0 |
113 |
tmpVN(i,j,bi,bj) = 0. _d 0 |
114 |
tmpUX(i,j,bi,bj) = 0. _d 0 |
115 |
tmpVY(i,j,bi,bj) = 0. _d 0 |
116 |
enddo |
117 |
enddo |
118 |
enddo |
119 |
enddo |
120 |
|
121 |
call ctrl_get_gen ( |
122 |
& xx_tauu_file, xx_tauustartdate, xx_tauuperiod, |
123 |
& maskc, tmpUE, xx_tauu0, xx_tauu1, xx_tauu_dummy, |
124 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
125 |
& mytime, myiter, mythid ) |
126 |
|
127 |
call ctrl_get_gen ( |
128 |
& xx_tauv_file, xx_tauvstartdate, xx_tauvperiod, |
129 |
& maskc, tmpVN, xx_tauv0, xx_tauv1, xx_tauv_dummy, |
130 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
131 |
& mytime, myiter, mythid ) |
132 |
|
133 |
_EXCH_XY_RL(tmpUE,myThid) |
134 |
_EXCH_XY_RL(tmpVN,myThid) |
135 |
|
136 |
call rotate_uv2en_rl(tmpUX,tmpVY,tmpUE,tmpVN, |
137 |
& .FALSE.,stressIsOnCgrid,.TRUE.,1,mythid) |
138 |
|
139 |
IF ( stressIsOnCgrid ) THEN |
140 |
CALL EXCH_UV_XY_RL( tmpUX, tmpVY, .TRUE., myThid ) |
141 |
ELSE |
142 |
CALL EXCH_UV_AGRID_3D_RL( tmpUX, tmpVY, .TRUE., 1, myThid) |
143 |
ENDIF |
144 |
|
145 |
do bj = mybylo(mythid),mybyhi(mythid) |
146 |
do bi = mybxlo(mythid),mybxhi(mythid) |
147 |
do j = 1-oly,sny+oly |
148 |
do i = 1-olx,snx+olx |
149 |
ustress(i,j,bi,bj)=ustress(i,j,bi,bj)+tmpUX(i,j,bi,bj) |
150 |
vstress(i,j,bi,bj)=vstress(i,j,bi,bj)+tmpVY(i,j,bi,bj) |
151 |
enddo |
152 |
enddo |
153 |
enddo |
154 |
enddo |
155 |
|
156 |
#endif |
157 |
#endif /* ALLOW_ROTATE_UV_CONTROLS */ |
158 |
ENDIF |
159 |
|
160 |
|
161 |
end |