-
Notifications
You must be signed in to change notification settings - Fork 242
/
cost_temp.F
87 lines (76 loc) · 2.04 KB
/
cost_temp.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "COST_OPTIONS.h"
c#ifdef ALLOW_CTRL
c# include "CTRL_OPTIONS.h"
c#endif
CBOP
C !ROUTINE: COST_TEMP
C !INTERFACE:
SUBROUTINE COST_TEMP( myThid )
C *==========================================================*
C | SUBROUTINE COST_TEMP
C | o the subroutine computes the sum of the squared errors
C | relatively to the Levitus climatology
C *==========================================================*
C
C \ev
C !USES:
IMPLICIT NONE
C == Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
#include "cost.h"
#ifdef ALLOW_OPENAD
# include "FFIELDS.h"
#else
# include "cost_local.h"
#endif
C !INPUT/OUTPUT PARAMETERS:
C myThid - Thread number for this instance of the routine.
INTEGER myThid
#ifdef ALLOW_COST_TEMP
C !LOCAL VARIABLES:
INTEGER i, j, k
INTEGER bi, bj
INTEGER Nk
_RL locfc,tmp
_RL thetalev(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
CEOP
Nk = 2
C Read annual mean Levitus temperature
CALL READ_FLD_XYZ_RL('lev_t_an.bin',' ',thetalev,0,myThid)
C Total number of wet temperature point
tmp = 0. _d 0
DO bj=myByLo(myThid),myByHi(myThid)
DO bi=myBxLo(myThid),myBxHi(myThid)
DO k=1, Nk
DO j=1,sNy
DO i=1,sNx
tmp = tmp + maskC(i,j,k,bi,bj)
ENDDO
ENDDO
ENDDO
ENDDO
ENDDO
_GLOBAL_SUM_RL( tmp , myThid )
IF ( tmp.GT.0. ) tmp = 1. _d 0 / tmp
DO bj=myByLo(myThid),myByHi(myThid)
DO bi=myBxLo(myThid),myBxHi(myThid)
locfc = 0. _d 0
DO k=1,Nk
DO j=1,sNy
DO i=1,sNx
locfc = locfc + tmp*maskC(i,j,k,bi,bj)*
& wtheta(k,bi,bj)*
& ( cMeanTheta(i,j,k,bi,bj) - thetalev(i,j,k,bi,bj) )**2
ENDDO
ENDDO
ENDDO
objf_temp_tut(bi,bj) = locfc
c print*,'objf_temp_tut =',locfc,startTime,endTime,tmp
ENDDO
ENDDO
#endif /* ALLOW_COST_TEMP */
RETURN
END