1 |
C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_cost_surf_accum.F,v 1.8 2012/10/10 21:11:46 dgoldberg Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#ifdef ALLOW_COST |
5 |
# include "COST_OPTIONS.h" |
6 |
#endif |
7 |
#include "STREAMICE_OPTIONS.h" |
8 |
|
9 |
|
10 |
subroutine streamice_cost_surf_accum ( myThid, myIter ) |
11 |
C /==========================================================\ |
12 |
C | subroutine cost_test | |
13 |
C | o this routine computes the cost function for the tiles | |
14 |
C | of this processor | |
15 |
C |==========================================================| |
16 |
C | | |
17 |
C | Notes | |
18 |
C | ===== | |
19 |
C \==========================================================/ |
20 |
IMPLICIT NONE |
21 |
|
22 |
C == Global variables === |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "DYNVARS.h" |
27 |
#include "GRID.h" |
28 |
#ifdef ALLOW_STREAMICE |
29 |
# include "STREAMICE.h" |
30 |
#endif |
31 |
|
32 |
#ifdef ALLOW_COST |
33 |
# include "cost.h" |
34 |
#endif |
35 |
#ifdef ALLOW_AUTODIFF_TAMC |
36 |
# include "tamc.h" |
37 |
#endif |
38 |
|
39 |
C == Routine arguments == |
40 |
C myThid - Thread number for this instance of the routine. |
41 |
integer myThid, myIter |
42 |
|
43 |
|
44 |
#ifdef ALLOW_COST_TEST |
45 |
C == Local variables |
46 |
_RL thetaRef, HAF |
47 |
|
48 |
integer i, j, k, bi, bj |
49 |
integer ig, jg |
50 |
integer itlo,ithi |
51 |
integer jtlo,jthi |
52 |
INTEGER ILNBLNK |
53 |
EXTERNAL ILNBLNK |
54 |
CHARACTER*(MAX_LEN_FNAM) suff |
55 |
CHARACTER*(MAX_LEN_FNAM) STREAMICEsurfOptimFile |
56 |
_RL S_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
57 |
|
58 |
jtlo = mybylo(mythid) |
59 |
jthi = mybyhi(mythid) |
60 |
itlo = mybxlo(mythid) |
61 |
ithi = mybxhi(mythid) |
62 |
|
63 |
WRITE(suff,'(I10.10)') myIter |
64 |
suff = suff(1:ILNBLNK(suff))//'.bin' |
65 |
|
66 |
CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff, ' ', |
67 |
& S_obs, 0, myThid ) |
68 |
|
69 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
70 |
! k=1 |
71 |
|
72 |
#ifdef ALLOW_AUTODIFF_TAMC |
73 |
CADJ STORE surf_el_streamice = comlev1, key = ikey_dynamics, |
74 |
CADJ & kind = isbyte |
75 |
CADJ STORE H_streamice_prev = comlev1, key = ikey_dynamics, |
76 |
CADJ & kind = isbyte |
77 |
CADJ STORE H_streamice = comlev1, key = ikey_dynamics, |
78 |
CADJ & kind = isbyte |
79 |
#endif |
80 |
|
81 |
C-- Calculate cost function on tile of this instance |
82 |
do bj = jtlo,jthi |
83 |
do bi = itlo,ithi |
84 |
do j=1,sNy |
85 |
do i=1,sNx |
86 |
|
87 |
|
88 |
! S_obs(i,j,bi,bj) = 0.0 |
89 |
|
90 |
cost_func1_streamice (bi,bj) = |
91 |
& cost_func1_streamice (bi,bj) + |
92 |
& streamice_wgt_surf * (S_obs(i,j,bi,bj)- |
93 |
& surf_el_streamice(i,j,bi,bj))**2 / Nx / Ny + |
94 |
& streamice_wgt_drift * (H_streamice(i,j,bi,bj)- |
95 |
& H_streamice_prev(i,j,bi,bj))**2 / Nx / Ny |
96 |
|
97 |
|
98 |
end do |
99 |
end do |
100 |
end do |
101 |
end do |
102 |
|
103 |
#endif |
104 |
|
105 |
RETURN |
106 |
END |
107 |
|