1 |
heimbach |
1.4 |
C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_cost_surf_accum.F,v 1.3 2012/09/28 12:31:31 heimbach Exp $ |
2 |
dgoldberg |
1.1 |
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 |
heimbach |
1.4 |
#ifdef ALLOW_AUTODIFF_TAMC |
32 |
|
|
# include "tamc.h" |
33 |
|
|
#endif |
34 |
dgoldberg |
1.1 |
|
35 |
|
|
C == Routine arguments == |
36 |
|
|
C myThid - Thread number for this instance of the routine. |
37 |
|
|
integer myThid, myIter |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
#ifdef ALLOW_COST_TEST |
41 |
|
|
C == Local variables |
42 |
|
|
_RL thetaRef, HAF |
43 |
|
|
|
44 |
|
|
integer i, j, k, bi, bj |
45 |
|
|
integer ig, jg |
46 |
|
|
integer itlo,ithi |
47 |
|
|
integer jtlo,jthi |
48 |
|
|
INTEGER ILNBLNK |
49 |
|
|
EXTERNAL ILNBLNK |
50 |
|
|
CHARACTER*(MAX_LEN_FNAM) suff |
51 |
|
|
CHARACTER*(MAX_LEN_FNAM) STREAMICEsurfOptimFile |
52 |
|
|
_RL S_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
53 |
|
|
|
54 |
|
|
jtlo = mybylo(mythid) |
55 |
|
|
jthi = mybyhi(mythid) |
56 |
|
|
itlo = mybxlo(mythid) |
57 |
|
|
ithi = mybxhi(mythid) |
58 |
|
|
|
59 |
|
|
WRITE(suff,'(I10.10)') myIter |
60 |
|
|
|
61 |
|
|
CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff//'.data.', ' ', |
62 |
|
|
& S_obs, 0, myThid ) |
63 |
|
|
|
64 |
|
|
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
65 |
|
|
! k=1 |
66 |
|
|
|
67 |
heimbach |
1.4 |
#ifdef ALLOW_AUTODIFF_TAMC |
68 |
|
|
CADJ STORE surf_el_streamice = comlev1, key = ikey_dynamics, |
69 |
|
|
CADJ & kind = isbyte |
70 |
|
|
#endif |
71 |
|
|
|
72 |
dgoldberg |
1.1 |
C-- Calculate cost function on tile of this instance |
73 |
|
|
do bj = jtlo,jthi |
74 |
|
|
do bi = itlo,ithi |
75 |
|
|
do j=1,sNy |
76 |
|
|
do i=1,sNx |
77 |
|
|
|
78 |
|
|
cost_func1_streamice (bi,bj) = |
79 |
heimbach |
1.2 |
& cost_func1_streamice (bi,bj) + |
80 |
|
|
& 0.5 * (S_obs(i,j,bi,bj)- |
81 |
heimbach |
1.3 |
& surf_el_streamice(i,j,bi,bj))**2 |
82 |
dgoldberg |
1.1 |
|
83 |
|
|
end do |
84 |
|
|
end do |
85 |
|
|
end do |
86 |
|
|
end do |
87 |
|
|
|
88 |
|
|
#endif |
89 |
|
|
|
90 |
|
|
RETURN |
91 |
|
|
END |
92 |
heimbach |
1.2 |
|