/[MITgcm]/MITgcm/pkg/ctrl/ctrl_bound.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_bound.F

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


Revision 1.5 - (show annotations) (download)
Sun Aug 12 19:34:22 2012 UTC (11 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63r, checkpoint63s, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, 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, HEAD
Changes since 1.4: +86 -68 lines
- includes CTRL_OPTIONS.h (instead of CPP_OPTIONS.h)
- remove PARAMS.h (not needed); remove some unused var;
- improve doc (separate S/R arg from loc vars) and error msg (if it stops)

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_bound.F,v 1.4 2012/08/02 01:30:27 jmc Exp $
2 C $Name: $
3
4 #include "CTRL_OPTIONS.h"
5 C- note: although we just need CPP_EEOPTIONS.h here, prefer to
6 C include the same option-file above as in the AD version.
7
8 C-- File ctrl_bound.F:
9 C-- Contents
10 C-- o CTRL_BOUND_3D
11 C-- o CTRL_BOUND_2D
12
13 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
14 CBOP
15 C !ROUTINE: CTRL_BOUND_3D
16 C !INTERFACE:
17 SUBROUTINE CTRL_BOUND_3D(
18 U fieldCur,
19 I maskFld3d, boundsVec, myThid )
20 C !DESCRIPTION: \bv
21 C *==========================================================*
22 C | started: Gael Forget gforget@mit.edu 20-Aug-2007
23 C |
24 C | o in forward mode: impose bounds on ctrl vector values
25 C | o in adjoint mode: do nothing ... or emulate local minimum
26 C *==========================================================*
27 C \ev
28
29 C !USES:
30 IMPLICIT NONE
31 #include "SIZE.h"
32 #include "EEPARAMS.h"
33
34 C !INPUT/OUTPUT PARAMETERS:
35 _RL fieldCur (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
36 _RS maskFld3d(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
37 _RL boundsVec(5)
38 INTEGER myThid
39
40 C !LOCAL VARIABLES:
41 INTEGER bi,bj,i,j,k
42 CEOP
43
44 IF (boundsVec(1).LT.boundsVec(4)) THEN
45
46 DO bj=myByLo(myThid), myByHi(myThid)
47 DO bi=myBxLo(myThid), myBxHi(myThid)
48
49 DO k = 1,Nr
50 DO j = 1,sNy
51 DO i = 1,sNx
52 IF (maskFld3d(i,j,k,bi,bj).NE.0.) THEN
53 IF (fieldCur(i,j,k,bi,bj).GT.boundsVec(4)) THEN
54 fieldCur(i,j,k,bi,bj)=boundsVec(4)
55 ENDIF
56 IF (fieldCur(i,j,k,bi,bj).LT.boundsVec(1)) THEN
57 fieldCur(i,j,k,bi,bj)=boundsVec(1)
58 ENDIF
59 ENDIF
60 ENDDO
61 ENDDO
62 ENDDO
63
64 ENDDO
65 ENDDO
66
67 ENDIF
68
69 RETURN
70 END
71
72 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
73 CBOP
74 C
75 C !ROUTINE: CTRL_BOUND_2D
76 C !INTERFACE:
77 SUBROUTINE CTRL_BOUND_2D(
78 U fieldCur,
79 I maskFld3d, boundsVec, myThid )
80 C !DESCRIPTION: \bv
81 C *==========================================================*
82 C | started: Gael Forget gforget@mit.edu 20-Aug-2007
83 C |
84 C | o in forward mode: impose bounds on ctrl vector values
85 C | o in adjoint mode: do nothing ... or emulate local minimum
86 C *==========================================================*
87 C \ev
88
89 C !USES:
90 IMPLICIT NONE
91 #include "SIZE.h"
92 #include "EEPARAMS.h"
93
94 C !INPUT/OUTPUT PARAMETERS:
95 _RL fieldCur (1-Olx:sNx+Olx,1-Oly:sNy+Oly, nSx,nSy)
96 _RS maskFld3d(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
97 _RL boundsVec(5)
98 INTEGER myThid
99
100 C !LOCAL VARIABLES:
101 INTEGER bi,bj,i,j
102 CEOP
103
104 IF (boundsVec(1).LT.boundsVec(4)) THEN
105
106 DO bj=myByLo(myThid), myByHi(myThid)
107 DO bi=myBxLo(myThid), myBxHi(myThid)
108
109 DO j = 1-OLy,sNy+OLy
110 DO i = 1-OLx,sNx+OLx
111 IF (maskFld3d(i,j,1,bi,bj).NE.0.) THEN
112 IF (fieldCur(i,j,bi,bj).GT.boundsVec(4)) THEN
113 fieldCur(i,j,bi,bj)=boundsVec(4)
114 ENDIF
115 IF (fieldCur(i,j,bi,bj).LT.boundsVec(1)) THEN
116 fieldCur(i,j,bi,bj)=boundsVec(1)
117 ENDIF
118 ENDIF
119 ENDDO
120 ENDDO
121
122 ENDDO
123 ENDDO
124
125 ENDIF
126
127 RETURN
128 END

  ViewVC Help
Powered by ViewVC 1.1.22