/[MITgcm]/MITgcm/pkg/diagnostics/diagnostics_fill.F
ViewVC logotype

Annotation of /MITgcm/pkg/diagnostics/diagnostics_fill.F

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


Revision 1.9 - (hide annotations) (download)
Sun Jun 26 16:51:49 2005 UTC (18 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57k_post, checkpoint57j_post
Changes since 1.8: +47 -44 lines
change pointers so that 1 diag. can be used several times (with # freq.)

1 jmc 1.9 C $Header: /u/gcmpack/MITgcm/pkg/diagnostics/diagnostics_fill.F,v 1.8 2005/05/20 07:28:49 jmc Exp $
2 jmc 1.1 C $Name: $
3    
4     #include "DIAG_OPTIONS.h"
5    
6 jmc 1.2 CBOP
7     C !ROUTINE: DIAGNOSTICS_FILL
8     C !INTERFACE:
9 jmc 1.9 SUBROUTINE DIAGNOSTICS_FILL (inpfld, chardiag,
10     I kLev, nLevs, bibjFlg, biArg, bjArg, myThid)
11 jmc 1.2
12     C !DESCRIPTION:
13 jmc 1.1 C***********************************************************************
14 jmc 1.6 C Wrapper routine to increment the diagnostics arrays with a field
15 jmc 1.2 C***********************************************************************
16     C !USES:
17     IMPLICIT NONE
18    
19     C == Global variables ===
20     #include "EEPARAMS.h"
21     #include "SIZE.h"
22     #include "DIAGNOSTICS_SIZE.h"
23     #include "DIAGNOSTICS.h"
24    
25     C !INPUT PARAMETERS:
26     C***********************************************************************
27 jmc 1.1 C Arguments Description
28     C ----------------------
29 molod 1.5 C inpfld ..... Field to increment diagnostics array
30 jmc 1.1 C chardiag ... Character expression for diag to fill
31 jmc 1.2 C kLev ..... Integer flag for vertical levels:
32 jmc 1.3 C > 0 (any integer): WHICH single level to increment in qdiag.
33     C 0,-1 to increment "nLevs" levels in qdiag,
34 jmc 1.9 C 0 : fill-in in the same order as the input array
35 jmc 1.3 C -1: fill-in in reverse order.
36     C nLevs ...... indicates Number of levels of the input field array
37     C (whether to fill-in all the levels (kLev<1) or just one (kLev>0))
38 jmc 1.9 C bibjFlg .... Integer flag to indicate instructions for bi bj loop
39 jmc 1.1 C 0 indicates that the bi-bj loop must be done here
40     C 1 indicates that the bi-bj loop is done OUTSIDE
41     C 2 indicates that the bi-bj loop is done OUTSIDE
42     C AND that we have been sent a local array (with overlap regions)
43     C 3 indicates that the bi-bj loop is done OUTSIDE
44     C AND that we have been sent a local array
45     C AND that the array has no overlap region (interior only)
46 jmc 1.9 C NOTE - bibjFlg can be NEGATIVE to indicate not to increment counter
47     C biArg ...... X-direction tile number - used for bibjFlg=1-3
48     C bjArg ...... Y-direction tile number - used for bibjFlg=1-3
49 jmc 1.1 C myThid :: my thread Id number
50     C***********************************************************************
51     C NOTE: User beware! If a local (1 tile only) array
52 jmc 1.9 C is sent here, bibjFlg MUST NOT be set to 0
53 jmc 1.1 C or there will be out of bounds problems!
54     C***********************************************************************
55 molod 1.5 _RL inpfld(*)
56 jmc 1.2 CHARACTER*8 chardiag
57 jmc 1.9 INTEGER kLev, nLevs, bibjFlg, biArg, bjArg
58 jmc 1.2 INTEGER myThid
59     CEOP
60    
61     C !LOCAL VARIABLES:
62 jmc 1.9 C ndId :: diagnostic Id number (in available diagnostics list)
63 jmc 1.2 C ===============
64 jmc 1.9 INTEGER m, n, j, k, l, bi, bj
65     INTEGER ndId, ipt, iSp
66 jmc 1.8 INTEGER region2fill(0:nRegions)
67 jmc 1.1
68 jmc 1.9 IF ( bibjFlg.EQ.0 ) THEN
69     bi = 1
70     bj = 1
71     ELSE
72     bi = biArg
73     bj = bjArg
74     ENDIF
75 jmc 1.6 C-- 2D/3D Diagnostics :
76 jmc 1.1 C Run through list of active diagnostics to make sure
77     C we are trying to fill a valid diagnostic
78     DO n=1,nlists
79     DO m=1,nActive(n)
80 jmc 1.9 IF ( chardiag.EQ.flds(m,n) .AND. idiag(m,n).GT.0 ) THEN
81     ipt = idiag(m,n)
82     IF ( ndiag(ipt,bi,bj).GE.0 ) THEN
83     C diagnostic is valid & active, do the filling:
84     ndId = jdiag(m,n)
85     CALL DIAGNOSTICS_FILL_FIELD( inpfld, ndId, ipt,
86     I kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
87     ENDIF
88 jmc 1.1 ENDIF
89     ENDDO
90     ENDDO
91    
92     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
93 jmc 1.8 C-- Global/Regional Statistics :
94    
95     C Run through list of active statistics-diagnostics to make sure
96     C we are trying to compute & fill a valid diagnostic
97    
98     DO n=1,diagSt_nbLists
99     DO m=1,diagSt_nbActv(n)
100 jmc 1.9 IF ( chardiag.EQ.diagSt_Flds(m,n) .AND. iSdiag(m,n).GT.0 ) THEN
101     iSp = iSdiag(m,n)
102     IF ( qSdiag(0,0,iSp,bi,bj).GE.0. ) THEN
103     C- diagnostics is valid and Active. Find list of regions to fill:
104 jmc 1.8 DO j=0,nRegions
105     region2fill(j) = diagSt_region(j,n)
106     ENDDO
107 jmc 1.9 C- if this diagnostics appears in several lists (with same freq)
108     C then add regions from other lists
109     DO l=1,diagSt_nbLists
110     DO k=1,diagSt_nbActv(l)
111     IF ( iSdiag(k,l).EQ.-iSp ) THEN
112     DO j=0,nRegions
113     region2fill(j) = MAX(region2fill(j),diagSt_region(j,l))
114     ENDDO
115     ENDIF
116     ENDDO
117 jmc 1.8 ENDDO
118 jmc 1.9 C- Now do the filling :
119     ndId = jSdiag(m,n)
120     CALL DIAGSTATS_FILL( inpfld, ndId, iSp, region2fill,
121     I kLev, nLevs, bibjFlg, biArg, bjArg, myThid )
122 jmc 1.8 ENDIF
123     ENDIF
124     ENDDO
125     ENDDO
126    
127 jmc 1.9 RETURN
128 jmc 1.2 END

  ViewVC Help
Powered by ViewVC 1.1.22