/[MITgcm]/MITgcm/verification/tutorial_global_oce_optim/code_ad/cost_hflux.F
ViewVC logotype

Contents of /MITgcm/verification/tutorial_global_oce_optim/code_ad/cost_hflux.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Fri Aug 10 19:31:56 2012 UTC (11 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63r, checkpoint63s, checkpoint64, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a
Changes since 1.5: +2 -2 lines
rename COST_CPPOPTIONS.h to COST_OPTIONS.h

1 C $Header: /u/gcmpack/MITgcm/verification/tutorial_global_oce_optim/code_ad/cost_hflux.F,v 1.5 2012/07/07 01:48:48 jmc Exp $
2 C $Name: $
3
4 #include "COST_OPTIONS.h"
5
6 SUBROUTINE COST_HFLUX( myThid )
7 C *==========================================================*
8 C | SUBROUTINE COST_HFLUX
9 C | o the subroutine computes the cost function relative to
10 C | surface hflux optimization
11 C *==========================================================*
12
13 IMPLICIT NONE
14
15 C == Global variables ===
16 #include "SIZE.h"
17 #include "EEPARAMS.h"
18 #include "PARAMS.h"
19 #include "GRID.h"
20 #include "DYNVARS.h"
21 #include "cost.h"
22 #include "ctrl_weights.h"
23 #ifdef ALLOW_HFLUXM_CONTROL
24 #include "FFIELDS.h"
25 #endif
26 #ifdef ALLOW_AUTODIFF_TAMC
27 # include "tamc.h"
28 # include "tamc_keys.h"
29 #endif /* ALLOW_AUTODIFF_TAMC */
30
31 C ======== Routine arguments ======================
32 C myThid - Thread number for this instance of the routine.
33 integer myThid
34
35 #if (defined (ALLOW_COST_HFLUXM) && defined (ALLOW_HFLUXM_CONTROL))
36 C ========= Local variables =========================
37 integer i, j
38 integer bi, bj
39 _RL locfc,tmpC
40
41 tmpC = 0. _d 0
42 DO bj=myByLo(myThid),myByHi(myThid)
43 DO bi=myBxLo(myThid),myBxHi(myThid)
44 do j=1,sNy
45 do i=1,sNx
46 tmpC = tmpC + maskC(i,j,1,bi,bj)
47 ENDDO
48 ENDDO
49 ENDDO
50 ENDDO
51 _GLOBAL_SUM_RL( tmpC , myThid )
52 IF ( tmpC.GT.0. ) tmpC = 1. _d 0 / tmpC
53
54 DO bj=myByLo(myThid),myByHi(myThid)
55 DO bi=myBxLo(myThid),myBxHi(myThid)
56
57 #ifdef ALLOW_AUTODIFF_TAMC
58 act1 = bi - myBxLo(myThid)
59 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
60 act2 = bj - myByLo(myThid)
61 max2 = myByHi(myThid) - myByLo(myThid) + 1
62 act3 = myThid - 1
63 ikey = (act1 + 1) + act2*max1
64 & + act3*max1*max2
65 #endif /* ALLOW_AUTODIFF_TAMC */
66
67 locfc = 0. _d 0
68 DO j=1,sNy
69 DO i=1,sNx
70 locfc = locfc + tmpC*maskC(i,j,1,bi,bj)*
71 & whfluxm(i,j,bi,bj)*
72 & (
73 & Qnetm(i,j,bi,bj)
74 & )**2
75 ENDDO
76 ENDDO
77
78 objf_hflux_tut(bi,bj) = locfc
79 c print*,'objf_hflux_tut =',locfc
80
81 ENDDO
82 ENDDO
83
84 #endif
85 RETURN
86 END

  ViewVC Help
Powered by ViewVC 1.1.22