1 |
C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_cost_test.F,v 1.2 2013/04/13 20:51:32 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "THSICE_OPTIONS.h" |
5 |
|
6 |
subroutine thsice_cost_test( mytime, myiter, mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE thsice_cost_test |
10 |
c ================================================================== |
11 |
c |
12 |
c o Compute sea-ice cost function. The following options can be |
13 |
c selected with data.thsice (THSICE_PARM02) variable thsice_cost_ice_flag |
14 |
c |
15 |
c thsice_cost_ice_flag = 1 |
16 |
c - compute mean sea-ice volume |
17 |
c costIceStart < mytime < costIceEnd |
18 |
c |
19 |
c thsice_cost_ice_flag = 2 |
20 |
c - compute mean sea-ice area |
21 |
c costIceStart < mytime < costIceEnd |
22 |
c |
23 |
c thsice_cost_ice_flag = 3 |
24 |
c - heat content of top level plus latent heat of sea-ice |
25 |
c costIceStart < mytime < costIceEnd |
26 |
c |
27 |
c thsice_cost_ice_flag = 4 |
28 |
c - heat content of top level |
29 |
c costIceStart < mytime < costIceEnd |
30 |
c |
31 |
c thsice_cost_ice_flag = 5 |
32 |
c - heat content of top level plus sea-ice plus latent heat of snow |
33 |
c costIceStart < mytime < costIceEnd |
34 |
c |
35 |
c thsice_cost_ice_flag = 6 |
36 |
c - quadratic cost function measuring difference between pkg/thsice |
37 |
c AREA variable and simulated sea-ice measurements at every time |
38 |
c step. |
39 |
c |
40 |
c ================================================================== |
41 |
c SUBROUTINE thsice_cost_test |
42 |
c ================================================================== |
43 |
|
44 |
implicit none |
45 |
|
46 |
c == global variables == |
47 |
#ifdef ALLOW_THSICE_COST_TEST |
48 |
#include "EEPARAMS.h" |
49 |
#include "SIZE.h" |
50 |
#include "GRID.h" |
51 |
#include "PARAMS.h" |
52 |
#include "THSICE_SIZE.h" |
53 |
#include "THSICE_COST.h" |
54 |
#include "THSICE_VARS.h" |
55 |
#include "DYNVARS.h" |
56 |
#include "cost.h" |
57 |
#endif /* ALLOW_THSICE_COST_TEST */ |
58 |
|
59 |
c == routine arguments == |
60 |
|
61 |
_RL mytime |
62 |
integer myiter |
63 |
integer mythid |
64 |
|
65 |
#ifdef ALLOW_THSICE_COST_TEST |
66 |
|
67 |
c == local variables == |
68 |
|
69 |
c msgBuf - Informational/error message buffer |
70 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
71 |
integer bi,bj,i,j,kSrf |
72 |
_RL tempVar |
73 |
|
74 |
c == external functions == |
75 |
|
76 |
integer ilnblnk |
77 |
external ilnblnk |
78 |
|
79 |
c == end of interface == |
80 |
|
81 |
if ( myTime .GT. (endTime - lastinterval) ) then |
82 |
tempVar = 1. _d 0/ |
83 |
& ( ( 1. _d 0 + min(endTime-startTime,lastinterval) ) |
84 |
& / deltaTClock ) |
85 |
|
86 |
kSrf = 1 |
87 |
|
88 |
if ( thsice_cost_ice_flag .eq. 1 ) then |
89 |
c sea-ice volume |
90 |
do bj=myByLo(myThid),myByHi(myThid) |
91 |
do bi=myBxLo(myThid),myBxHi(myThid) |
92 |
do j = 1,sny |
93 |
do i = 1,snx |
94 |
objf_thsice(bi,bj) = objf_thsice(bi,bj) + |
95 |
& tempVar*rA(i,j,bi,bj)*iceHeight(i,j,bi,bj) |
96 |
enddo |
97 |
enddo |
98 |
enddo |
99 |
enddo |
100 |
|
101 |
elseif ( thsice_cost_ice_flag .eq. 2 ) then |
102 |
c sea-ice area |
103 |
do bj=myByLo(myThid),myByHi(myThid) |
104 |
do bi=myBxLo(myThid),myBxHi(myThid) |
105 |
do j = 1,sny |
106 |
do i = 1,snx |
107 |
objf_thsice(bi,bj) = objf_thsice(bi,bj) + |
108 |
& tempVar*rA(i,j,bi,bj)*iceMask(i,j,bi,bj) |
109 |
enddo |
110 |
enddo |
111 |
enddo |
112 |
enddo |
113 |
|
114 |
else |
115 |
WRITE(msgBuf,'(A)') |
116 |
& 'THSICE_COST_TEST: invalid thsice_cost_ice_flag' |
117 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
118 |
& SQUEEZE_RIGHT , myThid ) |
119 |
STOP 'ABNORMAL END: S/R THSICE_COST_TEST' |
120 |
endif |
121 |
endif |
122 |
|
123 |
#endif /* ALLOW_THSICE_COST_TEST */ |
124 |
|
125 |
return |
126 |
end |