1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GMREDI_OPTIONS.h" |
5 |
|
6 |
CStartOfInterface |
7 |
SUBROUTINE GMREDI_CALC_PSI_B( |
8 |
I bi, bj, iMin, iMax, jMin, jMax, |
9 |
I sigmaX, sigmaY, sigmaR, |
10 |
I myThid ) |
11 |
C /==========================================================\ |
12 |
C | SUBROUTINE GMREDI_CALC_PSI_B | |
13 |
C | o Calculate stream-functions for GM bolus velocity | |
14 |
C |==========================================================| |
15 |
C \==========================================================/ |
16 |
IMPLICIT NONE |
17 |
|
18 |
C == Global variables == |
19 |
#include "SIZE.h" |
20 |
#include "GRID.h" |
21 |
#include "DYNVARS.h" |
22 |
#include "EEPARAMS.h" |
23 |
#include "PARAMS.h" |
24 |
#include "GMREDI.h" |
25 |
#include "GMREDI_DIAGS.h" |
26 |
|
27 |
C == Routine arguments == |
28 |
C |
29 |
_RL sigmaX(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
30 |
_RL sigmaY(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
31 |
_RL sigmaR(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr) |
32 |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
33 |
INTEGER myThid |
34 |
CEndOfInterface |
35 |
|
36 |
#ifdef ALLOW_GMREDI |
37 |
#ifdef GM_BOLUS_ADVEC |
38 |
|
39 |
C == Local variables == |
40 |
INTEGER i,j,k, km1 |
41 |
_RL SlopeX(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
42 |
_RL SlopeY(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
43 |
_RL dSigmaDrW(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
44 |
_RL dSigmaDrS(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
45 |
_RL taperX(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
46 |
_RL taperY(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
47 |
|
48 |
C- Initialization : <= done in S/R gmredi_init |
49 |
|
50 |
IF (GM_AdvForm) THEN |
51 |
DO k=2,Nr |
52 |
C----- |
53 |
|
54 |
km1 = k-1 |
55 |
DO j=1-Oly+1,sNy+Oly-1 |
56 |
DO i=1-Olx+1,sNx+Olx-1 |
57 |
|
58 |
C Gradient of Sigma below U and V points |
59 |
SlopeX(i,j)=0.5*( sigmaX(i,j,km1)+sigmaX(i,j,k) ) |
60 |
& *maskW(i,j,k,bi,bj) |
61 |
dSigmaDrW(i,j)=0.5*( sigmaR(i-1,j,k)+sigmaR(i,j,k) ) |
62 |
& *maskW(i,j,k,bi,bj) |
63 |
SlopeY(i,j)=0.5*( sigmaY(i,j,km1)+sigmaY(i,j,k) ) |
64 |
& *maskS(i,j,k,bi,bj) |
65 |
dSigmaDrS(i,j)=0.5*( sigmaR(i,j-1,k)+sigmaR(i,j,k) ) |
66 |
& *maskS(i,j,k,bi,bj) |
67 |
|
68 |
ENDDO |
69 |
ENDDO |
70 |
|
71 |
C Calculate slopes , taper and/or clip |
72 |
CALL GMREDI_SLOPE_PSI_B( |
73 |
I dSigmaDrW, dSigmaDrS, |
74 |
I rF(K), |
75 |
U SlopeX, SlopeY, |
76 |
O taperX, taperY, |
77 |
I bi, bj, myThid ) |
78 |
|
79 |
DO j=1-Oly+1,sNy+Oly-1 |
80 |
DO i=1-Olx+1,sNx+Olx-1 |
81 |
|
82 |
C- Compute the 2 stream-function Components ( GM bolus vel.) |
83 |
GM_PsiX(i,j,k,bi,bj) = SlopeX(i,j)*taperX(i,j) |
84 |
& *( GM_background_K |
85 |
#ifdef GM_VISBECK_VARIABLE_K |
86 |
& +0.5*(VisbeckK(i-1,j,bi,bj)+VisbeckK(i,j,bi,bj)) |
87 |
#endif |
88 |
& )*maskW(i,j,k,bi,bj) |
89 |
GM_PsiY(i,j,k,bi,bj) = SlopeY(i,j)*taperY(i,j) |
90 |
& *( GM_background_K |
91 |
#ifdef GM_VISBECK_VARIABLE_K |
92 |
& +0.5*(VisbeckK(i,j-1,bi,bj)+VisbeckK(i,j,bi,bj)) |
93 |
#endif |
94 |
& )*maskS(i,j,k,bi,bj) |
95 |
|
96 |
#ifdef ALLOW_TIMEAVE |
97 |
C-- Time-average |
98 |
GM_PsiXtave(i,j,k,bi,bj)=GM_PsiXtave(i,j,k,bi,bj) |
99 |
& +GM_PsiX(i,j,k,bi,bj)*deltaTclock |
100 |
GM_PsiYtave(i,j,k,bi,bj)=GM_PsiYtave(i,j,k,bi,bj) |
101 |
& +GM_PsiY(i,j,k,bi,bj)*deltaTclock |
102 |
#endif /* ALLOW_TIMEAVE */ |
103 |
|
104 |
ENDDO |
105 |
ENDDO |
106 |
|
107 |
C----- |
108 |
ENDDO |
109 |
ENDIF |
110 |
#endif /* GM_BOLUS_ADVEC */ |
111 |
#endif /* ALLOW_GMREDI */ |
112 |
|
113 |
RETURN |
114 |
END |