Ignore:
Timestamp:
Aug 24, 2016 3:47:17 PM (8 years ago)
Author:
kanani
Message:

changes in the course of urban surface model implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/plant_canopy_model_mod.f90

    r2001 r2007  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! Added SUBROUTINE pcm_read_plant_canopy_3d for reading 3d plant canopy data
     23! from file (new case canopy_mode=read_from_file_3d) in the course of
     24! introduction of urban surface model,
     25! introduced variable ext_coef,
     26! resorted SUBROUTINEs to alphabetical order
    2327!
    2428! Former revisions:
     
    120124    REAL(wp) ::  cthf = 0.0_wp              !< canopy top heat flux
    121125    REAL(wp) ::  dt_plant_canopy = 0.0_wp   !< timestep account. for canopy drag
     126    REAL(wp) ::  ext_coef = 0.6_wp          !< extinction coefficient
    122127    REAL(wp) ::  lad_surface = 0.0_wp       !< lad surface value
    123128    REAL(wp) ::  lai_beta = 0.0_wp          !< leaf area index (lai) for lad calc.
     
    154159!
    155160!-- Public variables and constants
    156     PUBLIC canopy_mode, cthf, dt_plant_canopy, lad, lad_s, plant_canopy
     161    PUBLIC canopy_heat_flux, canopy_mode, cthf, dt_plant_canopy, lad, lad_s,   &
     162           pch_index, plant_canopy
     163           
    157164
    158165
     
    171178    INTERFACE pcm_parin
    172179       MODULE PROCEDURE pcm_parin
    173     END INTERFACE pcm_parin 
     180    END INTERFACE pcm_parin
     181
     182    INTERFACE pcm_read_plant_canopy_3d
     183       MODULE PROCEDURE pcm_read_plant_canopy_3d
     184    END INTERFACE pcm_read_plant_canopy_3d
    174185   
    175186    INTERFACE pcm_tendency
     
    363374
    364375       USE control_parameters,                                                 &
    365            ONLY: dz, ocean, passive_scalar
     376           ONLY: coupling_char, dz, humidity, io_blocks, io_group,             &
     377                 message_string, ocean, passive_scalar
    366378
    367379
    368380       IMPLICIT NONE
    369381
    370        INTEGER(iwp) ::  i !< running index
    371        INTEGER(iwp) ::  j !< running index
    372        INTEGER(iwp) ::  k !< running index
    373 
    374        REAL(wp) ::  int_bpdf      !< vertical integral for lad-profile construction
    375        REAL(wp) ::  dzh           !< vertical grid spacing in units of canopy height
    376        REAL(wp) ::  gradient      !< gradient for lad-profile construction
    377        REAL(wp) ::  canopy_height !< canopy height for lad-profile construction
    378 
     382       CHARACTER(10) :: pct
     383       
     384       INTEGER(iwp) ::  i   !< running index
     385       INTEGER(iwp) ::  ii  !< index       
     386       INTEGER(iwp) ::  j   !< running index
     387       INTEGER(iwp) ::  k   !< running index
     388
     389       REAL(wp) ::  int_bpdf        !< vertical integral for lad-profile construction
     390       REAL(wp) ::  dzh             !< vertical grid spacing in units of canopy height
     391       REAL(wp) ::  gradient        !< gradient for lad-profile construction
     392       REAL(wp) ::  canopy_height   !< canopy height for lad-profile construction
     393       REAL(wp) ::  pcv(nzb:nzt+1)  !<
     394       
    379395!
    380396!--    Allocate one-dimensional arrays for the computation of the
     
    509525             ENDDO
    510526
     527          CASE ( 'read_from_file_3d' )
     528!
     529!--          Initialize canopy parameters cdc (canopy drag coefficient),
     530!--          lsec (leaf scalar exchange coefficient), lsc (leaf surface concentration)
     531!--          from file which contains complete 3D data (separate vertical profiles for
     532!--          each location).
     533             CALL pcm_read_plant_canopy_3d
     534
    511535          CASE DEFAULT
    512 
    513 !
    514 !--       The DEFAULT case is reached either if the parameter
    515 !--       canopy mode contains a wrong character string or if the
    516 !--       user has coded a special case in the user interface.
    517 !--       There, the subroutine user_init_plant_canopy checks
    518 !--       which of these two conditions applies.
    519           CALL user_init_plant_canopy
     536!
     537!--          The DEFAULT case is reached either if the parameter
     538!--          canopy mode contains a wrong character string or if the
     539!--          user has coded a special case in the user interface.
     540!--          There, the subroutine user_init_plant_canopy checks
     541!--          which of these two conditions applies.
     542             CALL user_init_plant_canopy
    520543 
    521544       END SELECT
     
    561584                DO  k = 0, pch_index
    562585                   canopy_heat_flux(k,j,i) = cthf *                            &
    563                                              exp( -0.6_wp * cum_lai_hf(k,j,i) )
     586                                             exp( -ext_coef * cum_lai_hf(k,j,i) )
    564587                ENDDO
    565588             ENDDO
     
    585608
    586609
     610!------------------------------------------------------------------------------!
     611! Description:
     612! ------------
     613!> Parin for &canopy_par for plant canopy model
     614!------------------------------------------------------------------------------!
     615    SUBROUTINE pcm_parin
     616
     617
     618       IMPLICIT NONE
     619
     620       CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
     621       
     622       NAMELIST /canopy_par/      alpha_lad, beta_lad, canopy_drag_coeff,      &
     623                                  canopy_mode, cthf,                           &
     624                                  lad_surface,                                 &
     625                                  lad_vertical_gradient,                       &
     626                                  lad_vertical_gradient_level,                 &
     627                                  lai_beta,                                    &
     628                                  leaf_scalar_exch_coeff,                      &
     629                                  leaf_surface_conc, pch_index
     630       
     631       line = ' '
     632       
     633!
     634!--    Try to find radiation model package
     635       REWIND ( 11 )
     636       line = ' '
     637       DO   WHILE ( INDEX( line, '&canopy_par' ) == 0 )
     638          READ ( 11, '(A)', END=10 )  line
     639       ENDDO
     640       BACKSPACE ( 11 )
     641
     642!
     643!--    Read user-defined namelist
     644       READ ( 11, canopy_par )
     645
     646!
     647!--    Set flag that indicates that the radiation model is switched on
     648       plant_canopy = .TRUE.
     649
     650 10    CONTINUE
     651       
     652
     653    END SUBROUTINE pcm_parin
     654
     655
     656
     657!------------------------------------------------------------------------------!
     658! Description:
     659! ------------
     660!
     661!> Loads 3D plant canopy data from file. File format is as follows:
     662!>
     663!> num_levels
     664!> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1)
     665!> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1)
     666!> dtype,x,y,value(nzb),value(nzb+1), ... ,value(nzb+num_levels-1)
     667!> ...
     668!>
     669!> i.e. first line determines number of levels and further lines represent plant
     670!> canopy data, one line per column and variable. In each data line,
     671!> dtype represents variable to be set:
     672!>
     673!> dtype=1: leaf area density (lad_s)
     674!> dtype=2: canopy drag coefficient (cdc)
     675!> dtype=3: leaf scalar exchange coefficient (lsec)
     676!> dtype=4: leaf surface concentration (lsc)
     677!>
     678!> Zeros are added automatically above num_levels until top of domain.  Any
     679!> non-specified (x,y) columns have zero values as default.
     680!------------------------------------------------------------------------------!
     681    SUBROUTINE pcm_read_plant_canopy_3d
     682        USE control_parameters, &
     683            ONLY: passive_scalar, message_string
     684        IMPLICIT NONE
     685
     686        INTEGER(iwp)                            :: i, j, dtype, nzp, nzpltop, nzpl, kk
     687        REAL(wp), DIMENSION(:), ALLOCATABLE     :: col
     688       
     689        lad_s = 0.0_wp
     690!         cdc = 0.0_wp
     691!         if ( passive_scalar )  then
     692!            lsc = 0.0_wp
     693!            lsec = 0.0_wp
     694!         endif
     695
     696        WRITE(9,*) 'Reading PLANT_CANOPY_DATA_3D', nzt
     697        FLUSH(9)
     698        OPEN(152, file='PLANT_CANOPY_DATA_3D', access='SEQUENTIAL', &
     699                action='READ', status='OLD', form='FORMATTED', err=515)
     700        READ(152, *, err=516, end=517) nzp   !< read first line = number of vertical layers
     701        ALLOCATE(col(1:nzp))
     702        nzpltop = MIN(nzt+1, nzb+nzp-1)
     703        nzpl = nzpltop - nzb + 1    !< no. of layers to assign
     704
     705        DO
     706            READ(152, *, err=516, end=517) dtype, i, j, col(:)
     707            IF ( i < nxlg .or. i > nxrg .or. j < nysg .or. j > nyng ) CYCLE
     708            WRITE(9,*) 'Read ', i,j,nzb_s_inner(j,i),col(:)
     709            FLUSH(9)
     710
     711            SELECT CASE (dtype)
     712              CASE( 1 ) !< leaf area density
     713                !-- only lad_s has flat z-coordinate, others have regular
     714                kk = nzb_s_inner(j, i)
     715                lad_s(nzb:nzpltop-kk, j, i) = col(1+kk:nzpl)
     716!               CASE( 2 ) !< canopy drag coefficient
     717!                 cdc(nzb:nzpltop, j, i) = col(1:nzpl)
     718!               CASE( 3 ) !< leaf scalar exchange coefficient
     719!                 lsec(nzb:nzpltop, j, i) = col(1:nzpl)
     720!               CASE( 4 ) !< leaf surface concentration
     721!                 lsc(nzb:nzpltop, j, i) = col(1:nzpl)
     722              CASE DEFAULT
     723                write(message_string, '(a,i2,a)')   &
     724                    'Unknown record type in file PLANT_CANOPY_DATA_3D: "', dtype, '"'
     725                CALL message( 'pcm_read_plant_canopy_3d', 'PA0530', 1, 2, 0, 6, 0 )
     726            END SELECT
     727        ENDDO
     728
     729515     message_string = 'error opening file PLANT_CANOPY_DATA_3D'
     730        CALL message( 'pcm_read_plant_canopy_3d', 'PA0531', 1, 2, 0, 6, 0 )
     731
     732516     message_string = 'error reading file PLANT_CANOPY_DATA_3D'
     733        CALL message( 'pcm_read_plant_canopy_3d', 'PA0532', 1, 2, 0, 6, 0 )
     734
     735517     CLOSE(152)
     736        DEALLOCATE(col)
     737       
     738    END SUBROUTINE pcm_read_plant_canopy_3d
     739   
     740   
    587741
    588742!------------------------------------------------------------------------------!
     
    9131067! Description:
    9141068! ------------
    915 !> Parin for &canopy_par for plant canopy model
    916 !------------------------------------------------------------------------------!
    917     SUBROUTINE pcm_parin
    918 
    919 
    920        IMPLICIT NONE
    921 
    922        CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
    923        
    924         NAMELIST /canopy_par/     alpha_lad, beta_lad, canopy_drag_coeff,      &
    925                                   canopy_mode, cthf,                           &
    926                                   lad_surface,                                 &
    927                                   lad_vertical_gradient,                       &
    928                                   lad_vertical_gradient_level,                 &
    929                                   lai_beta,                                    &
    930                                   leaf_scalar_exch_coeff,                      &
    931                                   leaf_surface_conc, pch_index
    932        
    933        line = ' '
    934        
    935 !
    936 !--    Try to find radiation model package
    937        REWIND ( 11 )
    938        line = ' '
    939        DO   WHILE ( INDEX( line, '&canopy_par' ) == 0 )
    940           READ ( 11, '(A)', END=10 )  line
    941        ENDDO
    942        BACKSPACE ( 11 )
    943 
    944 !
    945 !--    Read user-defined namelist
    946        READ ( 11, canopy_par )
    947 
    948 !
    949 !--    Set flag that indicates that the radiation model is switched on
    950        plant_canopy = .TRUE.
    951 
    952  10    CONTINUE
    953        
    954 
    955     END SUBROUTINE pcm_parin   
    956    
    957 
    958 
    959 !------------------------------------------------------------------------------!
    960 ! Description:
    961 ! ------------
    9621069!> Calculation of the tendency terms, accounting for the effect of the plant
    9631070!> canopy on momentum and scalar quantities.
     
    12491356    END SUBROUTINE pcm_tendency_ij
    12501357
     1358
     1359
    12511360 END MODULE plant_canopy_model_mod
Note: See TracChangeset for help on using the changeset viewer.