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