1 |
C $Header: /u/gcmpack/MITgcm/pkg/admtlm/admtlm_metric.F,v 1.6 2009/04/28 18:08:13 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ADMTLM_OPTIONS.h" |
5 |
|
6 |
subroutine admtlm_metric( myThid ) |
7 |
C /==========================================================\ |
8 |
C | subroutine admtlm_metric | |
9 |
C | o This routine assigns final T,S to cost function | |
10 |
C \==========================================================/ |
11 |
implicit none |
12 |
|
13 |
C == Global variables === |
14 |
#include "SIZE.h" |
15 |
#include "EEPARAMS.h" |
16 |
#include "PARAMS.h" |
17 |
#include "GRID.h" |
18 |
#include "DYNVARS.h" |
19 |
#ifdef ALLOW_ADMTLM |
20 |
# include "cost.h" |
21 |
# include "g_cost.h" |
22 |
# include "optim.h" |
23 |
#endif |
24 |
|
25 |
C ======== Routine arguments ====================== |
26 |
C myThid - Thread number for this instance of the routine. |
27 |
integer myThid |
28 |
|
29 |
#ifdef ALLOW_ADMTLM |
30 |
C ========= Local variables ========================= |
31 |
integer i, j, k |
32 |
integer bi, bj |
33 |
_RL myMetric |
34 |
_RL stdDevSST |
35 |
_RL stdDevSSS |
36 |
_RL stdDevtheta |
37 |
_RL stdDevsalt |
38 |
_RL stdDevuvel |
39 |
_RL stdDevvvel |
40 |
_RL stdDevetan |
41 |
|
42 |
myMetric = 0. _d 0 |
43 |
stdDevSST = 0.52 _d 0 |
44 |
stdDevSSS = 0.134 _d 0 |
45 |
stdDevtheta = 1. |
46 |
stdDevsalt = 1. |
47 |
stdDevuvel = 1. |
48 |
stdDevvvel = 1. |
49 |
stdDevetan = 1. |
50 |
|
51 |
DO bj=myByLo(myThid),myByHi(myThid) |
52 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
53 |
DO j=1,sNy |
54 |
DO i=1,sNx |
55 |
DO k=1,Nr |
56 |
myMetric = myMetric |
57 |
& + g_objf_state_final(i,j,bi,bj,k+0*Nr)**2/stdDevtheta**2 |
58 |
& + g_objf_state_final(i,j,bi,bj,k+1*Nr)**2/stdDevsalt**2 |
59 |
& + g_objf_state_final(i,j,bi,bj,k+2*Nr)**2/stdDevuvel**2 |
60 |
& + g_objf_state_final(i,j,bi,bj,k+3*Nr)**2/stdDevvvel**2 |
61 |
END DO |
62 |
myMetric = myMetric |
63 |
& + g_objf_state_final(i,j,bi,bj,1+4*Nr)**2/stdDevetan**2 |
64 |
END DO |
65 |
END DO |
66 |
END DO |
67 |
END DO |
68 |
|
69 |
_GLOBAL_SUM_RL( myMetric , myThid ) |
70 |
myMetric = myMetric/(nx*ny*(4*Nr+1)) |
71 |
|
72 |
cph( |
73 |
DO bj=myByLo(myThid),myByHi(myThid) |
74 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
75 |
DO j=1,sNy |
76 |
DO i=1,sNx |
77 |
c print '(a,2I4,2(x,F15.9))', 'ph-metric T ', i, j, |
78 |
c & g_objf_state_final(i,j,bi,bj,1), |
79 |
c & g_objf_state_final(i,j,bi,bj,1)**2 / stdDevSST**2 |
80 |
c print '(a,2I4,2(x,F15.9))', 'ph-metric S ', i, j, |
81 |
c & g_objf_state_final(i,j,bi,bj,2), |
82 |
c & g_objf_state_final(i,j,bi,bj,2)**2 / stdDevSSS**2 |
83 |
END DO |
84 |
END DO |
85 |
END DO |
86 |
END DO |
87 |
|
88 |
print *, 'ph-admtlm myMetric = ', optimcycle, myMetric |
89 |
|
90 |
cph) |
91 |
|
92 |
#endif |
93 |
|
94 |
end |