/[MITgcm]/MITgcm/compare01/src/diags.F
ViewVC logotype

Annotation of /MITgcm/compare01/src/diags.F

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


Revision 1.1 - (hide annotations) (download)
Mon May 25 20:21:04 1998 UTC (27 years, 1 month ago) by cnh
Branch: MAIN
CVS Tags: branch-atmos-merge-phase6, checkpoint24, checkpoint4, checkpoint7, checkpoint6, checkpoint26, checkpoint3, branch-atmos-merge-start, checkpoint27, checkpoint9, checkpoint8, checkpoint11, checkpoint10, checkpoint13, checkpoint12, checkpoint15, checkpoint18, checkpoint17, checkpoint16, checkpoint19, checkpoint32, checkpoint31, branch-atmos-merge-zonalfilt, branch-atmos-merge-shapiro, checkpoint5, branch-atmos-merge-freeze, branch-point-rdot, checkpoint14, checkpoint28, checkpoint29, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, checkpoint23, branch-atmos-merge-phase1, checkpoint25, branch-atmos-merge-phase3, branch-atmos-merge-phase2, checkpoint20, checkpoint21, checkpoint22
Branch point for: branch-atmos-merge, checkpoint7-4degree-ref, branch-rdot
Added version of compare01 reference code to repository.
Code committed is configured to produce same results as MITgcmUV

1 cnh 1.1 C $Id: diags.F,v 1.7 1997/06/21 02:00:03 cnh Exp $
2     C /---------------------------------------------------------------\
3     C |+| MIT General Circulation Modeling Package (GCMPACK) |+|
4     C |+| |+|
5     C |+| Copyright (c) 1993, 1994, 1995, 1996, 1997 |+|
6     C |+| |+|
7     C |+| All rights reserved |+|
8     C |+| |+|
9     C |+| This software is provided with absolutely NO WARRANTY. |+|
10     C |+| |+|
11     C |+| Permission is given to use this software for any |+|
12     C |+| non-commercial purpose provided that |+|
13     C |+| o Publications acknowledge any use of GCMPACK. |+|
14     C |+| o Alterations to the software are made freely and |+|
15     C |+| unconditionally available to all and any of GCMPACK |+|
16     C |+| authors without prejudice. |+|
17     C |+| |+|
18     C |+| All other uses, including redistribution in whole or |+|
19     C |+| in part, are forbidden. |+|
20     C |+| |+|
21     C |+| Chris Hill cnh@plume.mit.edu |+|
22     C \---------------------------------------------------------------/
23     C
24     C /---------------------------------------------------------------\
25     C ||| ************************************************** |||
26     C ||| * General Circulation Modeling Package (GCMPACK) * |||
27     C ||| ************************************************** |||
28     C ||| |||
29     C ||| MIT Ocean-Atmosphere Diagnostics Library |||
30     C ||| ======================================== |||
31     C ||| |||
32     C ||| Diagnostic routines that are compatible with the MIT |||
33     C ||| Ocean-Atmosphere Circulation Model. The diagnostics |||
34     C ||| use the same gridding and other conventions as the |||
35     C ||| Ocean-Atmosphere Model. They can be used in a stand |||
36     C ||| alone mode reading output from the Ocean-Atmosphere |||
37     C ||| Model or invoked with calls to the library routines |||
38     C ||| can be made during a dynamical run. |||
39     C \---------------------------------------------------------------/
40     #include "CPP_OPTIONS.h"
41     #include "CPP_MACROS.h"
42    
43     C |============|
44     C | diags.F |
45     C |============|
46     C o Contents
47     C DIAGS_ADD_BASIN
48     C DIAGS_CALC_AVE_T_S_AND_RHO
49     C DIAGS_CALC_MERID_PSI
50     C DIAGS_CALC_MLD
51     C DIAGS_CONTROL
52     C DIAGS_DUMP_MLD
53     C DIAGS_MIXED_LAYER_DEPTH
54     C DIAGS_MERIDIONAL_FLUX
55     C DIAGS_PRINT_AVE_T_S_AND_RHO
56     C DIAGS_READ_BASIN_MASK
57     C DIAGS_SHOW
58     C DIAGS_SHOW_BASINS
59    
60     C/-------------------------------------------------------------------\
61     C||| Procedure: DIAGS_ADD_BASIN |||
62     C|||===============================================================|||
63     C||| Function: Add a basin definition to the diagnostic |||
64     C||| objects set. |||
65     C||| Comments: |||
66     C\-------------------------------------------------------------------/
67     CStartofinterface
68     SUBROUTINE DIAGS_ADD_BASIN( bName, iErr )
69     IMPLICIT NONE
70     C /--------------------------------------------------------------\
71     C | Global data |
72     C \--------------------------------------------------------------/
73     #include "SIZE.h"
74     #include "OPERATORS.h"
75     #include "GRID.h"
76     #include "PARAMS.h"
77     #include "DIAGS.h"
78     #include "MASKS.h"
79     C /--------------------------------------------------------------\
80     C | Routine arguments |
81     C |==============================================================|
82     C | bName - Name of the basin. |
83     C | iErr - Error flag. |
84     C \--------------------------------------------------------------/
85     CHARACTER*(*) bName
86     INTEGER iErr
87     REAL X1, X2, X3
88     CEndofinterface
89    
90     CALL DIAGS_CONTROL (
91     & 'ADD_BASIN', bName, X1, X2, X3, iErr )
92    
93     RETURN
94     END
95    
96     C/-------------------------------------------------------------------\
97     C||| Procedure: DIAGS_CALC_AVE_T_S_AND_RHO |||
98     C|||===============================================================|||
99     C||| Function: Calculate the basin and whole domain average |||
100     C||| temperature, salinity and density. |||
101     C||| Average is calculated for each depth in the |||
102     C||| model. |||
103     C||| Comments: Result is stored in internal COMMON block. |||
104     C\-------------------------------------------------------------------/
105     CStartofinterface
106     SUBROUTINE DIAGS_CALC_AVE_T_S_AND_RHO(
107     I T, S )
108     IMPLICIT NONE
109     C /--------------------------------------------------------------\
110     C | Global data |
111     C \--------------------------------------------------------------/
112     #include "SIZE.h"
113     #include "OPERATORS.h"
114     #include "GRID.h"
115     #include "PARAMS.h"
116     #include "DIAGS.h"
117     #include "MASKS.h"
118     C /--------------------------------------------------------------\
119     C | Routine arguments |
120     C |==============================================================|
121     C | T - Model temperature field ( oC ). |
122     C | S - Model salinity field (ppt). |
123     C \--------------------------------------------------------------/
124     REAL T (_I3(Nz,Nx,Ny))
125     REAL S (_I3(Nz,Nx,Ny))
126     CEndofinterface
127     C /--------------------------------------------------------------\
128     C | Local variables |
129     C |==============================================================|
130     C | Nb, LEV - Loop counters. |
131     C | I, J, K - Loop counters. |
132     C | rho - Array to hold density |
133     C | basinVol- Accumulates volume of water in basin levels. |
134     C | basinT - Accumulates volume integrated T in basin levels. |
135     C | basinS - Accumulates volume integrated S in basin levels. |
136     C | basinRho- Accumulates volume integrated Rho in basin levels. |
137     C | vol - Temporary scalar holding cell volume. |
138     C \--------------------------------------------------------------/
139     INTEGER Nb, K, I, J
140     INTEGER LEV
141     REAL rho(_I3(Nz,Nx,Ny))
142     REAL basinVol
143     REAL basinT
144     REAL basinS
145     REAL basinRho
146     REAL vol
147     C Calculate sigmaTheta.
148     DO K=1,Nz
149     LEV=K
150     CALL UPDATE_RHO(T,S,LEV,'LINEAR','ABS_LOCAL', rho )
151     ENDDO
152     C Calculate basin averages.
153     DO Nb = 1, numberOfBasins
154     bAveTime(Nb) = currentTime
155     DO K=1,Nz
156     basinVol = 0.
157     basinT = 0.
158     basinS = 0.
159     basinRho = 0.
160     DO J=1,Ny
161     DO I=1,Nx
162     vol = ZA(_I3(K,I,J))*delps(K)
163     basinVol = basinVol+vol*basinMask(I,J,Nb)*PMASK(_I3(K,I,J))
164     basinT = basinT + T(_I3(K,I,J))*vol*basinMask(I,J,Nb)*PMASK(_I3(K,I,J))
165     basinS = basinS + S(_I3(K,I,J))*vol*basinMask(I,J,Nb)*PMASK(_I3(K,I,J))
166     basinRho = basinRho+RHO(_I3(K,I,J))*vol*basinMask(I,J,Nb)*PMASK(_I3(K,I,J))
167     ENDDO
168     ENDDO
169     IF ( basinVol .NE. 0. ) THEN
170     bAveT (K,Nb) = basinT/basinVol
171     bAveS (K,Nb) = basinS/basinVol
172     bAveRho(K,Nb) = basinRho/basinVol
173     ELSE
174     bAveT (K,Nb) = 0.
175     bAveS (K,Nb) = 0.
176     bAveRho(K,Nb) = 0.
177     ENDIF
178     ENDDO
179     ENDDO
180     RETURN
181     END
182    
183     C/-------------------------------------------------------------------\
184     C||| Procedure: DIAGS_CALC_MERID_PSI |||
185     C|||===============================================================|||
186     C||| Function: Calculate the meridional overturning |||
187     C||| Comments: Result is stored in internal COMMON block. |||
188     C\-------------------------------------------------------------------/
189     CStartofinterface
190     SUBROUTINE DIAGS_CALC_MERID_PSI(
191     I V )
192     IMPLICIT NONE
193     C /--------------------------------------------------------------\
194     C | Global data |
195     C \--------------------------------------------------------------/
196     #include "SIZE.h"
197     #include "OPERATORS.h"
198     #include "GRID.h"
199     #include "PARAMS.h"
200     #include "DIAGS.h"
201     #include "MASKS.h"
202     C /--------------------------------------------------------------\
203     C | Routine arguments |
204     C |==============================================================|
205     C | V - Meridional velocity ( m/s ). |
206     C \--------------------------------------------------------------/
207     REAL V (_I3(Nz,Nx,Ny))
208     CEndofinterface
209     C /--------------------------------------------------------------\
210     C | Local variables |
211     C |==============================================================|
212     C | I, J, K, Nb - Loop counters. |
213     C | depth - Temporary scalar holding depth. |
214     C \--------------------------------------------------------------/
215     INTEGER I, J, K, Nb
216     REAL depth
217     REAL totalFlux
218     REAL openArea
219     C /--------------------------------------------------------------\
220     C | Calculate psi YZ |
221     C \--------------------------------------------------------------/
222     DO Nb =1,numberOfBasins
223     DO K=Nz,1,-1
224     DO J=1,Ny
225     totalFlux = 0.
226     DO I=1,Nx
227     openArea =
228     & basinMask(I,J,Nb)*vMask(_I3(K,I,J))*yA(_I3(K,I,J))/g/ronil
229     totalFlux = totalFlux+openArea*V(_I3(K,I,J))
230     ENDDO
231     IF ( K .NE. Nz ) THEN
232     meridPsi(J,K,Nb) = meridPsi(J,K+1,Nb)+totalFlux
233     ELSE
234     meridPsi(J,K,Nb) = totalFlux
235     ENDIF
236     ENDDO
237     ENDDO
238     ENDDO
239     C
240     RETURN
241     END
242    
243     C/-------------------------------------------------------------------\
244     C||| Procedure: DIAGS_CALC_MLD |||
245     C|||===============================================================|||
246     C||| Function: Calculate the mixed layer depth. |||
247     C||| Comments: Result is stored in internal COMMON block. |||
248     C\-------------------------------------------------------------------/
249     CStartofinterface
250     SUBROUTINE DIAGS_CALC_MLD(
251     I T, S )
252     IMPLICIT NONE
253     C /--------------------------------------------------------------\
254     C | Global data |
255     C \--------------------------------------------------------------/
256     #include "SIZE.h"
257     #include "OPERATORS.h"
258     #include "GRID.h"
259     #include "PARAMS.h"
260     #include "DIAGS.h"
261     #include "MASKS.h"
262     C /--------------------------------------------------------------\
263     C | Routine arguments |
264     C |==============================================================|
265     C | T - Model temperature field ( oC ). |
266     C | S - Model salinity field (ppt). |
267     C \--------------------------------------------------------------/
268     REAL T (_I3(Nz,Nx,Ny))
269     REAL S (_I3(Nz,Nx,Ny))
270     CEndofinterface
271     C /--------------------------------------------------------------\
272     C | Local variables |
273     C |==============================================================|
274     C | I, J, K - Loop counters. |
275     C | rho - Array to hold density |
276     C | depth - Temporary scalar holding depth. |
277     C \--------------------------------------------------------------/
278     INTEGER K, I, J, LEV
279     REAL rho(_I3(Nz,Nx,Ny))
280     REAL depth
281     C Calculate sigma0.
282     DO K=1,Nz
283     LEV=K
284     CALL UPDATE_RHO(T,S,LEV,'LINEAR','ABS_SURFACE', rho )
285     ENDDO
286     C Calculate mixed layer depth.
287     depth = -delps(1)/G/RONIL/2
288     DO J=1,Ny
289     DO I=1,Nx
290     MLD(I,J) = depth*PMASK(_I3(1,I,J))
291     MLDIndex(I,J) = 1
292     ENDDO
293     ENDDO
294     DO K=2,Nz
295     depth = depth -delps(K-1)/G/RONIL/2 -delps(K)/G/RONIL/2
296     DO J=1,Ny
297     DO I=1,Nx
298     IF ( rho(_I3(K,I,J)) - rho(_I3(1,I,J)) .LE. MixedLayerDensityJump .AND.
299     & PMASK(_I3(K,I,J)) .EQ. WATER ) THEN
300     MLD (I,J) = depth
301     MLDIndex(I,J) = K
302     ENDIF
303     ENDDO
304     ENDDO
305     ENDDO
306     RETURN
307     END
308    
309     C/-------------------------------------------------------------------\
310     C||| Procedure: DIAGS_CONTROL |||
311     C|||===============================================================|||
312     C||| Function: Central interface to the DIAGS configuration |||
313     C||| routines. Maintains global state associated |||
314     C||| with DIAGS routines. |||
315     C||| Comments: |||
316     C\-------------------------------------------------------------------/
317     CStartofinterface
318     SUBROUTINE DIAGS_CONTROL (
319     I op, oper01, oper02, oper03, oper04,
320     U iErr )
321     IMPLICIT NONE
322     C /--------------------------------------------------------------\
323     C | Global data |
324     C \--------------------------------------------------------------/
325     #include "SIZE.h"
326     #include "PARAMS.h"
327     #include "DIAGS.h"
328     #include "MASKS.h"
329     #include "EXTERNAL.h"
330     CEndofinterface
331     C /--------------------------------------------------------------\
332     C | Routine arguments |
333     C |==============================================================|
334     C | op - Operation to be performed. |
335     C | Supported operations are |
336     C | o ADD_BASIN |
337     C | oper01 - CHARACTER string holding basin name |
338     C | String also identifies file from which |
339     C | basin map will be read. |
340     C | oper02 - Ignored |
341     C | oper03 - Ignored |
342     C | oper04 - Ignored |
343     C | o PRINT_BASIN |
344     C | oper01 - Ignored |
345     C | oper02 - Ignored |
346     C | oper03 - Ignored |
347     C | oper04 - Ignored |
348     C | o ADD_ZONAL_SECTION |
349     C | oper01 - CHARACTER string identifying section. |
350     C | oper02 - Y coordinate of section. |
351     C | oper03 - X starting coordinate of section. |
352     C | oper04 - X ending coordinate of section. |
353     C | o ADD_MERIDIONAL_SECTION |
354     C | oper01 - CHARACTER string identifying section. |
355     C | oper02 - X coordinate of section. |
356     C | oper03 - Y starting coordinate of section. |
357     C | oper04 - Y ending coordinate of section. |
358     C | oper01 - Argument for operation op. |
359     C | oper02 - Argument for operation op. |
360     C | oper03 - Argument for operation op. |
361     C | oper04 - Argument for operation op. |
362     C | iErr - Error flag. |
363     C \--------------------------------------------------------------/
364     CHARACTER*(*) OP
365     CHARACTER*(*) OPER01
366     REAL OPER02
367     REAL OPER03
368     REAL OPER04
369     INTEGER iErr
370     C /--------------------------------------------------------------\
371     C | Local variables |
372     C |==============================================================|
373     C | CALL1 - Flag used to cause initialisation. |
374     C | fName - Holds constructed file name for basin mask. |
375     C | loc - Index used to move through fName string. |
376     C | s1, s2- Substring start and end indices. |
377     C | bNumber - Active basin number. |
378     C \--------------------------------------------------------------/
379     LOGICAL CALL1
380     SAVE CALL1
381     DATA CALL1 /.TRUE./
382     CHARACTER*(MAXFN) fName
383     INTEGER loc
384     INTEGER s1
385     INTEGER s2
386     INTEGER bNumber
387     C /--------------------------------------------------------------\
388     C | Initialise if not already done. |
389     C \--------------------------------------------------------------/
390     IF ( CALL1 ) THEN
391     numberOfBasins = 0
392     CALL1 = .FALSE.
393     ENDIF
394     IF ( op .EQ. 'ADD_BASIN' ) THEN
395     C /--------------------------------------------------------------\
396     C | Load basin definition. |
397     C \--------------------------------------------------------------/
398     bNumber = numberOfBasins + 1
399     IF ( bNumber .GT. DIAGS_MAX_NUMBER_OF_BASINS ) GOTO 999
400     C /--------------------------------------------------------------\
401     C | Determine size of the basin name |
402     C \--------------------------------------------------------------/
403     loc = 1
404     s1 = IFNBLNK(oper01)
405     s2 = ILNBLNK(oper01)
406     IF ( loc+s2-s1 .LE. MAXFN )
407     & fName(loc:loc+s2-s1) = oper01(s1:s2)
408     loc = loc+s2-s1+1
409     s1 = IFNBLNK(bMapSuffix)
410     s2 = ILNBLNK(bMapSuffix)
411     IF ( loc+s2-s1 .LE. MAXFN ) fName(loc:loc+s2-s1) = bMapSuffix(s1:s2)
412     loc = loc+s2-s1
413     IF ( loc .GT. MAXFN ) GOTO 998
414     CALL GET_MAP(fName(1:loc), dUnit,
415     O basinMask,
416     I Nx, Ny, DIAGS_MAX_NUMBER_OF_BASINS, bNumber,
417     O iErr)
418     IF ( iErr .EQ. 0 ) THEN
419     numberOfBasins = numberOfBasins+1
420     basinList(numberOfBasins) = oper01
421     ENDIF
422     ELSEIF ( op .EQ. 'PRINT_BASINS' ) THEN
423     CALL DIAGS_SHOW_BASINS
424     ELSE
425     GOTO 997
426     ENDIF
427     1000 CONTINUE
428     RETURN
429     999 CONTINUE
430     iErr = 1 ! Too many basins.
431     GOTO 1000
432     998 CONTINUE
433     iErr = 2 ! Name too long.
434     GOTO 1000
435     997 CONTINUE
436     iErr = 3 ! Unrecognised operation.
437     GOTO 1000
438     END
439    
440     C/-------------------------------------------------------------------\
441     C||| Procedure: DIAGS_DUMP_MERID_PSI |||
442     C|||===============================================================|||
443     C||| Function: Dump out the meridional overturning. |||
444     C||| Comments: PSI is stored in internal COMMON block. |||
445     C\-------------------------------------------------------------------/
446     CStartofinterface
447     SUBROUTINE DIAGS_DUMP_MERID_PSI( IOUNIT )
448     IMPLICIT NONE
449     C /--------------------------------------------------------------\
450     C | Global data |
451     C \--------------------------------------------------------------/
452     #include "SIZE.h"
453     #include "OPERATORS.h"
454     #include "GRID.h"
455     #include "PARAMS.h"
456     #include "DIAGS.h"
457     #include "MASKS.h"
458     C /--------------------------------------------------------------\
459     C | Routine arguments |
460     C |==============================================================|
461     C | IOUNIT - Unit to which data will be written. |
462     C \--------------------------------------------------------------/
463     INTEGER IOUNIT
464     CEndofinterface
465     C /--------------------------------------------------------------\
466     C | Local variables |
467     C |==============================================================|
468     C | I, J, K, Nb - Loop counters. |
469     C | meridPsiGrid- Temporary array holding grid for psi. |
470     C | yCoord - Temporary array v point y coordinates. |
471     C | zCoord - Temporary array v point z coordinates. |
472     C \--------------------------------------------------------------/
473     INTEGER I, J, K, Nb
474     REAL meridPsiGrid(Ny,Nz)
475     REAL yCoord(Ny)
476     REAL zCoord(Nz)
477     REAL timePeriod
478     C This is really dumb here!!!!!
479     REAL delY
480     REAL sbLat
481    
482     sbLat = -80.D0
483     delY = 4.0
484     C
485     C Dump the grid.
486     yCoord(1)=sbLat
487     DO J=2,Ny
488     yCoord(J)=yCoord(J-1)+delY
489     ENDDO
490     zCoord(1)=-delps(1)/g/ronil/2
491     DO K=2,Nz
492     zCoord(K)=zCoord(K-1)-delps(K-1)/g/ronil/2-delps(K)/g/ronil/2
493     ENDDO
494     DO K=1,Nz
495     DO J=1,Ny
496     meridPsiGrid(J,K)=yCoord(J)
497     ENDDO
498     ENDDO
499     WRITE(IOUNIT) meridPsiGrid
500     DO K=1,Nz
501     DO J=1,Ny
502     meridPsiGrid(J,K)=zCoord(J)
503     ENDDO
504     ENDDO
505     WRITE(IOUNIT) meridPsiGrid
506     C Dump each basin.
507     DO Nb =1,numberOfBasins
508     WRITE(IOUNIT) ((meridPsi(J,K,Nb),J=1,Ny),K=1,Nz)
509     ENDDO
510     timePeriod = currentTime-sumMeridPsiTime0+delT
511     DO Nb =1,numberOfBasins
512     WRITE(IOUNIT)
513     & ((sumMeridPsi(J,K,Nb)/timePeriod,J=1,Ny),K=1,Nz)
514     ENDDO
515     C
516     RETURN
517     END
518    
519     C/-------------------------------------------------------------------\
520     C||| Procedure: DIAGS_DUMP_MLD |||
521     C|||===============================================================|||
522     C||| Function: Write out the mixed layer depth. |||
523     C||| Comments: |||
524     C\-------------------------------------------------------------------/
525     CStartofinterface
526     SUBROUTINE DIAGS_DUMP_MLD(
527     I IOUNIT )
528     IMPLICIT NONE
529     C /--------------------------------------------------------------\
530     C | Global data |
531     C \--------------------------------------------------------------/
532     #include "SIZE.h"
533     #include "OPERATORS.h"
534     #include "GRID.h"
535     #include "PARAMS.h"
536     #include "DIAGS.h"
537     #include "MASKS.h"
538     C /--------------------------------------------------------------\
539     C | Routine arguments |
540     C |==============================================================|
541     C | IOUNIT - Unit number for writing dump. |
542     C \--------------------------------------------------------------/
543     INTEGER IOUNIT
544     REAL timePeriod
545     CEndofinterface
546     WRITE(IOUNIT) mld
547     timePeriod = currentTime-sumMldTime0+delT
548     WRITE(IOUNIT) sumMld/timePeriod
549     WRITE(IOUNIT) minMld
550     WRITE(IOUNIT) maxMld
551     RETURN
552     END
553    
554     C/-------------------------------------------------------------------\
555     C||| Procedure: DIAGS_GET_MLD |||
556     C|||===============================================================|||
557     C||| Function: Pass current mixed layer out. |||
558     C||| Comments: |||
559     C\-------------------------------------------------------------------/
560     CStartofinterface
561     SUBROUTINE DIAGS_GET_MLD(
562     I mldArr, mldIndexArr )
563     IMPLICIT NONE
564     C /--------------------------------------------------------------\
565     C | Global data |
566     C \--------------------------------------------------------------/
567     #include "SIZE.h"
568     #include "OPERATORS.h"
569     #include "GRID.h"
570     #include "PARAMS.h"
571     #include "DIAGS.h"
572     #include "MASKS.h"
573     C /--------------------------------------------------------------\
574     C | Routine arguments |
575     C |==============================================================|
576     C | mldArr - Array for passing mixed layer depth |
577     C | mldIndexArr - Array for passing mixed layer base index. |
578     C \--------------------------------------------------------------/
579     REAL mldArr (Nx,Ny)
580     INTEGER mldIndexArr(Nx,Ny)
581     CEndofinterface
582     mldArr = mld
583     mldIndexArr = mldIndex
584     C
585     RETURN
586     END
587    
588     C/-------------------------------------------------------------------\
589     C||| Procedure: DIAGS_READ_BASIN_MASK |||
590     C|||===============================================================|||
591     C||| Function: Controls loading of "basin" masks from |||
592     C||| external file. |||
593     C||| Comments: |||
594     C\-------------------------------------------------------------------/
595     CStartofinterface
596     SUBROUTINE DIAGS_READ_BASIN_MASK( bNumber )
597     IMPLICIT NONE
598     C /--------------------------------------------------------------\
599     C | Global data |
600     C \--------------------------------------------------------------/
601     #include "SIZE.h"
602     #include "PARAMS.h"
603     #include "DIAGS.h"
604     #include "EXTERNAL.h"
605     CEndofinterface
606     C /--------------------------------------------------------------\
607     C | Routine arguments |
608     C |==============================================================|
609     C | bNumber - Ordinal index of basin mask to be loaded. |
610     C \--------------------------------------------------------------/
611     INTEGER bNumber
612     C /--------------------------------------------------------------\
613     C | Local variables |
614     C |==============================================================|
615     C | fName - Holds constructed file name for basin mask. |
616     C | loc - Index used to move through fName string. |
617     C | s1, s2- Substring start and end indices. |
618     C \--------------------------------------------------------------/
619     CHARACTER*(MAXFN) fName
620     INTEGER loc
621     INTEGER s1
622     INTEGER s2
623     C /--------------------------------------------------------------\
624     C | Determine size of the basin name |
625     C \--------------------------------------------------------------/
626     loc = 1
627     s1 = IFNBLNK(basinList(bNumber))
628     s2 = ILNBLNK(basinList(bNumber))
629     IF ( loc+s2-s1+1 .LE. MAXFN ) fName(loc:loc+s2-s1+1) = basinList(bNumber)(s1:s2)
630     loc = loc+s2-s1+1
631     s1 = IFNBLNK(bMapSuffix)
632     s2 = ILNBLNK(bMapSuffix)
633     IF ( loc+s2-s1+1 .LE. MAXFN ) fName(loc:loc+s2-s1+1) = bMapSuffix(s1:s2)
634     loc = loc+s2-s1+1
635     IF ( loc .LE. MAXFN ) THEN
636     ENDIF
637     RETURN
638     END
639     C/-------------------------------------------------------------------\
640     C||| Procedure: DIAGS_PRINT_AVE_T_S_AND_RHO |||
641     C|||===============================================================|||
642     C||| Function: Request tabulation of current diagnostics. |||
643     C||| Comments: |||
644     C\-------------------------------------------------------------------/
645     CStartofinterface
646     SUBROUTINE DIAGS_PRINT_AVE_T_S_AND_RHO(
647     I IOUNIT )
648     IMPLICIT NONE
649     C /--------------------------------------------------------------\
650     C | Global data |
651     C \--------------------------------------------------------------/
652     #include "SIZE.h"
653     #include "PARAMS.h"
654     #include "DIAGS.h"
655     #include "MASKS.h"
656     #include "EXTERNAL.h"
657     CEndofinterface
658     C /--------------------------------------------------------------\
659     C | Routine arguments |
660     C |==============================================================|
661     C | IOUNIT - Unit number on which output will be written. |
662     C \--------------------------------------------------------------/
663     INTEGER IOUNIT
664     C /--------------------------------------------------------------\
665     C | Local variables |
666     C |==============================================================|
667     C | depth - Holds layer depth |
668     C | K, Nb - Loop counter |
669     C \--------------------------------------------------------------/
670     REAL depth
671     INTEGER K, Nb
672     WRITE(IOUNIT,*) 'numberOfBasins=', numberOfBasins
673     DO Nb = 1, numberOfBasins
674     WRITE(IOUNIT,*) 'basinName=',basinList(Nb), ',timeOfAverage=',
675     & bAveTime(Nb), ',Nz=',Nz
676     WRITE (IOUNIT,*) 'Temp Salt Rho Depth '
677     depth = -delps(1)/2/G/ronil
678     DO K = 1, Nz
679     IF ( K.NE. 1 ) THEN
680     depth = depth - delps(K-1)/2/G/ronil - delps(K)/2/G/ronil
681     ENDIF
682     WRITE (IOUNIT,*) bAveT(K,Nb), bAveS(K,Nb), bAveRho(K,Nb), depth
683     ENDDO
684     ENDDO
685     C
686     RETURN
687     END
688    
689     C/-------------------------------------------------------------------\
690     C||| Procedure: DIAGS_SHOW |||
691     C|||===============================================================|||
692     C||| Function: Request tabulation of current diagnostics. |||
693     C||| Comments: |||
694     C\-------------------------------------------------------------------/
695     CStartofinterface
696     SUBROUTINE DIAGS_SHOW
697     IMPLICIT NONE
698     C /--------------------------------------------------------------\
699     C | Global data |
700     C \--------------------------------------------------------------/
701     #include "SIZE.h"
702     #include "PARAMS.h"
703     #include "DIAGS.h"
704     #include "MASKS.h"
705     #include "EXTERNAL.h"
706     CEndofinterface
707     C /--------------------------------------------------------------\
708     C | Routine arguments |
709     C |==============================================================|
710     C | ** NONE ** |
711     C \--------------------------------------------------------------/
712     C /--------------------------------------------------------------\
713     C | Local variables |
714     C |==============================================================|
715     C | ** NONE ** |
716     C \--------------------------------------------------------------/
717     REAL X1, X2, X3
718     INTEGER iErr
719    
720     CALL DIAGS_CONTROL ('PRINT_BASINS', ' ', X1, X2, X3, iErr )
721    
722     RETURN
723     END
724    
725     C/-------------------------------------------------------------------\
726     C||| Procedure: DIAGS_SHOW_BASINS |||
727     C|||===============================================================|||
728     C||| Function: Print maps of basins relative to coastline. |||
729     C||| Comments: |||
730     C\-------------------------------------------------------------------/
731     CStartofinterface
732     SUBROUTINE DIAGS_SHOW_BASINS
733     IMPLICIT NONE
734     C /--------------------------------------------------------------\
735     C | Global data |
736     C \--------------------------------------------------------------/
737     #include "SIZE.h"
738     #include "PARAMS.h"
739     #include "DIAGS.h"
740     #include "MASKS.h"
741     #include "EXTERNAL.h"
742     CEndofinterface
743     C /--------------------------------------------------------------\
744     C | Routine arguments |
745     C |==============================================================|
746     C | ** NONE ** |
747     C \--------------------------------------------------------------/
748     INTEGER IOUNIT
749     C /--------------------------------------------------------------\
750     C | Local variables |
751     C |==============================================================|
752     C | I - Loop counter. |
753     C | tmpArr - Work array for print routine. |
754     C \--------------------------------------------------------------/
755     REAL tmpArr(Nx,Ny)
756     INTEGER I
757     C
758     DO I = 1, numberOfBasins
759     tmpArr = basinMask(:,:,I)+PMASK(_I3(1,:,:))
760     tmpArr = tmpArr*PMASK(_I3(1,:,:))
761     CALL PLOT_FIELD(tmpArr,Nx,Ny)
762     ENDDO
763     C
764     RETURN
765     END
766    
767     C/-------------------------------------------------------------------\
768     C||| Procedure: DIAGS_RESET_MLD_STATS |||
769     C|||===============================================================|||
770     C||| Function: Reset the mixed layer depth statistics. |||
771     C||| Comments: |||
772     C\-------------------------------------------------------------------/
773     CStartofinterface
774     SUBROUTINE DIAGS_RESET_MLD_STATS
775     IMPLICIT NONE
776     C /--------------------------------------------------------------\
777     C | Global data |
778     C \--------------------------------------------------------------/
779     #include "SIZE.h"
780     #include "PARAMS.h"
781     #include "DIAGS.h"
782     #include "MASKS.h"
783     #include "EXTERNAL.h"
784     CEndofinterface
785     C /--------------------------------------------------------------\
786     C | Routine arguments |
787     C |==============================================================|
788     C | ** NONE ** |
789     C \--------------------------------------------------------------/
790     INTEGER IOUNIT
791     C /--------------------------------------------------------------\
792     C | Local variables |
793     C |==============================================================|
794     C | I - Loop counter. |
795     C | CALL1 - Initialisation flag. |
796     C \--------------------------------------------------------------/
797     REAL tmpArr(Nx,Ny)
798     INTEGER I
799     LOGICAL CALL1
800     DATA CALL1 /.TRUE./
801     SAVE CALL1
802     C
803     maxMld = mld
804     minMld = mld
805     sumMld = 0.
806     sumMldTime0 = currentTime
807     C
808     RETURN
809     END
810    
811     C/-------------------------------------------------------------------\
812     C||| Procedure: DIAGS_RESET_PSI_STATS |||
813     C|||===============================================================|||
814     C||| Function: Reset the meridional overturning statistics. |||
815     C||| Comments: |||
816     C\-------------------------------------------------------------------/
817     CStartofinterface
818     SUBROUTINE DIAGS_RESET_PSI_STATS
819     IMPLICIT NONE
820     C /--------------------------------------------------------------\
821     C | Global data |
822     C \--------------------------------------------------------------/
823     #include "SIZE.h"
824     #include "PARAMS.h"
825     #include "DIAGS.h"
826     #include "MASKS.h"
827     #include "EXTERNAL.h"
828     CEndofinterface
829     C /--------------------------------------------------------------\
830     C | Routine arguments |
831     C |==============================================================|
832     C | ** NONE ** |
833     C \--------------------------------------------------------------/
834     C
835     sumMeridPsi = 0.
836     sumMeridPsiTime0 = currentTime
837     C
838     RETURN
839     END
840    
841     C/-------------------------------------------------------------------\
842     C||| Procedure: DIAGS_STORE_MLD_STATS |||
843     C|||===============================================================|||
844     C||| Function: Store the mixed layer depth statistics. |||
845     C||| Comments: |||
846     C\-------------------------------------------------------------------/
847     CStartofinterface
848     SUBROUTINE DIAGS_STORE_MLD_STATS
849     IMPLICIT NONE
850     C /--------------------------------------------------------------\
851     C | Global data |
852     C \--------------------------------------------------------------/
853     #include "SIZE.h"
854     #include "PARAMS.h"
855     #include "DIAGS.h"
856     #include "MASKS.h"
857     #include "EXTERNAL.h"
858     CEndofinterface
859     C /--------------------------------------------------------------\
860     C | Routine arguments |
861     C |==============================================================|
862     C | ** NONE ** |
863     C \--------------------------------------------------------------/
864     C /--------------------------------------------------------------\
865     C | Local variables |
866     C |==============================================================|
867     C | CALL1 - Initialisation flag. |
868     C \--------------------------------------------------------------/
869     LOGICAL CALL1
870     DATA CALL1 /.TRUE./
871     SAVE CALL1
872     C
873     IF ( CALL1 ) THEN
874     maxMld = mld
875     minMld = mld
876     sumMld = 0.
877     sumMldTime0 = currentTime
878     CALL1 = .FALSE.
879     ENDIF
880     C
881     WHERE ( mld .GT. minMld ) minMld = mld
882     WHERE ( mld .LT. maxMld ) maxMld = mld
883     sumMld = sumMld + mld*delT
884     C
885     RETURN
886     END
887    
888     C/-------------------------------------------------------------------\
889     C||| Procedure: DIAGS_STORE_PSI_STATS |||
890     C|||===============================================================|||
891     C||| Function: Store the meridional overturning statistics. |||
892     C||| Comments: |||
893     C\-------------------------------------------------------------------/
894     CStartofinterface
895     SUBROUTINE DIAGS_STORE_PSI_STATS
896     IMPLICIT NONE
897     C /--------------------------------------------------------------\
898     C | Global data |
899     C \--------------------------------------------------------------/
900     #include "SIZE.h"
901     #include "PARAMS.h"
902     #include "DIAGS.h"
903     #include "MASKS.h"
904     #include "EXTERNAL.h"
905     CEndofinterface
906     C /--------------------------------------------------------------\
907     C | Routine arguments |
908     C |==============================================================|
909     C | ** NONE ** |
910     C \--------------------------------------------------------------/
911     INTEGER IOUNIT
912     C /--------------------------------------------------------------\
913     C | Local variables |
914     C |==============================================================|
915     C | I - Loop counter. |
916     C | CALL1 - Initialisation flag. |
917     C \--------------------------------------------------------------/
918     INTEGER I
919     LOGICAL CALL1
920     DATA CALL1 /.TRUE./
921     SAVE CALL1
922     C
923     IF ( CALL1 ) THEN
924     sumMeridPsi = 0.
925     sumMeridPsiTime0 = currentTime
926     CALL1 = .FALSE.
927     ENDIF
928     C
929     sumMeridPsi = sumMeridPsi+meridPsi*delT
930     C
931     RETURN
932     END

  ViewVC Help
Powered by ViewVC 1.1.22