1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "COST_CPPOPTIONS.h" |
5 |
|
6 |
subroutine cost_readgeoid( |
7 |
I geoid_covariancefile, reclength, jrec, |
8 |
O pinv, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cost_readgeoid |
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_readgeoid |
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 |
#ifdef ALLOW_SPHERE |
42 |
# include "sphere.h" |
43 |
#endif |
44 |
|
45 |
c == routine arguments == |
46 |
|
47 |
character*(MAX_LEN_FNAM) geoid_covariancefile |
48 |
integer reclength |
49 |
integer jrec |
50 |
#ifndef ALLOW_SPHERE |
51 |
c-- dummy declaration |
52 |
integer ncshc |
53 |
parameter ( ncshc = 1 ) |
54 |
#endif |
55 |
Real*8 pinv( ncshc ) |
56 |
integer mythid |
57 |
|
58 |
#ifdef ALLOW_EGM96_ERROR_COV |
59 |
|
60 |
c == local variables == |
61 |
|
62 |
integer ilo,ihi |
63 |
integer ireads |
64 |
integer egmunit |
65 |
character*(max_len_mbuf) msgbuf |
66 |
|
67 |
c == external functions == |
68 |
integer ilnblnk |
69 |
external ilnblnk |
70 |
integer ifnblnk |
71 |
external ifnblnk |
72 |
|
73 |
c == end of interface == |
74 |
|
75 |
#ifndef ALLOW_SPHERE |
76 |
print *, 'WARNING: this routine assumes package sphere' |
77 |
print *, 'enable sphere in packages.conf when using ' |
78 |
print *, 'CPP option ALLOW_EGM96_ERROR_COV' |
79 |
STOP 'in S/R cost_readgeoid' |
80 |
#endif |
81 |
|
82 |
c-- Only the master thread is doing I/O |
83 |
_BEGIN_MASTER( mythid ) |
84 |
|
85 |
c-- Open the geoid error covariance data file. |
86 |
call mdsfindunit( egmunit, mythid ) |
87 |
|
88 |
ilo = ifnblnk(geoid_covariancefile) |
89 |
ihi = ilnblnk(geoid_covariancefile) |
90 |
|
91 |
write(msgbuf,'(2a)') |
92 |
& 'opening geoid_covariancefile = ', |
93 |
& geoid_covariancefile(ilo:ihi) |
94 |
call print_message( msgbuf, standardmessageunit, |
95 |
& SQUEEZE_RIGHT , mythid) |
96 |
|
97 |
open(egmunit, file = geoid_covariancefile(ilo:ihi), |
98 |
& form = 'unformatted', |
99 |
& access = 'direct', |
100 |
& recl = reclength, |
101 |
& status = 'old' ) |
102 |
|
103 |
read(egmunit,rec=jrec) pinv |
104 |
|
105 |
c-- close geoid error covariance file |
106 |
close(egmunit) |
107 |
|
108 |
_END_MASTER( mythid ) |
109 |
|
110 |
#endif /* ALLOW_EGM96_ERROR_COV */ |
111 |
|
112 |
end |
113 |
|
114 |
|