/[MITgcm]/MITgcm/pkg/ctrl/ctrl_get_gen_rec.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_get_gen_rec.F

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


Revision 1.4 - (show annotations) (download)
Thu Mar 4 19:49:47 2004 UTC (20 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint57t_post, checkpoint57o_post, checkpoint52l_pre, checkpoint58e_post, checkpoint57v_post, checkpoint52n_post, checkpoint53d_post, checkpoint58u_post, checkpoint58w_post, checkpoint54a_pre, checkpoint57m_post, checkpoint55c_post, checkpoint54e_post, checkpoint57s_post, checkpoint54a_post, checkpoint53c_post, checkpoint57k_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint57b_post, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint52l_post, checkpoint55h_post, checkpoint58n_post, checkpoint58x_post, checkpoint57g_pre, checkpoint54b_post, checkpoint53b_pre, checkpoint55b_post, checkpoint58t_post, checkpoint58h_post, checkpoint54d_post, checkpoint56c_post, checkpoint52m_post, checkpoint57y_pre, checkpoint55, checkpoint53a_post, checkpoint57f_pre, checkpoint57a_post, checkpoint54, checkpoint58q_post, checkpoint54f_post, checkpoint53b_post, checkpoint55g_post, checkpoint58j_post, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint57r_post, checkpoint59, checkpoint58, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint53, eckpoint57e_pre, checkpoint57h_done, checkpoint58f_post, checkpoint53g_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint58i_post, checkpoint57q_post, checkpoint58g_post, hrcube5, checkpoint58o_post, checkpoint57z_post, checkpoint57c_post, checkpoint58y_post, checkpoint55e_post, checkpoint58k_post, checkpoint58v_post, checkpoint53f_post, checkpoint55a_post, checkpoint53d_pre, checkpoint54c_post, checkpoint58s_post, checkpoint58p_post, checkpoint57j_post, checkpoint58b_post, checkpoint57h_pre, checkpoint58m_post, checkpoint57l_post, checkpoint57h_post, checkpoint56a_post, checkpoint55d_post
Changes since 1.3: +1 -6 lines
Some tricks...

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_get_gen_rec.F,v 1.3 2003/11/06 22:05:08 heimbach Exp $
2
3 #include "PACKAGES_CONFIG.h"
4 #include "CTRL_CPPOPTIONS.h"
5
6
7 subroutine ctrl_get_gen_rec(
8 I xx_genstartdate,
9 I xx_genperiod,
10 O fac,
11 O first,
12 O changed,
13 O count0,
14 O count1,
15 I mytime,
16 I myiter,
17 I mythid
18 & )
19
20 c ==================================================================
21 c SUBROUTINE ctrl_get_gen_rec
22 c ==================================================================
23 c
24 c o Get flags, counters, and the linear interpolation factor for a
25 c given control vector contribution.
26 c o New, generic, for new routine ctrl_get_gen
27 c
28 c ==================================================================
29 c SUBROUTINE ctrl_get_gen_rec
30 c ==================================================================
31
32 implicit none
33
34 c == global variables ==
35
36 #include "EEPARAMS.h"
37 #include "SIZE.h"
38
39 #include "ctrl.h"
40 #ifdef ALLOW_CAL
41 # include "cal.h"
42 #endif
43
44 c == routine arguments ==
45
46 integer xx_genstartdate(4)
47 _RL xx_genperiod
48 _RL fac
49 logical first
50 logical changed
51 integer count0
52 integer count1
53 _RL mytime
54 integer myiter
55 integer mythid
56
57 c == local variables ==
58
59 #ifdef ALLOW_CAL
60
61 integer mydate(4)
62 integer previousdate(4)
63 integer difftime(4)
64
65 integer fldcount
66 _RL fldsecs
67 integer prevfldcount
68 _RL prevfldsecs
69 integer flddate(4)
70
71 integer fldstartdate(4)
72 _RL fldperiod
73
74 logical lArgErr
75
76 #ifdef ECCO_VERBOSE
77 character*(max_len_mbuf) msgbuf
78 #endif
79
80 c == end of interface ==
81
82 lArgErr = .true.
83 fldperiod = 0.
84
85 c Map the field parameters.
86
87 call cal_CopyDate(
88 I xx_genstartdate,
89 O fldstartdate,
90 I mythid
91 & )
92 fldperiod = xx_genperiod
93 lArgErr = .false.
94
95 c-- Check the field argument.
96 if ( lArgErr ) then
97 print*,' The subroutine *ctrl_get_gen_rec* has been called'
98 print*,' with an illegal field specification.'
99 stop ' ... stopped in ctrl_get_gen_rec.'
100 endif
101
102 c-- Determine the current date.
103 call cal_GetDate( myiter, mytime, mydate, mythid )
104
105 c Determine the flux record just before mycurrentdate.
106 call cal_TimePassed( fldstartdate, mydate, difftime,
107 & mythid )
108 call cal_ToSeconds( difftime, fldsecs, mythid )
109 fldsecs = int((fldsecs+0.5)/fldperiod)*fldperiod
110 fldcount = int((fldsecs+0.5)/fldperiod) + 1
111
112 c Set switches for reading new records.
113 first = ((mytime - modelstart) .lt. 0.5*modelstep)
114
115 if ( first) then
116 changed = .false.
117 else
118 call cal_GetDate( myiter-1, mytime-modelstep,
119 & previousdate, mythid )
120
121 call cal_TimePassed( fldstartdate, previousdate,
122 & difftime, mythid )
123 call cal_ToSeconds( difftime, prevfldsecs, mythid )
124 prevfldsecs = int((prevfldsecs+0.5)/fldperiod)*fldperiod
125 prevfldcount = int((prevfldsecs+0.5)/fldperiod) + 1
126
127 if (fldcount .ne. prevfldcount) then
128 changed = .true.
129 else
130 changed = .false.
131 endif
132 endif
133
134 count0 = fldcount
135 count1 = fldcount + 1
136
137 call cal_TimeInterval( fldsecs, 'secs', difftime, mythid )
138 call cal_AddTime( fldstartdate, difftime, flddate, mythid )
139 call cal_TimePassed( flddate, mydate, difftime, mythid )
140 call cal_ToSeconds( difftime, fldsecs, mythid )
141
142 c Weight belonging to irec for linear interpolation purposes.
143 c Note: The weight as chosen here is 1. - fac of the "old"
144 c MITgcm's estimation program.
145 fac = 1. - fldsecs/fldperiod
146
147 #ifdef ECCO_VERBOSE
148 c Do some printing for the protocol.
149 _BEGIN_MASTER( mythid )
150 write(msgbuf,'(a)') ' '
151 call print_message( msgbuf, standardmessageunit,
152 & SQUEEZE_RIGHT , mythid)
153 write(msgbuf,'(a,2x,l2,2x,l2,2x,D15.8)')
154 & ' first, changed, fac:',
155 & first, changed, fac
156 call print_message( msgbuf, standardmessageunit,
157 & SQUEEZE_RIGHT , mythid)
158 write(msgbuf,'(a,i4,i4)')
159 & ' count0, count1:',
160 & count0, count1
161 call print_message( msgbuf, standardmessageunit,
162 & SQUEEZE_RIGHT , mythid)
163 write(msgbuf,'(a)') ' '
164 call print_message( msgbuf, standardmessageunit,
165 & SQUEEZE_RIGHT , mythid)
166 _END_MASTER( mythid )
167 #endif
168
169 #endif /* ALLOW_CAL */
170
171 return
172 end
173

  ViewVC Help
Powered by ViewVC 1.1.22