1 |
C $Header: /u/gcmpack/MITgcm/model/src/post_cg3d.F,v 1.1 2009/12/11 04:31:31 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: POST_CG3D |
8 |
C !INTERFACE: |
9 |
SUBROUTINE POST_CG3D( |
10 |
I zeroPsNH, zeroMeanPnh, |
11 |
I myTime, myIter, myThid ) |
12 |
|
13 |
C !DESCRIPTION: |
14 |
C Called from SOLVE_FOR_PRESSURE, after 3-D solver (cg3d): |
15 |
C Finish computation of Non-hydrostatic pressure from 3-D solver solution |
16 |
|
17 |
C !USES: |
18 |
IMPLICIT NONE |
19 |
C == Global variables |
20 |
#include "SIZE.h" |
21 |
#include "EEPARAMS.h" |
22 |
#include "PARAMS.h" |
23 |
#include "GRID.h" |
24 |
#include "SURFACE.h" |
25 |
c#include "FFIELDS.h" |
26 |
#include "DYNVARS.h" |
27 |
#ifdef ALLOW_NONHYDROSTATIC |
28 |
#include "NH_VARS.h" |
29 |
#endif |
30 |
|
31 |
C === Functions ==== |
32 |
LOGICAL DIFFERENT_MULTIPLE |
33 |
EXTERNAL DIFFERENT_MULTIPLE |
34 |
|
35 |
C !INPUT/OUTPUT PARAMETERS: |
36 |
C == Routine arguments == |
37 |
C zeroPsNH :: account for Hyd.component of cg3d_x by updating NH & Surf.Press |
38 |
C zeroMeanPnh :: account for Hyd.component of cg3d_x by updating NH & Surf.Press |
39 |
C myTime :: Current time in simulation |
40 |
C myIter :: Current iteration number in simulation |
41 |
C myThid :: My Thread Id. number |
42 |
LOGICAL zeroPsNH, zeroMeanPnh |
43 |
_RL myTime |
44 |
INTEGER myIter |
45 |
INTEGER myThid |
46 |
|
47 |
#ifdef ALLOW_NONHYDROSTATIC |
48 |
C !LOCAL VARIABLES: |
49 |
C == Local variables == |
50 |
INTEGER i,j,k,bi,bj |
51 |
INTEGER ks |
52 |
c INTEGER ioUnit |
53 |
CHARACTER*10 sufx |
54 |
c CHARACTER*(MAX_LEN_MBUF) msgBuf |
55 |
c _RL tmpVar(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
56 |
CEOP |
57 |
|
58 |
C-- Separate the Hydrostatic Surface Pressure adjusment (=> put it in dPhiNH) |
59 |
C from the Non-hydrostatic pressure (since cg3d_x contains both contribution) |
60 |
IF ( nonHydrostatic .AND. exactConserv ) THEN |
61 |
DO bj=myByLo(myThid),myByHi(myThid) |
62 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
63 |
IF ( select_rStar.EQ.0 .AND. usingZCoords ) THEN |
64 |
C- Z coordinate: assume surface @ level k=1 |
65 |
DO j=1-OLy,sNy+OLy |
66 |
DO i=1-OLx,sNx+OLx |
67 |
dPhiNH(i,j,bi,bj) = phi_nh(i,j,1,bi,bj) |
68 |
ENDDO |
69 |
ENDDO |
70 |
ELSEIF ( select_rStar.EQ.0 ) THEN |
71 |
C- Other than Z coordinate: no assumption on surface level index |
72 |
DO j=1-OLy,sNy+OLy |
73 |
DO i=1-OLx,sNx+OLx |
74 |
ks = ksurfC(i,j,bi,bj) |
75 |
IF ( ks.LE.Nr ) THEN |
76 |
dPhiNH(i,j,bi,bj) = phi_nh(i,j,ks,bi,bj) |
77 |
ELSE |
78 |
dPhiNH(i,j,bi,bj) = 0. |
79 |
ENDIF |
80 |
ENDDO |
81 |
ENDDO |
82 |
#ifdef NONLIN_FRSURF |
83 |
ELSE |
84 |
C rStar : take vertical average of P_NH as Hyd.Surf.Press adjustment |
85 |
DO j=1-OLy,sNy+OLy |
86 |
DO i=1-OLx,sNx+OLx |
87 |
dPhiNH(i,j,bi,bj) = 0. |
88 |
ENDDO |
89 |
ENDDO |
90 |
DO k=1,Nr |
91 |
DO j=1-OLy,sNy+OLy |
92 |
DO i=1-OLx,sNx+OLx |
93 |
dPhiNH(i,j,bi,bj) = dPhiNH(i,j,bi,bj) |
94 |
& + phi_nh(i,j,k,bi,bj)*drF(k)*h0FacC(i,j,k,bi,bj) |
95 |
ENDDO |
96 |
ENDDO |
97 |
ENDDO |
98 |
DO j=1-OLy,sNy+OLy |
99 |
DO i=1-OLx,sNx+OLx |
100 |
dPhiNH(i,j,bi,bj) = dPhiNH(i,j,bi,bj)*recip_Rcol(i,j,bi,bj) |
101 |
ENDDO |
102 |
ENDDO |
103 |
#endif /* NONLIN_FRSURF */ |
104 |
ENDIF |
105 |
ENDDO |
106 |
ENDDO |
107 |
IF ( DIFFERENT_MULTIPLE(diagFreq, myTime, deltaTClock) ) THEN |
108 |
WRITE(sufx,'(I10.10)') myIter |
109 |
CALL WRITE_FLD_XY_RL( 'dPhiNH.',sufx, dPhiNH, myIter, myThid ) |
110 |
ENDIF |
111 |
ENDIF |
112 |
|
113 |
C-- Update surface pressure (account for NH-p @ surface level) and NH pressure: |
114 |
IF ( zeroPsNH .OR. zeroMeanPnh ) THEN |
115 |
IF ( DIFFERENT_MULTIPLE( diagFreq, myTime, deltaTClock) ) THEN |
116 |
WRITE(sufx,'(I10.10)') myIter |
117 |
CALL WRITE_FLD_XYZ_RL( 'cg3d_x.',sufx, phi_nh, myIter, myThid ) |
118 |
ENDIF |
119 |
DO bj=myByLo(myThid),myByHi(myThid) |
120 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
121 |
|
122 |
DO k=1,Nr |
123 |
DO j=1-OLy,sNy+OLy |
124 |
DO i=1-OLx,sNx+OLx |
125 |
phi_nh(i,j,k,bi,bj) = ( phi_nh(i,j,k,bi,bj) |
126 |
& - dPhiNH(i,j,bi,bj) |
127 |
& )*maskC(i,j,k,bi,bj) |
128 |
ENDDO |
129 |
ENDDO |
130 |
ENDDO |
131 |
DO j=1-OLy,sNy+OLy |
132 |
DO i=1-OLx,sNx+OLx |
133 |
etaN(i,j,bi,bj) = etaN(i,j,bi,bj) |
134 |
& + recip_Bo(i,j,bi,bj)*dPhiNH(i,j,bi,bj) |
135 |
ENDDO |
136 |
ENDDO |
137 |
|
138 |
ENDDO |
139 |
ENDDO |
140 |
ENDIF |
141 |
#endif /* ALLOW_NONHYDROSTATIC */ |
142 |
|
143 |
RETURN |
144 |
END |