/[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.16 - (hide annotations) (download)
Wed Aug 14 01:00:11 2013 UTC (10 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64o, checkpoint64n, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e
Changes since 1.15: +8 -1 lines
check pkgStatus (stop if not right) before doing anything

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

  ViewVC Help
Powered by ViewVC 1.1.22