Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:38:16 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
6d54cf9ca1 Ed H*0001 #include "CAL_OPTIONS.h"
a63ed37559 Patr*0002 
                0003       subroutine cal_StepsPerDay(
                0004      I                            myiter,
                0005      I                            mytime,
                0006      O                            numsteps,
                0007      I                            mythid
                0008      &                          )
                0009 
                0010 c     ==================================================================
                0011 c     SUBROUTINE cal_StepsPerDay
                0012 c     ==================================================================
                0013 c
                0014 c     o Given the iteration number and/or the current time of
                0015 c       integration return the number of steps left for the current
                0016 c       calendar day including the step belonging to iter/currenttime.
                0017 c              
                0018 c     started: Christian Eckert eckert@mit.edu  30-Jun-1999
                0019 c
                0020 c     changed: Christian Eckert eckert@mit.edu  29-Dec-1999
                0021 c
                0022 c              - restructured the original version in order to have a
                0023 c                better interface to the MITgcmUV.
                0024 c
                0025 c              Christian Eckert eckert@mit.edu  03-Feb-2000
                0026 c
                0027 c              - Introduced new routine and function names, cal_<NAME>,
                0028 c                for verion 0.1.3.
                0029 c
                0030 c     ==================================================================
                0031 c     SUBROUTINE cal_StepsPerDay
                0032 c     ==================================================================
                0033 
                0034       implicit none
                0035 
                0036 c     == global variables ==
                0037 
                0038 #include "cal.h"
                0039 
                0040 c     == routine arguments ==
                0041 
                0042       integer myiter
                0043       _RL     mytime
                0044       integer numsteps
                0045       integer mythid
                0046 
                0047 c     == local variables ==
                0048 
                0049       integer currentdate(4)
                0050       integer present
                0051       integer presentsecs
                0052       integer final
                0053       integer finalsecs
                0054       integer ierr
b809ce8096 Jean*0055       integer modelstepsperday
a63ed37559 Patr*0056 
                0057 c     == end of interface ==
                0058 
                0059       call cal_GetDate( myiter, mytime, currentdate, mythid )
                0060 
                0061       present     = currentdate(1)
                0062       presentsecs = (currentdate(2)/10000)*secondsperhour +
                0063      &              mod(currentdate(2)/100,100)*secondsperminute +
                0064      &              mod(currentdate(2),100)
                0065       final       = modelenddate(1)
                0066 
                0067       if (present .lt. final) then
b809ce8096 Jean*0068 C       modelstepsperday = cal_nStepDay(mythid)
                0069 C-jmc: inline Function "cal_nStepDay":
                0070         modelstepsperday = secondsperday/nint(modelstep)
a63ed37559 Patr*0071         numsteps = modelstepsperday -
                0072      &             int(presentsecs/modelstep)
                0073       else if (present .eq. final) then
                0074         finalsecs   = (modelenddate(2)/10000)*secondsperhour +
                0075      &                mod(modelenddate(2)/100,100)*secondsperminute +
                0076      &                mod(modelenddate(2),100)
                0077         numsteps    = int((finalsecs - presentsecs)/modelstep)
                0078       else
                0079 
                0080         ierr = 1101
                0081         call cal_PrintError( ierr, mythid )
                0082         stop ' stopped in cal_StepsPerDay.'
                0083 
                0084       endif
                0085 
                0086       return
                0087       end