pl_write_parms_cal.f90 Source File


This file depends on

sourcefile~~pl_write_parms_cal.f90~~EfferentGraph sourcefile~pl_write_parms_cal.f90 pl_write_parms_cal.f90 sourcefile~calibration_data_module.f90 calibration_data_module.f90 sourcefile~pl_write_parms_cal.f90->sourcefile~calibration_data_module.f90 sourcefile~hydrograph_module.f90 hydrograph_module.f90 sourcefile~pl_write_parms_cal.f90->sourcefile~hydrograph_module.f90 sourcefile~input_file_module.f90 input_file_module.f90 sourcefile~pl_write_parms_cal.f90->sourcefile~input_file_module.f90 sourcefile~maximum_data_module.f90 maximum_data_module.f90 sourcefile~pl_write_parms_cal.f90->sourcefile~maximum_data_module.f90 sourcefile~plant_module.f90 plant_module.f90 sourcefile~pl_write_parms_cal.f90->sourcefile~plant_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 pl_write_parms_cal
      
       use maximum_data_module
       use calibration_data_module
       use hydrograph_module
       use input_file_module
       use plant_module
       
       implicit none        
      
       integer :: eof = 0              !           |end of file
       integer :: mreg = 0             !none       |end of loop
       integer :: i = 0                !none       |counter
       integer :: ilum = 0
       integer :: ilum_mx = 0
       
       mreg = 0
       eof = 0

       open (107,file="plant_parms.cal",recl = 1500)

        write (107,*) "Calibrated plant parameter file"
        write (107,*) db_mx%plcal_reg
        write (107,*) "header"

      do i = 1, db_mx%plcal_reg

        write (107,*) pl_prms(i)%name, pl_prms(i)%lum_num, pl_prms(i)%parms, "  0"  
        write (107,*) "header"

        !! read landscape soft calibration data for each land use and parameter
        if (pl_prms(i)%lum_num > 0) then
          ilum_mx = pl_prms(i)%lum_num * pl_prms(i)%parms
          do ilum = 1, ilum_mx
            select case (pl_prms(i)%prm(ilum)%var)
              case ("pest_stress")
                pl_prms(i)%prm(ilum)%init_val = pl_prms(i)%prm(ilum)%init_val + plcal(i)%lum(ilum)%prm%pest_stress
                pl_prms(i)%prm(ilum)%init_val = amin1 (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%up)
                pl_prms(i)%prm(ilum)%init_val = Max (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%lo)
              case ("epco")
                pl_prms(i)%prm(ilum)%init_val = plcal(i)%lum(ilum-pl_prms(i)%lum_num)%prm%epco
                pl_prms(i)%prm(ilum)%init_val = amin1 (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%up)
                pl_prms(i)%prm(ilum)%init_val = Max (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%lo)
              case ("lai_pot")
                pl_prms(i)%prm(ilum)%init_val = pl_prms(i)%prm(ilum)%init_val + plcal(i)%lum(ilum-2*pl_prms(i)%lum_num)%prm%lai_pot
                pl_prms(i)%prm(ilum)%init_val = amin1 (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%up)
                pl_prms(i)%prm(ilum)%init_val = Max (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%lo)
              case ("harv_idx")
                pl_prms(i)%prm(ilum)%init_val = pl_prms(i)%prm(ilum)%init_val + plcal(i)%lum(ilum-3*pl_prms(i)%lum_num)%prm%harv_idx
                pl_prms(i)%prm(ilum)%init_val = amin1 (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%up)
                pl_prms(i)%prm(ilum)%init_val = Max (pl_prms(i)%prm(ilum)%init_val, pl_prms(i)%prm(ilum)%lo)
            end select
            !! write parameters to file
            write (107,*) pl_prms(i)%prm(ilum)
          end do
        end if 

      end do    !mreg

       close(107)
       return
       end subroutine pl_write_parms_cal