Changeset 272


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)

Location:
branches/ORCHIDEE_EXT/ORCHIDEE_OL
Files:
2 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) 
  • branches/ORCHIDEE_EXT/ORCHIDEE_OL/teststomate.f90

    r258 r272  
    5353  REAL(r_std),DIMENSION(:,:),ALLOCATABLE    :: qsintmax_x 
    5454  REAL(r_std),DIMENSION(:,:),ALLOCATABLE    :: co2_flux 
    55 !!$   DS add for externalised version 
     55!!$ >>  DS add for externalised version 
    5656  REAL(r_std),DIMENSION(:),ALLOCATABLE      :: hist_PFTaxis 
    57 !!$   DS 
     57!!$ >>  DS 
    5858 
    5959 
     
    7575  CHARACTER(LEN=30)                :: time_str 
    7676  REAL                             :: hist_days_stom,hist_dt_stom 
    77 !!$  REAL,DIMENSION(nvm)              :: hist_PFTaxis 
    7877  REAL(r_std),DIMENSION(10)         :: hist_pool_10axis      
    7978  REAL(r_std),DIMENSION(100)        :: hist_pool_100axis      
     
    176175  write(*,*) 'ATTENTION',dtradia,dt_force 
    177176 
    178 !!$ DS added for the externalised version 
    179 !!$we need to know the pft parameters values used for stomate 
     177!!$ >> DS added for the externalised version 
     178!!$ we need to know the pft parameters values used for stomate 
     179 
     180  ! 1. Read the number of PFTs 
     181  CALL getin('NVM',nvm) 
     182  ! 2. Allocate and read the pft parameters stomate specific 
    180183  CALL pft_parameters_main 
    181184  CALL getin_stomate_pft_parameters 
     
    186189!- 
    187190  a_er = .FALSE. 
    188 !!$ DS added for the externalised version 
    189 !!$  ALLOCATE (pft_to_mtc(nvm),stat=ier) 
    190 !!$  a_er = a_er .OR. (ier.NE.0)  
     191!!$ >> DS added for the externalised version 
    191192  ALLOCATE (hist_PFTaxis(nvm),stat=ier) 
    192193  a_er = a_er .OR. (ier.NE.0) 
     
    356357  control%ok_co2 = .TRUE. 
    357358  control%ok_stomate = .TRUE. 
    358 !!$DS now we search the values for the scalar parameters in orchidee.def 
     359!!$ >> DS now we search the values for the scalar parameters in  some .def files 
    359360  CALL getin_co2_parameters 
    360361  CALL getin_stomate_parameters 
    361 !!$  CALL getin('CLAYFRACTION_DEFAULT',clayfraction_default) 
     362!!$ >> DS  
    362363!- 
    363364! is DGVM activated? 
     
    366367  CALL getin('STOMATE_OK_DGVM',control%ok_dgvm) 
    367368  WRITE(*,*) 'LPJ is activated: ',control%ok_dgvm 
    368 !!$DS for the externalisation reading the scalar parameters when ok_dgvm is set to true 
     369!!$ >> DS for the externalisation reading the scalar parameters when ok_dgvm is set to true 
    369370  IF (control%ok_dgvm) THEN  
    370371     CALL getin_dgvm_parameters    
    371372  ENDIF 
     373!!$ >> DS  
    372374!- 
    373375! restart files 
     
    542544!- 
    543545   
    544   ! DS : getin the value of slowproc parameters 
     546  ! >> DS : getin the value of slowproc parameters 
    545547  CALL getin('CLAYFRACTION_DEFAULT',clayfraction_default) 
     548  CALL getin('SOILTYPE_DEFAULT',soiltype_default) 
     549  ! >> DS 
    546550 
    547551  CALL slowproc_main & 
Note: See TracChangeset for help on using the changeset viewer.