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

Annotation 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.5 - (hide annotations) (download)
Sat Jul 7 01:48:48 2012 UTC (11 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63q
Changes since 1.4: +1 -2 lines
remove PACKAGES_CONFIG.h (already included from ${PKG}_OPTIONS.h file)

1 jmc 1.5 C $Header: /u/gcmpack/MITgcm/verification/tutorial_global_oce_optim/code_ad/cost_hflux.F,v 1.4 2009/10/09 01:21:42 jmc Exp $
2 dfer 1.1 C $Name: $
3    
4     #include "COST_CPPOPTIONS.h"
5    
6 jmc 1.4 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 dfer 1.1
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 jmc 1.4
41 dfer 1.1 tmpC = 0. _d 0
42     DO bj=myByLo(myThid),myByHi(myThid)
43 jmc 1.4 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 dfer 1.1 ENDDO
49 jmc 1.4 ENDDO
50 dfer 1.1 ENDDO
51 jmc 1.3 _GLOBAL_SUM_RL( tmpC , myThid )
52 jmc 1.4 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 dfer 1.1 #ifdef ALLOW_AUTODIFF_TAMC
58 jmc 1.4 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 dfer 1.1 & + act3*max1*max2
65     #endif /* ALLOW_AUTODIFF_TAMC */
66 jmc 1.4
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 dfer 1.1 & whfluxm(i,j,bi,bj)*
72     & (
73     & Qnetm(i,j,bi,bj)
74     & )**2
75 jmc 1.4 ENDDO
76 dfer 1.1 ENDDO
77 jmc 1.4
78     objf_hflux_tut(bi,bj) = locfc
79     c print*,'objf_hflux_tut =',locfc
80    
81     ENDDO
82     ENDDO
83 dfer 1.1
84     #endif
85 jmc 1.4 RETURN
86     END

  ViewVC Help
Powered by ViewVC 1.1.22