1 |
gforget |
1.10 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_gen_transport.F,v 1.9 2015/08/05 20:55:37 gforget Exp $ |
2 |
jmc |
1.3 |
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
jmc |
1.7 |
#include "ECCO_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
|
|
|
7 |
|
|
subroutine cost_gen_transport( |
8 |
|
|
I myiter, |
9 |
|
|
I mytime, |
10 |
|
|
I mythid |
11 |
|
|
& ) |
12 |
|
|
|
13 |
|
|
c ================================================================== |
14 |
|
|
c SUBROUTINE cost_gen_transport |
15 |
|
|
c ================================================================== |
16 |
|
|
c |
17 |
|
|
c o Evaluate cost function contribution for transports |
18 |
|
|
c |
19 |
|
|
c ================================================================== |
20 |
|
|
c SUBROUTINE cost_ssh |
21 |
|
|
c ================================================================== |
22 |
|
|
|
23 |
|
|
implicit none |
24 |
|
|
|
25 |
|
|
c == global variables == |
26 |
|
|
|
27 |
gforget |
1.8 |
#ifdef ALLOW_TRANSPORT_COST_CONTRIBUTION |
28 |
heimbach |
1.1 |
#include "EEPARAMS.h" |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
|
32 |
|
|
#include "ecco_cost.h" |
33 |
|
|
#include "ctrl.h" |
34 |
|
|
#include "optim.h" |
35 |
|
|
#include "DYNVARS.h" |
36 |
gforget |
1.8 |
#endif |
37 |
heimbach |
1.1 |
|
38 |
|
|
c == routine arguments == |
39 |
|
|
|
40 |
|
|
integer myiter |
41 |
|
|
_RL mytime |
42 |
|
|
integer mythid |
43 |
|
|
|
44 |
|
|
#ifdef ALLOW_TRANSPORT_COST_CONTRIBUTION |
45 |
|
|
c == local variables == |
46 |
|
|
|
47 |
|
|
integer bi,bj |
48 |
|
|
integer itlo,ithi |
49 |
|
|
integer jtlo,jthi |
50 |
|
|
integer irec |
51 |
|
|
integer ilps |
52 |
|
|
logical doglobalread |
53 |
|
|
logical ladinit |
54 |
|
|
_RL ftmp |
55 |
|
|
character*(max_len_mbuf) msgbuf |
56 |
|
|
|
57 |
|
|
c == external functions == |
58 |
|
|
|
59 |
|
|
integer ilnblnk |
60 |
|
|
external ilnblnk |
61 |
|
|
|
62 |
|
|
c == end of interface == |
63 |
|
|
|
64 |
|
|
jtlo = mybylo(mythid) |
65 |
|
|
jthi = mybyhi(mythid) |
66 |
|
|
itlo = mybxlo(mythid) |
67 |
|
|
ithi = mybxhi(mythid) |
68 |
|
|
|
69 |
|
|
c-- Loop over records for the second time. |
70 |
|
|
do irec = 1, ndaysrec |
71 |
|
|
|
72 |
|
|
ftmp = 0. _d 0 |
73 |
|
|
do bj = jtlo,jthi |
74 |
|
|
do bi = itlo,ithi |
75 |
|
|
ftmp = ftmp + transpbar(irec,bi,bj) |
76 |
|
|
enddo |
77 |
|
|
enddo |
78 |
jmc |
1.5 |
_GLOBAL_SUM_RL( ftmp , myThid ) |
79 |
heimbach |
1.1 |
|
80 |
heimbach |
1.4 |
cph write(msgbuf,'(A,I,2(X,P2E22.14))') |
81 |
|
|
cph & 'ph-cost-transport FS: day, 1-model, 2-obs ', |
82 |
|
|
cph & irec, ftmp, transpobs(irec) |
83 |
|
|
cph call print_message( msgbuf, standardmessageunit, |
84 |
|
|
cph & SQUEEZE_RIGHT , mythid) |
85 |
heimbach |
1.1 |
|
86 |
|
|
if ( ftmp.NE.0. .AND. wtransp(irec).NE.0. ) then |
87 |
|
|
objf_transp = objf_transp + |
88 |
|
|
& wtransp(irec)*( ftmp - transpobs(irec) )**2 |
89 |
|
|
num_transp = num_transp + 1. _d 0 |
90 |
|
|
endif |
91 |
|
|
|
92 |
|
|
enddo |
93 |
|
|
|
94 |
|
|
#endif /* ifdef ALLOW_TRANSPORT_COST_CONTRIBUTION */ |
95 |
|
|
|
96 |
|
|
end |