/[MITgcm]/MITgcm/pkg/profiles/profiles_interp_mean_gg.F
ViewVC logotype

Contents of /MITgcm/pkg/profiles/profiles_interp_mean_gg.F

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


Revision 1.1 - (show annotations) (download)
Fri Feb 22 21:16:51 2008 UTC (16 years, 2 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59o, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
rename profiles_interp_mean_genericgrid as profiles_interp_mean_gg
(for "less than 32 characters name" compiler requirement)

1 C $Header: /u/gcmpack/MITgcm/pkg/profiles/profiles_interp_mean_gg.F,v 1.2 2007/11/05 19:17:59 jmc Exp $
2 C $Name: $
3
4 #include "PROFILES_OPTIONS.h"
5
6 C o==========================================================o
7 C | subroutine profiles_interp |
8 C | o 3D interpolation of model counterparts |
9 C | for netcdf profiles data |
10 C | started: Gael Forget 15-March-2006 |
11 C o==========================================================o
12
13 SUBROUTINE profiles_interp_mean_gg(
14 O traj_cur_out,
15 I i_cur,
16 I j_cur,
17 I weights_cur,
18 I type_cur,
19 I file_cur,
20 I mytime,
21 I bi,
22 I bj,
23 I myThid
24 & )
25
26 implicit none
27
28 C ==================== Global Variables ===========================
29 #include "EEPARAMS.h"
30 #include "SIZE.h"
31 #include "GRID.h"
32 c#include "DYNVARS.h"
33 #include "PARAMS.h"
34 #ifdef ALLOW_CAL
35 #include "cal.h"
36 #endif
37 #ifdef ALLOW_PROFILES
38 # include "profiles.h"
39 #else
40 integer NLEVELMAX
41 parameter (NLEVELMAX=1)
42 #endif
43 c#ifdef ALLOW_PTRACERS
44 c#include "PTRACERS_SIZE.h"
45 c#include "PTRACERS_FIELDS.h"
46 c#endif
47 C ==================== Routine Variables ==========================
48 _RL mytime
49 integer mythid
50 integer type_cur,file_cur
51 _RL traj_cur_out(NLEVELMAX)
52 _RL weights_cur(NUM_INTERP_POINTS)
53 integer i_cur(NUM_INTERP_POINTS)
54 integer j_cur(NUM_INTERP_POINTS)
55
56 #ifdef ALLOW_PROFILES
57
58 C ==================== Local Variables ==========================
59 _RL tab_coeffs1(NUM_INTERP_POINTS)
60 _RL tab_coeffs3(NUM_INTERP_POINTS)
61 _RL ponderations(NUM_INTERP_POINTS)
62 _RL pondsSUM,distance1,distance2
63 integer q,i,j,k,kk,kcur,iG,jG,bi,bj
64 _RL traj_cur(nR),mask_cur(nR)
65 _RL tmp_coeff
66 c-- == end of interface ==
67
68 do k=1,nr
69
70 pondsSUM=0
71 do q=1,NUM_INTERP_POINTS
72
73 if (type_cur.EQ.6) then
74 tab_coeffs1(q)=prof_etan_mean(i_cur(q),j_cur(q),bi,bj)
75 tab_coeffs3(q)=maskC(i_cur(q),j_cur(q),1,bi,bj)
76 else
77 tab_coeffs1(q)=0.
78 tab_coeffs3(q)=0.
79 endif
80
81 ponderations(q)=tab_coeffs3(q)*weights_cur(q)
82 pondsSUM=pondsSUM+ponderations(q)
83 enddo
84
85 if (pondsSUM.GT.0) then
86 mask_cur(k)=1
87 traj_cur(k)=0
88 do q=1,NUM_INTERP_POINTS
89 traj_cur(k)=traj_cur(k)+tab_coeffs1(q)*ponderations(q)/pondsSUM
90 enddo
91 else
92 traj_cur(k)=0
93 mask_cur(k)=0
94 endif
95
96 enddo
97
98 cgf vertical interpolation:
99 do kk=1,NLEVELMAX
100 traj_cur_out(kk)=0
101 prof_mask1D_cur(kk,bi,bj)=0
102 enddo
103 do kk=1,ProfDepthNo(file_cur,bi,bj)
104 c case 1: above first grid center=> first grid center value
105 if (prof_depth(file_cur,kk,bi,bj).LT.-rC(1)) then
106 traj_cur_out(kk)=traj_cur(1)
107 prof_mask1D_cur(kk,bi,bj)=mask_cur(1)
108 c case 2: just below last grid center=> last cell value
109 elseif (prof_depth(file_cur,kk,bi,bj).GE.-rC(nr)) then
110 if ( prof_depth(file_cur,kk,bi,bj) .LT.
111 & (-rC(nr)+drC(nr)/2) ) then
112 traj_cur_out(kk)=traj_cur(nr)
113 prof_mask1D_cur(kk,bi,bj)=mask_cur(nr)
114 endif
115 c case 3: between two grid centers
116 else
117 kcur=0
118 do k=1,nr-1
119 if ((prof_depth(file_cur,kk,bi,bj).GE.-rC(k)).AND.
120 & (prof_depth(file_cur,kk,bi,bj).LT.-rC(k+1))) then
121 kcur=k
122 endif
123 enddo
124 if (kcur.EQ.0) then
125 WRITE(errorMessageUnit,'(A)')
126 & 'ERROR in PROFILES_INTERP: unexpected case 1'
127 STOP 'ABNORMAL END: S/R PROFILES_INTERP'
128 endif
129 if (mask_cur(kcur+1).EQ.1.) then
130 c subcase 1: 2 wet points=>linear interpolation
131 tmp_coeff=(prof_depth(file_cur,kk,bi,bj)+rC(kcur))/
132 & (-rC(kcur+1)+rC(kcur))
133 traj_cur_out(kk)=(1-tmp_coeff)*traj_cur(kcur)
134 & +tmp_coeff*traj_cur(kcur+1)
135 prof_mask1D_cur(kk,bi,bj)=1
136 if (mask_cur(kcur).EQ.0.) then
137 WRITE(errorMessageUnit,'(A)')
138 & 'ERROR in PROFILES_INTERP: unexpected case 2'
139 STOP 'ABNORMAL END: S/R PROFILES_INTERP'
140 endif
141 elseif (prof_depth(file_cur,kk,bi,bj).LT.-rF(kcur+1)) then
142 c subcase 2: only 1 wet point just above=>upper cell value
143 traj_cur_out(kk)=traj_cur(kcur)
144 prof_mask1D_cur(kk,bi,bj)=mask_cur(kcur)
145 endif
146 endif
147 enddo
148
149
150 #endif
151
152 end
153

  ViewVC Help
Powered by ViewVC 1.1.22