/[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.1 - (hide annotations) (download)
Tue Jan 15 21:16:42 2008 UTC (16 years, 4 months ago) by dfer
Branch: MAIN
Initial check-in.

1 dfer 1.1 C $Header: $
2     C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "COST_CPPOPTIONS.h"
6    
7     subroutine cost_hflux( myThid )
8     C /==========================================================\
9     C | subroutine cost_hflux |
10     C | o the subroutine computes the cost function relative to |
11     C | surface hflux optimization |
12     C \==========================================================/
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     LOGICAL DIFFERENT_MULTIPLE
32     EXTERNAL DIFFERENT_MULTIPLE
33    
34     C ======== Routine arguments ======================
35     C myThid - Thread number for this instance of the routine.
36     integer myThid
37    
38     #if (defined (ALLOW_COST_HFLUXM) && defined (ALLOW_HFLUXM_CONTROL))
39     C ========= Local variables =========================
40     integer i, j
41     integer bi, bj
42     _RL locfc,tmpC
43     C
44     tmpC = 0. _d 0
45     DO bj=myByLo(myThid),myByHi(myThid)
46     DO bi=myBxLo(myThid),myBxHi(myThid)
47     do j=1,sNy
48     do i=1,sNx
49     tmpC = tmpC + maskC(i,j,1,bi,bj)
50     enddo
51     enddo
52     ENDDO
53     ENDDO
54     _GLOBAL_SUM_R8( tmpC , myThid )
55     print *,'tmpC',tmpC
56     locfc = 0. _d 0
57     c
58     DO bj=myByLo(myThid),myByHi(myThid)
59     DO bi=myBxLo(myThid),myBxHi(myThid)
60     c
61     #ifdef ALLOW_AUTODIFF_TAMC
62     act1 = bi - myBxLo(myThid)
63     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
64     act2 = bj - myByLo(myThid)
65     max2 = myByHi(myThid) - myByLo(myThid) + 1
66     act3 = myThid - 1
67     ikey = (act1 + 1) + act2*max1
68     & + act3*max1*max2
69     #endif /* ALLOW_AUTODIFF_TAMC */
70     c
71     do j=1,sNy
72     do i=1,sNx
73     locfc = locfc + 1/tmpC*maskC(i,j,1,bi,bj)*
74     & whfluxm(i,j,bi,bj)*
75     & (
76     & Qnetm(i,j,bi,bj)
77     & )**2
78     enddo
79     enddo
80     c
81     objf_hfluxm(bi,bj) = locfc
82     print*,'objf_hfluxm =',locfc
83     c
84     ENDDO
85     ENDDO
86    
87     #endif
88    
89     end

  ViewVC Help
Powered by ViewVC 1.1.22