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