1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_readgeoid.F,v 1.1 2005/05/05 23:47:57 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
subroutine cost_readgeoid( |
6 |
I geoid_covariancefile, reclength, jrec, |
7 |
O pinv, |
8 |
I mythid |
9 |
& ) |
10 |
|
11 |
c ================================================================== |
12 |
c SUBROUTINE cost_readgeoid |
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 - Restructured the code in order to create a package |
21 |
c for the MITgcmUV. |
22 |
c |
23 |
c changed: Ralf Giering Ralf.Giering@FastOpt.de 12-Jun-2001 |
24 |
c - totally rewrite for parallel processing |
25 |
c |
26 |
c heimbach@mit.edu 05-May-2005 |
27 |
c - debugged and restructuted |
28 |
c |
29 |
c ================================================================== |
30 |
c SUBROUTINE cost_readgeoid |
31 |
c ================================================================== |
32 |
|
33 |
implicit none |
34 |
|
35 |
c == global variables == |
36 |
|
37 |
#include "EEPARAMS.h" |
38 |
#include "SIZE.h" |
39 |
#include "PARAMS.h" |
40 |
#ifdef ALLOW_SPHERE |
41 |
# include "sphere.h" |
42 |
#endif |
43 |
|
44 |
c == routine arguments == |
45 |
|
46 |
character*(MAX_LEN_FNAM) geoid_covariancefile |
47 |
integer reclength |
48 |
integer jrec |
49 |
#ifndef ALLOW_SPHERE |
50 |
c-- dummy declaration |
51 |
integer ncshc |
52 |
parameter ( ncshc = 1 ) |
53 |
#endif |
54 |
Real*8 pinv( ncshc ) |
55 |
integer mythid |
56 |
|
57 |
#ifdef ALLOW_EGM96_ERROR_COV |
58 |
|
59 |
c == local variables == |
60 |
|
61 |
integer ilo,ihi |
62 |
integer ireads |
63 |
integer egmunit |
64 |
character*(max_len_mbuf) msgbuf |
65 |
|
66 |
c == external functions == |
67 |
integer ilnblnk |
68 |
external ilnblnk |
69 |
integer ifnblnk |
70 |
external ifnblnk |
71 |
|
72 |
c == end of interface == |
73 |
|
74 |
#ifndef ALLOW_SPHERE |
75 |
print *, 'WARNING: this routine assumes package sphere' |
76 |
print *, 'enable sphere in packages.conf when using ' |
77 |
print *, 'CPP option ALLOW_EGM96_ERROR_COV' |
78 |
STOP 'in S/R cost_readgeoid' |
79 |
#endif |
80 |
|
81 |
c-- Only the master thread is doing I/O |
82 |
_BEGIN_MASTER( mythid ) |
83 |
|
84 |
c-- Open the geoid error covariance data file. |
85 |
call mdsfindunit( egmunit, mythid ) |
86 |
|
87 |
ilo = ifnblnk(geoid_covariancefile) |
88 |
ihi = ilnblnk(geoid_covariancefile) |
89 |
|
90 |
write(msgbuf,'(2a)') |
91 |
& 'opening geoid_covariancefile = ', |
92 |
& geoid_covariancefile(ilo:ihi) |
93 |
call print_message( msgbuf, standardmessageunit, |
94 |
& SQUEEZE_RIGHT , mythid) |
95 |
|
96 |
open(egmunit, file = geoid_covariancefile(ilo:ihi), |
97 |
& form = 'unformatted', |
98 |
& access = 'direct', |
99 |
& recl = reclength, |
100 |
& status = 'old' ) |
101 |
|
102 |
read(egmunit,rec=jrec) pinv |
103 |
|
104 |
c-- close geoid error covariance file |
105 |
close(egmunit) |
106 |
|
107 |
_END_MASTER( mythid ) |
108 |
|
109 |
#endif /* ALLOW_EGM96_ERROR_COV */ |
110 |
|
111 |
end |
112 |
|
113 |
|