Oasis3 4.0.2
initim.f
Go to the documentation of this file.
00001       SUBROUTINE initim
00002 C****
00003 C               *****************************
00004 C               * OASIS ROUTINE  -  LEVEL 0 *
00005 C               * -------------     ------- *
00006 C               *****************************
00007 C
00008 C**** *initim*  - Initialize time
00009 C
00010 C     Purpose:
00011 C     -------
00012 C     Initialize date at run starting date and find coupler timestep
00013 C     value
00014 C
00015 C**   Interface:
00016 C     ---------
00017 C       *CALL*  *initim*
00018 C
00019 C     Input:
00020 C     -----
00021 C     None
00022 C
00023 C     Output:
00024 C     ------
00025 C     None
00026 C
00027 C     Workspace:
00028 C     ---------
00029 C     None
00030 C
00031 C     Externals:
00032 C     ---------
00033 C     None
00034 C
00035 C     Reference:
00036 C     ---------
00037 C     See OASIS manual (1995)
00038 C
00039 C     History:
00040 C     -------
00041 C       Version   Programmer     Date      Description
00042 C       -------   ----------     ----      -----------  
00043 C       1.0       L. Terray      94/01/01  created
00044 C       2.0beta   L. Terray      95/08/30  modified : new structure
00045 C       2.0       L. Terray      96/02/01  modified : get final iteration
00046 C       2.3       S. Valcke      99/04/30  added: printing levels
00047 C       2.5       S. Valcke      01/12/10  Explicit intialization of nddeb
00048 C
00049 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00050 C
00051 C* ---------------- Include files and USE of modules---------------------------
00052 C
00053       USE mod_unit
00054       USE mod_parameter
00055       USE mod_string
00056       USE mod_timestep 
00057       USE mod_calendar
00058       USE mod_printing
00059 C
00060 C* ---------------------------- Local functions -------------------------
00061 C
00062 C* - Time functions
00063 C    Date is under form: ccaammdd
00064 C            ndd   --->>> extract dd from ccaammdd
00065 C            nmm   --->>> extract mm from ccaammdd
00066 C            nccaa --->>> extract ccaa from ccaammdd
00067 C            ncth  --->>> turn seconds into hours
00068 C
00069       ndd(kidat) = MOD(kidat,100)
00070       nmm(kidat) = MOD((kidat - ndd(kidat))/100,100)
00071       nccaa(kidat) = kidat / 10000
00072       ncth(ksec) = ksec / 3600
00073 C
00074 C* ---------------------------- Poema verses ----------------------------
00075 C
00076 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00077 C
00078 C     
00079       IF (nlogprt .GE. 2) THEN
00080           WRITE (UNIT = nulou,FMT = *)' '
00081           WRITE (UNIT = nulou,FMT = *)'      ROUTINE initim  -  Level 0'
00082           WRITE (UNIT = nulou,FMT = *)'      **************     *******'
00083           WRITE (UNIT = nulou,FMT = *)' '
00084           WRITE (UNIT = nulou,FMT = *) 
00085      $           ' Determine time iteration parameters '
00086           WRITE (UNIT = nulou,FMT = *)' and initialize simulation date '
00087           WRITE (UNIT = nulou,FMT = *)' '
00088           CALL FLUSH(nulou)
00089       ENDIF
00090 C     
00091 C*    1. Initializations
00092 C         ---------------
00093 C* First, get initial date of this run
00094 C
00095          ig_date(:) = 0
00096          njini = ndd(ndate)
00097          ig_date(3) = njini
00098          nmini = nmm(ndate)
00099          ig_date(2) = nmini
00100          naini = nccaa(ndate)
00101          ig_date(1) = naini
00102 C     
00103 C* Print initial date of this run
00104 C
00105          WRITE (UNIT = nulou,FMT = 1001) njini,  nmini, naini
00106          WRITE (UNIT = nulou,FMT = *) ' '
00107 C
00108 C* Following lines are called only if one field (at least) goes through Oasis
00109 C
00110          IF (lg_oasis_field) THEN
00111 C     
00112 C* Get time iteration parameters
00113 C     
00114 C* Get minimum exchange frequency
00115 C     
00116             ifrqmin = iminim (nfexch, ig_nfield)
00117 C     
00118 C* Get greatest common divisor for all frequencies
00119 C     
00120             nstep = idivmax (nfexch, ig_nfield, ifrqmin)
00121 C     
00122 C* Get total number of iterations
00123 C     
00124             niter = ntime / nstep
00125 C     
00126 C* Get final iteration number
00127 C     
00128             nitfn = niter - 1
00129 C     
00130          IF (nlogprt .GE. 1) THEN
00131 C*    Print number of iterations and timestep
00132 C     
00133             WRITE (UNIT = nulou,FMT = *) 
00134      $           '      Number of iterations = ', niter
00135             WRITE (UNIT = nulou,FMT = *) '     ====================   '
00136             WRITE (UNIT = nulou,FMT = *) ' '
00137             WRITE (UNIT = nulou,FMT = *) 
00138      $           '      Value of timestep = ', nstep
00139             WRITE (UNIT = nulou,FMT = *) '     =================   '
00140             WRITE (UNIT = nulou,FMT = *) ' '
00141          ENDIF
00142 C     
00143 C* Get beginning date of the whole coupled simulation
00144 C     
00145          nddeb = 0
00146          njdeb = ndd(nddeb)
00147          nmdeb = nmm(nddeb)
00148          nadeb = nccaa(nddeb)
00149       ENDIF
00150 C     
00151 C* Formats
00152 C     
00153  1001    FORMAT(5X,'  Run initial date : ',I2,' - ',I2,' - ',I4,
00154      $        /,5X,'  ================ ')
00155 C     
00156 C     
00157 C*    2. End of routine
00158 C     --------------
00159 C     
00160          IF (nlogprt .GE. 2) THEN 
00161              WRITE (UNIT = nulou,FMT = *)' '
00162              WRITE (UNIT = nulou,FMT = *)'--- End of ROUTINE initim ---'
00163              CALL FLUSH (nulou)
00164          ENDIF
00165       RETURN
00166       END
 All Data Structures Namespaces Files Functions Variables Defines