/[MITgcm]/MITgcm/pkg/flt/flt_traj.F
ViewVC logotype

Contents of /MITgcm/pkg/flt/flt_traj.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download)
Wed Dec 22 21:25:18 2010 UTC (13 years, 5 months ago) by jahn
Branch: MAIN
Changes since 1.10: +2 -1 lines
add FLT_SIZE.h

1 C $Header: /u/gcmpack/MITgcm/pkg/flt/flt_traj.F,v 1.10 2010/12/22 21:24:58 jahn Exp $
2 C $Name: $
3
4 #include "FLT_OPTIONS.h"
5
6
7 SUBROUTINE FLT_TRAJ (
8 I myTime, myIter, myThid )
9
10 C ==================================================================
11 C SUBROUTINE FLT_TRAJ
12 C ==================================================================
13 C o This routine samples the model state at float position every
14 C flt_int_traj time steps and writes output.
15 C ==================================================================
16
17 C !USES:
18 IMPLICIT NONE
19
20 C == global variables ==
21 #include "SIZE.h"
22 #include "EEPARAMS.h"
23 #include "PARAMS.h"
24 #include "DYNVARS.h"
25 #include "FLT_SIZE.h"
26 #include "FLT.h"
27 #ifdef ALLOW_EXCH2
28 #include "W2_EXCH2_SIZE.h"
29 #include "W2_EXCH2_TOPOLOGY.h"
30 #endif
31
32 C == routine arguments ==
33 _RL myTime
34 INTEGER myIter, myThid
35
36 C === Functions ==
37 INTEGER ILNBLNK
38 _RL FLT_MAP_K2R
39 EXTERNAL ILNBLNK
40 EXTERNAL FLT_MAP_K2R
41
42 C == local variables ==
43 INTEGER bi, bj, imax
44 PARAMETER (imax=13)
45 INTEGER ip, kp, ii
46 _RL ix, jy, i0x, j0y, xx, yy, zz
47 _RL uu, vv, tt, ss, pp
48
49 INTEGER ioUnit, irecord
50 _RL tmp(imax)
51 _RL npart_read,npart_times
52 _RS dummyRS(1)
53 CHARACTER*(MAX_LEN_FNAM) fn
54 CHARACTER*(MAX_LEN_MBUF) msgBuf
55 CHARACTER*(80) dataFName
56 INTEGER iG,jG,IL
57 #ifdef ALLOW_EXCH2
58 INTEGER nT
59 #endif
60 LOGICAL exst
61 LOGICAL globalFile
62
63 C == end of interface ==
64
65 fn = 'float_trajectories'
66
67 DO bj=myByLo(myThid),myByHi(myThid)
68 DO bi=myBxLo(myThid),myBxHi(myThid)
69
70 C (1) read actual number floats from file (if exists)
71 IL=ILNBLNK( fn )
72 iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles
73 jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles
74 WRITE(dataFname(1:80),'(2a,i3.3,a,i3.3,a)')
75 & fn(1:IL),'.',iG,'.',jG,'.data'
76 INQUIRE( file=dataFname, exist=exst )
77 IF (exst) THEN
78 CALL FLT_MDSREADVECTOR(fn,globalFile,precFloat64,'RL',
79 & imax,tmp,bi,bj,1,myThid)
80 npart_read = tmp(1)
81 npart_times = tmp(5)
82 ELSE
83 npart_read = 0.
84 npart_times = 0.
85 tmp(2) = myTime
86 ENDIF
87
88 C the standard routine mds_writevec_loc can be used here
89 C (2) WRITE new actual number floats and time axis into file
90 C
91 C total number of records in this file
92 tmp(1) = DBLE(npart_tile(bi,bj))+npart_read
93 C first time of writing floats (do not change when written)
94 c tmp(2) = tmp(2)
95 C current time
96 tmp(3) = myTime
97 C timestep
98 tmp(4) = flt_int_traj
99 C total number of timesteps
100 tmp(5) = npart_times + 1.
101 C total number of floats
102 tmp(6) = max_npart
103 DO ii=7,imax
104 tmp(ii) = 0.
105 ENDDO
106
107 ioUnit = -1
108 CALL MDS_WRITEVEC_LOC( fn, precFloat64, ioUnit,
109 & 'RL', imax, tmp, dummyRS,
110 & bi,bj,-1, myIter, myThid )
111
112 #ifdef ALLOW_EXCH2
113 nT = W2_myTileList(bi,bj)
114 i0x = DFLOAT( exch2_txGlobalo(nT) - 1 )
115 j0y = DFLOAT( exch2_tyGlobalo(nT) - 1 )
116 #else
117 i0x = DFLOAT( myXGlobalLo-1 + (bi-1)*sNx )
118 j0y = DFLOAT( myYGlobalLo-1 + (bj-1)*sNy )
119 #endif
120 DO ip=1,npart_tile(bi,bj)
121
122 ix = ipart(ip,bi,bj)
123 jy = jpart(ip,bi,bj)
124 CALL FLT_MAP_IJLOCAL2XY( xx, yy,
125 I ix, jy, bi,bj, myThid )
126 zz = FLT_MAP_K2R( kpart(ip,bi,bj),bi,bj,myThid )
127 kp = NINT(kpart(ip,bi,bj))
128 tmp(1) = npart(ip,bi,bj)
129 tmp(2) = myTime
130 tmp(3) = xx
131 tmp(4) = yy
132 tmp(5) = zz
133 tmp(6) = ix + i0x
134 tmp(7) = jy + j0y
135 tmp(8) = kpart(ip,bi,bj)
136
137 IF ( ( myTime.GE.tstart(ip,bi,bj)) .AND.
138 & ( tend(ip,bi,bj).EQ.-1. .OR. myTime.LE.tend(ip,bi,bj))
139 & ) THEN
140
141 IF ( kp.LT.1 .OR. kp.GT.Nr ) THEN
142 WRITE(msgBuf,'(2A,I8)') '** WARNING ** FLT_TRAJ: ',
143 & ' illegal value for kp=',kp
144 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
145 & SQUEEZE_RIGHT, myThid )
146 WRITE(msgBuf,'(A,1P5E20.13)')
147 & ' FLT_TRAJ: ', (tmp(ii),ii=1,5)
148 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
149 & SQUEEZE_RIGHT, myThid )
150 c CALL PRINT_ERROR( msgBuf, myThid )
151 c STOP 'ABNORMAL END: S/R FLT_TRAJ'
152 C-- jmc: not sure if this is right but added to avoid Pb in FLT_BILINEAR:
153 kp = MIN( MAX(kp,1), Nr)
154 ENDIF
155
156 CALL FLT_BILINEAR (ix,jy,uu,uVel, kp,1,bi,bj,myThid)
157 CALL FLT_BILINEAR (ix,jy,vv,vVel, kp,2,bi,bj,myThid)
158 CALL FLT_BILINEAR2D(ix,jy,pp,etaN, 0,bi,bj,myThid)
159 CALL FLT_BILINEAR (ix,jy,tt,theta, kp,0,bi,bj,myThid)
160 CALL FLT_BILINEAR (ix,jy,ss,salt, kp,0,bi,bj,myThid)
161
162 tmp( 9) = pp
163 tmp(10) = uu
164 tmp(11) = vv
165 tmp(12) = tt
166 tmp(13) = ss
167 ELSE
168 tmp( 9) = flt_nan
169 tmp(10) = flt_nan
170 tmp(11) = flt_nan
171 tmp(12) = flt_nan
172 tmp(13) = flt_nan
173 ENDIF
174
175 C (3) WRITE float positions into file
176 irecord = npart_read+ip+1
177 IF ( ip.NE.npart_tile(bi,bj) ) irecord = -irecord
178 CALL MDS_WRITEVEC_LOC( fn, precFloat64, ioUnit,
179 & 'RL', imax, tmp, dummyRS,
180 & bi,bj,irecord, myIter, myThid )
181
182 ENDDO
183 CLOSE( ioUnit )
184
185 ENDDO
186 ENDDO
187
188 RETURN
189 END

  ViewVC Help
Powered by ViewVC 1.1.22