cal_allo_init.f90 Source File


This file depends on

sourcefile~~cal_allo_init.f90~~EfferentGraph sourcefile~cal_allo_init.f90 cal_allo_init.f90 sourcefile~aquifer_module.f90 aquifer_module.f90 sourcefile~cal_allo_init.f90->sourcefile~aquifer_module.f90 sourcefile~calibration_data_module.f90 calibration_data_module.f90 sourcefile~cal_allo_init.f90->sourcefile~calibration_data_module.f90 sourcefile~conditional_module.f90 conditional_module.f90 sourcefile~cal_allo_init.f90->sourcefile~conditional_module.f90 sourcefile~hru_lte_module.f90 hru_lte_module.f90 sourcefile~cal_allo_init.f90->sourcefile~hru_lte_module.f90 sourcefile~hru_module.f90 hru_module.f90 sourcefile~cal_allo_init.f90->sourcefile~hru_module.f90 sourcefile~hydrograph_module.f90 hydrograph_module.f90 sourcefile~cal_allo_init.f90->sourcefile~hydrograph_module.f90 sourcefile~mgt_operations_module.f90 mgt_operations_module.f90 sourcefile~cal_allo_init.f90->sourcefile~mgt_operations_module.f90 sourcefile~organic_mineral_mass_module.f90 organic_mineral_mass_module.f90 sourcefile~cal_allo_init.f90->sourcefile~organic_mineral_mass_module.f90 sourcefile~plant_data_module.f90 plant_data_module.f90 sourcefile~cal_allo_init.f90->sourcefile~plant_data_module.f90 sourcefile~plant_module.f90 plant_module.f90 sourcefile~cal_allo_init.f90->sourcefile~plant_module.f90 sourcefile~reservoir_data_module.f90 reservoir_data_module.f90 sourcefile~cal_allo_init.f90->sourcefile~reservoir_data_module.f90 sourcefile~sd_channel_module.f90 sd_channel_module.f90 sourcefile~cal_allo_init.f90->sourcefile~sd_channel_module.f90 sourcefile~soil_module.f90 soil_module.f90 sourcefile~cal_allo_init.f90->sourcefile~soil_module.f90 sourcefile~basin_module.f90 basin_module.f90 sourcefile~hydrograph_module.f90->sourcefile~basin_module.f90 sourcefile~time_module.f90 time_module.f90 sourcefile~hydrograph_module.f90->sourcefile~time_module.f90

Source Code

      subroutine cal_allo_init

      use sd_channel_module
      use hru_lte_module
      use organic_mineral_mass_module
      use hru_module, only : hru, hru_init, bss
      use soil_module
      use plant_module
      use plant_data_module
      use hydrograph_module !, only : sp_ob, res, res_om_init, ch_stor, ch_om_water_init, wet, wet_om_init
      use calibration_data_module
      use reservoir_data_module
      use aquifer_module
      use mgt_operations_module
      use conditional_module
      
      implicit none
      
      integer :: nplt = 0
      integer :: icom = 0
      integer :: iauto = 0
      integer :: isched = 0
      integer :: id = 0
      integer :: nly1 = 0
      integer :: iihru = 0

      allocate (hru_init(0:sp_ob%hru))
      allocate (soil_init(0:sp_ob%hru))
      allocate (rsd1_init(0:sp_ob%hru))
      allocate (pl_mass_init(0:sp_ob%hru))
      allocate (pcom_init(0:sp_ob%hru))

      do iihru = 1, sp_ob%hru
        icom = hru(iihru)%plant_cov
        nplt = pcomdb(icom)%plants_com
        allocate (pcom_init(iihru)%plg(nplt))
        allocate (pcom_init(iihru)%plm(nplt))
        allocate (pcom_init(iihru)%plstr(nplt))
        allocate (pcom_init(iihru)%plcur(nplt))
        allocate (pl_mass_init(iihru)%tot(nplt))
        allocate (pl_mass_init(iihru)%ab_gr(nplt))
        allocate (pl_mass_init(iihru)%leaf(nplt))
        allocate (pl_mass_init(iihru)%stem(nplt))
        allocate (pl_mass_init(iihru)%seed(nplt))
        allocate (pl_mass_init(iihru)%root(nplt))
        allocate (pl_mass_init(iihru)%yield_tot(nplt))
        allocate (pl_mass_init(iihru)%yield_yr(nplt))

        isched = hru(iihru)%mgt_ops
        allocate (pcom_init(iihru)%dtbl(sched(isched)%num_autos))
        do iauto = 1, sched(isched)%num_autos
          id = sched(isched)%num_db(iauto)
          allocate (pcom_init(iihru)%dtbl(iauto)%num_actions(dtbl_lum(id)%acts), source = 0)
          pcom_init(iihru)%dtbl(iauto)%num_actions = 1
          allocate (pcom_init(iihru)%dtbl(iauto)%days_act(dtbl_lum(id)%acts), source = 0)
          pcom_init(iihru)%dtbl(iauto)%days_act = 0
        end do
             
        allocate (rsd1_init(iihru)%tot(nplt))
             
        nly1 = soil(iihru)%nly + 1                                                                                                         
        allocate (soil_init(iihru)%ly(nly1))
        !allocate (soil_init(iihru)%ly(nly1)%rs(nplt))    !bac and pest not allocated
        allocate (soil_init(iihru)%phys(nly1))
      end do
      
      allocate (hlt_init(0:sp_ob%hru_lte))
      allocate (sdch_init(0:sp_ob%chandeg))

      !! initialize all hru parameters
      if (sp_ob%hru > 0) then
        hru_init = hru
        soil_init = soil
        soil1_init = soil1
        rsd1_init = rsd1
        pcom_init = pcom
        pl_mass_init = pl_mass
        wet = wet_om_init
        bss = 0.
      end if
      
      !! initialize hru_lte parameters
      if (sp_ob%hru_lte > 0) then
        hlt_init = hlt
      end if
      
      !! initialize channel lte storage and dimensions
      if (sp_ob%chandeg > 0) then
        sdch_init = sd_ch
        ch_stor = ch_om_water_init
        fp_stor = fp_om_water_init
      end if
      
      !! initialize reservoir storage
      if (sp_ob%res > 0) then
        res = res_om_init
      end if
      
      !! initialize aquifer storage
      if (sp_ob%aqu > 0) then
        aqu_d = aqu_om_init
      end if

      return
      end subroutine cal_allo_init