/[MITgcm]/MITgcm_contrib/heimbach/cs_adj_advdiff/code_ad/cost_test.F
ViewVC logotype

Annotation of /MITgcm_contrib/heimbach/cs_adj_advdiff/code_ad/cost_test.F

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


Revision 1.1 - (hide annotations) (download)
Tue May 9 19:37:35 2006 UTC (19 years, 2 months ago) by heimbach
Branch: MAIN
(Re-)starting exch2 adjoint (based on cubed-sphere grid)

1 heimbach 1.1 C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_test.F,v 1.6 2003/10/10 22:43:28 heimbach Exp $
2    
3     #include "PACKAGES_CONFIG.h"
4     #include "CPP_OPTIONS.h"
5    
6     subroutine cost_test( myThid )
7     C /==========================================================\
8     C | subroutine cost_test |
9     C | o this routine computes the cost function for the tiles |
10     C | of this processor |
11     C |==========================================================|
12     C | |
13     C | Notes |
14     C | ===== |
15     C \==========================================================/
16     IMPLICIT NONE
17    
18     C == Global variables ===
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21     #include "PARAMS.h"
22     #include "DYNVARS.h"
23     #include "GRID.h"
24    
25     #include "cost.h"
26    
27     C == Routine arguments ==
28     C myThid - Thread number for this instance of the routine.
29     integer bi, bj
30     integer myThid
31    
32     #ifdef ALLOW_COST_TEST
33     C == Local variables
34     _RL thetaRef
35     _RL sumcost(nSx,nSy)
36    
37     integer i, j, k
38     integer ig, jg
39     integer itlo,ithi
40     integer jtlo,jthi
41    
42     jtlo = mybylo(mythid)
43     jthi = mybyhi(mythid)
44     itlo = mybxlo(mythid)
45     ithi = mybxhi(mythid)
46    
47     if ( useCubedSphereExchange) then
48     iLocOut = 7
49     jLocOut = 17
50     kLocOut = 1
51     else
52     iLocOut = 80
53     jLocOut = 30
54     kLocOut = 1
55     endif
56    
57     ce some reference temperature
58     thetaRef = 24.0D0
59    
60     C-- Calculate mask for tracer cells (0 => land, 1 => water)
61     k=1
62    
63     C-- Calculate cost function on tile of this instance
64     do bj = jtlo,jthi
65     do bi = itlo,ithi
66    
67     sumcost(bi,bj) = 0.
68    
69     do j=1,sNy
70     jg = myYGlobalLo-1+(bj-1)*sNy+j
71     do i=1,sNx
72     ig = myXGlobalLo-1+(bi-1)*sNx+i
73    
74     if ( ig .GE. (iLocOut-3) .AND. ig .LE. (iLocOut+3) .AND.
75     & jg .GE. (jLocOut-3) .AND. jg .LE. (jLocOut+3) ) then
76    
77     c write(*,'(a,3(x,i4),a,4(x,i4))')
78     c & 'COST ',ig,jg,kLocOut,' TILE ',i,j,bi,bj
79    
80     objf_test(bi,bj) = objf_test(bi,bj) +
81     & theta(i,j,kLocOut,bi,bj)*hFacC(i,j,kLocOut,bi,bj)
82    
83     sumcost(bi,bj) = sumcost(bi,bj)+hFacC(i,j,kLocOut,bi,bj)
84     cph(
85     cph print *, 'ph-cost ', ig, jg, kLocOut,
86     cph & theta(i,j,kLocOut,bi,bj)
87     cph)
88     endif
89    
90     end do
91     end do
92    
93     if ( sumcost(bi,bj) .NE. 0. ) then
94     objf_test(bi,bj) = objf_test(bi,bj)/sumcost(bi,bj)
95     print *, 'ph-cost ', bi,bj, objf_test(bi,bj)
96     endif
97    
98     end do
99     end do
100    
101     #endif
102    
103     END

  ViewVC Help
Powered by ViewVC 1.1.22