Changeset 7325


Ignore:
Timestamp:
2021-10-20T17:04:48+02:00 (3 years ago)
Author:
josefine.ghattas
Message:

Add test for each of the variables njsc, ks, nvan, avan, mcr, mcs, mcfc, mcw, clayfraction, sandfraction if they were not found in restart file. If at least one was missing, activate call to slowproc_soilt. This commit is needed if using old restart file were clayfraction was in the restart file but not the 7 new variables (ks, nvan, avan, mcr, mcs, mcfc, mcw) which were added with modifications from branch SP-MIP. See ticket #800

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/slowproc.f90

    r7265 r7325  
    935935    LOGICAL                                               :: found_restart     !! found_restart=true if all 3 variables veget_max, veget and  
    936936                                                                               !! frac_nobio are read from restart file 
     937    LOGICAL                                               :: call_slowproc_soilt !! This variables will be true if subroutine slowproc_soilt needs to be called 
    937938    !_ ================================================================================================================================ 
    938939   
     
    10751076     
    10761077    ! Below we define the soil texture of the grid-cells 
     1078 
    10771079    ! Add the soil_classif as suffix for the variable name of njsc when it is stored in the restart file.  
    10781080    IF (soil_classif == 'zobler') THEN 
     
    10841086    END IF 
    10851087 
     1088    ! The variables are read from restart file. If at least one of the related variables are not found, the  
     1089    ! variable call_slowproc_soilt will be true and the variables will be read and interpolated from file in  
     1090    ! subroutine slowproc_soilt. 
     1091    call_slowproc_soilt=.FALSE. 
     1092 
    10861093    CALL ioconf_setatt_p('UNITS', '-') 
    10871094    CALL ioconf_setatt_p('LONG_NAME','Index of soil type') 
     
    10891096    IF ( ALL( tmp_real(:) .EQ. val_exp) ) THEN 
    10901097       njsc (:) = undef_int 
     1098       call_slowproc_soilt=.TRUE. 
    10911099    ELSE 
    10921100       njsc = NINT(tmp_real) 
     
    10941102 
    10951103    ! Salma: we define restget for the 7 soil variables following clay_frac 
    1096  
     1104     
    10971105    var_name= 'ks' 
    10981106    CALL ioconf_setatt_p('UNITS', 'mm/d') 
    10991107    CALL ioconf_setatt_p('LONG_NAME','Soil saturated water content') 
    11001108    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., ks, "gather", nbp_glo, index_g) 
     1109    IF ( ALL(ks(:) .EQ. val_exp ) ) THEN 
     1110       ! ks is not in restart file 
     1111       call_slowproc_soilt=.TRUE. 
     1112    END IF 
    11011113 
    11021114    var_name= 'mcs' 
     
    11041116    CALL ioconf_setatt_p('LONG_NAME','') 
    11051117    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., mcs, "gather", nbp_glo, index_g) 
     1118    IF ( ALL(mcs(:) .EQ. val_exp ) ) THEN 
     1119       ! mcs is not in restart file 
     1120       call_slowproc_soilt=.TRUE. 
     1121    END IF 
    11061122 
    11071123    var_name= 'mcr' 
     
    11091125    CALL ioconf_setatt_p('LONG_NAME','') 
    11101126    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., mcr, "gather", nbp_glo, index_g) 
     1127    IF ( ALL(mcr(:) .EQ. val_exp ) ) THEN 
     1128       ! mcr is not in restart file 
     1129       call_slowproc_soilt=.TRUE. 
     1130    END IF 
    11111131 
    11121132    var_name= 'mcfc' 
     
    11141134    CALL ioconf_setatt_p('LONG_NAME','') 
    11151135    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., mcfc, "gather", nbp_glo, index_g) 
     1136    IF ( ALL(mcfc(:) .EQ. val_exp ) ) THEN 
     1137       ! mcfc is not in restart file 
     1138       call_slowproc_soilt=.TRUE. 
     1139    END IF 
    11161140 
    11171141    var_name= 'mcw' 
     
    11191143    CALL ioconf_setatt_p('LONG_NAME','') 
    11201144    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., mcw, "gather", nbp_glo, index_g) 
     1145    IF ( ALL(mcw(:) .EQ. val_exp ) ) THEN 
     1146       ! mcw is not in restart file 
     1147       call_slowproc_soilt=.TRUE. 
     1148    END IF 
    11211149 
    11221150    var_name= 'nvan' 
     
    11241152    CALL ioconf_setatt_p('LONG_NAME','') 
    11251153    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., nvan, "gather", nbp_glo, index_g) 
     1154    IF ( ALL(nvan(:) .EQ. val_exp ) ) THEN 
     1155       ! nvan is not in restart file 
     1156       call_slowproc_soilt=.TRUE. 
     1157    END IF 
    11261158 
    11271159    var_name= 'avan' 
     
    11291161    CALL ioconf_setatt_p('LONG_NAME','') 
    11301162    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., avan, "gather", nbp_glo, index_g) 
     1163    IF ( ALL(avan(:) .EQ. val_exp ) ) THEN 
     1164       ! avan is not in restart file 
     1165       call_slowproc_soilt=.TRUE. 
     1166    END IF 
    11311167 
    11321168    !end salma 
     
    11361172    CALL ioconf_setatt_p('LONG_NAME','Fraction of clay in each mesh') 
    11371173    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., clayfraction, "gather", nbp_glo, index_g) 
     1174    IF ( ALL(clayfraction(:) .EQ. val_exp ) ) THEN 
     1175       ! clayfraction is not in restart file 
     1176       call_slowproc_soilt=.TRUE. 
     1177    END IF 
    11381178 
    11391179    var_name= 'sand_frac' 
     
    11411181    CALL ioconf_setatt_p('LONG_NAME','Fraction of sand in each mesh') 
    11421182    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., sandfraction, "gather", nbp_glo, index_g)    
     1183    IF ( ALL(sandfraction(:) .EQ. val_exp ) ) THEN 
     1184       ! sandfraction is not in restart file 
     1185       call_slowproc_soilt=.TRUE. 
     1186    END IF 
    11431187 
    11441188    ! Calculate siltfraction not needed to be in restart file 
     
    13181362       ELSE ! impveg=T and impsoil=F 
    13191363          ! Case impsoilt=false and impveg=true 
    1320           IF ( MINVAL(clayfraction) .EQ. MAXVAL(clayfraction) .AND. MAXVAL(clayfraction) .EQ. val_exp .OR. & 
    1321                MINVAL(sandfraction) .EQ. MAXVAL(sandfraction) .AND. MAXVAL(sandfraction) .EQ. val_exp .OR. & 
    1322                MINVAL(njsc) .EQ. MAXVAL(njsc) .AND. MAXVAL(njsc) .EQ. undef_int ) THEN 
    1323               
     1364          IF (call_slowproc_soilt) THEN 
     1365             ! At least one of the output variables from slowproc_soilt were not found in the restart file  
    13241366             CALL slowproc_soilt(njsc, ks, nvan, avan, mcr, mcs, mcfc, mcw, kjpindex, lalo, neighbours, resolution, contfrac, soilclass, & 
    13251367                  clayfraction, sandfraction, siltfraction) 
     
    13281370                njsc(ji) = MAXLOC(soilclass(ji,:),1) 
    13291371             ENDDO 
     1372             call_slowproc_soilt=.FALSE. 
    13301373          ENDIF 
    13311374       ENDIF 
     
    14531496    ENDIF 
    14541497     
    1455     ! Initialize clayfraction and njsc if not found in restart file and not already initialized using impveg 
    1456     IF ( MINVAL(clayfraction) .EQ. MAXVAL(clayfraction) .AND. MAXVAL(clayfraction) .EQ. val_exp .OR. & 
    1457          MINVAL(sandfraction) .EQ. MAXVAL(sandfraction) .AND. MAXVAL(sandfraction) .EQ. val_exp .OR. & 
    1458          MINVAL(njsc) .EQ. MAXVAL(njsc) .AND. MAXVAL(njsc) .EQ. undef_int ) THEN 
    1459         
    1460        IF (printlev_loc>=4) WRITE (numout,*) 'clayfraction or njcs were not in restart file, call slowproc_soilt' 
     1498    ! Initialize clayfraction, sandfraction, njsc, ks, nvan, avan, mcr, mcs, mcfc and mcw if one of them  
     1499    ! were not found in restart file and not already initialized using impveg 
     1500    IF (call_slowproc_soilt) THEN 
     1501       IF (printlev_loc>=4) WRITE (numout,*) 'clayfraction or njcs or one of the 7 new variables were not in restart file, call slowproc_soilt' 
    14611502       CALL slowproc_soilt(njsc, ks, nvan, avan, mcr, mcs, mcfc, mcw, kjpindex, lalo, neighbours, resolution, contfrac, soilclass, & 
    14621503            clayfraction, sandfraction, siltfraction) 
     
    14661507          njsc(ji) = MAXLOC(soilclass(ji,:),1) 
    14671508       ENDDO 
     1509       call_slowproc_soilt=.FALSE. 
    14681510    ENDIF 
    14691511 
Note: See TracChangeset for help on using the changeset viewer.