InterceptionInit Subroutine

public subroutine InterceptionInit(filename, domain)

initialize variables for computing rainfall interception

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

configuration file name

type(grid_integer), intent(in) :: domain

analysis domain


Variables

Type Visibility Attributes Name Initial
real(kind=float), public :: ics

initial canopy storage value

type(IniList), public :: iniDB

configuration info


Source Code

SUBROUTINE InterceptionInit &
!
( filename, domain )  

IMPLICIT NONE

!Arguments with intent in
CHARACTER (LEN = *), INTENT(in) :: filename !!configuration file name
TYPE (grid_integer), INTENT(IN) :: domain  !!analysis domain

!local declarations:
TYPE(IniList) :: iniDB !! configuration info
REAL (KIND = float) :: ics !!initial canopy storage value
    
!-------------------------end of declarations----------------------------------

CALL IniOpen (filename, iniDB)

!read if parameters are loaded from map files
IF (KeyIsPresent ( 'parameters-by-map ', iniDB) ) THEN
  interceptionParametersByMap =  IniReadInt ('parameters-by-map', iniDB )
ELSE
   CALL Catch ('error', 'PlantsInterception', &
       'missing parameters-by-map in PlantsInterception configuration file')
END IF


IF ( interceptionParametersByMap == 1) THEN !load maps

        ! load laimax map
        IF (SectionIsPresent ( 'laimax', iniDB) ) THEN
           CALL GridByIni (iniDB, laimax, section = 'laimax')
        ELSE
           CALL Catch ('error', 'PlantsInterception', &
               'missing laimax map in PlantsInterception configuration file')
        END IF


        ! load canopymax map
        IF (SectionIsPresent ( 'canopymax', iniDB) ) THEN
           CALL GridByIni (iniDB, canopymax, section = 'canopymax')
        ELSE
           CALL Catch ('error', 'PlantsInterception', &
               'missing canopymax map in PlantsInterception configuration file')
        END IF
        
END IF

!set canopy storage initial value
IF ( KeyIsPresent ('cold', iniDB, section = 'canopy-storage') ) THEN
    
    !initial value
    ics = IniReadReal ('cold', iniDB, section = 'canopy-storage')
    CALL Catch ('info', 'PlantsInterception: ',     &
                 'initial canopy storage value (m): ', &
                 argument = ToString(ics))
    		
    CALL NewGrid (canopyStorage, domain, ics / millimeter)
ELSE !read map (hot start)
    CALL GridByIni (iniDB, canopyStorage, section = 'canopy-storage')
END IF

CALL IniClose (iniDB)


!allocate canopyET grid
CALL NewGrid (canopyPT, domain, 0.)


RETURN
END SUBROUTINE InterceptionInit