5.13.2-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_mhm_messages.F90
Go to the documentation of this file.
1!> \file mo_mhm_messages.f90
2!> \brief \copybrief mo_mhm_messages
3!> \details \copydetails mo_mhm_messages
4
5!> \brief Module for mHM messages.
6!> \details Write out messages of mHM (startup, checks, status, finish, ect.).
7!> \authors Sebastian Mueller
8!> \version 0.1
9!> \date Oct 2021
10!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
11!! mHM is released under the LGPLv3+ license \license_note
12!> \ingroup f_mhm
14
15 use mo_kind, only: i4
16 use mo_message, only: message
17 use mo_string_utils, only: num2str, separator
18
19 implicit none
20
21 private
22
23 public :: startup_message
25 public :: finish_message
26
27contains
28
29 !> \brief write startup message of mHM.
30 subroutine startup_message()
31 use mo_file, only: &
32 version, &
37 use mo_os, only: check_path_isfile, get_cwd
38 !$ use omp_lib, only: OMP_GET_NUM_THREADS
39
40 implicit none
41
42 character(4096) :: message_text
43 integer(i4), dimension(8) :: datetime
44 logical :: compiled_with_openmp = .false.
45 character(len=255) :: cur_work_dir
46 logical :: compiled_with_mpi = .false.
47 !$ integer(i4) :: n_threads
48
49#ifdef MPI
50 compiled_with_mpi = .true.
51#endif
52
53 ! check for working dir (optional argument to the executable)
54 CALL get_cwd(cur_work_dir)
55
56 call message(separator)
57 call message(' mHM-UFZ')
58 call message()
59 call message(' MULTISCALE HYDROLOGIC MODEL')
60 call message(' Version: ', trim(version))
61 call message(' Date: ', trim(version_date))
62 call message()
63 call message('Originally by L. Samaniego & R. Kumar')
64 call message(separator)
65
66 call message()
67 !$ compiled_with_openmp = .true.
68 if (compiled_with_openmp) then
69 call message('OpenMP used.')
70 else
71 call message('Openmp not used.')
72 end if
73 !$OMP PARALLEL
74 !$ n_threads = OMP_GET_NUM_THREADS()
75 !$OMP END PARALLEL
76 !$ call message('Run with OpenMP with ', trim(num2str(n_threads)), ' threads.')
77
78 call message()
79 if (compiled_with_mpi) then
80 call message('MPI used.')
81 else
82 call message('MPI not used.')
83 end if
84
85 call message()
86 call date_and_time(values = datetime)
87 message_text = trim(num2str(datetime(3), '(I2.2)')) // "." // trim(num2str(datetime(2), '(I2.2)')) &
88 // "." // trim(num2str(datetime(1), '(I4.4)')) // " " // trim(num2str(datetime(5), '(I2.2)')) &
89 // ":" // trim(num2str(datetime(6), '(I2.2)')) // ":" // trim(num2str(datetime(7), '(I2.2)'))
90 call message('Start at ', trim(message_text), '.')
91 call message('Working directory: ', trim(cur_work_dir))
92 call message('Using namelists:')
93 call message(' ', trim(file_namelist_mhm))
94 call message(' ', trim(file_namelist_mhm_param))
95 call message(' ', trim(file_defoutput))
96 call message()
97
98 call check_path_isfile(path = file_namelist_mhm, raise=.true.)
99 call check_path_isfile(path = file_namelist_mhm_param, raise=.true.)
100 call check_path_isfile(path = file_defoutput, raise=.true.)
101
102 end subroutine startup_message
103
104 !> \brief Check input directories for mHM.
106 use mo_check, only: check_dir
108 use mo_common_variables, only: &
109 dirmorpho, &
110 dirlcover, &
111 dirout, &
112 domainmeta, &
114
115 implicit none
116
117 integer(i4) :: domainid, idomain
118
119 call message()
120 call message('# of domains: ', trim(num2str(domainmeta%overallNumberOfDomains)))
121 call message()
122 call message(' Given data directories:')
123 do idomain = 1, domainmeta%nDomains
124 domainid = domainmeta%indices(idomain)
125 call message(' --------------')
126 call message(' DOMAIN ', num2str(domainid, '(I3)'))
127 call message(' --------------')
128 call check_dir(dirmorpho(idomain), "Morphological directory:", .false., 4, 30)
129 call check_dir(dirlcover(idomain), "Land cover directory:", .false., 4, 30)
130 if (.not. meteo_handler%couple_all) &
131 call check_dir(meteo_handler%dir_meteo_header(idomain), "Level-2 header directory:", .false., 4, 30)
132 if (.not. meteo_handler%couple_pre) &
133 call check_dir(meteo_handler%dirPrecipitation(idomain), "Precipitation directory:", .false., 4, 30)
134 if (.not. meteo_handler%couple_temp) &
135 call check_dir(meteo_handler%dirTemperature(idomain), "Temperature directory:", .false., 4, 30)
136 select case (processmatrix(5, 1))
137 case(-1 : 0) ! PET is input
138 if (.not. meteo_handler%couple_pet) &
139 call check_dir(meteo_handler%dirReferenceET(idomain), "PET directory:", .false., 4, 30)
140 case(1) ! Hargreaves-Samani
141 if (.not. meteo_handler%couple_tmin) &
142 call check_dir(meteo_handler%dirMinTemperature(idomain), "Min. temperature directory:", .false., 4, 30)
143 if (.not. meteo_handler%couple_tmax) &
144 call check_dir(meteo_handler%dirMaxTemperature(idomain), "Max. temperature directory:", .false., 4, 30)
145 case(2) ! Priestely-Taylor
146 if (.not. meteo_handler%couple_netrad) &
147 call check_dir(meteo_handler%dirNetRadiation(idomain), "Net radiation directory:", .false., 4, 30)
148 case(3) ! Penman-Monteith
149 if (.not. meteo_handler%couple_netrad) &
150 call check_dir(meteo_handler%dirNetRadiation(idomain), "Net radiation directory:", .false., 4, 30)
151 if (.not. meteo_handler%couple_absvappress) &
152 call check_dir(meteo_handler%dirabsVapPressure(idomain), "Abs. vap. press. directory:", .false., 4, 30)
153 if (.not. meteo_handler%couple_windspeed) &
154 call check_dir(meteo_handler%dirwindspeed(idomain), "Windspeed directory:", .false., 4, 30)
155 end select
156 call check_dir(dirout(idomain), "Output directory:", .true., 4, 30)
157 call message()
158 end do
159 call message()
160
161 end subroutine domain_dir_check_message
162
163 !> \brief Finish message for mHM.
164 subroutine finish_message()
167
168 implicit none
169
170 integer(i4), dimension(8) :: datetime
171 integer(i4) :: ntimesteps
172 character(4096) :: message_text
173
174 ntimesteps = maxval(simper(1 : domainmeta%nDomains)%julEnd - simper(1 : domainmeta%nDomains)%julStart + 1) * ntstepday
175 call date_and_time(values = datetime)
176 call message()
177 message_text = 'Done ' // trim(num2str(ntimesteps, '(I10)')) // " time steps."
178 call message(trim(message_text))
179 message_text = trim(num2str(datetime(3), '(I2.2)')) // "." // trim(num2str(datetime(2), '(I2.2)')) &
180 // "." // trim(num2str(datetime(1), '(I4.4)')) // " " // trim(num2str(datetime(5), '(I2.2)')) &
181 // ":" // trim(num2str(datetime(6), '(I2.2)')) // ":" // trim(num2str(datetime(7), '(I2.2)'))
182 call message('Finished at ', trim(message_text), '.')
183 call message()
184 call message(separator)
185 call message('mHM: Finished!')
186 call message(separator)
187
188 end subroutine finish_message
189
190end module mo_mhm_messages
Input checking routines.
Definition mo_check.f90:12
subroutine, public check_dir(path, text, raise, tab, text_length)
Check if a given directory exists.
Definition mo_check.f90:31
Provides structures needed by mHM, mRM and/or mpr.
type(period), dimension(:), allocatable, public simper
Provides structures needed by mHM, mRM and/or mpr.
type(domain_meta), public domainmeta
character(256), dimension(:), allocatable, public dirlcover
character(256), dimension(:), allocatable, public dirout
character(256), dimension(:), allocatable, public dirmorpho
integer(i4), dimension(nprocesses, 3), public processmatrix
Provides file names and units for mHM.
Definition mo_file.F90:29
character(:), allocatable file_namelist_mhm_param
Parameter namelists file name.
Definition mo_file.F90:46
character(:), allocatable file_namelist_mhm
Namelist file name.
Definition mo_file.F90:42
character(len=*), parameter version
Current mHM model version (will be set to )
Definition mo_file.F90:33
character(len=*), parameter version_date
Time of current mHM model version release.
Definition mo_file.F90:36
character(:), allocatable file_defoutput
file defining mHM's outputs
Definition mo_file.F90:50
Main global variables for mHM.
type(meteo_handler_type), public meteo_handler
the meteo handler class
Module for mHM messages.
subroutine, public domain_dir_check_message()
Check input directories for mHM.
subroutine, public startup_message()
write startup message of mHM.
subroutine, public finish_message()
Finish message for mHM.