Changeset 1669


Ignore:
Timestamp:
Feb 21, 2017, 9:17:00 AM (8 years ago)
Author:
emillour
Message:

Generic GCM:
Added possibility to run without a startfi.nc file (mainly usefull for
tests with coupling with dynamico dynamical core):

  • added flag "startphy_file" flag (.false. if doing an "academic" start on the physics side).
  • turned phyetat0.F90 into module phyetat0_mod.F90
  • turned tabfi.F into module tabfi_mod.F90 and added handling of startphy_file==.false. case
  • extra initializations in physiq_mod for startphy_file==.false. case.

EM

Location:
trunk/LMDZ.GENERIC
Files:
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/README

    r1622 r1669  
    12821282of an initial date and month number and lenght).
    12831283
     1284== 21/02/2017 == EM
     1285Added possibility to run without a startfi.nc file (mainly usefull for
     1286tests with coupling with dynamico dynamical core):
     1287- added flag "startphy_file" flag (.false. if doing an "academic" start
     1288  on the physics side).
     1289- turned phyetat0.F90 into module  phyetat0_mod.F90
     1290- turned tabfi.F into module tabfi_mod.F90 and added handling of
     1291  startphy_file==.false. case
     1292- extra initializations in physiq_mod for startphy_file==.false. case.
     1293
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F

    r1589 r1669  
    3737      USE temps_mod, ONLY: day_ini
    3838      USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
     39      use tabfi_mod, only: tabfi
    3940      use iniphysiq_mod, only: iniphysiq
     41      use phyetat0_mod, only: phyetat0
    4042      implicit none
    4143
     
    353355        write(*,*) 'Reading file STARTFI'
    354356        fichnom = 'startfi.nc'
    355         CALL phyetat0 (ngridmx,llm,fichnom,tab0,Lmodif,nsoilmx,
     357        CALL phyetat0(.true.,ngridmx,llm,fichnom,tab0,Lmodif,nsoilmx,
    356358     .        nqtot,day_ini,time,
    357359     .        tsurf,tsoil,emis,q2,qsurf,   !) ! temporary modif by RDW
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F

    r1593 r1669  
    3737      USE temps_mod, ONLY: day_ini
    3838      USE iniphysiq_mod, ONLY: iniphysiq
     39      use phyetat0_mod, only: phyetat0
    3940      implicit none
    4041
     
    234235
    235236
    236       CALL phyetat0 (ngridmx,llm,fichnom,0,Lmodif,nsoilmx,nqtot,
     237      CALL phyetat0(.true.,ngridmx,llm,fichnom,0,Lmodif,nsoilmx,nqtot,
    237238     .      day_ini_fi,timefi,
    238239     .      tsurf,tsoil,emis,q2,qsurf,
  • trunk/LMDZ.GENERIC/libf/phystd/callkeys_mod.F90

    r1520 r1669  
    105105!$OMP THREADPRIVATE(iscallphys)
    106106
     107      ! do we read a startphy.nc file (default=.true.)
     108      logical,save :: startphy_file=.true.
     109!$OMP THREADPRIVATE(startphy_file)
     110
    107111END MODULE callkeys_mod
  • trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90

    r1542 r1669  
    9595  call getin_p("iphysiq",iphysiq) ! call physics every iphysiq dyn step
    9696
     97  ! do we read a startphy.nc file? (default: .true.)
     98  call getin_p("startphy_file",startphy_file)
     99 
    97100! --------------------------------------------------------------
    98101!  Reading the "callphys.def" file controlling some key options
  • trunk/LMDZ.GENERIC/libf/phystd/phyetat0_mod.F90

    r1666 r1669  
    1 subroutine phyetat0 (ngrid,nlayer,fichnom,tab0,Lmodif,nsoil,nq, &
     1module phyetat0_mod
     2
     3implicit none
     4
     5contains
     6
     7subroutine phyetat0 (startphy_file, &
     8                     ngrid,nlayer,fichnom,tab0,Lmodif,nsoil,nq, &
    29                     day_ini,time,tsurf,tsoil, &
    310                     emis,q2,qsurf,cloudfrac,totcloudfrac,hice, &
    411                     rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
    512
    6 
     13  use tabfi_mod, only: tabfi
    714  USE tracer_h, ONLY: noms
    815  USE surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam, zthe
     
    1623
    1724!======================================================================
    18 ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
    19 !  Adaptation à Mars : Yann Wanherdrick
    20 ! Objet: Lecture de l etat initial pour la physique
    21 !======================================================================
    22 #include "netcdf.inc"
    23 
    24 !======================================================================
    25 !  INTEGER nbsrf !Mars nbsrf a 1 au lieu de 4
    26 !  PARAMETER (nbsrf=1) ! nombre de sous-fractions pour une maille
    27 !======================================================================
    2825!  Arguments:
    2926!  ---------
    3027!  inputs:
     28  logical,intent(in) :: startphy_file ! .true. if reading start file
    3129  integer,intent(in) :: ngrid
    3230  integer,intent(in) :: nlayer
     
    3634  integer,intent(in) :: nsoil ! # of soil layers
    3735  integer,intent(in) :: nq
    38   integer,intent(in) :: day_ini
    39   real,intent(in) :: time
     36  integer,intent(out) :: day_ini
     37  real,intent(out) :: time
    4038
    4139!  outputs:
     
    8179      INTEGER :: indextime=1 ! index of selected time, default value=1
    8280      logical :: found
     81     
     82      character(len=8) :: modname="phyetat0"
    8383
    8484!
     
    9393IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(ngrid))
    9494
    95 
    96 ! open physics initial state file:
    97 call open_startphy(fichnom)
    98 
    99 
    100 ! possibility to modify tab_cntrl in tabfi
    101 write(*,*)
    102 write(*,*) 'TABFI in phyeta0: Lmodif=',Lmodif," tab0=",tab0
    103 call tabfi (ngrid,nid_start,Lmodif,tab0,day_ini,lmax,p_rad, &
     95if (startphy_file) then
     96  ! open physics initial state file:
     97  call open_startphy(fichnom)
     98
     99  ! possibility to modify tab_cntrl in tabfi
     100  write(*,*)
     101  write(*,*) 'TABFI in phyeta0: Lmodif=',Lmodif," tab0=",tab0
     102  call tabfi (ngrid,nid_start,Lmodif,tab0,day_ini,lmax,p_rad, &
    104103                   p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time)
    105104
    106 !c
    107 !c Lecture des latitudes (coordonnees):
    108 !c
    109 !      ierr = NF_INQ_VARID (nid, "latitude", nvarid)
    110 !      IF (ierr.NE.NF_NOERR) THEN
    111 !         PRINT*, 'phyetat0: Le champ <latitude> est absent'
    112 !         CALL abort
    113 !      ENDIF
    114 !#ifdef NC_DOUBLE
    115 !      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,lati)
    116 !#else
    117 !      ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,lati)
    118 !#endif
    119 !      IF (ierr.NE.NF_NOERR) THEN
    120 !         PRINT*, 'phyetat0: Lecture echouee pour <latitude>'
    121 !         CALL abort
    122 !      ENDIF
    123 !c
    124 !c Lecture des longitudes (coordonnees):
    125 !c
    126 !      ierr = NF_INQ_VARID (nid, "longitude", nvarid)
    127 !      IF (ierr.NE.NF_NOERR) THEN
    128 !         PRINT*, 'phyetat0: Le champ <longitude> est absent'
    129 !         CALL abort
    130 !      ENDIF
    131 !#ifdef NC_DOUBLE
    132 !      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,long)
    133 !#else
    134 !      ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,long)
    135 !#endif
    136 !      IF (ierr.NE.NF_NOERR) THEN
    137 !         PRINT*, 'phyetat0: Lecture echouee pour <longitude>'
    138 !         CALL abort
    139 !      ENDIF
    140 !c
    141 !c Lecture des aires des mailles:
    142 !c
    143 !      ierr = NF_INQ_VARID (nid, "area", nvarid)
    144 !      IF (ierr.NE.NF_NOERR) THEN
    145 !         PRINT*, 'phyetat0: Le champ <area> est absent'
    146 !         CALL abort
    147 !      ENDIF
    148 !#ifdef NC_DOUBLE
    149 !      ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,area)
    150 !#else
    151 !      ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,area)
    152 !#endif
    153 !      IF (ierr.NE.NF_NOERR) THEN
    154 !         PRINT*, 'phyetat0: Lecture echouee pour <area>'
    155 !         CALL abort
    156 !      ENDIF
    157 !      xmin = 1.0E+20
    158 !      xmax = -1.0E+20
    159 !      xmin = MINVAL(area)
    160 !      xmax = MAXVAL(area)
    161 !      PRINT*,'Aires des mailles <area>:', xmin, xmax
    162 
    163 ! Load surface geopotential:
    164 call get_field("phisfi",phisfi,found)
    165 if (.not.found) then
    166   write(*,*) "phyetat0: Failed loading <phisfi>"
    167   call abort
    168 else
    169   write(*,*) "phyetat0: surface geopotential <phisfi> range:", &
    170              minval(phisfi), maxval(phisfi)
    171 endif
    172 
    173 ! Load bare ground albedo:
    174 call get_field("albedodat",albedodat,found)
    175 if (.not.found) then
    176   write(*,*) "phyetat0: Failed loading <albedodat>"
    177   call abort
    178 else
    179   write(*,*) "phyetat0: Bare ground albedo <albedodat> range:", &
     105else ! "academic" initialization of planetary parameters via tabfi
     106  call tabfi (ngrid,0,0,0,day_ini,lmax,p_rad, &
     107                   p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time)
     108endif ! of if (startphy_file)
     109
     110if (startphy_file) then
     111  ! Load surface geopotential:
     112  call get_field("phisfi",phisfi,found)
     113  if (.not.found) then
     114    call abort_physic(modname,"Failed loading <phisfi>",1)
     115  endif
     116else
     117  phisfi(:)=0
     118endif ! of if (startphy_file)
     119write(*,*) "phyetat0: surface geopotential <phisfi> range:", &
     120               minval(phisfi), maxval(phisfi)
     121
     122if (startphy_file) then
     123  ! Load bare ground albedo:
     124  call get_field("albedodat",albedodat,found)
     125  if (.not.found) then
     126    call abort_physic(modname,"Failed loading <albedodat>",1)
     127  endif
     128else
     129  albedodat(:)=0.5 ! would be better to read value from def file...
     130endif ! of if (startphy_file)
     131write(*,*) "phyetat0: Bare ground albedo <albedodat> range:", &
    180132             minval(albedodat), maxval(albedodat)
    181 endif
    182133
    183134! ZMEA
    184 call get_field("ZMEA",zmea,found)
    185 if (.not.found) then
    186   write(*,*) "phyetat0: Failed loading <ZMEA>"
    187   call abort
    188 else
    189   write(*,*) "phyetat0: <ZMEA> range:", &
     135if (startphy_file) then
     136  call get_field("ZMEA",zmea,found)
     137  if (.not.found) then
     138    call abort_physic(modname,"Failed loading <ZMEA>",1)
     139  endif
     140else
     141  zmea(:)=0
     142endif ! of if (startphy_file)
     143write(*,*) "phyetat0: <ZMEA> range:", &
    190144             minval(zmea), maxval(zmea)
    191 endif
    192145
    193146! ZSTD
    194 call get_field("ZSTD",zstd,found)
    195 if (.not.found) then
    196   write(*,*) "phyetat0: Failed loading <ZSTD>"
    197   call abort
    198 else
    199   write(*,*) "phyetat0: <ZSTD> range:", &
     147if (startphy_file) then
     148  call get_field("ZSTD",zstd,found)
     149  if (.not.found) then
     150    call abort_physic(modname,"Failed loading <ZSTD>",1)
     151  endif
     152else
     153  zstd(:)=0
     154endif ! of if (startphy_file)
     155write(*,*) "phyetat0: <ZSTD> range:", &
    200156             minval(zstd), maxval(zstd)
    201 endif
    202157
    203158! ZSIG
    204 call get_field("ZSIG",zsig,found)
    205 if (.not.found) then
    206   write(*,*) "phyetat0: Failed loading <ZSIG>"
    207   call abort
    208 else
    209   write(*,*) "phyetat0: <ZSIG> range:", &
     159if (startphy_file) then
     160  call get_field("ZSIG",zsig,found)
     161  if (.not.found) then
     162    call abort_physic(modname,"Failed loading <ZSIG>",1)
     163  endif
     164else
     165  zsig(:)=0
     166endif ! of if (startphy_file)
     167write(*,*) "phyetat0: <ZSIG> range:", &
    210168             minval(zsig), maxval(zsig)
    211 endif
    212169
    213170! ZGAM
    214 call get_field("ZGAM",zgam,found)
    215 if (.not.found) then
    216   write(*,*) "phyetat0: Failed loading <ZGAM>"
    217   call abort
    218 else
    219   write(*,*) "phyetat0: <ZGAM> range:", &
     171if (startphy_file) then
     172  call get_field("ZGAM",zgam,found)
     173  if (.not.found) then
     174    call abort_physic(modname,"Failed loading <ZGAM>",1)
     175  endif
     176else
     177  zgam(:)=0
     178endif ! of if (startphy_file)
     179write(*,*) "phyetat0: <ZGAM> range:", &
    220180             minval(zgam), maxval(zgam)
    221 endif
    222181
    223182! ZTHE
    224 call get_field("ZTHE",zthe,found)
    225 if (.not.found) then
    226   write(*,*) "phyetat0: Failed loading <ZTHE>"
    227   call abort
    228 else
    229   write(*,*) "phyetat0: <ZTHE> range:", &
     183if (startphy_file) then
     184  call get_field("ZTHE",zthe,found)
     185  if (.not.found) then
     186    call abort_physic(modname,"Failed loading <ZTHE>",1)
     187  endif
     188else
     189  zthe(:)=0
     190endif ! of if (startphy_file)
     191write(*,*) "phyetat0: <ZTHE> range:", &
    230192             minval(zthe), maxval(zthe)
    231 endif
    232193
    233194! Surface temperature :
    234 call get_field("tsurf",tsurf,found,indextime)
    235 if (.not.found) then
    236   write(*,*) "phyetat0: Failed loading <tsurf>"
    237   call abort
    238 else
    239   write(*,*) "phyetat0: Surface temperature <tsurf> range:", &
     195if (startphy_file) then
     196  call get_field("tsurf",tsurf,found,indextime)
     197  if (.not.found) then
     198    call abort_physic(modname,"Failed loading <tsurf>",1)
     199  endif
     200else
     201  tsurf(:)=0 ! will be updated afterwards in physiq !
     202endif ! of if (startphy_file)
     203write(*,*) "phyetat0: Surface temperature <tsurf> range:", &
    240204             minval(tsurf), maxval(tsurf)
    241 endif
    242205
    243206! Surface emissivity
    244 call get_field("emis",emis,found,indextime)
    245 if (.not.found) then
    246   write(*,*) "phyetat0: Failed loading <emis>"
    247   call abort
    248 else
    249   write(*,*) "phyetat0: Surface emissivity <emis> range:", &
     207if (startphy_file) then
     208  call get_field("emis",emis,found,indextime)
     209  if (.not.found) then
     210    call abort_physic(modname,"Failed loading <emis>",1)
     211  endif
     212else
     213  emis(:)=1 ! would be better to read value from def file...
     214endif ! of if (startphy_file)
     215write(*,*) "phyetat0: Surface emissivity <emis> range:", &
    250216             minval(emis), maxval(emis)
    251 endif
    252217
    253218! Cloud fraction (added by BC 2010)
    254219if (CLFvarying) then
    255 call get_field("cloudfrac",cloudfrac,found,indextime)
    256 if (.not.found) then
    257   write(*,*) "phyetat0: Failed loading <cloudfrac>"
    258   call abort
    259 else
     220  if (startphy_file) then
     221    call get_field("cloudfrac",cloudfrac,found,indextime)
     222    if (.not.found) then
     223      call abort_physic(modname,"Failed loading <cloudfrac>",1)
     224    endif
     225  else
     226    cloudfrac(:,:)=0
     227  endif ! of if (startphy_file)
    260228  write(*,*) "phyetat0: Cloud fraction <cloudfrac> range:", &
    261              minval(cloudfrac), maxval(cloudfrac)
    262 endif
    263 else
    264 cloudfrac(:,:)=0.0
    265 endif
     229               minval(cloudfrac), maxval(cloudfrac)
     230else
     231  cloudfrac(:,:)=0.0
     232endif ! of if (CLFvarying)
    266233
    267234! Total cloud fraction (added by BC 2010)
    268235if (CLFvarying) then
    269 call get_field("totcloudfrac",totcloudfrac,found,indextime)
    270 if (.not.found) then
    271   write(*,*) "phyetat0: Failed loading <totcloudfrac>"
    272   call abort
    273 else
     236  if (startphy_file) then
     237    call get_field("totcloudfrac",totcloudfrac,found,indextime)
     238    if (.not.found) then
     239      call abort_physic(modname,"Failed loading <totcloudfrac>",1)
     240    endif
     241  else
     242    totcloudfrac(:)=0
     243  endif ! of if (startphy_file)
    274244  write(*,*) "phyetat0: Total cloud fraction <totcloudfrac> range:", &
    275245             minval(totcloudfrac), maxval(totcloudfrac)
    276 endif
    277 else
    278 totcloudfrac(:)=0.0
    279 endif
     246else
     247  totcloudfrac(:)=0.0
     248endif ! of if (CLFvarying)
    280249
    281250! Height of oceanic ice (added by BC 2010)
    282 call get_field("hice",hice,found,indextime)
    283 if (.not.found) then
    284   write(*,*) "phyetat0: Failed loading <hice>"
    285 !  call abort
    286       do ig=1,ngrid
    287       hice(ig)=0.
    288       enddo
    289 else
    290   write(*,*) "phyetat0: Height of oceanic ice <hice> range:", &
     251if (startphy_file) then
     252  call get_field("hice",hice,found,indextime)
     253  if (.not.found) then
     254    write(*,*) "phyetat0: Failed loading <hice>"
     255    !  call abort
     256    hice(:)=0
     257  endif
     258else
     259  hice(:)=0
     260endif ! of if (startphy_file)
     261write(*,*) "phyetat0: Height of oceanic ice <hice> range:", &
    291262             minval(hice), maxval(hice)
    292 endif
    293263
    294264! SLAB OCEAN (added by BC 2014)
    295 ! nature of the surface
    296 call get_field("rnat",rnat,found,indextime)
    297 if (.not.found) then
    298   write(*,*) "phyetat0: Failed loading <rnat>"
    299       do ig=1,ngrid
    300         rnat(ig)=1.
    301       enddo
    302 else
     265if (startphy_file) then
     266  ! nature of the surface
     267  call get_field("rnat",rnat,found,indextime)
     268  if (.not.found) then
     269    write(*,*) "phyetat0: Failed loading <rnat>"
     270        rnat(1:ngrid)=1.
     271  else
    303272      do ig=1,ngrid
    304273        if((nint(rnat(ig)).eq.2).or.(nint(rnat(ig)).eq.0))then
     
    308277        endif     
    309278      enddo
    310 
    311   write(*,*) "phyetat0: Nature of surface <rnat> range:", &
     279  endif ! of if (.not.found)
     280else
     281  rnat(:)=1
     282endif ! of if (startphy_file)
     283write(*,*) "phyetat0: Nature of surface <rnat> range:", &
    312284             minval(rnat), maxval(rnat)
    313 endif
    314 ! Pourcentage of sea ice cover
    315 call get_field("pctsrf_sic",pctsrf_sic,found,indextime)
    316 if (.not.found) then
    317   write(*,*) "phyetat0: Failed loading <pctsrf_sic>"
    318       do ig=1,ngrid
    319       pctsrf_sic(ig)=0.
    320       enddo
    321 else
    322   write(*,*) "phyetat0: Pourcentage of sea ice cover <pctsrf_sic> range:", &
     285
     286if (startphy_file) then
     287  ! Pourcentage of sea ice cover
     288  call get_field("pctsrf_sic",pctsrf_sic,found,indextime)
     289  if (.not.found) then
     290    write(*,*) "phyetat0: Failed loading <pctsrf_sic>"
     291    pctsrf_sic(1:ngrid)=0.
     292  endif
     293else
     294  pctsrf_sic(:)=0
     295endif ! of if (startphy_file)
     296write(*,*) "phyetat0: Pourcentage of sea ice cover <pctsrf_sic> range:", &
    323297             minval(pctsrf_sic), maxval(pctsrf_sic)
    324 endif
    325 ! Slab ocean temperature (2 layers)
    326 call get_field("tslab",tslab,found,indextime)
    327 if (.not.found) then
    328   write(*,*) "phyetat0: Failed loading <tslab>"
    329       do ig=1,ngrid
    330       do iq=1,noceanmx
    331       tslab(ig,iq)=tsurf(ig)
    332       enddo
    333       enddo
    334 else
    335   write(*,*) "phyetat0: Slab ocean temperature <tslab> range:", &
     298
     299if (startphy_file) then
     300  ! Slab ocean temperature (2 layers)
     301  call get_field("tslab",tslab,found,indextime)
     302  if (.not.found) then
     303    write(*,*) "phyetat0: Failed loading <tslab>"
     304    do iq=1,noceanmx
     305      tslab(1:ngrid,iq)=tsurf(1:ngrid)
     306    enddo
     307  endif
     308else
     309  do iq=1,noceanmx
     310    tslab(1:ngrid,iq)=tsurf(1:ngrid)
     311  enddo
     312endif ! of if (startphy_file)
     313write(*,*) "phyetat0: Slab ocean temperature <tslab> range:", &
    336314             minval(tslab), maxval(tslab)
    337 endif
    338 ! Oceanic ice temperature
    339 call get_field("tsea_ice",tsea_ice,found,indextime)
    340 if (.not.found) then
    341   write(*,*) "phyetat0: Failed loading <tsea_ice>"
    342       do ig=1,ngrid
    343       tsea_ice(ig)=273.15-1.8
    344       enddo
    345 else
    346   write(*,*) "phyetat0: Oceanic ice temperature <tsea_ice> range:", &
     315
     316if (startphy_file) then
     317  ! Oceanic ice temperature
     318  call get_field("tsea_ice",tsea_ice,found,indextime)
     319  if (.not.found) then
     320    write(*,*) "phyetat0: Failed loading <tsea_ice>"
     321    tsea_ice(1:ngrid)=273.15-1.8
     322  endif
     323else
     324  tsea_ice(1:ngrid)=273.15-1.8
     325endif ! of if (startphy_file)
     326write(*,*) "phyetat0: Oceanic ice temperature <tsea_ice> range:", &
    347327             minval(tsea_ice), maxval(tsea_ice)
    348 endif
    349 !  Oceanic ice quantity (kg/m^2)
    350 call get_field("sea_ice",sea_ice,found,indextime)
    351 if (.not.found) then
    352   write(*,*) "phyetat0: Failed loading <sea_ice>"
    353       do ig=1,ngrid
    354       tsea_ice(ig)=0.
    355       enddo
    356 else
    357   write(*,*) "phyetat0: Oceanic ice quantity <sea_ice> range:", &
     328
     329if (startphy_file) then
     330  !  Oceanic ice quantity (kg/m^2)
     331  call get_field("sea_ice",sea_ice,found,indextime)
     332  if (.not.found) then
     333    write(*,*) "phyetat0: Failed loading <sea_ice>"
     334    tsea_ice(1:ngrid)=0.
     335  endif
     336else
     337  tsea_ice(1:ngrid)=0
     338endif ! of if (startphy_file)
     339write(*,*) "phyetat0: Oceanic ice quantity <sea_ice> range:", &
    358340             minval(sea_ice), maxval(sea_ice)
    359 endif
    360 
    361 
    362341
    363342
    364343! pbl wind variance
    365 call get_field("q2",q2,found,indextime)
    366 if (.not.found) then
    367   write(*,*) "phyetat0: Failed loading <q2>"
    368   call abort
    369 else
    370   write(*,*) "phyetat0: PBL wind variance <q2> range:", &
     344if (startphy_file) then
     345  call get_field("q2",q2,found,indextime)
     346  if (.not.found) then
     347    call abort_physic(modname,"Failed loading <q2>",1)
     348  endif
     349else
     350  q2(:,:)=0
     351endif ! of if (startphy_file)
     352write(*,*) "phyetat0: PBL wind variance <q2> range:", &
    371353             minval(q2), maxval(q2)
    372 endif
    373354
    374355! tracer on surface
     
    376357  do iq=1,nq
    377358    txt=noms(iq)
    378    
    379     !! There was a bug here. MT2015.
    380    
    381     !if (txt.eq."h2o_vap") then
    382       ! There is no surface tracer for h2o_vap;
    383       ! "h2o_ice" should be loaded instead
    384      ! txt="h2o_ice"
    385      ! write(*,*) 'phyetat0: loading surface tracer', &
    386      !                      ' h2o_ice instead of h2o_vap'
    387     !endif
    388    
    389     call get_field(txt,qsurf(:,iq),found,indextime)
    390     if (.not.found) then
    391       write(*,*) "phyetat0: Failed loading <",trim(txt),">"
    392       write(*,*) "         ",trim(txt)," is set to zero"
    393       qsurf(:,iq) = 0.
     359    if (startphy_file) then
     360      call get_field(txt,qsurf(:,iq),found,indextime)
     361      if (.not.found) then
     362        write(*,*) "phyetat0: Failed loading <",trim(txt),">"
     363        write(*,*) "         ",trim(txt)," is set to zero"
     364        qsurf(:,iq) = 0.
     365      endif
    394366    else
    395       write(*,*) "phyetat0: Surface tracer <",trim(txt),"> range:", &
     367      qsurf(:,iq)=0
     368    endif ! of if (startphy_file)
     369    write(*,*) "phyetat0: Surface tracer <",trim(txt),"> range:", &
    396370                 minval(qsurf(:,iq)), maxval(qsurf(:,iq))
    397     endif
    398   enddo
     371  enddo! of do iq=1,nq
    399372endif ! of if (nq.ge.1)
    400373
    401374
    402 ! Call to soil_settings, in order to read soil temperatures,
    403 ! as well as thermal inertia and volumetric heat capacity
    404 call soil_settings(nid_start,ngrid,nsoil,tsurf,tsoil,indextime)
     375if (startphy_file) then
     376  ! Call to soil_settings, in order to read soil temperatures,
     377  ! as well as thermal inertia and volumetric heat capacity
     378  call soil_settings(nid_start,ngrid,nsoil,tsurf,tsoil,indextime)
     379endif ! of if (startphy_file)
    405380!
    406381! close file:
    407382!
    408 call close_startphy
    409 
    410 END SUBROUTINE phyetat0
     383if (startphy_file) call close_startphy
     384
     385end subroutine phyetat0
     386
     387end module phyetat0_mod
  • trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90

    r1637 r1669  
    3232                          igcm_co2_ice
    3333      use time_phylmdz_mod, only: ecritphy, iphysiq, nday
     34      use phyetat0_mod, only: phyetat0
    3435      use phyredem, only: physdem0, physdem1
    3536      use slab_ice_h, only: capcalocean, capcalseaice,capcalsno, &
     
    162163!    ------------------
    163164
    164 #include "netcdf.inc"
     165include "netcdf.inc"
    165166
    166167! Arguments :
     
    244245      real pw(ngrid,nlayer)               ! Vertical velocity (m/s). (NOTE : >0 WHEN DOWNWARDS !!)
    245246
    246       integer l,ig,ierr,iq,nw
     247      integer l,ig,ierr,iq,nw,isoil
    247248     
    248249      ! FOR DIAGNOSTIC :
     
    531532!        Read 'startfi.nc' file.
    532533!        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    533          call phyetat0(ngrid,nlayer,"startfi.nc",0,0,nsoilmx,nq,      &
     534         call phyetat0(startphy_file,                                 &
     535                       ngrid,nlayer,"startfi.nc",0,0,nsoilmx,nq,      &
    534536                       day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf,   &
    535537                       cloudfrac,totcloudfrac,hice,                   &
    536538                       rnat,pctsrf_sic,tslab, tsea_ice,sea_ice)
     539         if (.not.startphy_file) then
     540           ! additionnal "academic" initialization of physics
     541           if (is_master) write(*,*) "Physiq: initializing tsurf(:) to pt(:,1) !!"
     542           tsurf(:)=pt(:,1)
     543           if (is_master) write(*,*) "Physiq: initializing tsoil(:) to pt(:,1) !!"
     544           do isoil=1,nsoilmx
     545             tsoil(1:ngrid,isoil)=tsurf(1:ngrid)
     546           enddo
     547           if (is_master) write(*,*) "Physiq: initializing day_ini to pdat !"
     548           day_ini=pday
     549         endif
    537550
    538551         if (pday.ne.day_ini) then
  • trunk/LMDZ.GENERIC/libf/phystd/tabfi_mod.F90

    r1666 r1669  
    1 c=======================================================================
    2       SUBROUTINE tabfi(ngrid,nid,Lmodif,tab0,day_ini,lmax,p_rad,
    3      .                 p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time)
    4 c=======================================================================
    5 c
    6 c   C. Hourdin 15/11/96
    7 c
    8 c   Object:        Lecture du tab_cntrl physique dans un fichier
    9 c   ------            et initialisation des constantes physiques
    10 c
    11 c   Arguments:
    12 c   ----------
    13 c
    14 c     Inputs:
    15 c     ------
    16 c
    17 c      - nid:    unitne logique du fichier ou on va lire le tab_cntrl   
    18 c                      (ouvert dans le programme appellant)
    19 c
    20 c                 si nid=0:
    21 c                       pas de lecture du tab_cntrl mais
    22 c                       Valeurs par default des constantes physiques
    23 c       
    24 c      - tab0:    Offset de tab_cntrl a partir duquel sont ranges
    25 c                  les parametres physiques (50 pour start_archive)
    26 c
    27 c      - Lmodif:  si on souhaite modifier les constantes  Lmodif = 1 = TRUE
    28 c
    29 c
    30 c     Outputs:
    31 c     --------
    32 c
    33 c      - day_ini: tab_cntrl(tab0+3) (Dans les cas ou l'on souhaite
    34 c                              comparer avec le day_ini dynamique)
    35 c
    36 c      - lmax:    tab_cntrl(tab0+2) (pour test avec nlayer)
    37 c
    38 c      - p_rad
    39 c      - p_omeg   !
    40 c      - p_g      ! Constantes physiques ayant des
    41 c      - p_mugaz  ! homonymes dynamiques
    42 c      - p_daysec !
    43 c
    44 c=======================================================================
    45 ! to use  'getin'
    46       use ioipsl_getincom , only: getin
    47 
    48       use surfdat_h, only: emisice, iceradius, dtemisice,
    49      &                     emissiv
     1MODULE tabfi_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
     7!=======================================================================
     8      SUBROUTINE tabfi(ngrid,nid,Lmodif,tab0,day_ini,lmax,p_rad, &
     9                       p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time)
     10!=======================================================================
     11!
     12!   C. Hourdin 15/11/96
     13!
     14!   Object:        Lecture du tab_cntrl physique dans un fichier
     15!   ------            et initialisation des constantes physiques
     16!
     17!   Arguments:
     18!   ----------
     19!
     20!     Inputs:
     21!     ------
     22!
     23!      - nid:    unitne logique du fichier ou on va lire le tab_cntrl   
     24!                      (ouvert dans le programme appellant)
     25!
     26!                 si nid=0:
     27!                       pas de lecture du tab_cntrl mais
     28!                       Valeurs par default des constantes physiques
     29!       
     30!      - tab0:    Offset de tab_cntrl a partir duquel sont ranges
     31!                  les parametres physiques (50 pour start_archive)
     32!
     33!      - Lmodif:  si on souhaite modifier les constantes  Lmodif = 1 = TRUE
     34!
     35!
     36!     Outputs:
     37!     --------
     38!
     39!      - day_ini: tab_cntrl(tab0+3) (Dans les cas ou l'on souhaite
     40!                              comparer avec le day_ini dynamique)
     41!
     42!      - lmax:    tab_cntrl(tab0+2) (pour test avec nlayer)
     43!
     44!      - p_rad
     45!      - p_omeg   !
     46!      - p_g      ! Constantes physiques ayant des
     47!      - p_mugaz  ! homonymes dynamiques
     48!      - p_daysec !
     49!
     50!=======================================================================
     51! to use  'getin_p'
     52      use ioipsl_getin_p_mod, only: getin_p
     53
     54      use surfdat_h, only: emisice, iceradius, dtemisice, &
     55                           emissiv
    5056      use comsoil_h, only: volcapa
    5157      use iostart, only: get_var
    5258      use mod_phys_lmdz_para, only: is_parallel
    53       use planete_mod, only: year_day, periastr, apoastr, peri_day,
    54      &                       obliquit, z0, lmixmin, emin_turb
     59      use planete_mod, only: year_day, periastr, apoastr, peri_day, &
     60                             obliquit, z0, lmixmin, emin_turb
    5561      use comcstfi_mod, only: rad, omeg, g, mugaz, rcp, cpp, r
    5662      use time_phylmdz_mod, only: dtphys, daysec
     
    5864      implicit none
    5965 
    60 #include "netcdf.inc"
    61 
    62 c-----------------------------------------------------------------------
    63 c   Declarations
    64 c-----------------------------------------------------------------------
    65 
    66 c Arguments
    67 c ---------
     66      include "netcdf.inc"
     67
     68!-----------------------------------------------------------------------
     69!   Declarations
     70!-----------------------------------------------------------------------
     71
     72! Arguments
     73! ---------
    6874      INTEGER,INTENT(IN) :: ngrid,nid,tab0
    6975      INTEGER*4,INTENT(OUT) :: day_ini
     
    7278      REAL,INTENT(OUT) :: p_rad,p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time
    7379
    74 c Variables
    75 c ---------
     80! Variables
     81! ---------
    7682      INTEGER,PARAMETER :: length=100
    7783      REAL tab_cntrl(length) ! array in which are stored the run's parameters
     
    8086      CHARACTER modif*20
    8187      LOGICAL :: found
     88      CHARACTER(len=5) :: modname="tabfi"
    8289     
    8390      write(*,*)"tabfi: nid=",nid," tab0=",tab0," Lmodif=",Lmodif
    8491
    8592      IF (nid.eq.0) then
    86 c-----------------------------------------------------------------------
    87 c  Initialization of various physical constants to defaut values (nid = 0 case)
    88 c-----------------------------------------------------------------------
     93!-----------------------------------------------------------------------
     94!  Initialization of various physical constants to defaut values (nid = 0 case)
     95!-----------------------------------------------------------------------
     96        tab_cntrl(:)=0
     97        lmax=0 ! not used anyways
     98        !day_ini already set via inifis
     99        time=0
     100! Informations about planet for dynamics and physics
     101        ! rad,cpp,g,r,rcp already initialized by inifis
     102        omeg=-999.
     103        call getin_p("omega",omeg)
     104        if (omeg.eq.-999.) then
     105          call abort_physic(modname,"Missing value for omega in def files!",1)
     106        endif
     107        mugaz=(8.3144621/r)*1.E3
     108        ! daysec already set by inifis
     109        ! dtphys alread set by inifis
     110! Informations about planet for the physics only
     111        year_day=-999. ! length of year, in standard days
     112        call getin_p("year_day",year_day)
     113        if (year_day.eq.-999.) then
     114          call abort_physic(modname, &
     115               "Missing value for year_day in def files!",1)
     116        endif
     117        periastr=-999.
     118        call getin_p("periastron",periastr)
     119        if (periastr.eq.-999.) then
     120          call abort_physic(modname, &
     121               "Missing value for periastron in def files!",1)
     122        endif
     123        apoastr=-999.
     124        call getin_p("apoastron",apoastr)
     125        if (apoastr.eq.-999.) then
     126          call abort_physic(modname, &
     127               "Missing value for apoastron in def files!",1)
     128        endif
     129        peri_day=-999.
     130        call getin_p("periastron_day",peri_day)
     131        if (peri_day.eq.-999.) then
     132          call abort_physic(modname, &
     133               "Missing value for periastron date in def files!",1)
     134        endif
     135        obliquit=-999.
     136        call getin_p("obliquity",obliquit)
     137        if (obliquit.eq.-999.) then
     138          call abort_physic(modname, &
     139               "Missing value for obliquity in def files!",1)
     140        endif
     141! boundary layer and turbulence
     142        z0=1.e-2 ! surface roughness length (m)
     143        lmixmin=30
     144        emin_turb=1.e-6
     145! optical properties of polar caps and ground emissivity
     146        emisice(:)=0
     147        emissiv=0
     148        iceradius(:)=1.e-6 ! mean scat radius of CO2 snow
     149        dtemisice(:)=0 !time scale for snow metamorphism
     150        volcapa=1000000 ! volumetric heat capacity of subsurface
     151
    89152      ELSE
    90 c-----------------------------------------------------------------------
    91 c  Initialization of physical constants by reading array tab_cntrl(:)
    92 c               which contains these parameters (nid != 0 case)
    93 c-----------------------------------------------------------------------
    94 c Read 'controle' array
    95 c
     153!-----------------------------------------------------------------------
     154!  Initialization of physical constants by reading array tab_cntrl(:)
     155!               which contains these parameters (nid != 0 case)
     156!-----------------------------------------------------------------------
     157! Read 'controle' array
     158!
    96159
    97160       call get_var("controle",tab_cntrl,found)
    98161       if (.not.found) then
    99          write(*,*)"tabfi: Failed reading <controle> array"
    100          call abort
     162         call abort_physic(modname,"Failed reading <controle> array",1)
    101163       else
    102164         write(*,*)'tabfi: tab_cntrl',tab_cntrl
    103165       endif
    104 c
    105 c  Initialization of some physical constants
    106 c informations on physics grid
     166!
     167!  Initialization of some physical constants
     168! informations on physics grid
    107169!      if(ngrid.ne.tab_cntrl(tab0+1)) then
    108170!         print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngrid'
     
    113175      time = tab_cntrl(tab0+4)
    114176      write (*,*) 'IN tabfi day_ini=',day_ini
    115 c Informations about planet for dynamics and physics
     177! Informations about planet for dynamics and physics
    116178      rad = tab_cntrl(tab0+5)
    117179      omeg = tab_cntrl(tab0+6)
     
    122184      daysec = tab_cntrl(tab0+10)
    123185      dtphys = tab_cntrl(tab0+11)
    124 c Informations about planet for the physics only
     186! Informations about planet for the physics only
    125187      year_day = tab_cntrl(tab0+14)
    126188      periastr = tab_cntrl(tab0+15)
     
    128190      peri_day = tab_cntrl(tab0+17)
    129191      obliquit = tab_cntrl(tab0+18)
    130 c boundary layer and turbeulence
     192! boundary layer and turbulence
    131193      z0 = tab_cntrl(tab0+19)
    132194      lmixmin = tab_cntrl(tab0+20)
    133195      emin_turb = tab_cntrl(tab0+21)
    134 c optical properties of polar caps and ground emissivity
     196! optical properties of polar caps and ground emissivity
    135197      emisice(1) = tab_cntrl(tab0+24)
    136198      emisice(2) = tab_cntrl(tab0+25)
     
    140202      dtemisice(1)= tab_cntrl(tab0+33) !time scale for snow metamorphism (north)
    141203      dtemisice(2)= tab_cntrl(tab0+34) !time scale for snow metamorphism (south)
    142 c soil properties
     204! soil properties
    143205      volcapa = tab_cntrl(tab0+35) ! volumetric heat capacity
    144 c-----------------------------------------------------------------------
    145 c       Save some constants for later use (as routine arguments)
    146 c-----------------------------------------------------------------------
     206!-----------------------------------------------------------------------
     207!       Save some constants for later use (as routine arguments)
     208!-----------------------------------------------------------------------
    147209      p_omeg = omeg
    148210      p_g = g
     
    154216      ENDIF    ! end of (nid = 0)
    155217
    156 c-----------------------------------------------------------------------
    157 c       Write physical constants to output before modifying them
    158 c-----------------------------------------------------------------------
     218!-----------------------------------------------------------------------
     219!       Write physical constants to output before modifying them
     220!-----------------------------------------------------------------------
    159221 
    160222   6  FORMAT(a20,e15.6,e15.6)
     
    198260      write(*,*) 'Lmodif in tabfi!!!!!!!',Lmodif
    199261
    200 c-----------------------------------------------------------------------
    201 c        Modifications...
     262!-----------------------------------------------------------------------
     263!        Modifications...
    202264! NB: Modifying controls should only be done by newstart, and in seq mode
    203265      if ((Lmodif.eq.1).and.is_parallel) then
    204         write(*,*) "tabfi: Error modifying tab_control should",
    205      &             " only happen in serial mode (eg: by newstart)"
     266        write(*,*) "tabfi: Error modifying tab_control should", &
     267                   " only happen in serial mode (eg: by newstart)"
    206268        stop
    207269      endif
    208 c-----------------------------------------------------------------------
     270!-----------------------------------------------------------------------
    209271
    210272      IF(Lmodif.eq.1) then
     
    222284      write(*,*) '(24 et 25)   emisice : CO2 ice max emissivity '
    223285      write(*,*) '(31 et 32) iceradius : mean scat radius of CO2 snow'
    224       write(*,*) '(33 et 34) dtemisice : time scale for snow',
    225      &           'metamorphism'
     286      write(*,*) '(33 et 34) dtemisice : time scale for snow metamorphism'
    226287      write(*,*) '(35)      volcapa : soil volumetric heat capacity'
    227288      write(*,*) '(18)     obliquit : planet obliquity (deg)'
     
    466527 999  continue
    467528
    468 c-----------------------------------------------------------------------
    469 c       Write values of physical constants after modifications
    470 c-----------------------------------------------------------------------
     529!----------------------------------------------------------------------
     530!       Write values of physical constants after modifications
     531!-----------------------------------------------------------------------
    471532 
    472533      write(*,*) '*****************************************************'
     
    509570      ENDIF ! of if (Lmodif == 1)
    510571
    511 c-----------------------------------------------------------------------
    512 c       Save some constants for later use (as routine arguments)
    513 c-----------------------------------------------------------------------
     572!-----------------------------------------------------------------------
     573!       Save some constants for later use (as routine arguments)
     574!-----------------------------------------------------------------------
    514575      p_omeg = omeg
    515576      p_g = g
     
    520581
    521582
    522       end
     583      END SUBROUTINE tabfi
     584
     585end module tabfi_mod
Note: See TracChangeset for help on using the changeset viewer.