LCOV - code coverage report
Current view: top level - common - mo_common_run_variables.f90 (source / functions) Hit Total Coverage
Test: mHM coverage Lines: 10 11 90.9 %
Date: 2024-04-15 17:48:09 Functions: 2 4 50.0 %

          Line data    Source code
       1             : !> \file mo_common_run_variables.f90
       2             : !> \brief \copybrief mo_common_run_variables
       3             : !> \details \copydetails mo_common_run_variables
       4             : 
       5             : !> \brief Provides structures needed by mhm_eval to store current run config.
       6             : !> \author Sebastian Mueller
       7             : !> \date Jan 2022
       8             : !> \version 0.1
       9             : !> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
      10             : !! mHM is released under the LGPLv3+ license \license_note
      11             : !> \ingroup f_common
      12             : module mo_common_run_variables
      13             : 
      14             :   use mo_kind, only : i4, dp
      15             :   use mo_common_datetime_type, only : datetimeinfo
      16             :   use mo_nc_output, only : OutputDataset
      17             : 
      18             :   implicit none
      19             : 
      20             :   !> \class   run_cfg_t
      21             :   !> \brief   This is a container to hold all information while running mHM.
      22             :   type run_cfg_t
      23             :     !> time step counter
      24             :     integer(i4) :: time_step
      25             :     !> currently selected domain
      26             :     integer(i4) :: selected_domain
      27             :     !> number of domains simulated in this mhm_eval run. Depends on opti_function
      28             :     integer(i4) :: nDomains
      29             :     !> output runoff
      30             :     logical :: output_runoff = .false.
      31             :     !> output BFI
      32             :     logical :: output_BFI = .false.
      33             :     !> currently used parameter set
      34             :     real(dp), dimension(:), allocatable :: parameterset
      35             :     !> selected domains
      36             :     integer(i4), dimension(:), allocatable :: domain_indices
      37             :     !> fraction of NOT sealed area
      38             :     real(dp), dimension(:, :, :), allocatable :: L1_fNotSealed
      39             :     !> output mHM NetCDF object
      40             :     type(OutputDataset) :: nc_mhm
      41             :     !> output mRM NetCDF object
      42             :     type(OutputDataset) :: nc_mrm
      43             :     !> output groundwater NetCDF object
      44             :     type(OutputDataset) :: nc_gw
      45             :     !> No. of cells at level 1 for current Domain
      46             :     integer(i4) :: nCells
      47             :     !> start and end index at level 1 for current Domain
      48             :     integer(i4) :: s1, e1
      49             :     !> meteorological time step for process 5 (PET)
      50             :     integer(i4), dimension(6) :: iMeteo_p5
      51             :     !> process 5: start and end index of vectors
      52             :     !! index 1: pet
      53             :     !! index 2: tmin
      54             :     !! index 3: tmax
      55             :     !! index 4: netrad
      56             :     !! index 5: absolute vapour pressure
      57             :     !! index 6: windspeed
      58             :     integer(i4), dimension(6) :: s_p5, e_p5
      59             :     !> start and end index of meteo variables
      60             :     integer(i4) :: s_meteo, e_meteo
      61             :     !> pointer to current domain L1 mask
      62             :     logical, dimension(:, :), pointer :: mask1
      63             :     !> index of meteo time-step
      64             :     integer(i4) :: iMeteoTS
      65             :     !> datetimeinfo variable for everything that has to do with time dependend calculations
      66             :     type(datetimeinfo) :: domainDateTime
      67             :     !> discharge timestep
      68             :     integer(i4) :: iDischargeTS
      69             :     !> start and end index at L11
      70             :     integer(i4) :: s11, e11
      71             :     !> factor between routing and hydrological modelling resolution
      72             :     real(dp) :: tsRoutFactor
      73             :     !> factor between routing and hydrological modelling resolution (dummy)
      74             :     real(dp) :: tsRoutFactorIn
      75             :     !> timestep of runoff to rout [h]
      76             :     !! - identical to timestep of input if tsRoutFactor is less than 1
      77             :     !! - tsRoutFactor * timestep if tsRoutFactor is greater than 1
      78             :     integer(i4) :: timestep_rout
      79             :     !> Runoff that is input for routing
      80             :     real(dp), allocatable, dimension(:) :: RunToRout
      81             :     !> inflowing discharge
      82             :     real(dp), allocatable, dimension(:) :: InflowDischarge
      83             :     !> pointer to current domain L11 mask
      84             :     logical, pointer, dimension(:, :) :: mask11
      85             :     !> flag for performing routing
      86             :     logical :: doRoute
      87             :   contains
      88             :     !> \copydoc mo_common_run_variables::get_domain_index
      89             :     procedure :: get_domain_index!< \see mo_common_run_variables::get_domain_index
      90             :     !> \copydoc mo_common_run_variables::clean_up
      91             :     procedure :: clean_up!< \see mo_common_run_variables::clean_up
      92             :   end type run_cfg_t
      93             : 
      94             :   !> This is a container to hold all information while running mHM
      95             :   type(run_cfg_t), public :: run_cfg
      96             : 
      97             : contains
      98             : 
      99             :   !> \brief get domain index from domain loop counter
     100             :   !> \return index
     101     6061006 :   integer(i4) function get_domain_index(self, i) result(idx)
     102             :     implicit none
     103             :     class(run_cfg_t), intent(in) :: self
     104             :     integer(i4), intent(in) :: i !< domain loop counter
     105     6061006 :     idx = self%domain_indices(i)
     106     6061006 :   end function get_domain_index
     107             : 
     108             :   !> \brief clean up run variables
     109          14 :   subroutine clean_up(self)
     110             :     implicit none
     111             :     class(run_cfg_t), intent(inout) :: self
     112           0 :     if ( allocated(self%parameterset) ) deallocate(self%parameterset)
     113          14 :     if ( allocated(self%domain_indices) ) deallocate(self%domain_indices)
     114          14 :     if ( allocated(self%L1_fNotSealed) ) deallocate(self%L1_fNotSealed)
     115          14 :     if ( allocated(self%RunToRout) ) deallocate(self%RunToRout)
     116          14 :     if ( allocated(self%InflowDischarge) ) deallocate(self%InflowDischarge)
     117     6061006 :   end subroutine clean_up
     118             : 
     119          14 : end module mo_common_run_variables

Generated by: LCOV version 1.16