71 |
|
|
72 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
73 |
|
|
74 |
|
cnew( |
75 |
|
integer il |
76 |
|
integer mody, modm |
77 |
|
integer iyear, imonth |
78 |
|
character*(80) fnametmp |
79 |
|
logical exst |
80 |
|
cnew) |
81 |
|
|
82 |
c == external functions == |
c == external functions == |
83 |
|
|
84 |
integer ilnblnk |
integer ilnblnk |
95 |
imin = 1 |
imin = 1 |
96 |
imax = snx |
imax = snx |
97 |
|
|
98 |
spval = -9990. |
spval = -1.8 |
99 |
|
|
100 |
c-- Read state record from global file. |
c-- Read state record from global file. |
101 |
doglobalread = .false. |
doglobalread = .false. |
103 |
|
|
104 |
#ifdef ALLOW_CTDT_COST_CONTRIBUTION |
#ifdef ALLOW_CTDT_COST_CONTRIBUTION |
105 |
|
|
|
#ifdef ECCO_VERBOSE |
|
|
write(msgbuf,'(a)') ' ' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a,i8.8)') |
|
|
& ' cost_CTDT: number of records to process =', nmonsrec |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a)') ' ' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
#endif |
|
|
|
|
106 |
if (optimcycle .ge. 0) then |
if (optimcycle .ge. 0) then |
107 |
ilu=ilnblnk( tbarfile ) |
ilu=ilnblnk( tbarfile ) |
108 |
write(fnametheta(1:80),'(2a,i10.10)') |
write(fnametheta(1:80),'(2a,i10.10)') |
109 |
& tbarfile(1:ilu), '.', optimcycle |
& tbarfile(1:ilu),'.',optimcycle |
110 |
endif |
endif |
111 |
|
|
112 |
fcthread_ctdt = 0. _d 0 |
fcthread_ctdt = 0. _d 0 |
113 |
|
|
114 |
|
cnew( |
115 |
|
mody = modelstartdate(1)/10000 |
116 |
|
modm = modelstartdate(1)/100 - mody*100 |
117 |
|
cnew) |
118 |
|
|
119 |
c-- Loop over records. |
c-- Loop over records. |
120 |
do irec = 1,nmonsrec |
do irec = 1,nmonsrec |
121 |
|
|
124 |
& doglobalread, ladinit, |
& doglobalread, ladinit, |
125 |
& optimcycle, mythid, xx_tbar_mean_dummy ) |
& optimcycle, mythid, xx_tbar_mean_dummy ) |
126 |
|
|
127 |
call mdsreadfield( ctdtfile, cost_iprec, 'RL', nr, ctdtobs, |
cnew( |
128 |
& irec, mythid) |
iyear = mody + INT((modm-1+irec-1)/12) |
129 |
|
imonth = 1 + MOD(modm-1+irec-1,12) |
130 |
|
il=ilnblnk(ctdtfile) |
131 |
|
write(fnametmp(1:80),'(2a,i4)') |
132 |
|
& ctdtfile(1:il), '_', iyear |
133 |
|
inquire( file=fnametmp, exist=exst ) |
134 |
|
if (.NOT. exst) then |
135 |
|
write(fnametmp(1:80),'(a)') ctdtfile(1:il) |
136 |
|
imonth = irec |
137 |
|
endif |
138 |
|
|
139 |
|
call mdsreadfield( fnametmp, cost_iprec, 'RL', nr, ctdtobs, |
140 |
|
& imonth, mythid) |
141 |
|
cnew) |
142 |
|
|
143 |
c-- Loop over this thread's tiles. |
c-- Loop over this thread's tiles. |
144 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |