-
Notifications
You must be signed in to change notification settings - Fork 237
/
streamice_cost_accum.F
105 lines (90 loc) · 2.79 KB
/
streamice_cost_accum.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "STREAMICE_OPTIONS.h"
#ifdef ALLOW_AUTODIFF
# include "AUTODIFF_OPTIONS.h"
#endif
#ifdef ALLOW_COST
# include "COST_OPTIONS.h"
#endif
subroutine streamice_cost_accum ( myIter, myThid )
C *==========================================================*
C | subroutine cost_test |
C | o this routine accumulates the STREAMICE cost func- |
C | tion at each time step, called from cost_tile |
C *==========================================================*
C | |
C | Notes |
C | ===== |
C *==========================================================*
IMPLICIT NONE
C == Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "DYNVARS.h"
#include "GRID.h"
#ifdef ALLOW_STREAMICE
# include "STREAMICE.h"
#endif
#ifdef ALLOW_COST
# include "cost.h"
#endif
#ifdef ALLOW_AUTODIFF_TAMC
# include "tamc.h"
#endif
C == Routine arguments ==
C myThid - Thread number for this instance of the routine.
integer myIter, myThid
#ifdef ALLOW_COST
C == Local variables
_RL thetaRef, HAF
integer i, j, k, bi, bj
integer ig, jg
integer itlo,ithi
integer jtlo,jthi
integer il
integer itime
INTEGER ILNBLNK
EXTERNAL ILNBLNK
jtlo = myByLo(myThid)
jthi = myByHi(myThid)
itlo = myBxLo(myThid)
ithi = myBxHi(myThid)
C-- Calculate mask for tracer cells (0 => land, 1 => water)
c k=1
c#ifdef ALLOW_AUTODIFF_TAMC
cCADJ STORE surf_el_streamice = comlev1, key = ikey_dynamics,
cCADJ & kind = isbyte
cCADJ STORE H_streamice_prev = comlev1, key = ikey_dynamics,
cCADJ & kind = isbyte
cCADJ STORE H_streamice = comlev1, key = ikey_dynamics,
cCADJ & kind = isbyte
c#endif
C-- Calculate cost function on tile of this instance
do bj = jtlo,jthi
do bi = itlo,ithi
do j=1,sNy
do i=1,sNx
if (streamice_cost_mask(i,j,bi,bj).eq.1.0) THEN
cost_func1_streamice (bi,bj) =
& cost_func1_streamice (bi,bj) + 0.0
endif
end do
end do
end do
end do
#ifdef ALLOW_STREAMICE_TC_COST
IF ( STREAMICE_do_timedep_cost ) THEN
CALL STREAMICE_COST_REG_ACCUM (myIter, myThid)
DO itime = 1,streamiceMaxCostLevel
IF (myIter==streamice_surf_cost_timesteps(itime)) THEN
CALL STREAMICE_COST_SURF_ACCUM (myIter, myThid)
ENDIF
IF (myIter==streamice_vel_cost_timesteps(itime)) THEN
CALL STREAMICE_COST_VEL_ACCUM (myIter, myThid)
ENDIF
ENDDO
ENDIF
#endif
#endif
RETURN
END