1 |
gforget |
1.4 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_map_gentim2d.F,v 1.3 2013/03/27 00:10:26 gforget Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CTRL_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: CTRL_MAP_GENTIM2D |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE CTRL_MAP_GENTIM2D( |
10 |
|
|
I myTime, myIter, myThid ) |
11 |
|
|
C !DESCRIPTION: \bv |
12 |
|
|
C *=============================================================* |
13 |
|
|
C | S/R CTRL_MAP_GENTIM2D |
14 |
|
|
C *=============================================================* |
15 |
|
|
|
16 |
|
|
C !USES: |
17 |
|
|
IMPLICIT NONE |
18 |
|
|
|
19 |
|
|
C === Global variables === |
20 |
|
|
#include "SIZE.h" |
21 |
|
|
#include "EEPARAMS.h" |
22 |
|
|
#include "PARAMS.h" |
23 |
|
|
#include "FFIELDS.h" |
24 |
|
|
#include "DYNVARS.h" |
25 |
|
|
#include "GRID.h" |
26 |
|
|
#include "CTRL_SIZE.h" |
27 |
|
|
#include "ctrl.h" |
28 |
|
|
#include "CTRL_GENARR.h" |
29 |
|
|
#include "ctrl_dummy.h" |
30 |
|
|
#include "optim.h" |
31 |
|
|
#ifdef ALLOW_AUTODIFF |
32 |
|
|
#include "AUTODIFF_MYFIELDS.h" |
33 |
|
|
#endif |
34 |
|
|
|
35 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
36 |
|
|
C === Routine arguments === |
37 |
|
|
C myIter :: iteration counter for this thread |
38 |
|
|
C myTime :: time counter for this thread |
39 |
|
|
C myThid :: thread number for this instance of the routine. |
40 |
|
|
_RL myTime |
41 |
|
|
INTEGER myIter |
42 |
|
|
INTEGER myThid |
43 |
|
|
|
44 |
|
|
C !LOCAL VARIABLES: |
45 |
|
|
C == Local variables == |
46 |
|
|
integer bi,bj |
47 |
|
|
integer i,j,k |
48 |
|
|
integer itlo,ithi |
49 |
|
|
integer jtlo,jthi |
50 |
|
|
integer jmin,jmax |
51 |
|
|
integer imin,imax |
52 |
|
|
integer il |
53 |
|
|
integer iarr |
54 |
|
|
|
55 |
|
|
logical equal |
56 |
|
|
logical doglobalread |
57 |
|
|
logical ladinit |
58 |
|
|
character*( 80) fnamegeneric |
59 |
|
|
|
60 |
|
|
_RL fac |
61 |
|
|
_RL xx_gentim2d_loc(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
62 |
gforget |
1.3 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
63 |
gforget |
1.4 |
_RL LOCsumTile(nSx,nSy), LOCsumGlob, genprecipGloH |
64 |
heimbach |
1.1 |
|
65 |
|
|
c == external == |
66 |
|
|
integer ilnblnk |
67 |
|
|
external ilnblnk |
68 |
|
|
CEOP |
69 |
|
|
|
70 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
71 |
|
|
|
72 |
|
|
#ifdef ALLOW_GENTIM2D_CONTROL |
73 |
|
|
C-- An example of connecting specific fields |
74 |
|
|
C-- to generic time-varying 2D control arrays |
75 |
|
|
cph--->>> |
76 |
|
|
cph--->>> COMPILE FAILURE IS DELIBERATE |
77 |
|
|
cph--->>> BE SURE WHAT YOU ARE DOING AND CUSTOMIZE <<<--- |
78 |
|
|
cph--->>> |
79 |
|
|
C-- generic - user-defined control vars |
80 |
|
|
DO iarr = 1, maxCtrlTim2D |
81 |
|
|
|
82 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
83 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
84 |
|
|
DO J = 1-Oly,sNy+Oly |
85 |
|
|
DO I = 1-Olx,sNx+Olx |
86 |
|
|
xx_gentim2d_loc(I,J,bi,bj) = 0. _d 0 |
87 |
|
|
ENDDO |
88 |
|
|
ENDDO |
89 |
|
|
ENDDO |
90 |
|
|
ENDDO |
91 |
|
|
C |
92 |
|
|
CALL CTRL_GET_GEN ( |
93 |
jmc |
1.2 |
I xx_gentim2d_file(iarr)(1:MAX_LEN_FNAM), |
94 |
|
|
I xx_gentim2d_startdate(1,iarr), |
95 |
heimbach |
1.1 |
I xx_gentim2d_period(iarr), |
96 |
jmc |
1.2 |
I maskC, |
97 |
|
|
O xx_gentim2d_loc, |
98 |
heimbach |
1.1 |
I xx_gentim2d0(1-Olx,1-Oly,1,1,iarr), |
99 |
|
|
I xx_gentim2d1(1-Olx,1-Oly,1,1,iarr), |
100 |
|
|
I xx_gentim2d_dummy(iarr), |
101 |
jmc |
1.2 |
I zeroRL, zeroRL, |
102 |
heimbach |
1.1 |
I mytime, myiter, mythid ) |
103 |
|
|
C |
104 |
gforget |
1.3 |
DO bj=myByLo(myThid),myByHi(myThid) |
105 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
106 |
|
|
do j = 1,sNy |
107 |
|
|
do i = 1,sNx |
108 |
|
|
if (xx_gentim2d_cumsum(iarr)) then |
109 |
|
|
xx_gentim2d(i,j,bi,bj,iarr)=xx_gentim2d(i,j,bi,bj,iarr) |
110 |
|
|
& +xx_gentim2d_loc(i,j,bi,bj) |
111 |
|
|
else |
112 |
|
|
xx_gentim2d(i,j,bi,bj,iarr)=xx_gentim2d_loc(i,j,bi,bj) |
113 |
|
|
endif |
114 |
|
|
enddo |
115 |
|
|
enddo |
116 |
|
|
enddo |
117 |
|
|
enddo |
118 |
|
|
C |
119 |
|
|
if (xx_gentim2d_glosum(iarr)) then |
120 |
|
|
|
121 |
|
|
LOCsumGlob=0. _d 0 |
122 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
123 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
124 |
|
|
LOCsumTile(bi,bj)=0. _d 0 |
125 |
|
|
do j = 1,sNy |
126 |
|
|
do i = 1,sNx |
127 |
|
|
LOCsumTile(bi,bj)=LOCsumTile(bi,bj)+ |
128 |
|
|
& maskC(i,j,1,bi,bj)*rA(i,j,bi,bj) |
129 |
|
|
& *xx_gentim2d(i,j,bi,bj,iarr) |
130 |
|
|
enddo |
131 |
|
|
enddo |
132 |
|
|
enddo |
133 |
|
|
enddo |
134 |
|
|
|
135 |
|
|
CALL GLOBAL_SUM_TILE_RL( LOCsumTile, LOCsumGlob, myThid ) |
136 |
|
|
|
137 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
138 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
139 |
|
|
DO J = 1-Oly,sNy+Oly |
140 |
|
|
DO I = 1-Olx,sNx+Olx |
141 |
|
|
xx_gentim2d(I,J,bi,bj,iarr) = |
142 |
|
|
& LOCsumGlob/globalArea*maskC(i,j,1,bi,bj) |
143 |
|
|
ENDDO |
144 |
|
|
ENDDO |
145 |
|
|
ENDDO |
146 |
|
|
ENDDO |
147 |
|
|
|
148 |
gforget |
1.4 |
genprecipGloH=LOCsumGlob/globalArea |
149 |
|
|
& *rhoConstFresh*recip_rhoConst*deltaTClock |
150 |
|
|
|
151 |
|
|
WRITE(msgBuf,'(A,I6,A,1PE21.14)') |
152 |
|
|
& ' iter=', myiter, ' ; genprecipGloH= ', genprecipGloH |
153 |
gforget |
1.3 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
154 |
|
|
& SQUEEZE_RIGHT, myThid ) |
155 |
|
|
|
156 |
|
|
endif |
157 |
|
|
|
158 |
heimbach |
1.1 |
ENDDO |
159 |
|
|
|
160 |
|
|
#endif /* ALLOW_GENTIM2D_CONTROL */ |
161 |
|
|
|
162 |
|
|
RETURN |
163 |
|
|
END |