1 |
heimbach |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_depth_ini.F,v 1.4 2009/04/28 18:09:28 jmc Exp $ |
2 |
heimbach |
1.2 |
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
|
|
#include "CTRL_CPPOPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: ctrl_depth_ini |
8 |
|
|
C !INTERFACE: |
9 |
|
|
subroutine ctrl_depth_ini( mythid ) |
10 |
|
|
|
11 |
|
|
C !DESCRIPTION: \bv |
12 |
|
|
c *================================================================= |
13 |
|
|
c | SUBROUTINE ctrl_depth_ini |
14 |
|
|
c | Add the depth part of the control vector to the model state |
15 |
|
|
c | and update the tile halos. |
16 |
|
|
c | The control vector is defined in the header file "ctrl.h". |
17 |
|
|
c *================================================================= |
18 |
|
|
C \ev |
19 |
|
|
|
20 |
|
|
C !USES: |
21 |
|
|
implicit none |
22 |
|
|
|
23 |
|
|
c == global variables == |
24 |
|
|
#include "EEPARAMS.h" |
25 |
|
|
#include "SIZE.h" |
26 |
|
|
#include "GRID.h" |
27 |
heimbach |
1.5 |
#include "CTRL_SIZE.h" |
28 |
heimbach |
1.1 |
#include "ctrl.h" |
29 |
|
|
#include "ctrl_dummy.h" |
30 |
|
|
#include "optim.h" |
31 |
|
|
|
32 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
33 |
|
|
c == routine arguments == |
34 |
|
|
integer mythid |
35 |
|
|
|
36 |
|
|
#ifdef ALLOW_DEPTH_CONTROL |
37 |
|
|
C !LOCAL VARIABLES: |
38 |
|
|
c == local variables == |
39 |
|
|
|
40 |
|
|
integer bi,bj |
41 |
|
|
integer i,j,k |
42 |
|
|
integer itlo,ithi |
43 |
|
|
integer jtlo,jthi |
44 |
|
|
integer jmin,jmax |
45 |
|
|
integer imin,imax |
46 |
|
|
integer il |
47 |
|
|
|
48 |
|
|
logical equal |
49 |
|
|
logical doglobalread |
50 |
|
|
logical ladinit |
51 |
|
|
|
52 |
|
|
character*( 80) fnamedepth |
53 |
|
|
character*(max_len_mbuf) msgbuf |
54 |
|
|
|
55 |
|
|
_RL fac |
56 |
|
|
|
57 |
|
|
c == external == |
58 |
|
|
integer ilnblnk |
59 |
|
|
external ilnblnk |
60 |
|
|
|
61 |
|
|
c == end of interface == |
62 |
|
|
CEOP |
63 |
|
|
|
64 |
|
|
jtlo = mybylo(mythid) |
65 |
|
|
jthi = mybyhi(mythid) |
66 |
|
|
itlo = mybxlo(mythid) |
67 |
|
|
ithi = mybxhi(mythid) |
68 |
|
|
jmin = 1-oly |
69 |
|
|
jmax = sny+oly |
70 |
|
|
imin = 1-olx |
71 |
|
|
imax = snx+olx |
72 |
|
|
|
73 |
|
|
doglobalread = .false. |
74 |
|
|
ladinit = .false. |
75 |
|
|
|
76 |
|
|
equal = .true. |
77 |
|
|
|
78 |
|
|
if ( equal ) then |
79 |
|
|
fac = 1. _d 0 |
80 |
|
|
else |
81 |
|
|
fac = 0. _d 0 |
82 |
|
|
endif |
83 |
|
|
|
84 |
|
|
write(standardmessageunit,'(21x,a)') |
85 |
|
|
& 'ctrl_depth_ini: ctrl update R_low,' |
86 |
|
|
write(standardmessageunit,'(21x,a)') |
87 |
|
|
& ' adding the control vector.' |
88 |
|
|
|
89 |
|
|
C Re-initialize hFacC, so that TAMC/TAF can see it |
90 |
|
|
C Once hFacC is the control variable, and not its anomaly |
91 |
|
|
C this will be no longer necessary |
92 |
|
|
do bj = jtlo,jthi |
93 |
|
|
do bi = itlo,ithi |
94 |
|
|
do j = jmin,jmax |
95 |
|
|
do i = imin,imax |
96 |
|
|
tmpfld2d(i,j,bi,bj) = 0. _d 0 |
97 |
|
|
enddo |
98 |
|
|
enddo |
99 |
|
|
enddo |
100 |
|
|
enddo |
101 |
|
|
|
102 |
|
|
C-- |
103 |
|
|
do bj = jtlo,jthi |
104 |
|
|
do bi = itlo,ithi |
105 |
|
|
do j = jmin,jmax |
106 |
|
|
do i = imin,imax |
107 |
|
|
xx_r_low(i,j,bi,bj) = 0. _d 0 |
108 |
|
|
enddo |
109 |
|
|
enddo |
110 |
|
|
enddo |
111 |
|
|
enddo |
112 |
|
|
|
113 |
|
|
il=ilnblnk( xx_depth_file ) |
114 |
|
|
write(fnamedepth(1:80),'(2a,i10.10)') |
115 |
|
|
& xx_depth_file(1:il),'.',optimcycle |
116 |
heimbach |
1.2 |
call active_read_xy( fnamedepth, tmpfld2d, 1, |
117 |
heimbach |
1.1 |
& doglobalread, ladinit, optimcycle, |
118 |
|
|
& mythid, xx_depth_dummy ) |
119 |
|
|
do bj = jtlo,jthi |
120 |
|
|
do bi = itlo,ithi |
121 |
|
|
do j = jmin,jmax |
122 |
|
|
do i = imin,imax |
123 |
|
|
xx_r_low(i,j,bi,bj) = r_low(i,j,bi,bj) |
124 |
|
|
& + fac*tmpfld2d(i,j,bi,bj) |
125 |
|
|
enddo |
126 |
|
|
enddo |
127 |
|
|
enddo |
128 |
|
|
enddo |
129 |
|
|
|
130 |
|
|
c-- Update the tile edges. |
131 |
|
|
|
132 |
jmc |
1.4 |
_EXCH_XY_RL( xx_r_low, myThid ) |
133 |
heimbach |
1.1 |
|
134 |
|
|
#endif /* ALLOW_DEPTH_CONTROL */ |
135 |
|
|
|
136 |
|
|
return |
137 |
|
|
end |
138 |
|
|
|