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

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

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


Revision 1.2 - (hide 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 jmc 1.2 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 adcroft 1.1
4 jmc 1.2 #include "FLT_OPTIONS.h"
5 adcroft 1.1
6    
7 jmc 1.2 SUBROUTINE FLT_TRAJ (
8     I myIter,
9     I myTime,
10 adcroft 1.1 I myThid
11     & )
12    
13 jmc 1.2 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 adcroft 1.1
24 jmc 1.2 C == global variables ==
25 adcroft 1.1
26 jmc 1.2 #include "SIZE.h"
27 adcroft 1.1 #include "EEPARAMS.h"
28 jmc 1.2 #include "PARAMS.h"
29     #include "GRID.h"
30 adcroft 1.1 #include "DYNVARS.h"
31     #include "SOLVE_FOR_PRESSURE.h"
32     #include "FLT.h"
33     c#include "UNITS.h"
34    
35 jmc 1.2 C == routine arguments ==
36 adcroft 1.1
37 jmc 1.2 INTEGER myIter, myThid
38     _RL myTime
39 adcroft 1.1 INTEGER bi, bj, imax
40 jmc 1.2 PARAMETER (imax=10)
41 adcroft 1.1
42 jmc 1.2 C == local variables ==
43 adcroft 1.1
44 jmc 1.2 INTEGER ip, kp, ii
45 adcroft 1.1 _RL xx, yy, xlo, xhi, ylo, yhi
46     _RL uu,vv,ww,tt,ss, pp
47     _RL global2local_i
48     _RL global2local_j
49 jmc 1.2
50     INTEGER irecord
51 adcroft 1.1 _RL tmp(imax)
52     _RL npart_read,npart_times
53     CHARACTER*(MAX_LEN_FNAM) fn
54 jmc 1.2 CHARACTER*(MAX_LEN_MBUF) msgBuf
55 adcroft 1.1
56     C Functions
57 jmc 1.2 INTEGER ILNBLNK
58 adcroft 1.1 C Local variables
59 jmc 1.2 CHARACTER*(80) dataFName
60     INTEGER iG,jG,IL
61     LOGICAL exst
62     LOGICAL globalFile
63 adcroft 1.1
64 jmc 1.2 C == end of interface ==
65 adcroft 1.1
66     fn = 'float_trajectories'
67    
68    
69     DO bj=myByLo(myThid),myByHi(myThid)
70     DO bi=myBxLo(myThid),myBxHi(myThid)
71    
72 jmc 1.2 C (1) read actual number floats from file (if exists)
73 adcroft 1.1 IL=ILNBLNK( fn )
74     iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles
75     jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles
76 jmc 1.2 WRITE(dataFname(1:80),'(2a,i3.3,a,i3.3,a)')
77 adcroft 1.1 & fn(1:IL),'.',iG,'.',jG,'.data'
78 jmc 1.2 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 adcroft 1.1 npart_read = tmp(1)
83     npart_times = tmp(5)
84 jmc 1.2 ELSE
85 adcroft 1.1 npart_read = 0.
86     npart_times = 0.
87 jmc 1.2 tmp(2) = myTime
88     ENDIF
89 adcroft 1.1
90 jmc 1.2 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 adcroft 1.1 tmp(1) = DBLE(npart_tile(bi,bj))+npart_read
95 jmc 1.2 C first time of writing floats (do not change when written)
96 adcroft 1.1 c tmp(2) = tmp(2)
97 jmc 1.2 C current time
98     tmp(3) = myTime
99     C timestep
100 adcroft 1.1 tmp(4) = flt_int_traj
101 jmc 1.2 C total number of timesteps
102 adcroft 1.1 tmp(5) = npart_times + 1.
103 jmc 1.2 C total number of floats
104 adcroft 1.1 tmp(6) = max_npart
105 jmc 1.2 DO ip=7,imax
106 adcroft 1.1 tmp(ip) = 0.
107 jmc 1.2 ENDDO
108 adcroft 1.1
109 jmc 1.2 CALL MDSWRITEVECTOR(fn,64,.false.,'RL',imax,tmp,bi,bj,1,
110     & myIter,myThid)
111 adcroft 1.1
112 jmc 1.2 DO ip=1,npart_tile(bi,bj)
113 adcroft 1.1
114 jmc 1.2 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 adcroft 1.1 tmp(1) = npart(ip,bi,bj)
118 jmc 1.2 tmp(2) = myTime
119     tmp(3) = xpart(ip,bi,bj)
120     tmp(4) = ypart(ip,bi,bj)
121 adcroft 1.1 tmp(5) = kpart(ip,bi,bj)
122    
123 jmc 1.2 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 adcroft 1.1
170     irecord=npart_read+ip+1
171 jmc 1.2 CALL MDSWRITEVECTOR(fn,64,.false.,'RL',imax,tmp,bi,bj,
172     & irecord,myIter,myThid)
173 adcroft 1.1
174 jmc 1.2 ENDDO
175 adcroft 1.1
176     ENDDO
177     ENDDO
178    
179 jmc 1.2 RETURN
180     END

  ViewVC Help
Powered by ViewVC 1.1.22