Ignore:
Timestamp:
Jan 24, 2011, 1:57:13 PM (14 years ago)
Author:
aslmd
Message:

spiga@svn-planeto:les copains j ai fait ce changement

Location:
trunk/mesoscale/LMD_MM_MARS/SRC/WPS/metgrid/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/mesoscale/LMD_MM_MARS/SRC/WPS/metgrid/src/module_date_pack.f90

    r11 r12  
    1111!  3. split_date_char ( date , century_year , month , day , hour , minute , second )
    1212!  Given the date, return the integer components.
     13
     14!****************
     15! subroutines are similar to the ones in module_date_time in the WRF share directory
     16!****************
    1317
    1418use module_debug
     
    6872     
    6973      !  Assign the number of days in a months
    70      
    71       mday( 1) = 31
    72       mday( 2) = 28
    73       mday( 3) = 31
    74       mday( 4) = 30
    75       mday( 5) = 31
    76       mday( 6) = 30
    77       mday( 7) = 31
    78       mday( 8) = 31
    79       mday( 9) = 30
    80       mday(10) = 31
    81       mday(11) = 30
    82       mday(12) = 31
     74
     75! months as defined in Martian ESMF routines
     76 
     77      mday( 1) = 61
     78      mday( 2) = 66
     79      mday( 3) = 66
     80      mday( 4) = 65
     81      mday( 5) = 60
     82      mday( 6) = 54
     83      mday( 7) = 50
     84      mday( 8) = 46
     85      mday( 9) = 47
     86      mday(10) = 47
     87      mday(11) = 51
     88      mday(12) = 56
    8389     
    8490      !  Break down old hdate into parts
     
    143149      !  Check that the day of NDATE makes sense.
    144150     
    145       IF (monew.ne.2) THEN
     151!      IF (monew.ne.2) THEN
    146152      ! ...... For all months but February
    147153         IF ((dynew.GT.mday(monew)).or.(dynew.LT.1)) THEN
     
    149155            npass = .false.
    150156         END IF
    151       ELSE IF (monew.eq.2) THEN
    152       ! ...... For February
    153          IF ((dynew.GT.nfeb(yrnew)).OR.(dynew.LT.1)) THEN
    154             PRINT*, 'GETH_IDTS:  Day of NDATE = ', dynew
    155             npass = .false.
    156          END IF
    157       END IF
     157!      ELSE IF (monew.eq.2) THEN
     158!      ! ...... For February
     159!         IF ((dynew.GT.nfeb(yrnew)).OR.(dynew.LT.1)) THEN
     160!            PRINT*, 'GETH_IDTS:  Day of NDATE = ', dynew
     161!            npass = .false.
     162!         END IF
     163!      END IF
    158164     
    159165      !  Check that the day of ODATE makes sense.
    160166     
    161       IF (moold.ne.2) THEN
     167!      IF (moold.ne.2) THEN
    162168      ! ...... For all months but February
    163169         IF ((dyold.GT.mday(moold)).or.(dyold.LT.1)) THEN
     
    165171            opass = .false.
    166172         END IF
    167       ELSE IF (moold.eq.2) THEN
    168       ! ....... For February
    169          IF ((dyold.GT.nfeb(yrold)).or.(dyold.LT.1)) THEN
    170             PRINT*, 'GETH_IDTS:  Day of ODATE = ', dyold
    171             opass = .false.
    172          END IF
    173       END IF
     173!      ELSE IF (moold.eq.2) THEN
     174!      ! ....... For February
     175!         IF ((dyold.GT.nfeb(yrold)).or.(dyold.LT.1)) THEN
     176!            PRINT*, 'GETH_IDTS:  Day of ODATE = ', dyold
     177!            opass = .false.
     178!         END IF
     179!      END IF
    174180     
    175181      !  Check that the hour of NDATE makes sense.
     
    189195      !  Check that the minute of NDATE makes sense.
    190196     
    191       IF ((minew.GT.59).or.(minew.LT.0)) THEN
     197      IF ((minew.GT.36).or.(minew.LT.0)) THEN
    192198         PRINT*, 'GETH_IDTS:  Minute of NDATE = ', minew
    193199         npass = .false.
     
    196202      !  Check that the minute of ODATE makes sense.
    197203     
    198       IF ((miold.GT.59).or.(miold.LT.0)) THEN
     204      IF ((miold.GT.36).or.(miold.LT.0)) THEN
    199205         PRINT*, 'GETH_IDTS:  Minute of ODATE = ', miold
    200206         opass = .false.
     
    203209      !  Check that the second of NDATE makes sense.
    204210     
    205       IF ((scnew.GT.59).or.(scnew.LT.0)) THEN
     211      IF ((scnew.GT.99).or.(scnew.LT.0)) THEN
    206212         PRINT*, 'GETH_IDTS:  SECOND of NDATE = ', scnew
    207213         npass = .false.
     
    210216      !  Check that the second of ODATE makes sense.
    211217     
    212       IF ((scold.GT.59).or.(scold.LT.0)) THEN
     218      IF ((scold.GT.99).or.(scold.LT.0)) THEN
    213219         PRINT*, 'GETH_IDTS:  Second of ODATE = ', scold
    214220         opass = .false.
     
    216222     
    217223      IF (.not. npass) THEN
     224         !WRITE( wrf_err_message , * ) 'module_date_time: geth_idts: Bad NDATE: ', ndate(1:nlen)
     225         !CALL wrf_error_fatal ( TRIM ( wrf_err_message ) )
     226         !****difference with module_date_time
    218227         call mprintf(.true.,ERROR,'Screwy NDATE: %s',s1=ndate(1:nlen))
    219228      END IF
    220229     
    221230      IF (.not. opass) THEN
     231         !WRITE( wrf_err_message , * ) 'module_date_time: geth_idts: Bad ODATE: ', odate(1:olen)
     232         !CALL wrf_error_fatal ( TRIM ( wrf_err_message ) )
     233         !****difference with module_date_time
    222234         call mprintf(.true.,ERROR,'Screwy ODATE: %s',s1=odate(1:olen))
    223235      END IF
     
    231243      newdys = 0
    232244      DO i = yrold, yrnew - 1
    233          newdys = newdys + (365 + (nfeb(i)-28))
     245!         newdys = newdys + (365 + (nfeb(i)-28))
     246! so cool to deal with a planet without any february month :)
     247         newdys = newdys + 669
    234248      END DO
    235249     
    236250      IF (monew .GT. 1) THEN
    237          mday(2) = nfeb(yrnew)
     251!         mday(2) = nfeb(yrnew)
    238252         DO i = 1, monew - 1
    239253            newdys = newdys + mday(i)
    240254         END DO
    241          mday(2) = 28
     255!         mday(2) = 28
    242256      END IF
    243257     
     
    250264     
    251265      IF (moold .GT. 1) THEN
    252          mday(2) = nfeb(yrold)
     266!         mday(2) = nfeb(yrold)
    253267         DO i = 1, moold - 1
    254268            olddys = olddys + mday(i)
    255269         END DO
    256          mday(2) = 28
     270!         mday(2) = 28
    257271      END IF
    258272     
     
    261275      !  Determine the time difference in seconds
    262276     
    263       idts = (newdys - olddys) * 86400
    264       idts = idts + (hrnew - hrold) * 3600
    265       idts = idts + (minew - miold) * 60
     277      idts = (newdys - olddys) * 88800    !martian sols
     278      idts = idts + (hrnew - hrold) * 3700  !hours
     279      idts = idts + (minew - miold) * 100  !minutes
    266280      idts = idts + (scnew - scold)
    267281     
     
    328342      CHARACTER (LEN=10) :: hfrc
    329343      CHARACTER (LEN=1) :: sp
    330       ! INTEGER, EXTERNAL :: nfeb  ! in the same module now
    331 
     344!      INTEGER, EXTERNAL :: nfeb  ! in the same module now
     345     
    332346      !  Assign the number of days in a months
    333      
    334       mday( 1) = 31
    335       mday( 2) = 28
    336       mday( 3) = 31
    337       mday( 4) = 30
    338       mday( 5) = 31
    339       mday( 6) = 30
    340       mday( 7) = 31
    341       mday( 8) = 31
    342       mday( 9) = 30
    343       mday(10) = 31
    344       mday(11) = 30
    345       mday(12) = 31
     347
     348      mday( 1) = 61
     349      mday( 2) = 66
     350      mday( 3) = 66
     351      mday( 4) = 65
     352      mday( 5) = 60
     353      mday( 6) = 54
     354      mday( 7) = 50
     355      mday( 8) = 46
     356      mday( 9) = 47
     357      mday(10) = 47
     358      mday(11) = 51
     359      mday(12) = 56
    346360     
    347361      !  Break down old hdate into parts
     
    377391      END IF
    378392     
    379       !  Set the number of days in February for that year.
    380      
    381       mday(2) = nfeb(yrold)
     393!      !  Set the number of days in February for that year.
     394     
     395!      mday(2) = nfeb(yrold)
    382396     
    383397      !  Check that ODATE makes sense.
     
    408422      !  Check that the minute of ODATE makes sense.
    409423     
    410       IF ((miold.GT.59).or.(miold.LT.0)) THEN
     424      IF ((miold.GT.36).or.(miold.LT.0)) THEN
    411425         WRITE(*,*) 'GETH_NEWDATE:  Minute of ODATE = ', miold
    412426         opass = .FALSE.
     
    415429      !  Check that the second of ODATE makes sense.
    416430     
    417       IF ((scold.GT.59).or.(scold.LT.0)) THEN
     431      IF ((scold.GT.99).or.(scold.LT.0)) THEN
    418432         WRITE(*,*) 'GETH_NEWDATE:  Second of ODATE = ', scold
    419433         opass = .FALSE.
     
    424438     
    425439      IF (.not.opass) THEN
     440         !WRITE( wrf_err_message , * ) 'module_date_time: GETH_NEWDATE: Bad ODATE: ', odate(1:olen), olen
     441         !CALL wrf_error_fatal ( TRIM ( wrf_err_message ) )
     442         !**** difference avec module_date_time
    426443         call mprintf(.true.,ERROR,'GETH_NEWDATE: Crazy ODATE: %s %i',s1=odate(1:olen),i1=olen)
    427444      END IF
     
    435452         ifrc = olen-20
    436453         ifrc = 10**ifrc
    437          nday   = ABS(idt)/(86400*ifrc)
    438          nhour  = MOD(ABS(idt),86400*ifrc)/(3600*ifrc)
    439          nmin   = MOD(ABS(idt),3600*ifrc)/(60*ifrc)
    440          nsec   = MOD(ABS(idt),60*ifrc)/(ifrc)
     454         nday   = ABS(idt)/(88800*ifrc)
     455         nhour  = MOD(ABS(idt),88800*ifrc)/(3700*ifrc)
     456         nmin   = MOD(ABS(idt),3700*ifrc)/(100*ifrc)
     457         nsec   = MOD(ABS(idt),100*ifrc)/(ifrc)
    441458         nfrac = MOD(ABS(idt), ifrc)
    442459      ELSE IF (olen.eq.19) THEN  !idt should be in seconds
    443460         ifrc = 1
    444          nday   = ABS(idt)/86400 ! Integer number of days in delta-time
    445          nhour  = MOD(ABS(idt),86400)/3600
    446          nmin   = MOD(ABS(idt),3600)/60
    447          nsec   = MOD(ABS(idt),60)
     461         nday   = ABS(idt)/88800 ! Integer number of days in delta-time
     462         nhour  = MOD(ABS(idt),88800)/3700
     463         nmin   = MOD(ABS(idt),3700)/100
     464         nsec   = MOD(ABS(idt),100)
    448465         nfrac  = 0
    449466      ELSE IF (olen.eq.16) THEN !idt should be in minutes
    450467         ifrc = 1
    451          nday   = ABS(idt)/1440 ! Integer number of days in delta-time
    452          nhour  = MOD(ABS(idt),1440)/60
    453          nmin   = MOD(ABS(idt),60)
     468         nday   = ABS(idt)/2400 ! Integer number of days in delta-time
     469         nhour  = MOD(ABS(idt),2400)/100
     470         nmin   = MOD(ABS(idt),100)
    454471         nsec   = 0
    455472         nfrac  = 0
     
    469486         nfrac  = 0
    470487      ELSE
     488         !WRITE( wrf_err_message , * ) 'module_date_time: GETH_NEWDATE: Strange length for ODATE: ',olen
     489         !CALL wrf_error_fatal ( TRIM ( wrf_err_message ) )
     490         !**** difference with module_date_time
    471491         call mprintf(.true.,ERROR,'GETH_NEWDATE: Strange length for ODATE: %i',i1=olen)
    472492      END IF
     
    481501     
    482502         scnew = scold + nsec
    483          IF (scnew .GE. 60) THEN
    484             scnew = scnew - 60
     503         IF (scnew .GE. 100) THEN
     504            scnew = scnew - 100
    485505            nmin  = nmin + 1
    486506         END IF
    487507     
    488508         minew = miold + nmin
    489          IF (minew .GE. 60) THEN
    490             minew = minew - 60
     509         IF (minew .GE. 37) THEN
     510            minew = minew - 37
    491511            nhour  = nhour + 1
    492512         END IF
     
    509529                  monew = 1
    510530                  yrnew = yrnew + 1
    511                   ! If the year changes, recompute the number of days in February
    512                   mday(2) = nfeb(yrnew)
     531                  !! If the year changes, recompute the number of days in February
     532                  !mday(2) = nfeb(yrnew)
    513533               END IF
    514534            END IF
     
    525545         scnew = scold - nsec
    526546         IF (scnew .LT. 00) THEN
    527             scnew = scnew + 60
     547            scnew = scnew + 100
    528548            nmin  = nmin + 1
    529549         END IF
     
    531551         minew = miold - nmin
    532552         IF (minew .LT. 00) THEN
    533             minew = minew + 60
     553            minew = minew + 37
    534554            nhour  = nhour + 1
    535555         END IF
     
    551571                  monew = 12
    552572                  yrnew = yrnew - 1
    553                   ! If the year changes, recompute the number of days in February
    554                   mday(2) = nfeb(yrnew)
     573                  !! If the year changes, recompute the number of days in February
     574                  !mday(2) = nfeb(yrnew)
    555575               END IF
    556576               dynew = mday(monew)
     
    593613!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    594614
    595    FUNCTION nfeb ( year ) RESULT (num_days)
    596    
    597       ! Compute the number of days in February for the given year
    598    
    599       IMPLICIT NONE
    600    
    601       INTEGER :: year
    602       INTEGER :: num_days
    603    
    604       num_days = 28 ! By default, February has 28 days ...
    605       IF (MOD(year,4).eq.0) THEN 
    606          num_days = 29  ! But every four years, it has 29 days ...
    607          IF (MOD(year,100).eq.0) THEN
    608             num_days = 28  ! Except every 100 years, when it has 28 days ...
    609             IF (MOD(year,400).eq.0) THEN
    610                num_days = 29  ! Except every 400 years, when it has 29 days.
    611             END IF
    612          END IF
    613       END IF
    614    
    615    END FUNCTION nfeb
     615!   FUNCTION nfeb ( year ) RESULT (num_days)
     616!   
     617!      ! Compute the number of days in February for the given year
     618!   
     619!      IMPLICIT NONE
     620!   
     621!      INTEGER :: year
     622!      INTEGER :: num_days
     623!
     624!        num_days = 99999
     625!        PRINT *, 'WARNING !' 
     626!! normally never called ...       
     627
     628!!      num_days = 28 ! By default, February has 28 days ...
     629!!      IF (MOD(year,4).eq.0) THEN 
     630!!         num_days = 29  ! But every four years, it has 29 days ...
     631!!         IF (MOD(year,100).eq.0) THEN
     632!!            num_days = 28  ! Except every 100 years, when it has 28 days ...
     633!!            IF (MOD(year,400).eq.0) THEN
     634!!               num_days = 29  ! Except every 400 years, when it has 29 days.
     635!!            END IF
     636!!         END IF
     637!!      END IF
     638!   
     639!   END FUNCTION nfeb
    616640
    617641!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    623647   
    624648      CHARACTER(LEN=19) , INTENT(IN) :: date
    625   
     649 
    626650      !  Output data.
    627651   
     
    636660   
    637661   END SUBROUTINE split_date_char
    638    
     662
    639663END MODULE date_pack
  • trunk/mesoscale/LMD_MM_MARS/SRC/WPS/metgrid/src/process_domain_module.F90

    r11 r12  
    106106   
    107107         call geth_newdate(valid_date, trim(start_date(n)), t*interval_seconds)
     108
     109         print *,'now working on ...'       
     110         print *,valid_date
     111
    108112         temp_date = ' '
    109113
    110          if (mod(interval_seconds,3600) == 0) then
    111             write(temp_date,'(a13)') valid_date(1:10)//'_'//valid_date(12:13)
    112          else if (mod(interval_seconds,60) == 0) then
    113             write(temp_date,'(a16)') valid_date(1:10)//'_'//valid_date(12:16)
    114          else
     114!*****MARS !!!
     115!         if (mod(interval_seconds,3700) == 0) then
     116!            write(temp_date,'(a13)') valid_date(1:10)//'_'//valid_date(12:13)
     117!         else if (mod(interval_seconds,100) == 0) then
     118!            write(temp_date,'(a16)') valid_date(1:10)//'_'//valid_date(12:16)
     119!         else
    115120            write(temp_date,'(a19)') valid_date(1:10)//'_'//valid_date(12:19)
    116          end if
     121!         end if
    117122   
    118123         call mprintf(.true.,STDOUT, ' Processing %s', s1=trim(temp_date))
     
    726731                           met_dy = abs(deltalat)
    727732                        else
     733!
     734! MARS MARS: BEWARE WITH THAT PART !
     735!
    728736! BUG: Need to more correctly handle dx/dy in meters.
    729737                           met_dx = met_dx / 111000.  ! Convert meters to approximate degrees
Note: See TracChangeset for help on using the changeset viewer.