1 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/Attic/ctrl_getmerstress.F,v 1.1.2.1 2002/02/05 20:23:58 heimbach Exp $ |
2 |
|
3 |
#include "CTRL_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine ctrl_GetMerStress( |
7 |
I mytime, |
8 |
I myiter, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE ctrl_GetMerStress |
14 |
c ================================================================== |
15 |
c |
16 |
c o Get the meridional wind stress contribution of the control vector |
17 |
c and add it to the surface heat flux. |
18 |
c |
19 |
c started: Christian Eckert eckert@mit.edu 24-Feb-2000 |
20 |
c |
21 |
c - Introduced in order to create a package for the |
22 |
c MITgcmUV. |
23 |
c |
24 |
c changed: Ralf.Giering@FastOpt.de 31-Mai-2000 |
25 |
c |
26 |
c - set ladinit to .false. |
27 |
c |
28 |
c ================================================================== |
29 |
c SUBROUTINE ctrl_GetMerStress |
30 |
c ================================================================== |
31 |
|
32 |
implicit none |
33 |
|
34 |
#ifdef ALLOW_VSTRESS_CONTROL |
35 |
|
36 |
c == global variables == |
37 |
|
38 |
#include "EEPARAMS.h" |
39 |
#include "SIZE.h" |
40 |
#include "PARAMS.h" |
41 |
#include "GRID.h" |
42 |
|
43 |
#include "ctrl.h" |
44 |
#include "ctrl_dummy.h" |
45 |
#include "exf_fields.h" |
46 |
#include "optim.h" |
47 |
|
48 |
c == routine arguments == |
49 |
|
50 |
_RL mytime |
51 |
integer myiter |
52 |
integer mythid |
53 |
|
54 |
c == local variables == |
55 |
|
56 |
integer bi,bj |
57 |
integer i,j,k |
58 |
integer itlo,ithi |
59 |
integer jtlo,jthi |
60 |
integer jmin,jmax |
61 |
integer imin,imax |
62 |
integer ilvst |
63 |
|
64 |
_RL vstfac |
65 |
logical vstfirst |
66 |
logical vstchanged |
67 |
integer vstcount0 |
68 |
integer vstcount1 |
69 |
|
70 |
logical doglobalread |
71 |
logical ladinit |
72 |
|
73 |
character*(80) fnamevst |
74 |
|
75 |
c == external functions == |
76 |
|
77 |
integer ilnblnk |
78 |
external ilnblnk |
79 |
|
80 |
c == end of interface == |
81 |
|
82 |
jtlo = mybylo(mythid) |
83 |
jthi = mybyhi(mythid) |
84 |
itlo = mybxlo(mythid) |
85 |
ithi = mybxhi(mythid) |
86 |
jmin = 1-oly |
87 |
jmax = sny+oly |
88 |
imin = 1-olx |
89 |
imax = snx+olx |
90 |
|
91 |
c-- Now, read the control vector. |
92 |
doglobalread = .false. |
93 |
ladinit = .false. |
94 |
|
95 |
if (optimcycle .ge. 0) then |
96 |
ilvst=ilnblnk( xx_tauv_file ) |
97 |
write(fnamevst(1:80),'(2a,i10.10)') xx_tauv_file(1:ilvst),'.', |
98 |
& optimcycle |
99 |
else |
100 |
print* |
101 |
print*,' ctrl_GetMerStress: optimcycle not set correctly.' |
102 |
print*,' ... stopped in ctrl_GetMerStress.' |
103 |
endif |
104 |
|
105 |
c-- Get the counters, flags, and the interpolation factor. |
106 |
call ctrl_GetRec( 'xx_tauv', |
107 |
O vstfac, vstfirst, vstchanged, |
108 |
O vstcount0,vstcount1, |
109 |
I mytime, myiter, mythid ) |
110 |
|
111 |
if ( vstfirst ) then |
112 |
call active_read_xy( fnamevst, xx_tauv1, vstcount0, |
113 |
& doglobalread, ladinit, optimcycle, |
114 |
& mythid, xx_tauv_dummy ) |
115 |
endif |
116 |
|
117 |
if (( vstfirst ) .or. ( vstchanged )) then |
118 |
call exf_SwapFFields( xx_tauv0, xx_tauv1, mythid ) |
119 |
|
120 |
call active_read_xy( fnamevst,xx_tauv1 , vstcount1, |
121 |
& doglobalread, ladinit, optimcycle, |
122 |
& mythid, xx_tauv_dummy ) |
123 |
endif |
124 |
|
125 |
c-- Add control to model variable. |
126 |
do bj = jtlo,jthi |
127 |
do bi = itlo,ithi |
128 |
k = 1 |
129 |
do j = 1,sny |
130 |
do i = 1,snx |
131 |
vstress(i,j,bi,bj) = vstress(i,j,bi,bj) + |
132 |
& vstfac *xx_tauv0(i,j,bi,bj)+ |
133 |
& (1. _d 0 - vstfac)*xx_tauv1(i,j,bi,bj) |
134 |
vstress(i,j,bi,bj) = vstress(i,j,bi,bj)*masks(i,j,k,bi,bj) |
135 |
enddo |
136 |
enddo |
137 |
enddo |
138 |
enddo |
139 |
|
140 |
#else /* ALLOW_VSTRESS_CONTROL undefined */ |
141 |
|
142 |
c == routine arguments == |
143 |
|
144 |
_RL mytime |
145 |
integer myiter |
146 |
integer mythid |
147 |
|
148 |
c-- CPP flag ALLOW_VSTRESS_CONTROL undefined. |
149 |
|
150 |
#endif /* ALLOW_VSTRESS_CONTROL */ |
151 |
|
152 |
end |
153 |
|
154 |
|