Changeset 3369 for trunk/LMDZ.MARS/libf


Ignore:
Timestamp:
Jun 12, 2024, 11:00:16 AM (7 months ago)
Author:
emillour
Message:

Mars PCM:
Change the way the rate of outputs for diagfi.nc files is specified:
IMPORTANT: Specifying "ecritphy" no longer possible and will trigger an error.
Use "outputs_per_sol" to specify output rate instead.
This should makes things (hopefully) clearer for users and also better
enforces a cleaner and clearer separation between dynamics and physics.
EM

Location:
trunk/LMDZ.MARS/libf/phymars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/conf_phys.F

    r3343 r3369  
    2222     &                     frost_albedo_threshold, inert_h2o_ice,
    2323     &                     frost_metam_threshold,old_wsublimation_scheme
    24       use time_phylmdz_mod, only: ecritphy,day_step,iphysiq,ecritstart,
    25      &                            daysec,dtphys
     24      use time_phylmdz_mod, only: steps_per_sol,outputs_per_sol,iphysiq,
     25     &                            ecritstart,daysec,dtphys
    2626      use dimradmars_mod, only: naerkind, name_iaer,
    2727     &                      ini_scatterers,tauvis
     
    5555      INTEGER ierr,j
    5656      character(len=20),parameter :: modname="conf_phys"
     57     
     58      real :: ecritphy ! to check that this obsolete flag is no longer used...
    5759 
    5860      CHARACTER ch1*12
     
    6062      ! read in some parameters from "run.def" for physics,
    6163      ! or shared between dynamics and physics.
    62       ecritphy=240 ! default value
     64      ecritphy=-666 ! dummy default value
    6365      call getin_p("ecritphy",ecritphy) ! frequency of outputs in physics,
    6466                                      ! in dynamical steps
    65       day_step=960 ! default value
    66       call getin_p("day_step",day_step) ! number of dynamical steps per day
     67      if (ecritphy/=-666) then
     68        call abort_physic(modname,
     69     &     "Error: parameter ecritphy is obsolete! Remove it! "//
     70     &     "And use outputs_per_sol instead",1)
     71      endif
     72     
     73      outputs_per_sol=4 ! default value, 4 outputs per sol
     74      call getin_p("outputs_per_sol",outputs_per_sol)
     75      ! check that indeed it is possible for given physics time step
     76      if (modulo(steps_per_sol,outputs_per_sol)/=0) then
     77        write(*,*) "Error: outputs_per_sol = ",outputs_per_sol
     78        write(*,*) " is not a divisor of number of steps per sol = ",
     79     &             steps_per_sol
     80        call abort_physic(modname,
     81     &     "Error: inadequate value for outputs_per_sol",1)
     82      endif
     83     
    6784      iphysiq=20 ! default value
    6885      call getin_p("iphysiq",iphysiq) ! call physics every iphysiq dyn step
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90

    r3316 r3369  
    1111use ioipsl_getincom,          only: getin ! To use 'getin'
    1212use comcstfi_h,               only: pi, rad, omeg, g, mugaz, rcp, r, cpp
    13 use time_phylmdz_mod,         only: daysec, day_step, ecritphy, iphysiq
     13use time_phylmdz_mod, only: daysec, steps_per_sol, outputs_per_sol, iphysiq
    1414use planete_h,                only: year_day, periheli, aphelie, peri_day, obliquit, emin_turb, lmixmin
    1515use surfdat_h,                only: albedodat, z0_default, z0, emissiv, emisice, albedice, iceradius, dtemisice,      &
     
    287287nsoil = nsoilmx
    288288
    289 day_step = 48 ! Default value for day_step
     289steps_per_sol = 48 ! Default value for day_step (old name for steps_per_sol)
    290290write(*,*)'Number of time steps per sol?'
    291 call getin("day_step",day_step)
    292 write(*,*) " day_step = ",day_step
    293 
    294 ecritphy = day_step ! Default value for ecritphy, output every time step
     291call getin("day_step",steps_per_sol)
     292write(*,*) " steps_per_sol (aka day_step) = ",steps_per_sol
     293
     294outputs_per_sol = steps_per_sol ! Default value for outputs_per_sol
    295295
    296296ndt = 10 ! Default value for ndt
     
    300300
    301301dayn = day0 + ndt
    302 ndt = ndt*day_step
    303 dttestphys = daysec/day_step
     302ndt = ndt*steps_per_sol
     303dttestphys = daysec/steps_per_sol
    304304
    305305! Imposed surface pressure
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90

    r3350 r3369  
    88use tracer_mod,          only: igcm_h2o_vap, igcm_h2o_ice, igcm_co2, noms
    99use comcstfi_h,          only: pi, g, rcp, cpp
    10 use time_phylmdz_mod,    only: daysec, day_step
     10use time_phylmdz_mod, only: daysec
    1111use dimradmars_mod,      only: tauvis, totcloudfrac, albedo
    1212use dust_param_mod,      only: tauscaling
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r3325 r3369  
    6565      use conc_mod, only: init_r_cp_mu, update_r_cp_mu_ak, rnew,
    6666     &                    cpnew, mmean
    67       use time_phylmdz_mod, only: iphysiq, day_step, ecritstart, daysec
     67      use time_phylmdz_mod, only: steps_per_sol
     68      use time_phylmdz_mod, only: iphysiq, ecritstart, daysec
    6869      use dimradmars_mod, only: aerosol, totcloudfrac,
    6970     &                          dtrad, fluxrad_sky, fluxrad, albedo,
     
    10071008           ENDIF !end callnlte
    10081009
    1009 c          Find number of layers for LTE radiation calculations
    1010            IF(MOD(iphysiq*(icount-1),day_step).EQ.0)
     1010!          Find number of layers for LTE radiation calculations
     1011!          (done only once per sol)
     1012           IF(MOD((icount-1),steps_per_sol).EQ.0)
    10111013     &          CALL nlthermeq(ngrid,nlayer,zplev,zplay)
    10121014
  • trunk/LMDZ.MARS/libf/phymars/time_phylmdz_mod.F90

    r2511 r3369  
    44    REAL,SAVE    :: dtphys      ! physics time step (s)
    55!$OMP THREADPRIVATE(dtphys)
    6     INTEGER,SAVE :: day_step    ! number of dynamical steps per day
    7                                 ! (set via conf_phys)
    8 !$OMP THREADPRIVATE(day_step)
     6
    97    REAL,SAVE    :: daysec     ! length of day (s)
    108!$OMP THREADPRIVATE(daysec)
     9
     10    INTEGER,SAVE :: steps_per_sol ! number of physics steps per sol
     11!$OMP THREADPRIVATE(steps_per_sol)
     12
    1113    INTEGER,SAVE :: day_ini     ! initial day of the run
    1214!$OMP THREADPRIVATE(day_ini)
     
    1719!$OMP THREADPRIVATE(hour_ini)
    1820
    19     INTEGER,SAVE :: ecritphy    ! for diagfi.nc outputs, write every ecritphy
    20                                 ! dynamical steps (set via conf_phys)
    21 !$OMP THREADPRIVATE(ecritphy)
     21    INTEGER,SAVE :: outputs_per_sol ! for diagfi.nc outputs, number of outputs
     22                                    ! per sol (set via conf_phys)
     23!$OMP THREADPRIVATE(outputs_per_sol)
     24
    2225    INTEGER,SAVE :: iphysiq   ! call physics every iphysiq dynamical step
    2326                              ! (set via conf_phys)
     
    4346    dtphys=dtphys_
    4447   
     48    ! compute number of physics steps per sol
     49    steps_per_sol=nint(daysec/dtphys)
     50   
    4551  END SUBROUTINE init_time
    4652
  • trunk/LMDZ.MARS/libf/phymars/writediagfi.F

    r3092 r3369  
    4141      use surfdat_h, only: phisfi
    4242      use geometry_mod, only: cell_area
    43       use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini
     43      use time_phylmdz_mod, only: steps_per_sol, outputs_per_sol
     44      use time_phylmdz_mod, only: day_ini
    4445      USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
    4546     &                               is_master, gather
     
    7374      REAL area((nbp_lon+1),nbp_lat)
    7475
    75       integer irythme
     76      integer isample
    7677      integer ierr,ierr2
    7778      integer i,j,l, ig0
     
    121122
    122123!***************************************************************
    123 !Sortie des variables au rythme voulu
    124 
    125       irythme = int(ecritphy) ! output rate set by ecritphy
     124! Compute the output rate
     125
     126      isample=steps_per_sol/outputs_per_sol
    126127
    127128!***************************************************************
     
    267268!------------------------------------------------------------------------
    268269      if (nom.eq.firstnom) then
    269           zitau = zitau + iphysiq
     270          zitau = zitau + 1
    270271      end if
    271272
     
    274275!--------------------------------------------------------
    275276
    276       if ( MOD(zitau+1,irythme) .eq.0.) then
     277      if ( MOD(zitau+1,isample) .eq.0.) then
    277278
    278279! Compute/write/extend 'Time' coordinate (date given in days)
     
    287288           ntime=ntime+1 ! increment # of stored time steps
    288289           ! compute corresponding date (in days and fractions thereof)
    289            date=(zitau +1.)/day_step
     290           date=(zitau +1.)/steps_per_sol
    290291           ! Get NetCDF ID of 'Time' variable
    291292           ierr= NF_INQ_VARID(nid,"Time",varid)
     
    620621        endif ! of if (dim.eq.3) elseif(dim.eq.2)...
    621622
    622       endif ! of if ( MOD(zitau+1,irythme) .eq.0.)
     623      endif ! of if ( MOD(zitau+1,isample) .eq.0.)
    623624
    624625      if (is_master) then
  • trunk/LMDZ.MARS/libf/phymars/writediagmicrofi.F

    r2616 r3369  
    4545      use surfdat_h, only: phisfi
    4646      use geometry_mod, only: cell_area
    47       use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini
     47      use time_phylmdz_mod, only: steps_per_sol, outputs_per_sol
     48      use time_phylmdz_mod, only: day_ini
    4849      USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
    4950     &                               is_master, gather
     
    8081      REAL area((nbp_lon+1),nbp_lat)
    8182
    82       integer irythme
     83      integer isample
    8384      integer ierr,ierr2
    8485      integer i,j,l, ig0
     
    124125
    125126!***************************************************************
    126 !Sortie des variables au rythme voulu
    127 
    128       irythme = int(ecritphy) ! output rate set by ecritphy
     127! Compute the output rate
     128
     129      isample = steps_per_sol/outputs_per_sol
    129130
    130131!***************************************************************
     
    280281!------------------------------------------------------------------------
    281282      if ((nom.eq.firstnom) .and. (microstep.eq.1)) then
    282           zitau = zitau + iphysiq
     283          zitau = zitau + 1
    283284      end if
    284285
     
    287288!--------------------------------------------------------
    288289
    289       if ( MOD(zitau+1,irythme) .eq.0.) then
     290      if ( MOD(zitau+1,isample) .eq.0.) then
    290291
    291292! Compute/write/extend 'Time' coordinate (date given in days)
     
    300301           ntime=ntime+1 ! increment # of stored time steps
    301302           ! compute corresponding date (in days and fractions thereof)
    302            date=(zitau +1.)/day_step
     303           date=(zitau +1.)/steps_per_sol
    303304           subdate=0.
    304305           ! Get NetCDF ID of 'Time' variable
     
    668669        endif ! of if (dim.eq.3) elseif(dim.eq.2)...
    669670
    670       endif ! of if ( MOD(zitau+1,irythme) .eq.0.)
     671      endif ! of if ( MOD(zitau+1,isample) .eq.0.)
    671672
    672673      if (is_master) then
  • trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90

    r3344 r3369  
    2323use comsoil_h, only: mlayer, nsoilmx, inertiedat
    2424use geometry_mod, only: cell_area
    25 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
     25use time_phylmdz_mod, only: steps_per_sol, outputs_per_sol
    2626use mod_phys_lmdz_para, only: is_mpi_root, is_master, gather
    2727use mod_grid_phy_lmdz, only: klon_glo, Grid1Dto2D_glo, nbp_lon, nbp_lat
     
    109109 
    110110  ! Set output sample rate
    111   isample=int(ecritphy) ! same as for diagfi outputs
     111  isample=steps_per_sol/outputs_per_sol ! same as for diagfi outputs
    112112  ! Note ecritphy is known from control.h
    113113 
     
    175175if (name.eq.firstname) then
    176176  ! if we run across 'firstname', then it is a new time step
    177   zitau=zitau+iphysiq
    178   ! Note iphysiq is known from control.h
     177  zitau=zitau+1
    179178endif
    180179
     
    185184  if (name.eq.firstname) then
    186185    ntime=ntime+1
    187     date=float(zitau+1)/float(day_step)
    188     ! Note: day_step is known from control.h
     186    date=float(zitau+1)/float(steps_per_sol)
    189187   
    190188    if (is_master) then
Note: See TracChangeset for help on using the changeset viewer.