1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getsurfacefluxes.F,v 1.13 2010/07/13 00:02:10 gforget 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 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
86 |
|
87 |
#ifdef ALLOW_USTRESS_CONTROL |
88 |
call ctrl_get_gen ( |
89 |
& xx_tauu_file, xx_tauustartdate, xx_tauuperiod, |
90 |
& maskw, ustress, xx_tauu0, xx_tauu1, xx_tauu_dummy, |
91 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
92 |
& mytime, myiter, mythid ) |
93 |
#endif |
94 |
|
95 |
#ifdef ALLOW_VSTRESS_CONTROL |
96 |
call ctrl_get_gen ( |
97 |
& xx_tauv_file, xx_tauvstartdate, xx_tauvperiod, |
98 |
& masks, vstress, xx_tauv0, xx_tauv1, xx_tauv_dummy, |
99 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
100 |
& mytime, myiter, mythid ) |
101 |
#endif |
102 |
|
103 |
#else |
104 |
|
105 |
#if defined(ALLOW_USTRESS_CONTROL) && defined(ALLOW_VSTRESS_CONTROL) |
106 |
|
107 |
do bj = mybylo(mythid),mybyhi(mythid) |
108 |
do bi = mybxlo(mythid),mybxhi(mythid) |
109 |
do j = 1-oly,sny+oly |
110 |
do i = 1-olx,snx+olx |
111 |
tmpUE(i,j,bi,bj) = 0. _d 0 |
112 |
tmpVN(i,j,bi,bj) = 0. _d 0 |
113 |
tmpUX(i,j,bi,bj) = 0. _d 0 |
114 |
tmpVY(i,j,bi,bj) = 0. _d 0 |
115 |
enddo |
116 |
enddo |
117 |
enddo |
118 |
enddo |
119 |
|
120 |
call ctrl_get_gen ( |
121 |
& xx_tauu_file, xx_tauustartdate, xx_tauuperiod, |
122 |
& maskc, tmpUE, xx_tauu0, xx_tauu1, xx_tauu_dummy, |
123 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
124 |
& mytime, myiter, mythid ) |
125 |
|
126 |
call ctrl_get_gen ( |
127 |
& xx_tauv_file, xx_tauvstartdate, xx_tauvperiod, |
128 |
& maskc, tmpVN, xx_tauv0, xx_tauv1, xx_tauv_dummy, |
129 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
130 |
& mytime, myiter, mythid ) |
131 |
|
132 |
_EXCH_XY_RL(tmpUE,myThid) |
133 |
_EXCH_XY_RL(tmpVN,myThid) |
134 |
|
135 |
call rotate_uv2en_rl(tmpUX,tmpVY,tmpUE,tmpVN, |
136 |
& .FALSE.,stressIsOnCgrid,.TRUE.,1,mythid) |
137 |
|
138 |
IF ( stressIsOnCgrid ) THEN |
139 |
CALL EXCH_UV_XY_RL( tmpUX, tmpVY, .TRUE., myThid ) |
140 |
ELSE |
141 |
CALL EXCH_UV_AGRID_3D_RL( tmpUX, tmpVY, .TRUE., 1, myThid) |
142 |
ENDIF |
143 |
|
144 |
do bj = mybylo(mythid),mybyhi(mythid) |
145 |
do bi = mybxlo(mythid),mybxhi(mythid) |
146 |
do j = 1-oly,sny+oly |
147 |
do i = 1-olx,snx+olx |
148 |
ustress(i,j,bi,bj)=ustress(i,j,bi,bj)+tmpUX(i,j,bi,bj) |
149 |
vstress(i,j,bi,bj)=vstress(i,j,bi,bj)+tmpVY(i,j,bi,bj) |
150 |
enddo |
151 |
enddo |
152 |
enddo |
153 |
enddo |
154 |
|
155 |
#endif |
156 |
#endif /* ALLOW_ROTATE_UV_CONTROLS */ |
157 |
|
158 |
|
159 |
|
160 |
end |