1 |
C $Header: /u/gcmpack/MITgcm/model/src/tracers_iigw_correction.F,v 1.1 2006/02/23 21:00:10 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: TRACERS_CORRECTION_IIGW |
8 |
C !INTERFACE: |
9 |
SUBROUTINE TRACERS_IIGW_CORRECTION( |
10 |
I bi, bj, myTime, myIter, myThid ) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | S/R TRACERS_IIGW_CORRECTION |
14 |
C | o apply correction term to Tracers due to Implicit |
15 |
C | treatment of Internal Gravity Waves: |
16 |
C- | -DeltaT.(w^{n+1}-w^{n})*d.Tr_{ref}/dz |
17 |
C *==========================================================* |
18 |
C \ev |
19 |
|
20 |
C !USES: |
21 |
IMPLICIT NONE |
22 |
C == Global variables == |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "GRID.h" |
27 |
#include "DYNVARS.h" |
28 |
#ifdef ALLOW_NONHYDROSTATIC |
29 |
#include "NH_VARS.h" |
30 |
#endif |
31 |
|
32 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
C == Routine Arguments == |
34 |
C bi,bj :: tile indices |
35 |
C myTime :: current time in simulation |
36 |
C myIter :: current iteration number in simulation |
37 |
C myThid :: my Thread Id number |
38 |
INTEGER bi,bj |
39 |
_RL myTime |
40 |
INTEGER myIter |
41 |
INTEGER myThid |
42 |
|
43 |
#ifdef ALLOW_NONHYDROSTATIC |
44 |
C !LOCAL VARIABLES: |
45 |
C == Local variables == |
46 |
C i,j,k :: Loop counters |
47 |
INTEGER i,j,k |
48 |
INTEGER kp1 |
49 |
_RL dTr_k, dTrp1 |
50 |
_RL dW_k(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
51 |
_RL dWp1(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
52 |
CEOP |
53 |
|
54 |
C- Initialise dW = w^{n+1} - w^{n} to zero: |
55 |
DO j=1-Oly,sNy+Oly |
56 |
DO i=1-Olx,sNx+Olx |
57 |
dWp1(i,j) = 0. _d 0 |
58 |
ENDDO |
59 |
ENDDO |
60 |
|
61 |
C-- Start vertical loop |
62 |
DO k=1,Nr |
63 |
|
64 |
C- Compute dW @ interface k & k+1 |
65 |
kp1 = MIN(k+1,Nr) |
66 |
DO j=1-Oly,sNy+Oly |
67 |
DO i=1-Olx,sNx+Olx |
68 |
dW_k(i,j) = dWp1(i,j) |
69 |
dWp1(i,j) = ( wVel(i,j,kp1,bi,bj) |
70 |
& - gW(i,j,kp1,bi,bj) )*maskC(i,j,k,bi,bj) |
71 |
ENDDO |
72 |
ENDDO |
73 |
|
74 |
C- Add Impl.IGW correction to Pot.Temperature: |
75 |
dTr_k = 0. _d 0 |
76 |
IF ( k.GT.1 ) dTr_k = (tRef(k) - tRef(k-1))*rkSign |
77 |
dTrp1 = (tRef(kp1) - tRef(k))*rkSign |
78 |
IF ( tempAdvection .AND. |
79 |
& (dTr_k.NE.0. _d 0 .OR. dTrp1.NE.0. _d 0) ) THEN |
80 |
DO j=1-Oly,sNy+Oly |
81 |
DO i=1-Olx,sNx+Olx |
82 |
theta(i,j,k,bi,bj) = theta(i,j,k,bi,bj) |
83 |
& -dTtracerLev(k)*0.5 _d 0 |
84 |
& *( dTr_k*dW_k(i,j) + dTrp1*dWp1(i,j) ) |
85 |
& *recip_drF(k)*_recip_hFacC(i,j,k,bi,bj) |
86 |
ENDDO |
87 |
ENDDO |
88 |
ENDIF |
89 |
|
90 |
C- Add Impl.IGW correction to Salinity/Water vapor: |
91 |
dTr_k = 0. _d 0 |
92 |
IF ( k.GT.1 ) dTr_k = (sRef(k) - sRef(k-1))*rkSign |
93 |
dTrp1 = (sRef(kp1) - sRef(k))*rkSign |
94 |
IF ( saltAdvection .AND. |
95 |
& (dTr_k.NE.0. _d 0 .OR. dTrp1.NE.0. _d 0) ) THEN |
96 |
DO j=1-Oly,sNy+Oly |
97 |
DO i=1-Olx,sNx+Olx |
98 |
salt(i,j,k,bi,bj) = salt(i,j,k,bi,bj) |
99 |
& -dTtracerLev(k)*0.5 _d 0 |
100 |
& *( dTr_k*dW_k(i,j) + dTrp1*dWp1(i,j) ) |
101 |
& *recip_drF(k)*_recip_hFacC(i,j,k,bi,bj) |
102 |
ENDDO |
103 |
ENDDO |
104 |
ENDIF |
105 |
|
106 |
C- End of k loop |
107 |
ENDDO |
108 |
|
109 |
#endif /* ALLOW_NONHYDROSTATIC */ |
110 |
|
111 |
RETURN |
112 |
END |