/[MITgcm]/MITgcm/pkg/exf/exf_getffieldrec.F
ViewVC logotype

Contents of /MITgcm/pkg/exf/exf_getffieldrec.F

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


Revision 1.3 - (show annotations) (download)
Sat Dec 28 10:11:11 2002 UTC (21 years, 5 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint48e_post, checkpoint48b_post, checkpoint48c_pre, checkpoint48d_pre, checkpoint47i_post, checkpoint48d_post, checkpoint47g_post, checkpoint48a_post, checkpoint47j_post, checkpoint48c_post, checkpoint47f_post, checkpoint48, checkpoint47h_post
Changes since 1.2: +22 -13 lines
checkpoint47f_post
Merging from release1_p10:
o modifications for using pkg/exf with pkg/seaice
  - pkg/seaice CPP options SEAICE_EXTERNAL_FORCING
    and SEAICE_EXTERNAL_FLUXES
  - pkg/exf CPP options EXF_READ_EVAP and
    EXF_NO_BULK_COMPUTATIONS
  - usage examples are Experiments 8 and 9 in
    verification/lab_sea/README
  - verification/lab_sea default experiment now uses
    pkg/gmredi, pkg/kpp, pkg/seaice, and pkg/exf

1 c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_getffieldrec.F,v 1.2 2002/12/19 13:44:51 cheisey Exp $
2
3 #include "CPP_OPTIONS.h"
4
5
6 subroutine exf_GetFFieldRec(
7 I fldstartdate, fldperiod,
8 O fac,
9 O first,
10 O changed,
11 O count0,
12 O count1,
13 I mytime,
14 I myiter,
15 I mythid
16 & )
17
18 c ==================================================================
19 c SUBROUTINE exf_GetFFieldRec
20 c ==================================================================
21 c
22 c o Get flags, counters, and the linear interpolation factor for a
23 c given field.
24 c
25 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
26 c
27 c changed: Christian Eckert eckert@mit.edu 14-Jan-2000
28 c - Restructured the code in order to create a package
29 c for the MITgcmUV.
30 c
31 c Christian Eckert eckert@mit.edu 12-Feb-2000
32 c - Changed Routine names (package prefix: exf_)
33 c
34 c Curtis Heisey cheisey@mit.edu 19-Dec-2002
35 c - added "repeatPeriod" for cycling of forcing datasets
36 c
37 c Dimitris Menemenlis menemenlis@jpl.nasa.gov 27-Dec-2002
38 c - bug fix for verification/global_with_exf
39 c
40 c ==================================================================
41 c SUBROUTINE exf_GetFFieldRec
42 c ==================================================================
43
44 implicit none
45
46 c == global variables ==
47
48 c cal: modelstart, modelstep
49 #include "EEPARAMS.h"
50 #include "cal.h"
51 #include "exf_param.h"
52
53 c == routine arguments ==
54
55 integer fldstartdate(4)
56 _RL fldperiod
57 _RL fac
58 logical first
59 logical changed
60 integer count0
61 integer count1
62 _RL mytime
63 integer myiter
64 integer mythid
65
66 c == local variables ==
67
68 integer mydate(4)
69 integer previousdate(4)
70 integer difftime(4)
71
72 integer fldcount
73 _RL fldsecs
74 _RL fldsecs0
75 _RL fldsecs1
76 integer prevfldcount
77 _RL prevfldsecs
78 integer flddate(4)
79
80
81 #ifdef EXF_VERBOSE
82 character*(max_len_mbuf) msgbuf
83 #endif
84
85 c == end of interface ==
86 c print *,'exf_GetFFieldRec: fldstartdate',fldstartdate
87 c print *,'exf_GetFFieldRec: fldperiod',fldperiod
88 c print *,'exf_GetFFieldRec: fac',fac
89 c print *,'exf_GetFFieldRec: first',first
90 c print *,'exf_GetFFieldRec: changed',changed
91 c print *,'exf_GetFFieldRec: count0',count0
92 c print *,'exf_GetFFieldRec: count1',count1
93
94 c Determine the current date.
95 call cal_GetDate( myiter, mytime, mydate, mythid )
96
97 c Determine the flux record just before mycurrentdate.
98 call cal_TimePassed( fldstartdate, mydate, difftime, mythid )
99 call cal_ToSeconds( difftime, fldsecs, mythid )
100 fldsecs = int(fldsecs/fldperiod)*fldperiod
101 fldcount = int(fldsecs/fldperiod) + 1
102
103 c If using repeating data (e.g. monthly means) then make
104 c fldsecs cycle around
105 if (repeatPeriod.ne.0.) then
106 fldsecs0=mod(fldsecs,repeatPeriod)
107 c print *,'repeat: ',fldsecs
108 c Determine the flux record just after mycurrentdate.
109 count0 = int(fldsecs0/fldperiod) + 1
110 fldsecs1 = int((fldsecs+fldperiod)/fldperiod)*fldperiod
111 fldsecs1=mod(fldsecs1,repeatPeriod)
112 c print *,'repeat: ',fldsecs1
113 count1 = int(fldsecs1/fldperiod) + 1
114 endif
115
116 c Set switches for reading new records.
117 first = ((mytime - modelstart) .lt. 0.5*modelstep)
118
119 if ( first) then
120 changed = .false.
121 else
122 call cal_GetDate( myiter-1, mytime-modelstep,
123 & previousdate, mythid )
124
125 call cal_TimePassed( fldstartdate, previousdate, difftime,
126 & mythid )
127 call cal_ToSeconds( difftime, prevfldsecs, mythid )
128 prevfldsecs = int(prevfldsecs/fldperiod)*fldperiod
129 prevfldcount = int(prevfldsecs/fldperiod) + 1
130
131 if (fldcount .ne. prevfldcount) then
132 changed = .true.
133 else
134 changed = .false.
135 endif
136 endif
137
138 if (.NOT.repeatPeriod.ne.0.) then
139 count0 = fldcount
140 count1 = fldcount + 1
141 endif
142
143 call cal_TimeInterval( fldsecs, 'secs', difftime, mythid )
144 call cal_AddTime( fldstartdate, difftime, flddate, mythid )
145 call cal_TimePassed( flddate, mydate, difftime, mythid )
146 call cal_ToSeconds( difftime, fldsecs, mythid )
147
148 c Weight belonging to irec for linear interpolation purposes.
149 c Note: The weight as chosen here is 1. - fac of the "old" MITgcm's
150 c estimation program.
151 fac = 1. - fldsecs/fldperiod
152
153 #ifdef EXF_VERBOSE
154 c Do some printing for the protocol.
155 _BEGIN_MASTER( mythid )
156 write(msgbuf,'(a)') ' '
157 call print_message( msgbuf, standardmessageunit,
158 & SQUEEZE_RIGHT , mythid)
159 write(msgbuf,'(a,2x,l2,2x,l2,2x,D15.8)')
160 & ' exf_GetFFieldsRec: first, changed, fac:',
161 & first, changed, fac
162 call print_message( msgbuf, standardmessageunit,
163 & SQUEEZE_RIGHT , mythid)
164 write(msgbuf,'(a,i4,i4)')
165 & ' exf_GetFFieldsRec: count0, count1:',
166 & count0, count1
167 call print_message( msgbuf, standardmessageunit,
168 & SQUEEZE_RIGHT , mythid)
169 write(msgbuf,'(a)') ' '
170 call print_message( msgbuf, standardmessageunit,
171 & SQUEEZE_RIGHT , mythid)
172 _END_MASTER( mythid )
173 #endif
174
175 end

  ViewVC Help
Powered by ViewVC 1.1.22