1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_cost_weights.F,v 1.2 2005/09/01 14:23:45 heimbach Exp $ |
2 |
|
3 |
#include "SEAICE_OPTIONS.h" |
4 |
|
5 |
subroutine seaice_cost_weights( mythid ) |
6 |
|
7 |
c ================================================================== |
8 |
c SUBROUTINE seaice_cost_weights |
9 |
c ================================================================== |
10 |
c |
11 |
c ================================================================== |
12 |
c SUBROUTINE seaice_cost_weights |
13 |
c ================================================================== |
14 |
|
15 |
implicit none |
16 |
|
17 |
c == global variables == |
18 |
|
19 |
#include "EEPARAMS.h" |
20 |
#include "SIZE.h" |
21 |
#include "PARAMS.h" |
22 |
#include "GRID.h" |
23 |
|
24 |
#ifdef ALLOW_COST |
25 |
# include "ctrl.h" |
26 |
# include "ecco_cost.h" |
27 |
# include "SEAICE_COST.h" |
28 |
#endif |
29 |
|
30 |
c == routine arguments == |
31 |
|
32 |
integer mythid |
33 |
|
34 |
#ifdef ALLOW_COST |
35 |
c == local variables == |
36 |
|
37 |
integer bi,bj |
38 |
integer i,j,k |
39 |
integer itlo,ithi |
40 |
integer jtlo,jthi |
41 |
integer jmin,jmax |
42 |
integer imin,imax |
43 |
integer gwunit |
44 |
integer irec,nnz |
45 |
integer ilo,ihi |
46 |
|
47 |
_RL dummy |
48 |
|
49 |
c == external == |
50 |
|
51 |
integer ifnblnk |
52 |
external ifnblnk |
53 |
integer ilnblnk |
54 |
external ilnblnk |
55 |
|
56 |
c == end of interface == |
57 |
|
58 |
jtlo = mybylo(mythid) |
59 |
jthi = mybyhi(mythid) |
60 |
itlo = mybxlo(mythid) |
61 |
ithi = mybxhi(mythid) |
62 |
jmin = 1-oly |
63 |
jmax = sny+oly |
64 |
imin = 1-olx |
65 |
imax = snx+olx |
66 |
|
67 |
c-- Define frame. |
68 |
do j = jmin,jmax |
69 |
do i = imin,imax |
70 |
c-- North/South and West/East edges set to zero. |
71 |
if ( (j .lt. 1) .or. (j .gt. sny) .or. |
72 |
& (i .lt. 1) .or. (i .gt. snx) ) then |
73 |
frame(i,j) = 0. _d 0 |
74 |
else |
75 |
frame(i,j) = 1. _d 0 |
76 |
endif |
77 |
enddo |
78 |
enddo |
79 |
|
80 |
#ifdef ALLOW_SEAICE_COST_SMR_AREA |
81 |
|
82 |
do bj = jtlo,jthi |
83 |
do bi = itlo,ithi |
84 |
do j = jmin,jmax |
85 |
do i = imin,imax |
86 |
wsmrarea (i,j,bi,bj) = 0. _d 0 |
87 |
enddo |
88 |
enddo |
89 |
enddo |
90 |
enddo |
91 |
c-- |
92 |
nnz = 1 |
93 |
irec = 1 |
94 |
k = 1 |
95 |
if ( smrarea_errfile .NE. ' ' ) then |
96 |
call mdsreadfield( smrarea_errfile, cost_iprec, cost_yftype, |
97 |
& nnz, wsmrarea, irec, mythid ) |
98 |
do bj = jtlo,jthi |
99 |
do bi = itlo,ithi |
100 |
do j = jmin,jmax |
101 |
do i = imin,imax |
102 |
wsmrarea(i,j,bi,bj) = wsmrarea(i,j,bi,bj) |
103 |
& *frame(i,j)*_hFacC(i,j,k,bi,bj) |
104 |
enddo |
105 |
enddo |
106 |
enddo |
107 |
enddo |
108 |
else |
109 |
do bj = jtlo,jthi |
110 |
do bi = itlo,ithi |
111 |
do j = jmin,jmax |
112 |
do i = imin,imax |
113 |
wsmrarea(i,j,bi,bj) = wsmrarea0 |
114 |
& *frame(i,j)*_hFacC(i,j,k,bi,bj) |
115 |
enddo |
116 |
enddo |
117 |
enddo |
118 |
enddo |
119 |
endif |
120 |
c-- |
121 |
do bj = jtlo,jthi |
122 |
do bi = itlo,ithi |
123 |
do j = jmin,jmax |
124 |
do i = imin,imax |
125 |
if (wsmrarea(i,j,bi,bj) .ne. 0.) |
126 |
& wsmrarea(i,j,bi,bj) = |
127 |
& 1./wsmrarea(i,j,bi,bj)/wsmrarea(i,j,bi,bj) |
128 |
enddo |
129 |
enddo |
130 |
enddo |
131 |
enddo |
132 |
#endif /* ALLOW_SEAICE_COST_SMR_AREA */ |
133 |
|
134 |
#endif |
135 |
|
136 |
end |