/[MITgcm]/MITgcm/pkg/cal/cal_readparms.F
ViewVC logotype

Diff of /MITgcm/pkg/cal/cal_readparms.F

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

revision 1.1 by heimbach, Thu May 30 21:01:36 2002 UTC revision 1.2 by heimbach, Thu May 30 22:49:56 2002 UTC
# Line 0  Line 1 
1    
2    #include "CAL_CPPOPTIONS.h"
3    
4          subroutine cal_readparms( mythid )
5    
6    c     ==================================================================
7    c     SUBROUTINE cal_readparms
8    c     ==================================================================
9    c
10    c     o This routine initialises the calendar according to the user
11    c       specifications in "data.calendar".
12    c
13    c     started: Christian Eckert eckert@mit.edu  30-Jun-1999
14    c
15    c     changed: Christian Eckert eckert@mit.edu  29-Dec-1999
16    c
17    c              - restructured the original version in order to have a
18    c                better interface to the MITgcmUV.
19    c
20    c              Christian Eckert eckert@mit.edu  10-Jan-2000
21    c
22    c              - Modified namelist input. The data file is first copied
23    c                to scrunit1 with the comment lines being left out.
24    c                After this, scrunit1 is used to read the namelist data.
25    c
26    c              Christian Eckert eckert@mit.edu  19-Jan-2000
27    c
28    c              - Changed the role of the routine arguments. Chris Hill
29    c                proposed to make the calendar less "invasive". The tool
30    c                now assumes that the MITgcmUV already provides an ade-
31    c                quate set of time stepping parameters. The calendar
32    c                only associates a date with the given starttime of the
33    c                numerical model. startdate corresponds to zero start-
34    c                time. So, given niter0 or startdate .ne. zero the actual
35    c                startdate of the current integration is shifted by the
36    c                time interval correponding to niter0, startdate respec-
37    c                tively.
38    c
39    c              Christian Eckert eckert@mit.edu  03-Feb-2000
40    c
41    c              - Introduced new routine and function names, cal_<NAME>,
42    c                for verion 0.1.3.
43    c
44    c     ==================================================================
45    c     SUBROUTINE cal_readparms
46    c     ==================================================================
47    
48          implicit none
49    
50    c     == global variables ==
51    
52    #include "SIZE.h"
53    #include "EEPARAMS.h"
54    #include "PARAMS.h"
55    
56    c     == routine arguments ==
57    
58    c     modstart        - start time of the model integration
59    c     modend          - end time of the model integration
60    c     moditerini      - initial iteration number of the model
61    c     moditerend      - last iteration number of the model
62    c     modstep         - timestep of the numerical model
63    c     modintsteps     - number of timesteps that are to be performed.
64    c     mythid          - number of this instance of the subrotuine.
65    
66          _RL     modstart
67          _RL     modend
68          _RL     modstep
69          integer moditerini
70          integer moditerend
71          integer modintsteps
72          integer mythid
73    
74    c     == local variables ==
75    
76          integer errio
77          integer ierr
78          integer il
79          integer enddate_1
80          integer enddate_2
81    
82    c     Variables related to the calendar tool.
83          character*(9) TheCalendar
84          integer       startdate_1
85          integer       startdate_2
86    
87          character*(max_len_prec) record
88    
89    c     == external ==
90    
91          integer  ilnblnk
92          external ilnblnk
93    
94    c     == end of interface ==
95    
96    c     Calendar parameters
97    c     (version 0.1.3 >> START << )
98    
99          namelist /CAL_NML/
100         & TheCalendar,
101         & startDate_1,startDate_2
102    
103    c     (version 0.1.3 >> END << )
104    
105    
106          _BEGIN_MASTER(myThid)
107    
108    #ifndef ALLOW_CAL_NENDITER
109          print *, 'WARNING: ALLOW_CAL_NENDITER must be defined in CPP file'
110          STOP 'undef ALLOW_CAL_NENDITER no longer supported by cal package'
111    #endif
112    
113    c       Initialise the calendar's parameters
114            TheCalendar = ' '
115            startdate_1 = 0
116            startdate_2 = 0
117            enddate_1   = 0
118            enddate_2   = 0
119    
120            open(unit=scrunit1,status='scratch')
121    
122    c       Next, read the calendar data file.
123            open(unit = modeldataunit,file = 'data.cal',
124         &       status = 'old', iostat = errio)
125            if ( errio .lt. 0 ) then
126              ierr = 1
127              call cal_PrintError( ierr, mythid )
128              stop ' stopped in cal_readparms.'
129            endif
130    
131            do while ( .true. )
132              read(modeldataunit, fmt='(a)', end=1001) record
133              il = max(ilnblnk(record),1)
134              if ( record(1:1) .ne. commentcharacter )
135         &        write(unit=scrunit1, fmt='(a)') record(:il)
136            enddo
137     1001   continue
138    
139            close( modeldataunit )
140    
141            rewind( scrunit1 )
142            read(unit = scrunit1, nml = cal_nml)
143            close( scrunit1 )
144    
145    
146    c       Check consistency of the date specifications with the MITgcmUV's
147    c       startTime, endTime, and nTimeSteps, then set all the calendar
148    c       parameters.
149    
150            modstart    = startTime
151            modend      = endTime
152            modstep     = deltaTclock
153            moditerini  = nIter0
154            moditerend  = nEndIter
155            modintsteps = nTimeSteps
156    
157            call cal_Set(
158         I                modstart,
159         I                modend,
160         I                modstep,
161         I                TheCalendar,
162         I                startdate_1,
163         I                startdate_2,
164         I                enddate_1,
165         I                enddate_2,
166         I                moditerini,
167         I                moditerend,
168         I                modintsteps,
169         I                mythid
170         &              )
171    
172            call cal_Summary( mythid )
173    
174          _END_MASTER(myThid)
175    
176    c     Everyone else must wait for the parameters to be loaded
177          _BARRIER
178    
179          return
180          end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22