/[MITgcm]/MITgcm/pkg/smooth/smooth_init3d.F
ViewVC logotype

Contents of /MITgcm/pkg/smooth/smooth_init3d.F

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


Revision 1.5 - (show annotations) (download)
Tue Jan 10 15:37:49 2017 UTC (9 years ago) by gforget
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, HEAD
Changes since 1.4: +1 -8 lines
- smooth_filtervar2d.F, smooth_filtervar3d.F: add call to ALL_PROC_DIE before 'stop'
- smooth_init2d.F, smooth_init3d.F: remove print statements (now in smooth_readparms.F)
- smooth_readparms.F: add a cleaner version of print statements that were in smooth_init?d.F

1 C $Header: /u/gcmpack/MITgcm/pkg/smooth/smooth_init3d.F,v 1.4 2015/01/23 18:58:26 gforget Exp $
2 C $Name: $
3
4 #include "SMOOTH_OPTIONS.h"
5
6 subroutine smooth_init3D (smoothOpNb,mythid)
7
8 C *==========================================================*
9 C | SUBROUTINE smooth_init3D
10 C | o Routine that initializes one 3D smoothing/correlation operator
11 C | by computing/writing the corresponding diffusion operator
12 C *==========================================================*
13
14 cgf the choices of smooth3Dtype and smooth3Dsize need comments...
15 cgf
16 cgf smooth3DtypeH= 1) HORIZONTAL ALONG GRID AXIS
17 cgf 2-3) GMREDI TYPES
18 cgf 4) HORIZONTAL BUT WITH ROTATED AXIS
19 cgf for now I focus on the simpler smooth3DtypeH=1 case
20
21
22 IMPLICIT NONE
23 #include "SIZE.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "GRID.h"
27 #include "SMOOTH.h"
28
29 integer i,j,k, bi, bj, imin, imax, jmin, jmax
30 integer itlo,ithi
31 integer jtlo,jthi
32 integer myThid
33 character*( 80) fnamegeneric
34 _RL smooth3D_KzMax
35 integer ii,jj,kk
36 integer smoothOpNb
37
38 jtlo = mybylo(mythid)
39 jthi = mybyhi(mythid)
40 itlo = mybxlo(mythid)
41 ithi = mybxhi(mythid)
42
43 smooth3DtotTime=smooth3Dnbt(smoothOpNb)*smooth3DdelTime
44
45 c vertical smoothing:
46
47 if (smooth3DsizeZ(smoothOpNb).EQ.3) then
48 write(fnamegeneric(1:80),'(1a,i3.3)')
49 & 'smooth3DscalesZ',smoothOpNb
50 CALL READ_REC_3D_RL(fnamegeneric,smoothprec,
51 & Nr, smooth3D_Lz,1,1,mythid)
52 CALL EXCH_XYZ_RL( smooth3D_Lz, mythid )
53 else
54 DO bj=jtlo,jthi
55 DO bi=itlo,ithi
56 DO k=1,Nr
57 DO j=1-OLy,sNy+OLy
58 DO i=1-OLx,sNx+OLx
59 smooth3D_Lz(i,j,k,bi,bj)=smooth3D_Lz0(smoothOpNb)
60 ENDDO
61 ENDDO
62 ENDDO
63 ENDDO
64 ENDDO
65 endif
66
67 DO bj=jtlo,jthi
68 DO bi=itlo,ithi
69 DO k=1,Nr
70 DO j=1-OLy,sNy+OLy
71 DO i=1-OLx,sNx+OLx
72 smooth3D_kappaR(i,j,k,bi,bj)=smooth3D_Lz(i,j,k,bi,bj)*
73 & smooth3D_Lz(i,j,k,bi,bj)/smooth3DtotTime/2
74 ENDDO
75 ENDDO
76 ENDDO
77 ENDDO
78 ENDDO
79
80 c avoid excessive vertical smoothing:
81 if (smooth3DsizeZ(smoothOpNb).NE.3) then
82 DO bj=jtlo,jthi
83 DO bi=itlo,ithi
84 DO k=1,Nr
85 DO j=1-OLy,sNy+OLy
86 DO i=1-OLx,sNx+OLx
87
88 smooth3D_KzMax=drC(k)
89 smooth3D_KzMax=smooth3D_KzMax*smooth3D_KzMax/smooth3DtotTime/2
90 if (smooth3D_kappaR(i,j,k,bi,bj).GT.smooth3D_KzMax) then
91 smooth3D_kappaR(i,j,k,bi,bj)=smooth3D_KzMax
92 endif
93 ENDDO
94 ENDDO
95 ENDDO
96 ENDDO
97 ENDDO
98 endif
99
100 CALL EXCH_XYZ_RL( smooth3D_kappaR, myThid )
101
102
103 c hoizontal smoothing:
104
105 if (smooth3DsizeH(smoothOpNb).EQ.3) then
106 write(fnamegeneric(1:80),'(1a,i3.3)')
107 & 'smooth3DscalesH',smoothOpNb
108 CALL READ_REC_3D_RL(fnamegeneric,smoothprec,
109 & Nr, smooth3D_Lx,1,1,mythid)
110 CALL READ_REC_3D_RL(fnamegeneric,smoothprec,
111 & Nr, smooth3D_Ly,2,1,mythid)
112 CALL EXCH_XYZ_RL( smooth3D_Lx, mythid )
113 CALL EXCH_XYZ_RL( smooth3D_Ly, mythid )
114 else
115 DO bj=jtlo,jthi
116 DO bi=itlo,ithi
117 DO k=1,Nr
118 DO j=1-OLy,sNy+OLy
119 DO i=1-OLx,sNx+OLx
120 smooth3D_Lx(i,j,k,bi,bj)=smooth3D_Lx0(smoothOpNb)
121 smooth3D_Ly(i,j,k,bi,bj)=smooth3D_Ly0(smoothOpNb)
122 ENDDO
123 ENDDO
124 ENDDO
125 ENDDO
126 ENDDO
127 endif
128
129 DO bj=jtlo,jthi
130 DO bi=itlo,ithi
131 DO k=1,Nr
132 DO j=1-OLy,sNy+OLy
133 DO i=1-OLx,sNx+OLx
134 smooth3D_Kuy(i,j,k,bi,bj)=0.
135 smooth3D_Kvx(i,j,k,bi,bj)=0.
136 smooth3D_Kwx(i,j,k,bi,bj)=0.
137 smooth3D_Kwy(i,j,k,bi,bj)=0.
138 smooth3D_Kwz(i,j,k,bi,bj)=0.
139 smooth3D_Kux(i,j,k,bi,bj)=smooth3D_Lx(i,j,k,bi,bj)*
140 & smooth3D_Lx(i,j,k,bi,bj)/smooth3DtotTime/2
141 smooth3D_Kvy(i,j,k,bi,bj)=smooth3D_Ly(i,j,k,bi,bj)*
142 & smooth3D_Ly(i,j,k,bi,bj)/smooth3DtotTime/2
143 smooth3D_Kuz(i,j,k,bi,bj)=0.
144 smooth3D_Kvz(i,j,k,bi,bj)=0.
145 ENDDO
146 ENDDO
147 ENDDO
148 ENDDO
149 ENDDO
150
151 c is exchange useful here?
152
153 CALL EXCH_XYZ_RL( smooth3D_kappaR, myThid )
154 CALL EXCH_XYZ_RL( smooth3D_Kwx, myThid )
155 CALL EXCH_XYZ_RL( smooth3D_Kwy, myThid )
156 CALL EXCH_XYZ_RL( smooth3D_Kwz, myThid )
157 CALL EXCH_XYZ_RL( smooth3D_Kux, myThid )
158 CALL EXCH_XYZ_RL( smooth3D_Kvy, myThid )
159 CALL EXCH_XYZ_RL( smooth3D_Kuz, myThid )
160 CALL EXCH_XYZ_RL( smooth3D_Kvz, myThid )
161 CALL EXCH_XYZ_RL( smooth3D_Kuy, myThid )
162 CALL EXCH_XYZ_RL( smooth3D_Kvx, myThid )
163
164
165 c write diffusion operator to file
166
167 write(fnamegeneric(1:80),'(1a,i3.3)')
168 & 'smooth3Doperator',smoothOpNb
169
170 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
171 & Nr,smooth3D_Kwx,1,1,mythid)
172 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
173 & Nr,smooth3D_Kwy,2,1,mythid)
174 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
175 & Nr,smooth3D_Kwz,3,1,mythid)
176 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
177 & Nr,smooth3D_Kux,4,1,mythid)
178 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
179 & Nr,smooth3D_Kvy,5,1,mythid)
180 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
181 & Nr,smooth3D_Kuz,6,1,mythid)
182 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
183 & Nr,smooth3D_Kvz,7,1,mythid)
184 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
185 & Nr,smooth3D_Kuy,8,1,mythid)
186 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
187 & Nr,smooth3D_Kvx,9,1,mythid)
188 CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
189 & Nr,smooth3D_kappaR,10,1,mythid)
190
191
192 END

  ViewVC Help
Powered by ViewVC 1.1.22