pest_cha_res_read.f90 Source File


This file depends on

sourcefile~~pest_cha_res_read.f90~~EfferentGraph sourcefile~pest_cha_res_read.f90 pest_cha_res_read.f90 sourcefile~channel_data_module.f90 channel_data_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~channel_data_module.f90 sourcefile~constituent_mass_module.f90 constituent_mass_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~constituent_mass_module.f90 sourcefile~hydrograph_module.f90 hydrograph_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~hydrograph_module.f90 sourcefile~input_file_module.f90 input_file_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~input_file_module.f90 sourcefile~maximum_data_module.f90 maximum_data_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~maximum_data_module.f90 sourcefile~organic_mineral_mass_module.f90 organic_mineral_mass_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~organic_mineral_mass_module.f90 sourcefile~sd_channel_module.f90 sd_channel_module.f90 sourcefile~pest_cha_res_read.f90->sourcefile~sd_channel_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 sourcefile~carbon_module.f90 carbon_module.f90 sourcefile~organic_mineral_mass_module.f90->sourcefile~carbon_module.f90

Source Code

      subroutine pest_cha_res_read
    
      use constituent_mass_module
      use input_file_module
      use maximum_data_module
      use channel_data_module
      use hydrograph_module
      use sd_channel_module
      use organic_mineral_mass_module

      implicit none
 
      character (len=80) :: titldum = ""
      character (len=80) :: header = ""
      integer :: eof = 0
      integer :: imax = 0
      logical :: i_exist              !none       |check to determine if file exists
      integer :: ipest = 0
      integer :: ipesti = 0

      eof = 0
      
      !read all export coefficient data
      inquire (file=in_init%pest_water, exist=i_exist)
      if (i_exist .or. in_init%pest_water /= "null") then
        do
          open (107,file=in_init%pest_water)
          read (107,*,iostat=eof) titldum
          if (eof < 0) exit
          read (107,*,iostat=eof) header
          if (eof < 0) exit
          imax = 0
          do while (eof == 0)
            read (107,*,iostat=eof) titldum     !name
            if (eof < 0) exit
            do ipest = 1, cs_db%num_pests
              read (107,*,iostat=eof) titldum   !water
              if (eof < 0) exit
              read (107,*,iostat=eof) titldum   !benthic
              if (eof < 0) exit
            end do
            imax = imax + 1
          end do
          
          db_mx%pestw_ini = imax
          
          allocate (pest_water_ini(imax))
          allocate (pest_init_name(imax))

          do ipesti = 1, imax
            allocate (pest_water_ini(ipesti)%water(cs_db%num_pests), source = 0.)
            allocate (pest_water_ini(ipesti)%benthic(cs_db%num_pests), source = 0.)
          end do
          
          rewind (107)
          read (107,*,iostat=eof) titldum
          if (eof < 0) exit
          read (107,*,iostat=eof) header
          if (eof < 0) exit
          
          do ipesti = 1, imax
            read (107,*,iostat=eof) pest_init_name(ipesti)
            if (eof < 0) exit
              read (107,*,iostat=eof) titldum, pest_water_ini(ipesti)%water, pest_water_ini(ipesti)%benthic
              if (eof < 0) exit
          end do
          close (107)
          exit
        end do
      end if

      return
      end subroutine pest_cha_res_read