/[MITgcm]/MITgcm/pkg/ecco/cost_geoid.F
ViewVC logotype

Contents of /MITgcm/pkg/ecco/cost_geoid.F

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


Revision 1.5 - (show annotations) (download)
Tue Oct 9 00:02:50 2007 UTC (16 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint60, checkpoint61, checkpoint62, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59k, checkpoint59j, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62e, checkpoint62d, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.4: +2 -1 lines
add missing cvs $Header:$ or $Name:$

1 C $Header: $
2 C $Name: $
3
4 #include "COST_CPPOPTIONS.h"
5
6 subroutine cost_geoid(
7 O sphcost,
8 I shc,
9 I mythid
10 & )
11
12 c ==================================================================
13 c SUBROUTINE cost_geoid
14 c ==================================================================
15 c
16 c o Evaluate the cost function of the geoid contribution.
17 c
18 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
19 c
20 c changed: Christian Eckert eckert@mit.edu 25-Feb-2000
21 c - Restructured the code in order to create a package
22 c for the MITgcmUV.
23 c
24 c changed: Ralf Giering Ralf.Giering@FastOpt.de 12-Jun-2001
25 c - totally rewrite for parallel processing
26 c
27 c heimbach@mit.edu 05-May-2005
28 c - debugged and restructuted
29 c
30 c ==================================================================
31 c SUBROUTINE cost_geoid
32 c ==================================================================
33
34 implicit none
35
36 c == global variables ==
37
38 #include "EEPARAMS.h"
39 #include "SIZE.h"
40 #include "PARAMS.h"
41
42 #include "ecco_cost.h"
43 #ifdef ALLOW_SPHERE
44 # include "sphere.h"
45 #else
46 integer ncShc
47 parameter (ncShc=1)
48 #endif
49
50 c == routine arguments ==
51
52 _RL sphcost
53 _RL shc( ncShc )
54 integer mythid
55
56 #ifdef ALLOW_EGM96_ERROR_COV
57
58 c == local variables ==
59
60 Real*8 pinv( ncshc )
61
62 integer i,j
63 integer ilo,ihi
64 integer ireads
65 integer egmsize
66 parameter( egmsize = 8 )
67
68 integer jsize, joff, jbeg, jend
69 integer reclength
70
71 _RL factor
72 _RL recip_rr
73
74 c == end of interface ==
75
76 c-- Only the master thread is doing I/O
77 _BEGIN_MASTER( mythid )
78
79 c-- initialise cost variable for all threads
80 c-- to allow usage of global_sum_r8
81 sphcost = 0. _d 0
82 do i=1,ncShc
83 pinv(i) = 0. _d 0
84 enddo
85
86 c-- Initialise variables.
87 recip_rr = recip_rsphere*recip_rsphere
88
89 c-- round up the quotient to get jsize
90 jsize = ncshc / numberOfProcs
91 if (jsize*numberOfProcs .lt. ncshc ) then
92 jsize = jsize + 1
93 end if
94
95 c-- compute sub-intervall of 1..ncshc for this processor
96 joff = myProcId*jsize
97 jbeg = 1 + joff
98 jend = min( ncshc, joff+jsize )
99 reclength = ncshc*egmsize
100
101 c-- read part of geoid error covariance matrix
102 c-- and compute corresponding part of cost contribution
103 CADJ loop = parallel
104 do j = jbeg,jend
105
106 call cost_readgeoid(
107 I geoid_covariancefile, reclength, j,
108 O pinv,
109 I mythid )
110
111 factor = 0.
112 do i = 1,ncShc
113 factor = factor + pinv(i)*shc(i)*recip_rr
114 enddo
115 sphcost = sphcost + factor*shc(j)
116 enddo
117
118 _END_MASTER( mythid )
119
120 call global_sum_r8( sphcost, mythid )
121
122 #else /* ALLOW_EGM96_ERROR_COV */
123 sphcost = 0.
124
125 #endif /* ALLOW_EGM96_ERROR_COV */
126
127 end
128
129

  ViewVC Help
Powered by ViewVC 1.1.22