1 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/shap_filt/shap_filt_tracerold.F,v 1.3.2.2 2001/05/07 18:21:49 adcroft Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SHAP_FILT_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE SHAP_FILT_TRACEROLD( |
7 |
U field, |
8 |
I bi, bj, K, myCurrentTime, myThid ) |
9 |
C /==========================================================\ |
10 |
C | S/R SHAP_FILT_TRACER | |
11 |
C | Applies Shapiro filter to tracer field over one XY slice | |
12 |
C | of one tile at a time. | |
13 |
C \==========================================================/ |
14 |
IMPLICIT NONE |
15 |
|
16 |
C == Global variables === |
17 |
#include "SIZE.h" |
18 |
#include "EEPARAMS.h" |
19 |
#include "PARAMS.h" |
20 |
#include "GRID.h" |
21 |
#include "SHAP_FILT.h" |
22 |
|
23 |
C == Routine arguments |
24 |
INTEGER myThid |
25 |
_RL myCurrentTime |
26 |
INTEGER bi, bj, K |
27 |
_RL field(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
28 |
|
29 |
#ifdef ALLOW_SHAP_FILT |
30 |
|
31 |
C == Local variables == |
32 |
_RL tmpFldX(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
33 |
_RL tmpFldY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
34 |
INTEGER I,J,N,N1,N2 |
35 |
|
36 |
DO J=1-OLy,sNy+OLy |
37 |
DO I=1-OLx,sNx+OLx |
38 |
tmpFldX(i,j,1) = field(i,j,k,bi,bj) |
39 |
ENDDO |
40 |
ENDDO |
41 |
|
42 |
C Extract small-scale noise from tmpFldX (delta_ii^n) |
43 |
DO N=1,nShapT |
44 |
N1=1+mod(N+1,2) |
45 |
N2=1+mod( N ,2) |
46 |
DO J=1-OLy,sNy+OLy |
47 |
DO I=1-OLx+1,sNx+OLx-1 |
48 |
tmpFldX(i,j,N2) = -0.25*( |
49 |
& ( tmpFldX(i+1,j,N1)-tmpFldX( i ,j,N1) ) |
50 |
& *_maskW(i+1,j,k,bi,bj) |
51 |
& -( tmpFldX( i ,j,N1)-tmpFldX(i-1,j,N1) ) |
52 |
& *_maskW(i,j,k,bi,bj) ) |
53 |
ENDDO |
54 |
ENDDO |
55 |
ENDDO |
56 |
|
57 |
#ifdef SEQUENTIAL_2D_SHAP |
58 |
DO J=1-OLy,sNy+OLy |
59 |
DO I=1-OLx,sNx+OLx |
60 |
tmpFldX(i,j,N2) = field(i,j,k,bi,bj) - tmpFldX(i,j,N2) |
61 |
tmpFldY(i,j,1) = tmpFldX(i,j,N2) |
62 |
ENDDO |
63 |
ENDDO |
64 |
#else |
65 |
DO J=1-OLy,sNy+OLy |
66 |
DO I=1-OLx,sNx+OLx |
67 |
tmpFldY(i,j,1) = field(i,j,k,bi,bj) |
68 |
ENDDO |
69 |
ENDDO |
70 |
#endif /* SEQUENTIAL_2D_SHAP */ |
71 |
|
72 |
C Extract small-scale noise from tmpFldY (delta_jj^n) |
73 |
DO N=1,nShapT |
74 |
N1=1+mod(N+1,2) |
75 |
N2=1+mod( N ,2) |
76 |
DO J=1-OLy+1,sNy+OLy-1 |
77 |
DO I=1-OLx,sNx+OLx |
78 |
tmpFldY(i,j,N2) = -0.25*( |
79 |
& ( tmpFldY(i,j+1,N1)-tmpFldY(i, j ,N1) ) |
80 |
& *_maskS(i,j+1,k,bi,bj) |
81 |
& -( tmpFldY(i, j ,N1)-tmpFldY(i,j-1,N1) ) |
82 |
& *_maskS(i,j,k,bi,bj) ) |
83 |
ENDDO |
84 |
ENDDO |
85 |
ENDDO |
86 |
|
87 |
C Subtract small-scale noise from field |
88 |
#ifdef SEQUENTIAL_2D_SHAP |
89 |
DO J=1-OLy,sNy+OLy |
90 |
DO I=1-OLx,sNx+OLx |
91 |
field(i,j,k,bi,bj) = tmpFldX(i,j,N2) - tmpFldY(i,j,N2) |
92 |
ENDDO |
93 |
ENDDO |
94 |
#else |
95 |
DO J=1-OLy,sNy+OLy |
96 |
DO I=1-OLx,sNx+OLx |
97 |
field(i,j,k,bi,bj) = field(i,j,k,bi,bj) |
98 |
& -0.5*( tmpFldX(i,j,N2)+tmpFldY(i,j,N2) ) |
99 |
ENDDO |
100 |
ENDDO |
101 |
#endif /* SEQUENTIAL_2D_SHAP */ |
102 |
|
103 |
#endif /* ALLOW_SHAP_FILT */ |
104 |
|
105 |
RETURN |
106 |
END |