Ignore:
Timestamp:
Mar 14, 2023, 10:07:33 AM (2 years ago)
Author:
romain.vande
Message:

Mars PCM:
Adapt start2archive.F to the subslope parametrisation.
Small correction for some dimensions of variables.
RV

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/iostart.F90

    r2907 r2913  
    1515    INTEGER,SAVE :: idim7 ! "Time" dimension
    1616    INTEGER,SAVE :: idim8 ! "nslope" dimension
    17     INTEGER,SAVE :: idim9 ! "inter slope" dimension
     17    INTEGER,SAVE :: idim9 ! "nslope_plus_1" dimension
    1818    INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields)
    1919    INTEGER,PARAMETER :: length=100 ! size of tab_cntrl array
     
    564564      ENDIF
    565565
    566       ierr=NF90_DEF_DIM(nid_restart,"inter slope",nslope+1,idim9)
     566      ierr=NF90_DEF_DIM(nid_restart,"inter_slope",nslope+1,idim9)
    567567      IF (ierr/=NF90_NOERR) THEN
    568568        write(*,*)'phyredem: problem defining inter slope dimension'
     
    660660 
    661661  REAL                           :: field_glo(klon_glo,field_size)
     662  REAL                           :: field_glo_reshape(klon_glo,nsoilmx,nslope,timeindex)
    662663  INTEGER                        :: ierr
    663664  INTEGER                        :: nvarid
     
    804805        endif ! of if (.not.present(timeindex))
    805806
    806       ELSE IF (field_size==nsoilmx) THEN
     807      ELSE IF (field_size==nsoilmx .or. field_size==nsoilmx*nslope) THEN
    807808        ! input is a 2D "subsurface field" array
    808809        if (.not.present(time)) then ! for a time-independent field
     
    828829            ierr=NF90_REDEF(nid_restart)
    829830#ifdef NC_DOUBLE
     831            if(field_name.eq. "tsoil") then
     832            ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,&
     833                              (/idim2,idim3,idim8,idim7/),nvarid)
     834            else
    830835            ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,&
    831836                              (/idim2,idim3,idim7/),nvarid)
    832 #else
     837            endif
     838#else
     839            if(field_name.eq. "tsoil") then
     840            ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,&
     841                              (/idim2,idim3,idim8,idim7/),nvarid)
     842            else
    833843            ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,&
    834844                              (/idim2,idim3,idim7/),nvarid)
     845            endif
    835846#endif
    836847           if (ierr.ne.NF90_NOERR) then
     
    842853          endif
    843854          ! Write the variable
     855          if(field_name.eq. "tsoil") then
     856
     857          field_glo_reshape=RESHAPE(field_glo, (/klon_glo, nsoilmx, nslope, timeindex/))
     858
     859          ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo_reshape,&
     860                            start=(/1,1,1,timeindex/))
     861          else
    844862          ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo,&
    845863                            start=(/1,1,timeindex/))
    846 
     864          endif
    847865        endif ! of if (.not.present(time))
    848866
Note: See TracChangeset for help on using the changeset viewer.