Ignore:
Timestamp:
2011-06-20T15:28:40+02:00 (13 years ago)
Author:
didier.solyga
Message:

Correct forcesoil.f90 and teststomate.f90 for working with the externalized version (branche ORCHIDEE_EXT)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_EXT/ORCHIDEE_OL/forcesoil.f90

    r258 r272  
    7373  REAL(r_std),ALLOCATABLE :: carbon_loc(:,:,:) 
    7474  INTEGER :: ierr 
     75  !>> DS add for externalization 
     76  LOGICAL  :: l_error 
     77  ! >> DS 
    7578 
    7679  CALL Init_para(.FALSE.)  
    7780 
    78   CALL getin_p('NVM',nvm) 
     81  ! 
     82  ! DS : For externalization cause we decoupled forcesoil from ORCHIDEE 
     83  ! 
     84   
     85  ! 1. Read the number of PFTs 
     86  CALL getin('NVM',nvm) 
     87  ! 2. Allocation 
     88  l_error = .FALSE. 
     89  ALLOCATE(pft_to_mtc(nvm),stat=ier) 
     90  l_error = l_error .OR. (ier .NE. 0) 
     91  IF (l_error) THEN 
     92     STOP 'pft_to_mtc (forcesoil only) : error in memory allocation' 
     93  ENDIF 
     94 
     95  ! 3. Initialisation of the correspondance table 
     96  pft_to_mtc (:) = undef_integer 
     97   
     98  ! 4.Reading of the conrrespondance table in the .def file 
     99  CALL getin('PFT_TO_MTC',pft_to_mtc) 
     100 
     101  ! 4.1 if nothing is found, we use the standard configuration 
     102  IF(nvm .EQ. 13 ) THEN 
     103     IF(pft_to_mtc(1) .EQ. undef_integer) THEN 
     104        WRITE(numout,*) 'Note to the user : we will use ORCHIDEE to its standard configuration' 
     105        pft_to_mtc(:) = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 /) 
     106     ENDIF 
     107  ELSE    
     108     IF(pft_to_mtc(1) .EQ. undef_integer) THEN 
     109        WRITE(numout,*)' The array PFT_TO_MTC is empty : we stop' 
     110     ENDIF 
     111  ENDIF 
     112   
     113  ! 5. What happened if pft_to_mtc(j) > nvmc (if the mtc doesn't exist)? 
     114  DO i = 1, nvm 
     115     IF(pft_to_mtc(i) .GT. nvmc) THEN 
     116        WRITE(numout,*) "the MTC you chose doesn't exist" 
     117        STOP 'we stop reading pft_to_mtc' 
     118     ENDIF 
     119  ENDDO 
     120   
     121   
     122  ! 6. Check if pft_to_mtc(1) = 1  
     123  IF(pft_to_mtc(1) .NE. 1) THEN 
     124     WRITE(numout,*) 'the first pft has to be the bare soil' 
     125     STOP 'we stop reading next values of pft_to_mtc' 
     126  ELSE 
     127     DO i = 2,nvm 
     128        IF(pft_to_mtc(i) .EQ.1) THEN 
     129           WRITE(numout,*) 'only pft_to_mtc(1) has to be the bare soil' 
     130           STOP 'we stop reading pft_to_mtc' 
     131        ENDIF 
     132     ENDDO 
     133  ENDIF 
     134   
     135 
     136  ! 7. Allocate and initialize natural ans is_c4 
     137   
     138  ! 7.1 Memory allocation 
     139  l_error = .FALSE. 
     140  ALLOCATE(natural(nvm),stat=ier) 
     141  l_error = l_error .OR. (ier .NE. 0) 
     142  ALLOCATE(is_c4(nvm),stat=ier) 
     143 
     144  IF (l_error) THEN 
     145     STOP 'natural or is_c4 (forcesoil only) : error in memory allocation' 
     146  ENDIF 
     147 
     148  ! 7.2 Initialisation 
     149  DO j= 1, nvm 
     150     natural(j) = natural_mtc(pft_to_mtc(j)) 
     151     is_c4(j) = is_c4_mtc(pft_to_mtc(j)) 
     152  ENDDO 
     153 
    79154  !- 
    80155  ! Stomate's restart files 
     
    112187  !- 
    113188  CALL bcast(date0) 
    114 !!! MM : à revoir : choix du calendrier dans forcesoil ?? Il est dans le restart de stomate ! 
     189!!! MM : à revoir : choix du calendrier dans forcesoil ?? Il est dans le restart de stomate ! 
    115190  !  CALL ioconf_calendar ('noleap') 
    116191  CALL ioget_calendar  (one_year,one_day) 
     
    218293        IF (m<10) part_str(1:1)='0' 
    219294        var_name = 'carbon_'//part_str(1:LEN_TRIM(part_str)) 
    220         CALL restget & 
     295        CALL restget_p & 
    221296             &    (rest_id_sto, var_name, kjpindex, ncarb , 1, itau_dep, & 
    222297             &     .TRUE., carbon(:,:,m), 'gather', kjpindex, indices) 
     
    325400        IF (m<10) part_str(1:1)='0' 
    326401        var_name = 'carbon_'//part_str(1:LEN_TRIM(part_str)) 
    327         CALL restput & 
     402        CALL restput_p & 
    328403             &    (rest_id_sto, var_name, kjpindex, ncarb , 1, itau_dep, & 
    329404             &     carbon(:,:,m), 'scatter', kjpindex, indices) 
Note: See TracChangeset for help on using the changeset viewer.