/[MITgcm]/MITgcm/model/src/ini_linear_phisurf.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_linear_phisurf.F

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


Revision 1.16 - (show annotations) (download)
Sun Jun 14 21:50:26 2009 UTC (14 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint61q, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.15: +8 -12 lines
remove unnecessary BARRIER and local common block.

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_linear_phisurf.F,v 1.15 2009/04/28 18:01:14 jmc Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: INI_LINEAR_PHISURF
8 C !INTERFACE:
9 SUBROUTINE INI_LINEAR_PHISURF( myThid )
10
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE INI_LINEAR_PHISURF
14 C | o Initialise the Linear Relation Phi_surf(eta)
15 C *==========================================================*
16 C | Initialise -Boyancy at surface level (Bo_surf)
17 C | to setup the Linear relation: Phi_surf(eta)=Bo_surf*eta
18 C | Initialise phi0surf = starting point for integrating
19 C | phiHyd (= phiHyd at r=RoSurf)
20 C *==========================================================*
21 C \ev
22
23 C !USES:
24 IMPLICIT NONE
25 C === Global variables ===
26 #include "SIZE.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "GRID.h"
30 #include "SURFACE.h"
31
32 C !INPUT/OUTPUT PARAMETERS:
33 C === Routine arguments ===
34 C myThid - Thread no. that called this routine.
35 INTEGER myThid
36
37 C == Local variables in common ==
38 C Hloc :: Temporary array used to write surface topography
39 C has to be in common for multi threading
40 C no longer needed since MDSIO now allows (2009/06/07) to write local arrays
41 c COMMON / LOCAL_INI_PHISURF / topoHloc
42
43 C !LOCAL VARIABLES:
44 C === Local variables ===
45 C bi,bj :: tile indices
46 C I,J,K :: Loop counters
47 _RS topoHloc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
48 INTEGER bi, bj
49 INTEGER I, J, K
50 _RL pLoc, rhoLoc
51 _RL dPIdp
52 CEOP
53
54 #ifdef ALLOW_AUTODIFF_TAMC
55 DO bj=myByLo(myThid),myByHi(myThid)
56 DO bi=myBxLo(myThid),myBxHi(myThid)
57 DO J=1-Oly,sNy+Oly
58 DO I=1-Olx,sNx+Olx
59 Bo_surf(I,J,bi,bj) = 0. _d 0
60 recip_Bo(I,J,bi,bj) = 0. _d 0
61 ENDDO
62 ENDDO
63 ENDDO
64 ENDDO
65 #endif
66
67 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
68
69 C-- Initialise -Boyancy at surface level : Bo_surf
70 C Bo_surf is defined as d/dr(Phi_surf) and set to g/z2rUnit with
71 C z2rUnit = conversion factor from z-unit to r-unit: [z] * z2rUnit = [r]
72 C an accurate formulation includes P_surf and T,S_ref effects on rho_surf:
73 C (setting uniformLin_PhiSurf=.FALSE.):
74 C z-coord (z2rUnit=1): Bo_surf = - Boyancy
75 C = g * rho_surf(Tref,Sref,pSurf_0)/rho_0
76 C p-coord (z2rUnit=rho*g): Bo_surf = 1/rho(Tref(ksurf),pSurf_0)
77 C Note: on Phi_surf splitting : Non-linear Time-dependent effects on B_surf
78 C [through eta & (T-tRef)_surf] are included in PhiHyd rather than in Bo_surf
79 C--
80 IF ( buoyancyRelation .EQ. 'OCEANIC' ) THEN
81 C- gBaro = gravity (except for External mode test with reduced gravity)
82 DO bj=myByLo(myThid),myByHi(myThid)
83 DO bi=myBxLo(myThid),myBxHi(myThid)
84 DO J=1-Oly,sNy+Oly
85 DO I=1-Olx,sNx+Olx
86 Bo_surf(I,J,bi,bj) = gBaro
87 recip_Bo(I,J,bi,bj) = 1. _d 0 / gBaro
88 ENDDO
89 ENDDO
90 ENDDO
91 ENDDO
92 ELSEIF ( uniformLin_PhiSurf ) THEN
93 C- use a linear (in ps) uniform relation : Phi'_surf = 1/rhoConst * ps'_surf
94 DO bj=myByLo(myThid),myByHi(myThid)
95 DO bi=myBxLo(myThid),myBxHi(myThid)
96 DO J=1-Oly,sNy+Oly
97 DO I=1-Olx,sNx+Olx
98 c Bo_surf(I,J,bi,bj) = rVel2wUnit(1)*gravity
99 c recip_Bo(I,J,bi,bj) = wUnit2rVel(1)*recip_gravity
100 Bo_surf(I,J,bi,bj) = recip_rhoConst
101 recip_Bo(I,J,bi,bj) = rhoConst
102 ENDDO
103 ENDDO
104 ENDDO
105 ENDDO
106 ELSEIF ( buoyancyRelation .EQ. 'OCEANICP' ) THEN
107 DO bj=myByLo(myThid),myByHi(myThid)
108 DO bi=myBxLo(myThid),myBxHi(myThid)
109 DO J=1-Oly,sNy+Oly
110 DO I=1-Olx,sNx+Olx
111 IF ( Ro_surf(I,J,bi,bj).GT.0. _d 0
112 & .AND. ksurfC(I,J,bi,bj).LE.Nr ) THEN
113 k = ksurfC(I,J,bi,bj)
114 pLoc = Ro_surf(I,J,bi,bj)
115 CALL FIND_RHO_SCALAR(
116 I tRef(k), sRef(k), pLoc,
117 O rhoLoc, myThid )
118 IF ( rhoLoc .EQ. 0. _d 0 ) THEN
119 Bo_surf(I,J,bi,bj) = 0. _d 0
120 ELSE
121 Bo_surf(I,J,bi,bj) = 1. _d 0/rhoLoc
122 ENDIF
123 recip_Bo(I,J,bi,bj) = rhoLoc
124 ELSE
125 Bo_surf(I,J,bi,bj) = 0. _d 0
126 recip_Bo(I,J,bi,bj) = 0. _d 0
127 ENDIF
128 ENDDO
129 ENDDO
130 ENDDO
131 ENDDO
132 ELSEIF ( buoyancyRelation .EQ. 'ATMOSPHERIC' ) THEN
133 C- use a linearized (in ps) Non-uniform relation : Bo_surf(Po_surf,tRef_surf)
134 C--- Bo = d/d_p(Phi_surf) = tRef_surf*d/d_p(PI) ; PI = Cp*(p/Po)^kappa
135 DO bj=myByLo(myThid),myByHi(myThid)
136 DO bi=myBxLo(myThid),myBxHi(myThid)
137 DO J=1-Oly,sNy+Oly
138 DO I=1-Olx,sNx+Olx
139 IF ( Ro_surf(I,J,bi,bj).GT.0. _d 0
140 & .AND. ksurfC(I,J,bi,bj).LE.Nr ) THEN
141 dPIdp = (atm_Cp*atm_kappa/atm_Po)*
142 & (Ro_surf(I,J,bi,bj)/atm_Po)**(atm_kappa-1. _d 0)
143 Bo_surf(I,J,bi,bj) = dPIdp*tRef(ksurfC(I,J,bi,bj))
144 recip_Bo(I,J,bi,bj) = 1. _d 0 / Bo_surf(I,J,bi,bj)
145 ELSE
146 Bo_surf(I,J,bi,bj) = 0.
147 recip_Bo(I,J,bi,bj) = 0.
148 ENDIF
149 ENDDO
150 ENDDO
151 ENDDO
152 ENDDO
153 ELSE
154 STOP 'INI_LINEAR_PHISURF: We should never reach this point!'
155 ENDIF
156
157 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
158
159 C-- Update overlap regions (jmc: is it really needed ?)
160 _EXCH_XY_RL(Bo_surf, myThid)
161 _EXCH_XY_RL(recip_Bo, myThid)
162
163 IF ( ( buoyancyRelation .EQ. 'ATMOSPHERIC' .OR.
164 & buoyancyRelation .EQ. 'OCEANICP' )
165 & .AND. .NOT.uniformLin_PhiSurf ) THEN
166
167 CALL WRITE_FLD_XY_RL( 'Bo_surf',' ',Bo_surf,0,myThid)
168
169 ENDIF
170
171 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
172
173 C-- Initialise phi0surf: used for atmos. surf. P-loading (ocean, z-coord)
174 C or topographic geopotential anom. (p-coord)
175
176 DO bj=myByLo(myThid),myByHi(myThid)
177 DO bi=myBxLo(myThid),myBxHi(myThid)
178 DO J=1-Oly,sNy+Oly
179 DO I=1-Olx,sNx+Olx
180 phi0surf(I,J,bi,bj) = 0.
181 ENDDO
182 ENDDO
183 ENDDO
184 ENDDO
185
186 IF ( buoyancyRelation .EQ. 'ATMOSPHERIC'
187 & .AND. topoFile.NE.' ' ) THEN
188
189 #ifdef ALLOW_AUTODIFF_TAMC
190 STOP 'CANNOT PRESENTLY USE THIS OPTION WITH ADJOINT'
191 #else
192
193 C-- Compute topoH = PhiRef(Po_surf)/g ; is different from original
194 C topoZ(read from file) because of truncation of Po_surf.
195 C NOTE: not clear for now which topoZ needs to be saved in common block
196 C-- AND set phi0surf = starting point for integrating Geopotential;
197
198 CALL INI_P_GROUND( -2,
199 O topoHloc,
200 I Ro_surf, myThid )
201
202
203 IF (selectFindRoSurf.NE.0) THEN
204 _EXCH_XY_RS(phi0surf, myThid)
205 CALL WRITE_FLD_XY_RS( 'phi0surf',' ',phi0surf,0,myThid)
206 ENDIF
207
208 CALL WRITE_FLD_XY_RS( 'topo_H',' ',topoHloc,0,myThid)
209
210 #endif /* ALLOW_AUTODIFF_TAMC */
211
212 ENDIF
213
214 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
215 RETURN
216 END

  ViewVC Help
Powered by ViewVC 1.1.22