1 |
gforget |
1.1 |
C $Header: /u/gcmpack/MITgcm_contrib/gael/pkg/smooth2/smooth_correl3D.F,v 1.1 2009/10/24 23:27:24 gforget Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
subroutine smooth_correl3D ( |
7 |
|
|
U fld_in,smoothOpNb,mythid) |
8 |
|
|
|
9 |
|
|
C *==========================================================* |
10 |
|
|
C | SUBROUTINE smooth_correl3D |
11 |
|
|
C | o Routine that applies spatial correlation |
12 |
|
|
C | operator to a 3D control field |
13 |
|
|
C *==========================================================* |
14 |
|
|
|
15 |
|
|
IMPLICIT NONE |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "EEPARAMS.h" |
18 |
|
|
#include "GRID.h" |
19 |
|
|
#include "PARAMS.h" |
20 |
|
|
c#include "tamc.h" |
21 |
|
|
#include "smooth.h" |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
_RL fld_in(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nR,nSx,nSy) |
25 |
|
|
integer smoothOpNb |
26 |
|
|
integer nbt_in |
27 |
|
|
character*( 80) fnamegeneric |
28 |
|
|
integer i,j,k,bi,bj |
29 |
|
|
integer itlo,ithi |
30 |
|
|
integer jtlo,jthi |
31 |
|
|
integer myThid |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
jtlo = mybylo(mythid) |
35 |
|
|
jthi = mybyhi(mythid) |
36 |
|
|
itlo = mybxlo(mythid) |
37 |
|
|
ithi = mybxhi(mythid) |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
c read smoothing [i.e diffusion] operator: |
41 |
|
|
write(fnamegeneric(1:80),'(1a,i3.3)') |
42 |
|
|
& 'smooth3Doperator',smoothOpNb |
43 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kwx, |
44 |
|
|
& 1,mythid) |
45 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kwy, |
46 |
|
|
& 2,mythid) |
47 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kwz, |
48 |
|
|
& 3,mythid) |
49 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kux, |
50 |
|
|
& 4,mythid) |
51 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kvy, |
52 |
|
|
& 5,mythid) |
53 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kuz, |
54 |
|
|
& 6,mythid) |
55 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kvz, |
56 |
|
|
& 7,mythid) |
57 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kuy, |
58 |
|
|
& 8,mythid) |
59 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_Kvx, |
60 |
|
|
& 9,mythid) |
61 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR,smooth3D_kappaR, |
62 |
|
|
& 10,mythid) |
63 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kwx, myThid ) |
64 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kwy, myThid ) |
65 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kwz, myThid ) |
66 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kux, myThid ) |
67 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kvy, myThid ) |
68 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kuz, myThid ) |
69 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kvz, myThid ) |
70 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kuy, myThid ) |
71 |
|
|
_EXCH_XYZ_RL ( smooth3D_Kvx, myThid ) |
72 |
|
|
_EXCH_XYZ_RL ( smooth3D_kappaR, myThid ) |
73 |
|
|
|
74 |
|
|
c read normalization field [i.e. 1/sqrt(var(filter))]: |
75 |
|
|
write(fnamegeneric(1:80),'(1a,i3.3)') |
76 |
|
|
& 'smooth3Dnorm',smoothOpNb |
77 |
|
|
call mdsreadfield(fnamegeneric,smoothprec,'RL',nR, |
78 |
|
|
& smooth3Dnorm,1,mythid) |
79 |
|
|
_EXCH_XYZ_RL ( smooth3Dnorm, myThid ) |
80 |
|
|
|
81 |
|
|
c division by ~sqrt(volume): |
82 |
|
|
DO bj=jtlo,jthi |
83 |
|
|
DO bi=itlo,ithi |
84 |
|
|
DO k=1,Nr |
85 |
|
|
DO j=1,sNy |
86 |
|
|
DO i=1,sNx |
87 |
|
|
fld_in(i,j,k,bi,bj)=fld_in(i,j,k,bi,bj) |
88 |
|
|
& *sqrt(recip_rA(i,j,bi,bj)*recip_drF(k)) |
89 |
|
|
ENDDO |
90 |
|
|
ENDDO |
91 |
|
|
ENDDO |
92 |
|
|
ENDDO |
93 |
|
|
ENDDO |
94 |
|
|
_EXCH_XYZ_RL ( fld_in , myThid ) |
95 |
|
|
|
96 |
|
|
c do the smoothing: |
97 |
|
|
nbt_in=smooth3Dnbt(smoothOpNb)/2 |
98 |
|
|
call smooth_diff3D(fld_in,nbt_in,mythid) |
99 |
|
|
|
100 |
|
|
c division by ~sqrt(var(filter)): |
101 |
|
|
do bj = jtlo,jthi |
102 |
|
|
do bi = itlo,ithi |
103 |
|
|
DO j = 1,sNy |
104 |
|
|
DO i = 1,sNx |
105 |
|
|
DO k = 1,nR |
106 |
|
|
fld_in(i,j,k,bi,bj)=fld_in(i,j,k,bi,bj) |
107 |
|
|
& *smooth3Dnorm(i,j,k,bi,bj) |
108 |
|
|
ENDDO |
109 |
|
|
ENDDO |
110 |
|
|
ENDDO |
111 |
|
|
ENDDO |
112 |
|
|
ENDDO |
113 |
|
|
_EXCH_XYZ_RL ( fld_in , myThid ) |
114 |
|
|
|
115 |
|
|
end |