forked from altMITgcm/MITgcm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smooth_init2d.F
90 lines (75 loc) · 2.75 KB
/
smooth_init2d.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
C $Header: /u/gcmpack/MITgcm/pkg/smooth/smooth_init2d.F,v 1.2 2010/10/20 19:22:11 gforget Exp $
C $Name: $
#include "SMOOTH_OPTIONS.h"
subroutine smooth_init2D (smoothOpNb, mythid )
C *==========================================================*
C | SUBROUTINE smooth_init2D
C | o Routine that initializes one 2D smoothing/correlation operator
C | by computing/writing the corresponding diffusion operator
C *==========================================================*
cgf the choices of smooth2Dtype and smooth2Dsize need comments...
IMPLICIT NONE
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
#include "SMOOTH.h"
integer i,j,k, bi, bj
integer itlo,ithi
integer jtlo,jthi
integer myThid
character*( 80) fnamegeneric
integer smoothOpNb
jtlo = mybylo(mythid)
jthi = mybyhi(mythid)
itlo = mybxlo(mythid)
ithi = mybxhi(mythid)
smooth2DtotTime=smooth2Dnbt(smoothOpNb)*smooth2DdelTime
if ((smooth2Dtype(smoothOpNb).NE.0).AND.
& (smooth2Dsize(smoothOpNb).EQ.2)) then
write(fnamegeneric(1:80),'(1a,i3.3)')
& 'smooth2Dscales',smoothOpNb
CALL READ_REC_3D_RL(fnamegeneric,smoothprec,
& 1, smooth2D_Lx,1,1,mythid)
CALL READ_REC_3D_RL(fnamegeneric,smoothprec,
& 1, smooth2D_Ly,2,1,mythid)
_EXCH_XY_RL ( smooth2D_Lx, myThid )
_EXCH_XY_RL ( smooth2D_Ly, myThid )
else
DO bj=myByLo(myThid),myByHi(myThid)
DO bi=myBxLo(myThid),myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
smooth2D_Lx(i,j,bi,bj)=smooth2D_Lx0(smoothOpNb)
smooth2D_Ly(i,j,bi,bj)=smooth2D_Ly0(smoothOpNb)
ENDDO
ENDDO
ENDDO
ENDDO
endif
DO bj=myByLo(myThid),myByHi(myThid)
DO bi=myBxLo(myThid),myBxHi(myThid)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
smooth2D_Kux(i,j,bi,bj)=smooth2D_Lx(i,j,bi,bj)*
& smooth2D_Lx(i,j,bi,bj)/smooth2DtotTime/2
smooth2D_Kvy(i,j,bi,bj)=smooth2D_Ly(i,j,bi,bj)*
& smooth2D_Ly(i,j,bi,bj)/smooth2DtotTime/2
ENDDO
ENDDO
ENDDO
ENDDO
_EXCH_XY_RL ( smooth2D_Kux , myThid )
_EXCH_XY_RL ( smooth2D_Kvy , myThid )
WRITE(standardMessageUnit,'(A,I4,2f12.0)')
& 'smooth 2D default parameters: ',
& smooth2Dnbt(smoothOpNb),
& smooth2D_Lx0(smoothOpNb),smooth2D_Ly0(smoothOpNb)
c write diffusion operator to file
write(fnamegeneric(1:80),'(1a,i3.3)')
& 'smooth2Doperator',smoothOpNb
CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
& 1,smooth2D_Kux,1,1,mythid)
CALL WRITE_REC_3D_RL(fnamegeneric,smoothprec,
& 1,smooth2D_Kvy,2,1,mythid)
end