module phyetat0_mod implicit none contains subroutine phyetat0 (fichnom,tab0,Lmodif,nsoil,ngrid,nlay,nq, & day_ini,time0,tsurf,tsoil,albedo,emis,q2,qsurf,co2ice, & tauscaling,totcloudfrac,wstar,mem_Mccn_co2,mem_Nccn_co2,& mem_Mh2o_co2) use tracer_mod, only: noms ! tracer names use surfdat_h, only: phisfi, albedodat, z0, z0_default,& zmea, zstd, zsig, zgam, zthe use iostart, only: nid_start, open_startphy, close_startphy, & get_field, get_var, inquire_field, & inquire_dimension, inquire_dimension_length use ioipsl_getincom, only : getin implicit none !====================================================================== ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818 ! Adaptation à Mars : Yann Wanherdrick ! Objet: Lecture de l etat initial pour la physique ! Modifs: Aug.2010 EM : use NetCDF90 to load variables (enables using ! r4 or r8 restarts independently of having compiled ! the GCM in r4 or r8) ! June 2013 TN : Possibility to read files with a time axis ! November 2013 EM : Enabeling parallel, using iostart module !====================================================================== INTEGER nbsrf !Mars nbsrf a 1 au lieu de 4 PARAMETER (nbsrf=1) ! nombre de sous-fractions pour une maille !====================================================================== ! Arguments: ! --------- ! inputs: character*(*),intent(in) :: fichnom ! "startfi.nc" file integer,intent(in) :: tab0 integer,intent(in) :: Lmodif integer,intent(in) :: nsoil ! # of soil layers integer,intent(in) :: ngrid ! # of atmospheric columns integer,intent(in) :: nlay ! # of atmospheric layers integer,intent(in) :: nq integer :: day_ini real :: time0 ! outputs: real,intent(out) :: tsurf(ngrid) ! surface temperature real,intent(out) :: tsoil(ngrid,nsoil) ! soil temperature real,intent(out) :: albedo(ngrid,2) ! surface albedo real,intent(out) :: emis(ngrid) ! surface emissivity real,intent(out) :: q2(ngrid,nlay+1) ! real,intent(out) :: qsurf(ngrid,nq) ! tracers on surface real,intent(out) :: co2ice(ngrid) ! co2 ice cover real,intent(out) :: tauscaling(ngrid) ! dust conversion factor real,intent(out) :: totcloudfrac(ngrid) ! total cloud fraction real,intent(out) :: wstar(ngrid) ! Max vertical velocity in thermals (m/s) real,intent(out) :: mem_Mccn_co2(ngrid,nlay) ! Memory of CCN mass of H2O and dust used by CO2 real,intent(out) :: mem_Nccn_co2(ngrid,nlay) ! Memory of CCN number of H2O and dust used by CO2 real,intent(out) :: mem_Mh2o_co2(ngrid,nlay) ! Memory of H2O mass integred into CO2 crystal !====================================================================== ! Local variables: real surffield(ngrid) ! to temporarily store a surface field real xmin,xmax ! to display min and max of a field ! INTEGER ig,iq,lmax INTEGER nid, nvarid INTEGER ierr, i, nsrf ! integer isoil ! INTEGER length ! PARAMETER (length=100) CHARACTER*7 str7 CHARACTER*2 str2 CHARACTER*1 yes ! REAL p_rad,p_omeg,p_g,p_mugaz,p_daysec INTEGER nqold ! flag which identifies if 'startfi.nc' file is using old names (qsurf01,...) logical :: oldtracernames=.false. integer :: count character(len=30) :: txt ! to store some text ! specific for time REAL,ALLOCATABLE :: time(:) ! times stored in start INTEGER timelen ! number of times stored in the file INTEGER indextime ! index of selected time INTEGER :: edges(3),corner(3) LOGICAL :: found REAL :: timestart ! to pick which initial state to start from ! open physics initial state file: call open_startphy(fichnom) ! possibility to modify tab_cntrl in tabfi write(*,*) write(*,*) 'TABFI in phyeta0: Lmodif=',Lmodif," tab0=",tab0 call tabfi (nid_start,Lmodif,tab0,day_ini,lmax,p_rad, & p_omeg,p_g,p_mugaz,p_daysec,time0) ! Load surface geopotential: call get_field("phisfi",phisfi,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: surface geopotential range:", & minval(phisfi), maxval(phisfi) endif ! Load bare ground albedo: call get_field("albedodat",albedodat,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: Bare ground albedo range:", & minval(albedodat), maxval(albedodat) endif ! ZMEA call get_field("ZMEA",zmea,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: range:", & minval(zmea), maxval(zmea) endif ! ZSTD call get_field("ZSTD",zstd,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: range:", & minval(zstd), maxval(zstd) endif ! ZSIG call get_field("ZSIG",zsig,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: range:", & minval(zsig), maxval(zsig) endif ! ZGAM call get_field("ZGAM",zgam,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: range:", & minval(zgam), maxval(zgam) endif ! ZTHE call get_field("ZTHE",zthe,found) if (.not.found) then write(*,*) "phyetat0: Failed loading " call abort else write(*,*) "phyetat0: range:", & minval(zthe), maxval(zthe) endif ! Time axis ! obtain timestart from run.def timestart=-9999 ! default value call getin("timestart",timestart) found=inquire_dimension("Time") if (.not.found) then indextime = 1 write(*,*) "phyetat0: No time axis found in "//trim(fichnom) else write(*,*) "phyetat0: Time axis found in "//trim(fichnom) timelen=inquire_dimension_length("Time") allocate(time(timelen)) ! load "Time" array: call get_var("Time",time,found) if (.not.found) then write(*,*) "phyetat0: Failed loading