/[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.1 - (show annotations) (download)
Thu Nov 6 22:10:07 2003 UTC (20 years, 7 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint52l_pre, checkpoint52e_pre, hrcube4, checkpoint52n_post, checkpoint52j_post, checkpoint53d_post, checkpoint54a_pre, checkpoint55c_post, checkpoint54e_post, checkpoint52e_post, checkpoint53c_post, checkpoint55d_pre, hrcube_1, checkpoint52j_pre, checkpoint54a_post, branch-netcdf, checkpoint52d_pre, checkpoint52l_post, checkpoint52k_post, checkpoint52b_pre, checkpoint54b_post, checkpoint53b_pre, checkpoint55b_post, checkpoint54d_post, checkpoint53f_post, checkpoint52m_post, checkpoint55, checkpoint53a_post, checkpoint54, checkpoint54f_post, checkpoint53b_post, checkpoint53, checkpoint52, checkpoint52d_post, checkpoint52a_post, checkpoint52b_post, checkpoint53g_post, checkpoint52f_post, checkpoint52c_post, ecco_c52_e35, hrcube5, checkpoint52a_pre, checkpoint52i_post, checkpoint55a_post, checkpoint53d_pre, checkpoint54c_post, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, hrcube_2, hrcube_3
Branch point for: netcdf-sm0
o merging from ecco-branch
o pkg/ecco now containes ecco-specific part of cost function
o top level routines the_main_loop, forward_step
  supersede those in model/src/
  previous input data.cost now in data.ecco
  (new namelist ecco_cost_nml)

1 C $Header: /u/gcmpack/MITgcm/pkg/cost/Attic/cost_geoid.F,v 1.1.2.2 2002/04/04 10:58:58 heimbach Exp $
2
3 #include "COST_CPPOPTIONS.h"
4
5 subroutine cost_geoid(
6 O sphcost,
7 I shc,
8 I mythid
9 & )
10
11 c ==================================================================
12 c SUBROUTINE cost_geoid
13 c ==================================================================
14 c
15 c o Evaluate the cost function of the geoid contribution.
16 c
17 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
18 c
19 c changed: Christian Eckert eckert@mit.edu 25-Feb-2000
20 c
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
26 c - totally rewrite for parallel processing
27 c
28 c ==================================================================
29 c SUBROUTINE cost_geoid
30 c ==================================================================
31
32 implicit none
33
34 c == global variables ==
35
36 #include "EEPARAMS.h"
37 #include "SIZE.h"
38 #include "PARAMS.h"
39
40 #include "ecco_cost.h"
41 #include "cost_sph.h"
42
43 c == routine arguments ==
44
45 _RL sphcost
46 _RL shc( ncShc )
47 integer mythid
48
49 #ifdef ALLOW_EGM96_ERROR_COV
50
51 c == local variables ==
52
53 Real*8 pinv( ncshc )
54
55 integer i,j
56 integer ilo,ihi
57 integer ilnblnk
58 integer ifnblnk
59 integer ireads
60 integer egmunit
61 integer egmsize
62 parameter( egmsize = 8 )
63
64 integer jsize, joff, jbeg, jend, j
65
66 _RL factor
67 _RL recip_rr
68
69 c == external functions ==
70 integer ilnblnk
71 external ilnblnk
72 integer ifnblnk
73 external ifnblnk
74
75 c == end of interface ==
76
77 c-- Only the master thread is doing I/O
78 _BEGIN_MASTER( mythid )
79
80 c-- initialise cost variable for all threads
81 c-- to allow usage of global_sum_r8
82 sphcost = 0. _d 0
83 do i=1,ncShc
84 pinv(i) = 0. _d 0
85 enddo
86
87 c-- Initialise variables.
88 recip_rr = recip_rsphere*recip_rsphere
89
90 c-- Open the geoid error covariance data file.
91 call mdsfindunit( egmunit, mythid )
92 ilo = ifnblnk(geoid_covariancefile)
93 ihi = ilnblnk(geoid_covariancefile)
94
95 print*
96 print*,' cost_Geoid: egmunit = ',egmunit
97 print*,' geoid_covariancefile = ',
98 & geoid_covariancefile(ilo:ihi)
99 print*,' opening file ...'
100
101 open(egmunit, file = geoid_covariancefile(ilo:ihi),
102 & form = 'unformatted',
103 & access = 'direct',
104 & recl = ncshc*egmsize,
105 & status = 'old' )
106
107 c-- round up the quotient to get jsize
108 jsize = ncshc / numberOfProcs
109 if (jsize*numberOfProcs .lt. ncshc ) then
110 jsize = jsize + 1
111 end if
112
113 c-- compute sub-intervall of 1..ncshc for this processor
114 joff = myProcId*jsize
115 jbeg = 1 + joff
116 jend = min( ncshc, joff+jsize )
117
118 c-- read part of geoid error covariance matrix
119 c-- and compute corresponding part of cost contribution
120 CADJ loop = parallel
121 do j = jbeg,jend
122
123 read(egmunit,rec=j) pinv
124
125 factor = 0.
126 do i = 1,ncShc
127 factor = factor + pinv(i)*shc(i)*recip_rr
128 enddo
129 sphcost = sphcost + factor*shc(j)
130 enddo
131
132 c-- close geoid error covariance file
133 close(egmunit)
134
135 _END_MASTER( mythid )
136
137 call global_sum_r8( cost, mythid )
138 sphcost = cost
139
140 #else /* ALLOW_EGM96_ERROR_COV */
141 sphcost = 0.
142
143 #endif /* ALLOW_EGM96_ERROR_COV */
144
145 end
146
147

  ViewVC Help
Powered by ViewVC 1.1.22