Changeset 791 for trunk


Ignore:
Timestamp:
Sep 21, 2012, 12:50:01 PM (12 years ago)
Author:
emillour
Message:

Mars GCM:

Adapted code so that it can run fractions of days: e.g. if "nday=1.5" in

run.def, then run a sol and a half, "nday=0.75" to run three quarters of
a sol... Of course the fraction should correspond to a number of complete
dynamics/physics cycles. The fraction of the sol that a (re)start.nc
file corresponds to is (read)written as 'Time' in the file.

EM

Location:
trunk/LMDZ.MARS
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/README

    r788 r791  
    17991799   altitude above surface levels as well as the possibility to specify min,
    18001800   max and number of levels.
     1801
     1802== 21/09/2012 == EM
     1803>> Adapted code so that it can run fractions of days: e.g. if "nday=1.5" in
     1804  run.def, then run a sol and a half, "nday=0.75" to run three quarters of
     1805  a sol... Of course the fraction should correspond to a number of complete
     1806  dynamics/physics cycles. The fraction of the sol that a (re)start.nc
     1807  file corresponds to is (read)written as 'Time' in the file.
  • trunk/LMDZ.MARS/libf/dyn3d/caldyn.F

    r38 r791  
    4141      REAL dteta(ip1jmp1,llm),dp(ip1jmp1)
    4242      REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm)
    43       REAL time
     43      REAL time ! elapsed time (in days) since begining of the run
    4444
    4545c   Local:
  • trunk/LMDZ.MARS/libf/dyn3d/control.h

    r38 r791  
    55!
    66
    7       COMMON/control/nday,day_step,                                     &
     7      COMMON/control_i/day_step,                                        &
    88     &              iperiod,iconser,idissip,iphysiq ,                   &
    9      &              periodav,ecritphy,anneeref
     9     &              anneeref
     10      COMMON/control_r/periodav,ecritphy,nday_r
    1011
    11       INTEGER   nday,day_step,iperiod,iconser,                          &
    12      &          idissip,iphysiq,anneeref
    13       REAL periodav, ecritphy
     12      INTEGER day_step ! # of dynamical time steps per day
     13      INTEGER iperiod  ! make a Matsuno step before avery iperiod-1 LF steps
     14      INTEGER iconser !
     15      INTEGER idissip ! apply dissipation every idissip dynamical step
     16      INTEGER iphysiq ! call physics every iphysiq dynamical steps
     17      INTEGER anneeref ! reference year # ! not used
     18      REAL periodav
     19      REAL ecritphy ! output data in "diagfi.nc" every ecritphy dynamical steps
     20      real nday_r ! number of days to run (possibly including a fraction of day)
    1421
    1522!-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/dyn3d/defrun_new.F

    r575 r791  
    9595        WRITE(tapeout,*) ""
    9696        WRITE(tapeout,*) "Number of days to run:"
    97         nday=1 ! default value
    98         call getin("nday",nday)
    99         WRITE(tapeout,*)" nday = ",nday
     97        nday_r=1 ! default value
     98        call getin("nday",nday_r)
     99        WRITE(tapeout,*)" nday = ",nday_r
    100100
    101101        WRITE(tapeout,*) ""
     
    110110        iperiod=5 ! default value
    111111        call getin("iperiod",iperiod)
    112         WRITE(tapeout,*)" iperiod = ",iperiod
    113 
     112        ! verify that day_step is a multiple of iperiod
     113        if (((1.*day_step)/iperiod).ne.(day_step/iperiod)) then
     114          write(tapeout,*)" Error! iperiod must be such that",
     115     &    " day_step is a multiple of iperiod, but iperiod=",
     116     &    iperiod," and day_step=",day_step
     117        else
     118          WRITE(tapeout,*)" iperiod = ",iperiod
     119        endif
     120       
    114121        WRITE(tapeout,*) ""
    115122        WRITE(tapeout,*) "periode de sortie des variables de ",
     
    207214        iphysiq=20 ! default value
    208215        call getin("iphysiq",iphysiq)
    209         WRITE(tapeout,*)" iphysiq = ",iphysiq
     216        ! verify that day_step is a multiple of iphysiq
     217        if (((1.*day_step)/iphysiq).ne.(day_step/iphysiq)) then
     218          write(tapeout,*)" Error! iphysiq must be such that",
     219     &    " day_step is a multiple of iphysiq, but iphysiq=",
     220     &    iphysiq," and day_step=",day_step
     221        else
     222          WRITE(tapeout,*)" iphysiq = ",iphysiq
     223        endif
    210224
    211225        WRITE(tapeout,*) ""
     
    222236        ecritphy=240
    223237        call getin("ecritphy",ecritphy)
    224         WRITE(tapeout,*)" ecritphy = ",ecritphy
     238        ! verify that ecriphy is indeed a multiple of iphysiq
     239        if (((1.*ecritphy)/iphysiq).ne.(ecritphy/iphysiq)) then
     240          write(tapeout,*)" Error! ecritphy must be a multiple",
     241     &    " of iphysiq, but ecritphy=",ecritphy," and iphysiq=",
     242     &    iphysiq
     243        else
     244          WRITE(tapeout,*)" ecritphy = ",ecritphy
     245        endif
    225246
    226247ccc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
  • trunk/LMDZ.MARS/libf/dyn3d/dynetat0.F

    r38 r791  
    4848      REAL ps(iip1,jjp1),phis(iip1,jjp1)
    4949
    50       REAL time
     50      REAL time ! fraction of day the fields correspond to
    5151
    5252c   Variables
     
    383383      ierr=nf90_close(nid)
    384384
    385        day_ini=day_ini+INT(time)
    386       time=time-INT(time)
     385      ! day_ini=day_ini+INT(time) ! obsolete stuff ; 0<time<1 anyways
     386      ! time=time-INT(time)
    387387
    388388  1   FORMAT(//10x,'la valeur de im =',i4,2x,'lue sur le fichier de dem
  • trunk/LMDZ.MARS/libf/dyn3d/gcm.F

    r38 r791  
    199199          iday = iday+1
    200200         ENDIF
    201       itaufin   = nday*day_step
     201      itaufin=nint(nday_r*day_step) ! nint() to avoid problematic roundoffs
     202      ! check that this is compatible with call sequence dyn/phys/dissip
     203      ! i.e. that itaufin is a multiple of iphysiq and idissip
     204      if ((modulo(itaufin,iphysiq).ne.0).or.
     205     &    (modulo(itaufin,idissip).ne.0)) then
     206        write(*,*) "gcm: Problem: incompatibility between nday=",nday_r,
     207     &  " day_step=",day_step," which imply itaufin=",itaufin
     208        write(*,*) "  whereas iphysiq=",iphysiq," and idissip=",
     209     &  idissip
     210        stop
     211      endif
     212!      write(*,*)"gcm: itaufin=",itaufin
    202213c ********************************
    203214c      itaufin = 120   ! temporaire !!
     
    205216      itaufinp1 = itaufin +1
    206217
    207       day_end = day_ini + nday
     218      day_end = day_ini + floor(nday_r+time_0)
    208219      PRINT 300, itau,itaufin,day_ini,day_end
    209220 300  FORMAT('1'/,15x,'run du pas',i7,2x,'au pas',i7,2x, 
     
    231242      IF( MOD( itau, 10* day_step ).EQ.0 )  THEN
    232243        CALL test_period ( ucov,vcov,teta,q,p,phis )
    233         PRINT *,' ----   Test_period apres continue   OK ! -----', itau
     244        write(*,*)' GCM ---- Test_period apres continue   OK ! -----',
     245     &            ' itau: ',itau
    234246      ENDIF
    235247
     
    508520
    509521
    510        PRINT *,' Appel test_period avant redem ', itau
     522       write(*,*)' GCM: Appel test_period avant redem ; itau=',itau
    511523       CALL test_period ( ucov,vcov,teta,q,p,phis )
    512        CALL dynredem1("restart.nc",0.0,
     524       CALL dynredem1("restart.nc",time,
    513525     .                     vcov,ucov,teta,q,nqmx,masse,ps)
    514526
     
    585597
    586598                 IF(itau.EQ.itaufin)
    587      . CALL dynredem1("restart.nc",0.0,
     599     . CALL dynredem1("restart.nc",time,
    588600     .                     vcov,ucov,teta,q,nqmx,masse,ps)
    589601
  • trunk/LMDZ.MARS/libf/dyn3d/sortvarc.F

    r38 r791  
    3838      REAL phi(ip1jmp1,llm),bern(ip1jmp1,llm)
    3939      REAL dp(ip1jmp1)
    40       REAL time
     40      REAL time ! elapsed time (in days) since begining of the run
    4141      REAL pk(ip1jmp1,llm)
    4242
     
    6060       dtvrs1j   = dtvr/daysec
    6161       rjour     = REAL( INT( itau * dtvrs1j ))
    62        heure     = ( itau*dtvrs1j-rjour ) * 24.
     62!       heure     = ( itau*dtvrs1j-rjour ) * 24.
     63       heure     = (time-floor(time))*24.
    6364       imjmp1    = iim * jjp1
    6465       IF(ABS(heure - 24.).LE.0.0001 ) heure = 0.
  • trunk/LMDZ.MARS/libf/dyn3d/temps.h

    r340 r791  
    22c INCLUDE 'temps.h'
    33
    4       COMMON/temps_i/itaufin,
    5      s  day_ini,day_end,anne_ini
     4      COMMON/temps_i/day_ini,day_end,anne_ini,itaufin
    65      COMMON/temps_r/dt
    76
    8       INTEGER  itaufin
    9       INTEGER*4 day_ini,day_end,anne_ini
    10       REAL     dt
     7      INTEGER  itaufin  ! total number of dynamical steps for the run
     8      INTEGER*4 day_ini ! initial day # of simulation sequence
     9      INTEGER*4 day_end ! final day # ; i.e. day # when this simulation ends
     10      INTEGER*4 anne_ini ! initial year # of simulation sequence ? Not used.
     11      REAL dt ! (dynamics) time step (changes if doing Matsuno or LF step)
    1112
    1213c-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.