1 |
#include "CPP_OPTIONS.h" |
2 |
|
3 |
subroutine smooth_correl2Dw ( |
4 |
U fld_in,mask_in,xx_gen_file,MMF,mythid) |
5 |
CMM U fld_in,mask_in,xx_gen_file,mythid) |
6 |
|
7 |
IMPLICIT NONE |
8 |
#include "SIZE.h" |
9 |
#include "EEPARAMS.h" |
10 |
#include "GRID.h" |
11 |
#include "PARAMS.h" |
12 |
c#include "tamc.h" |
13 |
#include "smooth.h" |
14 |
#include "ctrl.h" |
15 |
#include "ecco_cost.h" |
16 |
|
17 |
_RL mask_in(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nR,nSx,nSy) |
18 |
_RL fld_in(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
19 |
_RL tmpW |
20 |
character*(MAX_LEN_FNAM) xx_gen_file |
21 |
|
22 |
integer i,j,bi,bj |
23 |
integer itlo,ithi |
24 |
integer jtlo,jthi |
25 |
integer myThid |
26 |
CMM( |
27 |
integer MMF |
28 |
CMM) |
29 |
|
30 |
jtlo = mybylo(mythid) |
31 |
jthi = mybyhi(mythid) |
32 |
itlo = mybxlo(mythid) |
33 |
ithi = mybxhi(mythid) |
34 |
|
35 |
|
36 |
DO bj = jtlo,jthi |
37 |
DO bi = itlo,ithi |
38 |
DO j = 1,sNy |
39 |
DO i = 1,sNx |
40 |
if ( xx_gen_file .EQ. xx_hflux_file ) then |
41 |
tmpW=whflux(i,j,bi,bj) |
42 |
elseif ( xx_gen_file .EQ. xx_sflux_file ) then |
43 |
tmpW=wsflux(i,j,bi,bj) |
44 |
elseif ( xx_gen_file .EQ. xx_tauu_file ) then |
45 |
tmpW=wtauu(i,j,bi,bj) |
46 |
elseif ( xx_gen_file .EQ. xx_tauv_file ) then |
47 |
tmpW=wtauv(i,j,bi,bj) |
48 |
|
49 |
elseif ( xx_gen_file .EQ. xx_atemp_file ) then |
50 |
tmpW=watemp(i,j,bi,bj) |
51 |
elseif ( xx_gen_file .EQ. xx_aqh_file ) then |
52 |
tmpW=waqh(i,j,bi,bj) |
53 |
elseif ( xx_gen_file .EQ. xx_precip_file ) then |
54 |
tmpW=wprecip(i,j,bi,bj) |
55 |
elseif ( xx_gen_file .EQ. xx_snowprecip_file ) then |
56 |
tmpW=wsnowprecip(i,j,bi,bj) |
57 |
|
58 |
elseif ( xx_gen_file .EQ. xx_swflux_file ) then |
59 |
tmpW=wswflux(i,j,bi,bj) |
60 |
elseif ( xx_gen_file .EQ. xx_swdown_file ) then |
61 |
tmpW=wswdown(i,j,bi,bj) |
62 |
elseif ( xx_gen_file .EQ. xx_lwflux_file ) then |
63 |
tmpW=wlwflux(i,j,bi,bj) |
64 |
elseif ( xx_gen_file .EQ. xx_lwdown_file ) then |
65 |
tmpW=wlwdown(i,j,bi,bj) |
66 |
|
67 |
elseif ( xx_gen_file .EQ. xx_evap_file ) then |
68 |
tmpW=wevap(i,j,bi,bj) |
69 |
elseif ( xx_gen_file .EQ. xx_apressure_file ) then |
70 |
tmpW=wapressure(i,j,bi,bj) |
71 |
elseif ( xx_gen_file .EQ. xx_uwind_file ) then |
72 |
tmpW=wuwind(i,j,bi,bj) |
73 |
elseif ( xx_gen_file .EQ. xx_vwind_file ) then |
74 |
tmpW=wvwind(i,j,bi,bj) |
75 |
|
76 |
else |
77 |
tmpW=0. |
78 |
WRITE(errorMessageUnit,'(2A)' ) |
79 |
& 'no weights implemented here for ',xx_gen_file |
80 |
STOP 'ABNORMAL END: S/R smooth_correl2Dw' |
81 |
endif |
82 |
|
83 |
if ((mask_in(i,j,1,bi,bj).NE.0.).AND.(tmpW.NE.0.)) then |
84 |
if (MMF.EQ.1) then |
85 |
fld_in(i,j,bi,bj)=fld_in(i,j,bi,bj)*sqrt(tmpW) |
86 |
elseif (MMF.EQ.2) then |
87 |
fld_in(i,j,bi,bj)=fld_in(i,j,bi,bj)/sqrt(tmpW) |
88 |
else |
89 |
WRITE(errorMessageUnit,'(2A)' ) |
90 |
& 'MM messed up for ',xx_gen_file |
91 |
STOP 'ABNORMAL END: S/R smooth_correl2Dw' |
92 |
endif |
93 |
else |
94 |
fld_in(i,j,bi,bj)=fld_in(i,j,bi,bj)*0. |
95 |
endif |
96 |
|
97 |
ENDDO |
98 |
ENDDO |
99 |
ENDDO |
100 |
ENDDO |
101 |
|
102 |
|
103 |
_EXCH_XY_RL ( fld_in , myThid ) |
104 |
|
105 |
end |