1 | MODULE flodom |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE flodom *** |
---|
4 | !! Ocean floats : domain |
---|
5 | !!====================================================================== |
---|
6 | !! History : OPA ! 1998-07 (Y.Drillet, CLIPPER) Original code |
---|
7 | !! NEMO_3.3.1 ! 2011-09 (C.Bricaud,S.Law-Chune Mercator-Ocean): |
---|
8 | ! add Ariane convention, Comsecitc changes |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | #if defined key_floats || defined key_esopa |
---|
11 | !!---------------------------------------------------------------------- |
---|
12 | !! 'key_floats' float trajectories |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | !! flo_dom : initialization of floats |
---|
15 | !! add_new_floats : add new floats (long/lat/depth) |
---|
16 | !! add_new_ariane_floats : add new floats with araine convention (i/j/k) |
---|
17 | !! findmesh : compute index of position |
---|
18 | !! dstnce : compute distance between face mesh and floats |
---|
19 | !!---------------------------------------------------------------------- |
---|
20 | USE oce ! ocean dynamics and tracers |
---|
21 | USE dom_oce ! ocean space and time domain |
---|
22 | USE flo_oce ! ocean drifting floats |
---|
23 | USE in_out_manager ! I/O manager |
---|
24 | USE lib_mpp ! distribued memory computing library |
---|
25 | |
---|
26 | IMPLICIT NONE |
---|
27 | PRIVATE |
---|
28 | |
---|
29 | PUBLIC flo_dom ! routine called by floats.F90 |
---|
30 | |
---|
31 | CHARACTER (len=21) :: clname1 = 'init_float' ! floats initialisation filename |
---|
32 | CHARACTER (len=21) :: clname2 = 'init_float_ariane' ! ariane floats initialisation filename |
---|
33 | |
---|
34 | !! * Substitutions |
---|
35 | # include "domzgr_substitute.h90" |
---|
36 | !!---------------------------------------------------------------------- |
---|
37 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
38 | !! $Id$ |
---|
39 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
40 | !!---------------------------------------------------------------------- |
---|
41 | CONTAINS |
---|
42 | |
---|
43 | SUBROUTINE flo_dom |
---|
44 | !! --------------------------------------------------------------------- |
---|
45 | !! *** ROUTINE flo_dom *** |
---|
46 | !! |
---|
47 | !! ** Purpose : Initialisation of floats |
---|
48 | !! |
---|
49 | !! ** Method : We put the floats in the domain with the latitude, |
---|
50 | !! the longitude (degree) and the depth (m). |
---|
51 | !!---------------------------------------------------------------------- |
---|
52 | INTEGER :: jfl ! dummy loop |
---|
53 | INTEGER :: inum ! logical unit for file read |
---|
54 | !!--------------------------------------------------------------------- |
---|
55 | |
---|
56 | ! Initialisation with the geographical position or restart |
---|
57 | |
---|
58 | IF(lwp) WRITE(numout,*) 'flo_dom : compute initial position of floats' |
---|
59 | IF(lwp) WRITE(numout,*) '~~~~~~~~' |
---|
60 | IF(lwp) WRITE(numout,*) ' jpnfl = ',jpnfl |
---|
61 | |
---|
62 | !-------------------------! |
---|
63 | ! FLOAT RESTART FILE READ ! |
---|
64 | !-------------------------! |
---|
65 | IF( ln_rstflo )THEN |
---|
66 | |
---|
67 | IF(lwp) WRITE(numout,*) ' float restart file read' |
---|
68 | |
---|
69 | ! open the restart file |
---|
70 | !---------------------- |
---|
71 | CALL ctl_opn( inum, 'restart_float', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) |
---|
72 | |
---|
73 | ! read of the restart file |
---|
74 | READ(inum,*) ( tpifl (jfl), jfl=1, jpnrstflo), & |
---|
75 | ( tpjfl (jfl), jfl=1, jpnrstflo), & |
---|
76 | ( tpkfl (jfl), jfl=1, jpnrstflo), & |
---|
77 | ( nisobfl(jfl), jfl=1, jpnrstflo), & |
---|
78 | ( ngrpfl (jfl), jfl=1, jpnrstflo) |
---|
79 | CLOSE(inum) |
---|
80 | |
---|
81 | ! if we want a surface drift ( like PROVOR floats ) |
---|
82 | IF( ln_argo ) nisobfl(1:jpnrstflo) = 0 |
---|
83 | |
---|
84 | ! It is possible to add new floats. |
---|
85 | !--------------------------------- |
---|
86 | IF( jpnfl > jpnrstflo )THEN |
---|
87 | |
---|
88 | IF(lwp) WRITE(numout,*) ' add new floats' |
---|
89 | |
---|
90 | IF( ln_ariane )THEN !Add new floats with ariane convention |
---|
91 | CALL add_new_ariane_floats(jpnrstflo+1,jpnfl) |
---|
92 | ELSE !Add new floats with long/lat convention |
---|
93 | CALL add_new_floats(jpnrstflo+1,jpnfl) |
---|
94 | ENDIF |
---|
95 | ENDIF |
---|
96 | |
---|
97 | !--------------------------------------! |
---|
98 | ! FLOAT INITILISATION: NO RESTART FILE ! |
---|
99 | !--------------------------------------! |
---|
100 | ELSE !ln_rstflo |
---|
101 | |
---|
102 | IF( ln_ariane )THEN !Add new floats with ariane convention |
---|
103 | CALL add_new_ariane_floats(1,jpnfl) |
---|
104 | ELSE !Add new floats with long/lat convention |
---|
105 | CALL add_new_floats(1,jpnfl) |
---|
106 | ENDIF |
---|
107 | |
---|
108 | ENDIF |
---|
109 | |
---|
110 | END SUBROUTINE flo_dom |
---|
111 | |
---|
112 | SUBROUTINE add_new_floats(kfl_start, kfl_end) |
---|
113 | !! ------------------------------------------------------------- |
---|
114 | !! *** SUBROUTINE add_new_arianefloats *** |
---|
115 | !! |
---|
116 | !! ** Purpose : |
---|
117 | !! |
---|
118 | !! First initialisation of floats |
---|
119 | !! the initials positions of floats are written in a file |
---|
120 | !! with a variable to know if it is a isobar float a number |
---|
121 | !! to identified who want the trajectories of this float and |
---|
122 | !! an index for the number of the float |
---|
123 | !! open the init file |
---|
124 | !! |
---|
125 | !! ** Method : |
---|
126 | !!---------------------------------------------------------------------- |
---|
127 | INTEGER, INTENT(in) :: kfl_start, kfl_end |
---|
128 | !! |
---|
129 | INTEGER :: inum ! file unit |
---|
130 | INTEGER :: jfl,ji, jj, jk ! dummy loop indices |
---|
131 | INTEGER :: itrash ! trash var for reading |
---|
132 | INTEGER :: ifl ! number of floats to read |
---|
133 | REAL(wp) :: zdxab, zdyad |
---|
134 | LOGICAL :: llinmesh |
---|
135 | CHARACTER(len=80) :: cltmp |
---|
136 | |
---|
137 | INTEGER , DIMENSION(jpnfl) :: iimfl, ijmfl, ikmfl ! index mesh of floats |
---|
138 | INTEGER , DIMENSION(jpnfl) :: idomfl, ivtest, ihtest ! - |
---|
139 | REAL(wp), DIMENSION(jpnfl) :: zgifl, zgjfl, zgkfl |
---|
140 | !!--------------------------------------------------------------------- |
---|
141 | ifl = kfl_end-kfl_start+1 |
---|
142 | |
---|
143 | ! we get the init values |
---|
144 | !----------------------- |
---|
145 | CALL ctl_opn( inum , clname1, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) |
---|
146 | DO jfl = kfl_start,kfl_end |
---|
147 | READ(inum,*) flxx(jfl),flyy(jfl),flzz(jfl), nisobfl(jfl),ngrpfl(jfl),itrash |
---|
148 | if(lwp)write(numout,*)'read:',jfl,flxx(jfl),flyy(jfl),flzz(jfl), nisobfl(jfl),ngrpfl(jfl),itrash ; call flush(numout) |
---|
149 | END DO |
---|
150 | CLOSE(inum) |
---|
151 | |
---|
152 | ! Test to find the grid point coordonate with the geographical position |
---|
153 | !---------------------------------------------------------------------- |
---|
154 | DO jfl = kfl_start,kfl_end |
---|
155 | ihtest(jfl) = 0 |
---|
156 | ivtest(jfl) = 0 |
---|
157 | ikmfl(jfl) = 0 |
---|
158 | # if defined key_mpp_mpi |
---|
159 | DO ji = MAX(nldi,2), nlei |
---|
160 | DO jj = MAX(nldj,2), nlej ! NO vector opt. |
---|
161 | # else |
---|
162 | DO ji = 2, jpi |
---|
163 | DO jj = 2, jpj ! NO vector opt. |
---|
164 | # endif |
---|
165 | ! For each float we find the indexes of the mesh |
---|
166 | CALL findmesh(glamf(ji-1,jj-1),gphif(ji-1,jj-1), & |
---|
167 | glamf(ji-1,jj ),gphif(ji-1,jj ), & |
---|
168 | glamf(ji ,jj ),gphif(ji ,jj ), & |
---|
169 | glamf(ji ,jj-1),gphif(ji ,jj-1), & |
---|
170 | flxx(jfl) ,flyy(jfl) , & |
---|
171 | glamt(ji ,jj ),gphit(ji ,jj ), llinmesh) |
---|
172 | IF( llinmesh )THEN |
---|
173 | iimfl(jfl) = ji |
---|
174 | ijmfl(jfl) = jj |
---|
175 | ihtest(jfl) = ihtest(jfl)+1 |
---|
176 | DO jk = 1, jpk-1 |
---|
177 | IF( (fsdepw(ji,jj,jk) <= flzz(jfl)) .AND. (fsdepw(ji,jj,jk+1) > flzz(jfl)) ) THEN |
---|
178 | ikmfl(jfl) = jk |
---|
179 | ivtest(jfl) = ivtest(jfl) + 1 |
---|
180 | ENDIF |
---|
181 | END DO |
---|
182 | ENDIF |
---|
183 | END DO |
---|
184 | END DO |
---|
185 | |
---|
186 | ! If the float is in a mesh computed by an other processor we put iimfl=ijmfl=-1 |
---|
187 | IF( ihtest(jfl) == 0 ) THEN |
---|
188 | iimfl(jfl) = -1 |
---|
189 | ijmfl(jfl) = -1 |
---|
190 | ENDIF |
---|
191 | END DO |
---|
192 | |
---|
193 | !Test if each float is in one and only one proc |
---|
194 | !---------------------------------------------- |
---|
195 | IF( lk_mpp ) THEN |
---|
196 | CALL mpp_sum(ihtest,jpnfl) |
---|
197 | CALL mpp_sum(ivtest,jpnfl) |
---|
198 | ENDIF |
---|
199 | DO jfl = kfl_start,kfl_end |
---|
200 | |
---|
201 | IF( (ihtest(jfl) > 1 ) .OR. ( ivtest(jfl) > 1) ) THEN |
---|
202 | WRITE(cltmp,'(A10,i4.4,A20)' )'THE FLOAT',jfl,' IS NOT IN ONLY ONE MESH' |
---|
203 | CALL ctl_stop('STOP',TRIM(cltmp) ) |
---|
204 | ENDIF |
---|
205 | IF( (ihtest(jfl) == 0) ) THEN |
---|
206 | WRITE(cltmp,'(A10,i4.4,A20)' )'THE FLOAT',jfl,' IS IN NO MESH' |
---|
207 | CALL ctl_stop('STOP',TRIM(cltmp) ) |
---|
208 | ENDIF |
---|
209 | END DO |
---|
210 | |
---|
211 | ! We compute the distance between the float and the face of the mesh |
---|
212 | !------------------------------------------------------------------- |
---|
213 | DO jfl = kfl_start,kfl_end |
---|
214 | |
---|
215 | ! Made only if the float is in the domain of the processor |
---|
216 | IF( (iimfl(jfl) >= 0) .AND. (ijmfl(jfl) >= 0) ) THEN |
---|
217 | |
---|
218 | ! TEST TO KNOW IF THE FLOAT IS NOT INITIALISED IN THE COAST |
---|
219 | idomfl(jfl) = 0 |
---|
220 | IF( tmask(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)) == 0. ) idomfl(jfl) = 1 |
---|
221 | |
---|
222 | ! Computation of the distance between the float and the faces of the mesh |
---|
223 | ! zdxab |
---|
224 | ! . |
---|
225 | ! B----.---------C |
---|
226 | ! | . | |
---|
227 | ! |<------>flo | |
---|
228 | ! | ^ | |
---|
229 | ! | |.....|....zdyad |
---|
230 | ! | | | |
---|
231 | ! A--------|-----D |
---|
232 | ! |
---|
233 | zdxab = dstnce( flxx(jfl), flyy(jfl), glamf(iimfl(jfl)-1,ijmfl(jfl)-1), flyy(jfl) ) |
---|
234 | zdyad = dstnce( flxx(jfl), flyy(jfl), flxx(jfl), gphif(iimfl(jfl)-1,ijmfl(jfl)-1) ) |
---|
235 | |
---|
236 | ! Translation of this distances (in meter) in indexes |
---|
237 | zgifl(jfl)= (iimfl(jfl)-0.5) + zdxab/e1u(iimfl(jfl)-1,ijmfl(jfl)) + (mig(1)-jpizoom) |
---|
238 | zgjfl(jfl)= (ijmfl(jfl)-0.5) + zdyad/e2v(iimfl(jfl),ijmfl(jfl)-1) + (mjg(1)-jpjzoom) |
---|
239 | zgkfl(jfl) = (( fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) - flzz(jfl) )* ikmfl(jfl)) & |
---|
240 | & / ( fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) & |
---|
241 | & - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl) ) ) & |
---|
242 | & + (( flzz(jfl)-fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)) ) *(ikmfl(jfl)+1)) & |
---|
243 | & / ( fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)+1) & |
---|
244 | & - fsdepw(iimfl(jfl),ijmfl(jfl),ikmfl(jfl)) ) |
---|
245 | ELSE |
---|
246 | zgifl(jfl) = 0.e0 |
---|
247 | zgjfl(jfl) = 0.e0 |
---|
248 | zgkfl(jfl) = 0.e0 |
---|
249 | ENDIF |
---|
250 | |
---|
251 | END DO |
---|
252 | |
---|
253 | ! The sum of all the arrays zgifl, zgjfl, zgkfl give 3 arrays with the positions of all the floats. |
---|
254 | IF( lk_mpp ) THEN |
---|
255 | CALL mpp_sum( zgjfl, ifl ) ! sums over the global domain |
---|
256 | CALL mpp_sum( zgkfl, ifl ) |
---|
257 | ENDIF |
---|
258 | |
---|
259 | DO jfl = kfl_start,kfl_end |
---|
260 | tpifl(jfl) = zgifl(jfl) |
---|
261 | tpjfl(jfl) = zgjfl(jfl) |
---|
262 | tpkfl(jfl) = zgkfl(jfl) |
---|
263 | END DO |
---|
264 | |
---|
265 | ! WARNING : initial position not in the sea |
---|
266 | IF( .NOT. ln_rstflo ) THEN |
---|
267 | DO jfl = kfl_start,kfl_end |
---|
268 | IF( idomfl(jfl) == 1 ) THEN |
---|
269 | IF(lwp) WRITE(numout,*)'*****************************' |
---|
270 | IF(lwp) WRITE(numout,*)'!!!!!!! WARNING !!!!!!!!!!' |
---|
271 | IF(lwp) WRITE(numout,*)'*****************************' |
---|
272 | IF(lwp) WRITE(numout,*)'The float number',jfl,'is out of the sea.' |
---|
273 | IF(lwp) WRITE(numout,*)'geographical position',flxx(jfl),flyy(jfl),flzz(jfl) |
---|
274 | IF(lwp) WRITE(numout,*)'index position',tpifl(jfl),tpjfl(jfl),tpkfl(jfl) |
---|
275 | ENDIF |
---|
276 | END DO |
---|
277 | ENDIF |
---|
278 | |
---|
279 | END SUBROUTINE add_new_floats |
---|
280 | |
---|
281 | SUBROUTINE add_new_ariane_floats(kfl_start, kfl_end) |
---|
282 | !! ------------------------------------------------------------- |
---|
283 | !! *** SUBROUTINE add_new_arianefloats *** |
---|
284 | !! |
---|
285 | !! ** Purpose : |
---|
286 | !! First initialisation of floats with ariane convention |
---|
287 | !! |
---|
288 | !! The indexes are read directly from file (warning ariane |
---|
289 | !! convention, are refered to |
---|
290 | !! U,V,W grids - and not T-) |
---|
291 | !! The isobar advection is managed with the sign of tpkfl ( >0 -> 3D |
---|
292 | !! advection, <0 -> 2D) |
---|
293 | !! Some variables are not read, as - gl : time index; 4th |
---|
294 | !! column |
---|
295 | !! - transport : transport ; 5th |
---|
296 | !! column |
---|
297 | !! and paste in the jtrash var |
---|
298 | !! At the end, ones need to replace the indexes on T grid |
---|
299 | !! RMQ : there is no float groups identification ! |
---|
300 | !! |
---|
301 | !! |
---|
302 | !! ** Method : |
---|
303 | !!---------------------------------------------------------------------- |
---|
304 | INTEGER, INTENT(in) :: kfl_start, kfl_end |
---|
305 | !! |
---|
306 | INTEGER :: inum ! file unit |
---|
307 | INTEGER :: ierr, ifl |
---|
308 | INTEGER :: jfl, jfl1 ! dummy loop indices |
---|
309 | INTEGER :: itrash ! trash var for reading |
---|
310 | CHARACTER(len=80) :: cltmp |
---|
311 | |
---|
312 | !!---------------------------------------------------------------------- |
---|
313 | nisobfl(kfl_start:kfl_end) = 1 ! we assume that by default we want 3D advection |
---|
314 | |
---|
315 | ifl = kfl_end - kfl_start + 1 ! number of floats to read |
---|
316 | |
---|
317 | ! we check that the number of floats in the init_file are consistant with the namelist |
---|
318 | IF( lwp ) THEN |
---|
319 | |
---|
320 | jfl1=0 |
---|
321 | CALL ctl_opn( inum, clname2, 'OLD', 'FORMATTED', 'SEQUENTIAL', 1, numout, .TRUE., 1 ) |
---|
322 | DO WHILE (ierr .GE. 0) |
---|
323 | jfl1=jfl1+1 |
---|
324 | READ (inum,*, iostat=ierr) |
---|
325 | END DO |
---|
326 | CLOSE(inum) |
---|
327 | IF( (jfl1-1) .NE. ifl )THEN |
---|
328 | WRITE(cltmp,'(A20,A20,A3,i4.4,A10,i4.4)')"the number of floats in",TRIM(clname2), & |
---|
329 | " = ",jfl1," is not equal to jfl= ",ifl |
---|
330 | CALL ctl_stop('STOP',TRIM(cltmp) ) |
---|
331 | ENDIF |
---|
332 | |
---|
333 | ENDIF |
---|
334 | |
---|
335 | ! we get the init values |
---|
336 | CALL ctl_opn( inum, clname2, 'OLD', 'FORMATTED', 'SEQUENTIAL', 1, numout, .TRUE., 1 ) |
---|
337 | DO jfl = kfl_start, kfl_end |
---|
338 | READ(inum,*) tpifl(jfl),tpjfl(jfl),tpkfl(jfl),itrash, itrash |
---|
339 | |
---|
340 | IF ( tpkfl(jfl) .LT. 0. ) nisobfl(jfl) = 0 !set the 2D advection according to init_float |
---|
341 | ngrpfl(jfl)=jfl |
---|
342 | END DO |
---|
343 | |
---|
344 | ! conversion from ariane index to T grid index |
---|
345 | tpkfl(kfl_start:kfl_end) = abs(tpkfl)-0.5 ! reversed vertical axis |
---|
346 | tpifl(kfl_start:kfl_end) = tpifl+0.5 |
---|
347 | tpjfl(kfl_start:kfl_end) = tpjfl+0.5 |
---|
348 | |
---|
349 | |
---|
350 | END SUBROUTINE add_new_ariane_floats |
---|
351 | |
---|
352 | |
---|
353 | SUBROUTINE findmesh( pax, pay, pbx, pby, & |
---|
354 | pcx, pcy, pdx, pdy, & |
---|
355 | px ,py ,ptx, pty, ldinmesh ) |
---|
356 | !! ------------------------------------------------------------- |
---|
357 | !! *** ROUTINE findmesh *** |
---|
358 | !! |
---|
359 | !! ** Purpose : Find the index of mesh for the point spx spy |
---|
360 | !! |
---|
361 | !! ** Method : |
---|
362 | !!---------------------------------------------------------------------- |
---|
363 | REAL(wp) :: & |
---|
364 | pax, pay, pbx, pby, & ! ??? |
---|
365 | pcx, pcy, pdx, pdy, & ! ??? |
---|
366 | px, py, & ! longitude and latitude |
---|
367 | ptx, pty ! ??? |
---|
368 | LOGICAL :: ldinmesh ! ??? |
---|
369 | !! |
---|
370 | REAL(wp) :: zabt, zbct, zcdt, zdat, zabpt, zbcpt, zcdpt, zdapt |
---|
371 | !!--------------------------------------------------------------------- |
---|
372 | !! Statement function |
---|
373 | REAL(wp) :: fsline |
---|
374 | REAL(wp) :: psax, psay, psbx, psby, psx, psy |
---|
375 | fsline( psax, psay, psbx, psby, psx, psy ) = psy * ( psbx - psax ) & |
---|
376 | & - psx * ( psby - psay ) & |
---|
377 | & + psax * psby - psay * psbx |
---|
378 | !!--------------------------------------------------------------------- |
---|
379 | |
---|
380 | ! 4 semi plane defined by the 4 points and including the T point |
---|
381 | zabt = fsline(pax,pay,pbx,pby,ptx,pty) |
---|
382 | zbct = fsline(pbx,pby,pcx,pcy,ptx,pty) |
---|
383 | zcdt = fsline(pcx,pcy,pdx,pdy,ptx,pty) |
---|
384 | zdat = fsline(pdx,pdy,pax,pay,ptx,pty) |
---|
385 | |
---|
386 | ! 4 semi plane defined by the 4 points and including the extrememity |
---|
387 | zabpt = fsline(pax,pay,pbx,pby,px,py) |
---|
388 | zbcpt = fsline(pbx,pby,pcx,pcy,px,py) |
---|
389 | zcdpt = fsline(pcx,pcy,pdx,pdy,px,py) |
---|
390 | zdapt = fsline(pdx,pdy,pax,pay,px,py) |
---|
391 | |
---|
392 | ! We compare the semi plane T with the semi plane including the point |
---|
393 | ! to know if it is in this mesh. |
---|
394 | ! For numerical reasons it is possible that for a point which is on |
---|
395 | ! the line we don't have exactly zero with fsline function. We want |
---|
396 | ! that a point can't be in 2 mesh in the same time, so we put the |
---|
397 | ! coefficient to zero if it is smaller than 1.E-12 |
---|
398 | |
---|
399 | IF( ABS(zabpt) <= 1.E-12 ) zabpt = 0. |
---|
400 | IF( ABS(zbcpt) <= 1.E-12 ) zbcpt = 0. |
---|
401 | IF( ABS(zcdpt) <= 1.E-12 ) zcdpt = 0. |
---|
402 | IF( ABS(zdapt) <= 1.E-12 ) zdapt = 0. |
---|
403 | IF( (zabt*zabpt > 0.) .AND. (zbct*zbcpt >= 0. ) .AND. ( zcdt*zcdpt >= 0. ) .AND. ( zdat*zdapt > 0. ) & |
---|
404 | .AND. ( px <= MAX(pcx,pdx) ) .AND. ( px >= MIN(pax,pbx) ) & |
---|
405 | .AND. ( py <= MAX(pby,pcy) ) .AND. ( py >= MIN(pay,pdy) ) ) THEN |
---|
406 | ldinmesh=.TRUE. |
---|
407 | ELSE |
---|
408 | ldinmesh=.FALSE. |
---|
409 | ENDIF |
---|
410 | ! |
---|
411 | END SUBROUTINE findmesh |
---|
412 | |
---|
413 | |
---|
414 | FUNCTION dstnce( pla1, phi1, pla2, phi2 ) |
---|
415 | !! ------------------------------------------------------------- |
---|
416 | !! *** Function dstnce *** |
---|
417 | !! |
---|
418 | !! ** Purpose : returns distance (in m) between two geographical |
---|
419 | !! points |
---|
420 | !! ** Method : |
---|
421 | !!---------------------------------------------------------------------- |
---|
422 | REAL(wp), INTENT(in) :: pla1, phi1, pla2, phi2 ! ??? |
---|
423 | !! |
---|
424 | REAL(wp) :: dly1, dly2, dlx1, dlx2, dlx, dls, dld, dpi |
---|
425 | REAL(wp) :: dstnce |
---|
426 | !!--------------------------------------------------------------------- |
---|
427 | ! |
---|
428 | dpi = 2.* ASIN(1.) |
---|
429 | dls = dpi / 180. |
---|
430 | dly1 = phi1 * dls |
---|
431 | dly2 = phi2 * dls |
---|
432 | dlx1 = pla1 * dls |
---|
433 | dlx2 = pla2 * dls |
---|
434 | ! |
---|
435 | dlx = SIN(dly1) * SIN(dly2) + COS(dly1) * COS(dly2) * COS(dlx2-dlx1) |
---|
436 | ! |
---|
437 | IF( ABS(dlx) > 1.0 ) dlx = 1.0 |
---|
438 | ! |
---|
439 | dld = ATAN(DSQRT( ( 1-dlx )/( 1+dlx ) )) * 222.24 / dls |
---|
440 | dstnce = dld * 1000. |
---|
441 | ! |
---|
442 | END FUNCTION dstnce |
---|
443 | |
---|
444 | |
---|
445 | # else |
---|
446 | !!---------------------------------------------------------------------- |
---|
447 | !! Default option Empty module |
---|
448 | !!---------------------------------------------------------------------- |
---|
449 | CONTAINS |
---|
450 | SUBROUTINE flo_dom ! Empty routine |
---|
451 | WRITE(*,*) 'flo_dom: : You should not have seen this print! error?' |
---|
452 | END SUBROUTINE flo_dom |
---|
453 | #endif |
---|
454 | |
---|
455 | !!====================================================================== |
---|
456 | END MODULE flodom |
---|