/[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.2 - (show annotations) (download)
Wed Dec 3 01:37:45 2008 UTC (15 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint61g
Changes since 1.1: +116 -105 lines
- move FLT_CPPOPTIONS.h to FLT_OPTIONS.h (standard name)
- add warning when kp is "out-off range" but continue.

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

  ViewVC Help
Powered by ViewVC 1.1.22