1 |
C $Header: /u/gcmpack/MITgcm/pkg/mom_common/mom_quasihydrostatic.F,v 1.5 2012/12/18 01:18:01 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "MOM_COMMON_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: MOM_QUASIHYDROSTATIC |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE MOM_QUASIHYDROSTATIC( |
11 |
I bi,bj,k, |
12 |
I uFld, vFld, |
13 |
O effectiveBuoy, |
14 |
I myThid ) |
15 |
|
16 |
C !DESCRIPTION: |
17 |
C *==========================================================* |
18 |
C | o SUBROUTINE MOM_QUASIHYDROSTATIC |
19 |
C | Add Quasi-Hydrostatic Terms to buoyancy |
20 |
C *==========================================================* |
21 |
|
22 |
C !USES: =============================================================== |
23 |
IMPLICIT NONE |
24 |
|
25 |
C-- == Global data == |
26 |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
29 |
#include "GRID.h" |
30 |
|
31 |
C-- == Routine arguments == |
32 |
C !INPUT VARIABLES: ==================================================== |
33 |
C bi,bj :: tile indices |
34 |
C k :: vertical level |
35 |
C uFld :: zonal flow |
36 |
C vFld :: meridional flow |
37 |
C myThid :: my Thread Id number |
38 |
INTEGER bi,bj,k |
39 |
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
40 |
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
41 |
INTEGER myThid |
42 |
|
43 |
C !OUTPUT/MODIFIED VARIABLES: ========================================== |
44 |
C effectiveBuoy :: Density (z-coord) / specific volume (p-coord) anomaly |
45 |
_RL effectiveBuoy(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
|
47 |
C !LOCAL VARIABLES: ==================================================== |
48 |
C i,j :: loop indices |
49 |
C scalingFactor :: scaling factor (from acceleration to density) |
50 |
INTEGER iMin,iMax,jMin,jMax |
51 |
PARAMETER( iMin = 0 , iMax = sNx+1 ) |
52 |
PARAMETER( jMin = 0 , jMax = sNy+1 ) |
53 |
INTEGER i,j |
54 |
_RL scalingFactor |
55 |
CEOP |
56 |
|
57 |
IF ( usingZCoords ) THEN |
58 |
C-- Z-coordinate case: Input is density anomaly |
59 |
|
60 |
scalingFactor = rhoConst*gravitySign |
61 |
& *recip_gravity*recip_gravFacC(k) |
62 |
C- to reproduce old (wrong) results: |
63 |
c scalingFactor=gravitySign*recip_gravity |
64 |
|
65 |
ELSEIF ( fluidIsWater ) THEN |
66 |
C-- P-coordinate, oceanic case: Input is specific-volume anomaly |
67 |
|
68 |
scalingFactor = recip_rhoConst*recip_gravity |
69 |
c scalingFactor = rVel2wUnit(k) <-- @ interface = wrong location |
70 |
C- should use expression below (consistent with omega <-> w-velocity |
71 |
C conversion) but rhoRef(k) = rho(tRef,sRef,p) is computed |
72 |
C in S/R SET_REF_STATE but is not stored: |
73 |
c scalingFactor = ( oneRL / rhoRef(k) )*recip_gravity |
74 |
|
75 |
ELSE |
76 |
C-- P-coord., Ideal-Gas case: Input is virtual potential temp. anomaly |
77 |
C (see White & Bromley, QJRMS 1995) |
78 |
scalingFactor = tRef(k)*recip_gravity |
79 |
|
80 |
ENDIF |
81 |
|
82 |
IF ( use3dCoriolis ) THEN |
83 |
DO j=jMin,jMax |
84 |
DO i=iMin,iMax |
85 |
effectiveBuoy(i,j)=effectiveBuoy(i,j) |
86 |
& +scalingFactor* |
87 |
& fCoriCos(i,j,bi,bj)* |
88 |
& ( angleCosC(i,j,bi,bj)*0.5 _d 0 * |
89 |
& (uFld(i,j,k,bi,bj)+uFld(i+1,j,k,bi,bj)) |
90 |
& -angleSinC(i,j,bi,bj)*0.5 _d 0 * |
91 |
& (vFld(i,j,k,bi,bj)+vFld(i,j+1,k,bi,bj)) |
92 |
& ) |
93 |
ENDDO |
94 |
ENDDO |
95 |
ENDIF |
96 |
|
97 |
IF ( useNHMTerms ) THEN |
98 |
DO j=jMin,jMax |
99 |
DO i=iMin,iMax |
100 |
effectiveBuoy(i,j)=effectiveBuoy(i,j) |
101 |
& +scalingFactor* |
102 |
& ( (uFld( i ,j,k,bi,bj)*uFld( i ,j,k,bi,bj) |
103 |
& +uFld(i+1,j,k,bi,bj)*uFld(i+1,j,k,bi,bj)) |
104 |
& + (vFld(i, j ,k,bi,bj)*vFld(i, j ,k,bi,bj) |
105 |
& +vFld(i,j+1,k,bi,bj)*vFld(i,j+1,k,bi,bj)) |
106 |
& )* 0.5 _d 0 * recip_rSphere*recip_deepFacC(k) |
107 |
ENDDO |
108 |
ENDDO |
109 |
ENDIF |
110 |
|
111 |
RETURN |
112 |
END |