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

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

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


Revision 1.7 - (show annotations) (download)
Thu Sep 11 19:52:44 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.6: +6 -17 lines
cleaning

1 C $Header: /u/gcmpack/MITgcm/verification/tutorial_global_oce_optim/code_ad/cost_temp.F,v 1.6 2012/08/10 19:31:56 jmc Exp $
2 C $Name: $
3
4 #include "COST_OPTIONS.h"
5 c#ifdef ALLOW_CTRL
6 c# include "CTRL_OPTIONS.h"
7 c#endif
8
9 SUBROUTINE COST_TEMP( myThid )
10 C *==========================================================*
11 C | SUBROUTINE COST_TEMP
12 C | o the subroutine computes the sum of the squared errors
13 C | relatively to the Levitus climatology
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 "cost.h"
24 #include "ctrl_weights.h"
25
26 C ======== Routine arguments ======================
27 C myThid - Thread number for this instance of the routine.
28 INTEGER myThid
29
30 #ifdef ALLOW_COST_TEMP
31 C ========= Local variables =========================
32 INTEGER i, j, k
33 INTEGER bi, bj
34 INTEGER Nk
35 _RL locfc,tmp
36 _RL thetalev(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
37
38 Nk = 2
39 C Read annual mean Levitus temperature
40
41 CALL READ_FLD_XYZ_RL('lev_t_an.bin',' ',thetalev,0,myThid)
42
43 C Total number of wet temperature point
44 tmp = 0. _d 0
45 DO bj=myByLo(myThid),myByHi(myThid)
46 DO bi=myBxLo(myThid),myBxHi(myThid)
47 DO k=1, Nk
48 DO j=1,sNy
49 DO i=1,sNx
50 tmp = tmp + maskC(i,j,k,bi,bj)
51 ENDDO
52 ENDDO
53 ENDDO
54 ENDDO
55 ENDDO
56 _GLOBAL_SUM_RL( tmp , myThid )
57 IF ( tmp.GT.0. ) tmp = 1. _d 0 / tmp
58
59 DO bj=myByLo(myThid),myByHi(myThid)
60 DO bi=myBxLo(myThid),myBxHi(myThid)
61
62 locfc = 0. _d 0
63 DO k=1,Nk
64 DO j=1,sNy
65 DO i=1,sNx
66 locfc = locfc + tmp*maskC(i,j,k,bi,bj)*
67 & wtheta(k,bi,bj)*
68 & ( cMeanTheta(i,j,k,bi,bj) - thetalev(i,j,k,bi,bj) )**2
69 ENDDO
70 ENDDO
71 ENDDO
72
73 objf_temp_tut(bi,bj) = locfc
74 c print*,'objf_temp_tut =',locfc,startTime,endTime,tmp
75
76 ENDDO
77 ENDDO
78
79 #endif /* ALLOW_COST_TEMP */
80 RETURN
81 END

  ViewVC Help
Powered by ViewVC 1.1.22