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

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

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


Revision 1.2 - (show annotations) (download)
Thu Sep 11 19:54:57 2014 UTC (9 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.1: +5 -16 lines
same changes as in ../code_ad: Include explicitly CTRL_OPTIONS.h (for
  ALLOW_HFLUXM_CONTROL, in case we don't use ECCO_CPPOPTIONS.h)

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

  ViewVC Help
Powered by ViewVC 1.1.22