source: CPL/oasis3/trunk/src/mod/oasis3/src/initim.f @ 1677

Last change on this file since 1677 was 1677, checked in by aclsce, 12 years ago

Imported oasis3 (tag ipslcm5a) from cvs server to svn server (igcmg project).

File size: 4.8 KB
Line 
1      SUBROUTINE initim
2C****
3C               *****************************
4C               * OASIS ROUTINE  -  LEVEL 0 *
5C               * -------------     ------- *
6C               *****************************
7C
8C**** *initim*  - Initialize time
9C
10C     Purpose:
11C     -------
12C     Initialize date at run starting date and find coupler timestep
13C     value
14C
15C**   Interface:
16C     ---------
17C       *CALL*  *initim*
18C
19C     Input:
20C     -----
21C     None
22C
23C     Output:
24C     ------
25C     None
26C
27C     Workspace:
28C     ---------
29C     None
30C
31C     Externals:
32C     ---------
33C     None
34C
35C     Reference:
36C     ---------
37C     See OASIS manual (1995)
38C
39C     History:
40C     -------
41C       Version   Programmer     Date      Description
42C       -------   ----------     ----      ----------- 
43C       1.0       L. Terray      94/01/01  created
44C       2.0beta   L. Terray      95/08/30  modified : new structure
45C       2.0       L. Terray      96/02/01  modified : get final iteration
46C       2.3       S. Valcke      99/04/30  added: printing levels
47C       2.5       S. Valcke      01/12/10  Explicit intialization of nddeb
48C
49C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50C
51C* ---------------- Include files and USE of modules---------------------------
52C
53      USE mod_parameter
54      USE mod_string
55      USE mod_timestep 
56      USE mod_unit
57      USE mod_calendar
58      USE mod_printing
59C
60C* ---------------------------- Local functions -------------------------
61C
62C* - Time functions
63C    Date is under form: ccaammdd
64C            ndd   --->>> extract dd from ccaammdd
65C            nmm   --->>> extract mm from ccaammdd
66C            nccaa --->>> extract ccaa from ccaammdd
67C            ncth  --->>> turn seconds into hours
68C
69      ndd(kidat) = MOD(kidat,100)
70      nmm(kidat) = MOD((kidat - ndd(kidat))/100,100)
71      nccaa(kidat) = kidat / 10000
72      ncth(ksec) = ksec / 3600
73C
74C* ---------------------------- Poema verses ----------------------------
75C
76C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77C
78C*    1. Initializations
79C         ---------------
80C     
81         IF (nlogprt .GE. 1) THEN
82            WRITE (UNIT = nulou,FMT = *) ' '
83            WRITE (UNIT = nulou,FMT = *) ' '
84            WRITE (UNIT = nulou,FMT = *) 
85     $           '           ROUTINE initim  -  Level 0'
86            WRITE (UNIT = nulou,FMT = *) 
87     $           '           **************     *******'
88            WRITE (UNIT = nulou,FMT = *) ' '
89            WRITE (UNIT = nulou,FMT = *) 
90     $           ' Determine time iteration parameters '
91            WRITE (UNIT = nulou,FMT = *) 
92     $           ' and initialize simulation date '
93            WRITE (UNIT = nulou,FMT = *) ' '
94            WRITE (UNIT = nulou,FMT = *) ' '
95         ENDIF
96C     
97C* First, get initial date of this run
98C
99         ig_date(:) = 0
100         njini = ndd(ndate)
101         ig_date(3) = njini
102         nmini = nmm(ndate)
103         ig_date(2) = nmini
104         naini = nccaa(ndate)
105         ig_date(1) = naini
106C     
107C* Print initial date of this run
108C
109         WRITE (UNIT = nulou,FMT = 1001) njini,  nmini, naini
110         WRITE (UNIT = nulou,FMT = *) ' '
111C
112C* Following lines are called only if one field (at least) goes through Oasis
113C
114         IF (lg_oasis_field) THEN
115C     
116C* Get time iteration parameters
117C     
118C* Get minimum exchange frequency
119C     
120            ifrqmin = iminim (nfexch, ig_nfield)
121C     
122C* Get greatest common divisor for all frequencies
123C     
124            nstep = idivmax (nfexch, ig_nfield, ifrqmin)
125C     
126C* Get total number of iterations
127C     
128            niter = ntime / nstep
129C     
130C* Get final iteration number
131C     
132            nitfn = niter - 1
133C     
134         IF (nlogprt .GE. 1) THEN
135C*    Print number of iterations and timestep
136C     
137            WRITE (UNIT = nulou,FMT = *) 
138     $           '      Number of iterations = ', niter
139            WRITE (UNIT = nulou,FMT = *) '     ====================   '
140            WRITE (UNIT = nulou,FMT = *) ' '
141            WRITE (UNIT = nulou,FMT = *) 
142     $           '      Value of timestep = ', nstep
143            WRITE (UNIT = nulou,FMT = *) '     =================   '
144            WRITE (UNIT = nulou,FMT = *) ' '
145         ENDIF
146C     
147C* Get beginning date of the whole coupled simulation
148C     
149         nddeb = 0
150         njdeb = ndd(nddeb)
151         nmdeb = nmm(nddeb)
152         nadeb = nccaa(nddeb)
153      ENDIF
154C     
155C* Formats
156C     
157 1001    FORMAT(5X,'  Run initial date : ',I2,' - ',I2,' - ',I4,
158     $        /,5X,'  ================ ')
159C     
160C     
161C*    2. End of routine
162C     --------------
163C     
164         IF (nlogprt .GE. 1) THEN
165            WRITE (UNIT = nulou,FMT = *) ' '
166            WRITE (UNIT = nulou,FMT = *) 
167     $           '          --------- End of routine initim ---------'
168            CALL FLUSH (nulou)
169         ENDIF
170      RETURN
171      END
Note: See TracBrowser for help on using the repository browser.