Changeset 142


Ignore:
Timestamp:
2011-03-16T10:08:26+01:00 (13 years ago)
Author:
didier.solyga
Message:

Adapte the history writing for treefrac,cropfrac and grassfrac for a variable number of pfts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_EXT/ORCHIDEE/src_sechiba/sechiba.f90

    r116 r142  
    252252    REAL(r_std), DIMENSION(kjpindex)                   :: histvar          !! computations for history files 
    253253 
    254     INTEGER(i_std) :: j 
     254 
     255    ! 15/03/2011 DS Add for externalisation 
     256    REAL(r_std), DIMENSION(kjpindex) :: sum_treefrac, sum_grassfrac, sum_cropfrac 
     257    INTEGER(i_std) :: jv 
    255258 
    256259 
     
    584587    ! 
    585588    ! 
     589 
     590    !DS 15:03/2011  Prepares the writing of the history files 
     591    sum_treefrac(:) = zero 
     592    sum_grassfrac(:) = zero 
     593    sum_cropfrac(:) = zero 
     594    DO jv = 2, nvm  
     595       IF (is_tree(jv) .AND. natural(jv)) THEN 
     596          sum_treefrac(:) = sum_treefrac(:) + veget_max(:,jv) 
     597       ELSE IF ((.NOT. is_tree(jv))  .AND. natural(jv)) THEN 
     598          sum_grassfrac(:) = sum_grassfrac(:) + veget_max(:,jv) 
     599       ELSE  
     600          sum_cropfrac = sum_cropfrac(:) + veget_max(:,jv) 
     601       ENDIF 
     602    ENDDO           
     603 
     604 
    586605    IF ( .NOT. almaoutput ) THEN 
    587606       CALL histwrite(hist_id, 'beta', kjit, vbeta, kjpindex, index) 
     
    638657 
    639658!$$ 25/10/10 Modif DS & NViovy 
    640  
    641 !!$       DO j = 2, nvm  
    642 !!$          IF (is_tree(j) .AND. natural(j)) THEN 
    643 !!$             histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    644 !!$             CALL histwrite(hist_id, 'treeFrac', kjit, histvar, kjpindex, index)  
    645 !!$          ELSE IF ((.NOT. is_tree(j))  .AND. natural(j)) THEN 
    646 !!$             histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    647 !!$             CALL histwrite(hist_id, 'grassFrac', kjit, histvar, kjpindex, index)  
    648 !!$          ELSE IF (.NOT. natural(j)) THEN 
    649 !!$             histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    650 !!$             CALL histwrite(hist_id, 'cropFrac', kjit, histvar, kjpindex, index) 
    651 !!$          ELSE 
    652 !!$             WRITE(numout,*) 'Something wrong happened in histvar of veget_max in sechiba.f90' 
    653 !!$          ENDIF 
    654 !!$       ENDDO 
    655659!!$ 
    656       WHERE (is_tree(:) .AND. natural(:))  
    657          histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    658       ENDWHERE 
    659       CALL histwrite(hist_id, 'treeFrac', kjit, histvar, kjpindex, index) 
    660  
    661       WHERE (.NOT. is_tree(:) .AND. natural(:)) 
    662          histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    663       ENDWHERE 
    664       CALL histwrite(hist_id, 'grassFrac', kjit, histvar, kjpindex, index) 
    665  
    666       WHERE (.NOT. natural(:)) 
    667          histvar(:)=SUM(veget_max(:,j))*100*contfrac(:) 
    668       ENDWHERE 
    669       CALL histwrite(hist_id, 'cropFrac', kjit, histvar, kjpindex, index) 
    670 !!$    
    671  
    672 !-------------------------------------------- 
     660       histvar(:)= sum_treefrac(:)*100*contfrac(:) 
     661       CALL histwrite(hist_id, 'treeFrac', kjit, histvar, kjpindex, index)  
     662 
     663       histvar(:)= sum_grassfrac(:)*100*contfrac(:) 
     664       CALL histwrite(hist_id, 'grassFrac', kjit, histvar, kjpindex, index)  
     665 
     666       histvar(:)= sum_cropfrac(:)*100*contfrac(:) 
     667       CALL histwrite(hist_id, 'cropFrac', kjit, histvar, kjpindex, index) 
     668 
     669 
    673670       histvar(:)=veget_max(:,1)*100*contfrac(:) 
    674671       CALL histwrite(hist_id, 'baresoilFrac', kjit, histvar, kjpindex, index) 
Note: See TracChangeset for help on using the changeset viewer.