5.13.2-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_write_ascii.f90
Go to the documentation of this file.
1!> \file mo_write_ascii.f90
2!> \brief \copybrief mo_write_ascii
3!> \details \copydetails mo_write_ascii
4
5!> \brief Module to write ascii file output.
6!> \details Module to write ascii file output.
7!! Writing model output to ASCII should be the exception. Therefore, output is written usually as NetCDF
8!! and only:
9!! 1. The configuration file of mHM,
10!! 2. the final parameter set after optimization, and
11!! 3. the simulated vs. observed daily discharge
12!! is written in ASCII file format to allow for a quick assurance of proper model runs.
13!> \changelog
14!! - Modified, Juliane Mai, May 2013
15!! - module version and documentation
16!! - Modified, Luis Samaniego, Nov 2013
17!! - improving all formats
18!! - Modified, Luis Samaniego, Mar 2014
19!! - added inflow gauge information write out
20!! - Modified, Stephan Thober, Jun 2014
21!! - bug fixed: in writing network properties
22!! - Modified, Rohini Kumar, Jun 2014
23!! - bug fixed: writing of max and min value of discharge
24!! - Modified, Stephan Thober, Aug 2015
25!! - moved write_daily_obs_sim_discharge to mRM
26!> \authors Christoph Schneider, Juliane Mai, Luis Samaniego
27!> \date May 2013
28!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
29!! mHM is released under the LGPLv3+ license \license_note
30!> \ingroup f_mhm
32
33
34 USE mo_kind, ONLY : i4, dp
35 use mo_message, only: message, error_message
36
37 IMPLICIT NONE
38
39 PUBLIC :: write_configfile ! Writes configuration file
40 PUBLIC :: write_optifile ! Write final OF and best parameter set
41 PUBLIC :: write_optinamelist ! Write final OF and best parameter set in a namelist format
42 ! ------------------------------------------------------------------
43
44 ! NAME
45 ! write_configfile
46
47 ! PURPOSE
48 !> \brief This modules writes the results of the configuration into an ASCII-file
49 !> \details
50
51 !> \details TODO: add description
52
53 ! HISTORY
54 !> \authors Christoph Schneider
55
56 !> \date May 2013
57
58 ! Modifications:
59 ! Juliane Mai May 2013 - module version and documentation
60 ! Stephan Thober Jun 2014 - bug fix in L11 config print out
61 ! Stephan Thober Jun 2014 - updated read_restart
62 ! Rohini, Luis Jul 2015 - updated version, L1 level prints
63 ! Stephan Thober Nov 2016 - moved processMatrix to common variables
64 ! Robert Schweppe Jun 2018 - refactoring and reformatting
65
66 PRIVATE
67
68 ! ------------------------------------------------------------------
69
70CONTAINS
71
72 ! NAME
73 ! write_configfile
74
75 ! PURPOSE
76 !> \brief TODO: add description
77
78 !> \details TODO: add description
79
80 ! HISTORY
81 !> \authors Robert Schweppe
82
83 !> \date Jun 2018
84
85 ! Modifications:
86 ! Robert Schweppe Jun 2018 - refactoring and reformatting
87 ! P Shrestha, S Thober Aug 2018 - resolved bug while printing River Network in
88 ! cases with multiple outlets.
89
90 Subroutine write_configfile(dirPrecipitation, dirReferenceET, dirTemperature)
91
94 use mo_common_variables, only : lc_year_end, &
98 use mo_file, only : version
99 use mo_kind, only : i4
100 use mo_string_utils, only : num2str
101 use mo_os, only : check_path_isdir
108
109 implicit none
110
111 character(256), dimension(:), intent(in) :: dirprecipitation !< Directory where precipitation files are located
112 character(256), dimension(:), intent(in) :: dirreferenceet !< Directory where reference-ET files are located
113 character(256), dimension(:), intent(in) :: dirtemperature !< Directory where temperature files are located
114
115 character(256) :: fname
116
117 integer(i4) :: i, j, idomain, domainid
118
119 integer(i4) :: err
120
121
122 fname = trim(adjustl(dirconfigout)) // trim(adjustl(file_config))
123 call message()
124 call message(' Log-file written to ', trim(fname))
125 !checking whether the directory exists where the file shall be created or opened
126 call check_path_isdir(trim(adjustl(dirconfigout)), raise=.true.)
127 open(uconfig, file = fname, status = 'unknown', action = 'write', iostat = err)
128 if (err .ne. 0) then
129 call error_message(' Problems while creating File. ', 'Error-Code ', num2str(err))
130 end if
131 write(uconfig, 200)
132 write(uconfig, 100) 'mHM-UFZ v-' // trim(version)
133 write(uconfig, 100) 'L. Samaniego & R. Kumar, UFZ'
134 write(uconfig, 200)
135 write(uconfig, 100)
136 write(uconfig, 201) ' M A I N mHM C O N F I G U R A T I O N I N F O R M A T I O N '
137 write(uconfig, 100)
138 write(uconfig, 103) 'Number of domain ', domainmeta%overallNumberOfDomains
139 if (processmatrix(8, 1) > 0) then
140 write(uconfig, 103) 'Total No. of gauges ', ngaugestotal
141 end if
142 write(uconfig, 103) 'Time Step [h] ', timestep
143 do idomain = 1, domainmeta%nDomains
144 domainid = domainmeta%indices(idomain)
145 write(uconfig, 103) 'Domain ', domainid, 'No. of cells L0 ', level0(domainmeta%L0DataFrom(idomain))%nCells
146 write(uconfig, 103) 'Domain ', domainid, 'No. of cells L1 ', level1(idomain)%nCells
147 if (domainmeta%doRouting(idomain)) then
148 write(uconfig, 103) 'Total No. of nodes ', level11(idomain)%nCells
149 write(uconfig, 103) 'Total No. of reaches ', level11(idomain)%nCells - 1
150 if (domainmeta%doRouting(idomain)) then
151 write(uconfig, 103) 'No. of cells L11 ', level11(idomain)%nCells
152 write(uconfig, 103) 'Total No. of gauges ', ngaugestotal
153 end if
154 end if
155
156 select case (iflag_cordinate_sys)
157 case (0)
158 write(uconfig, 301) 'Domain ', domainid, ' Hydrology Resolution [m] ', resolutionhydrology(idomain)
159 if (domainmeta%doRouting(idomain)) then
160 write(uconfig, 301) 'Domain ', domainid, ' Routing Resolution [m] ', resolutionrouting(idomain)
161 end if
162 case(1)
163 write(uconfig, 302) 'Domain ', domainid, ' Hydrology Resolution [o] ', resolutionhydrology(idomain)
164 if (domainmeta%doRouting(idomain)) then
165 write(uconfig, 302) 'Domain ', domainid, ' Routing Resolution [o] ', resolutionrouting(idomain)
166 end if
167 end select
168 end do
169 write(uconfig, 126) 'Flag READ restart ', read_restart
170 write(uconfig, 126) 'Flag WRITE restart ', write_restart
171 !
172 !******************
173 ! Model Run period
174 !******************
175 do idomain = 1, domainmeta%nDomains
176 domainid = domainmeta%indices(idomain)
177 write(uconfig, 115) ' Model Run Periods for Domain ', num2str(domainid)
178 write(uconfig, 116) &
179 'From To', &
180 ' Day Month Year Day Month Year'
181 write(uconfig, 117) &
182 'Warming Period (1) ', &
183 warmper(idomain)%dStart, warmper(idomain)%mStart, warmper(idomain)%yStart, &
184 warmper(idomain)%dEnd, warmper(idomain)%mEnd, warmper(idomain)%yEnd
185 write(uconfig, 117) &
186 'Evaluation Period (2) ', &
187 evalper(idomain)%dStart, evalper(idomain)%mStart, evalper(idomain)%yStart, &
188 evalper(idomain)%dEnd, evalper(idomain)%mEnd, evalper(idomain)%yEnd
189 write(uconfig, 117) &
190 'Simulation Period (1)+(2) ', &
191 simper(idomain)%dStart, simper(idomain)%mStart, simper(idomain)%yStart, &
192 simper(idomain)%dEnd, simper(idomain)%mEnd, simper(idomain)%yEnd
193 end do
194
195 !*********************************
196 ! Model Land Cover Observations
197 !*********************************
198 do idomain = 1, domainmeta%nDomains
199 domainid = domainmeta%indices(idomain)
200 write(uconfig, 118) ' Land Cover Observations for Domain ', num2str(domainid)
201 write(uconfig, 119) ' Start Year', ' End Year', ' Land cover scene', 'Land Cover File'
202 do i = 1, nlcoverscene
203 write(uconfig, 120) lc_year_start(i), lc_year_end(i), &
204 lcyearid(max(evalper(idomain)%yStart, lc_year_start(i)), idomain), trim(lcfilename(i))
205 end do
206 end do
207 !*********************************
208 ! Initial Parameter Ranges
209 !*********************************
210 write(uconfig, 121) ' Initial Transfer Function Parameter Ranges (gammas) '
211 !
212 ! Transfer functions
213 write(uconfig, 122) &
214 ' i', ' min', ' max', ' current', &
215 ' name'
216 do i = 1, size(global_parameters, 1)
217 write(uconfig, 123) &
219 trim(adjustl(global_parameters_name(i)))
220 end do
221 ! domain runoff data
222 if (processmatrix(8, 1) > 0) then
223 write(uconfig, 202) ' Domain Runoff Data '
224 write(uconfig, 107) ' Gauge No.', ' Domain Id', ' Qmax[m3/s]', ' Qmin[m3/s]'
225 do i = 1, ngaugeslocal
226 if(any(gauge%Q(:, i) > nodata_dp)) then
227 write(uconfig, 108) i, gauge%domainId(i), maxval(gauge%Q(:, i), gauge%Q(:, i) > nodata_dp), &
228 minval(gauge%Q(:, i), gauge%Q(:, i) > nodata_dp)
229 else
230 write(uconfig, 108) i, gauge%domainId(i), nodata_dp, nodata_dp
231 end if
232 end do
233 end if
234 ! inflow gauge data
235 if (ninflowgaugestotal .GT. 0) then
236 write(uconfig, 202) ' Domain Inflow Data '
237 write(uconfig, 107) ' Gauge No.', ' Domain Id', ' Qmax[m3/s]', ' Qmin[m3/s]'
238 do i = 1, ninflowgaugestotal
239 if(all(inflowgauge%Q(:, i) > nodata_dp)) then
240 write(uconfig, 108) i, inflowgauge%domainId(i), maxval(inflowgauge%Q(:, i), inflowgauge%Q(:, i) > nodata_dp), &
241 minval(inflowgauge%Q(:, i), inflowgauge%Q(:, i) > nodata_dp)
242 else
243 write(uconfig, 108) i, inflowgauge%domainId(i), nodata_dp, nodata_dp
244 end if
245 end do
246 end if
247
248 ! domain config
249 write(uconfig, 218) 'Domain-wise Configuration'
250 do idomain = 1, domainmeta%nDomains
251 domainid = domainmeta%indices(idomain)
252 !ST has to be moved to the config write of mRM
253 ! if (domainMeta%doRouting(iDomain)) then
254 ! write(uconfig,103) 'Domain No. ', domainID, &
255 ! 'No. of gauges ', domain%nGauges(iDomain)
256 ! end if
257
258 write(uconfig, 222) 'Directory list'
259
260 write(uconfig, 224) 'Directory to morphological input ', dirmorpho(idomain)
261 write(uconfig, 224) 'Directory to land cover input ', dirlcover(idomain)
262 if (domainmeta%doRouting(idomain)) then
263 write(uconfig, 224) 'Directory to gauging station input ', dirgauges(idomain)
264 end if
265 write(uconfig, 224) 'Directory to precipitation input ', dirprecipitation(idomain)
266 write(uconfig, 224) 'Directory to temperature input ', dirtemperature(idomain)
267 write(uconfig, 224) 'Directory to reference ET input ', dirreferenceet(idomain)
268 write(uconfig, 224) 'Directory to write output by default ', dirout(idomain)
269 write(uconfig, 224) 'File to write mHM output when restarted ', mhmfilerestartout(idomain)
270
271 if (domainmeta%doRouting(idomain)) then
272 write(uconfig, 102) 'River Network (Routing level)'
273 write(uconfig, 100) 'Label 0 = intermediate draining cell '
274 write(uconfig, 100) 'Label 1 = headwater cell '
275 write(uconfig, 100) 'Label 2 = sink cell '
276
277 if (processmatrix(8, 1) .eq. 1_i4) then
278 write(uconfig, 104) ' Overall', &
279 ' From', &
280 ' To', &
281 ' Routing', &
282 ' Label', &
283 ' Length', &
284 ' Mean', &
285 ' Link', &
286 ' Routing', &
287 ' Routing', &
288 ' Sequence', &
289 ' ', &
290 ' ', &
291 ' Slope'
292 !
293 write(uconfig, 105) ' Id', &
294 ' Node', &
295 ' Node', &
296 '', &
297 '', &
298 ' [km]', &
299 ' [o/oo]'
300 !
301 do j = level11(idomain)%iStart, level11(idomain)%iEnd - l11_noutlets(idomain)
302 i = l11_netperm(j) + level11(idomain)%iStart - 1 ! adjust permutation for multi-domain option
303 write(uconfig, 106) i, l11_fromn(i), l11_ton(i), l11_rorder(i), l11_label(i), &
304 l11_length(i) / 1000.0_dp, l11_slope(i) * 1.0e3_dp
305 end do
306
307 else if (processmatrix(8, 1) .eq. 2_i4) then
308 write(uconfig, 134) ' Overall', &
309 ' From', &
310 ' To', &
311 ' Routing', &
312 ' Label', &
313 ' Link', &
314 ' Routing', &
315 ' Routing', &
316 ' Sequence', &
317 ' '
318 !
319 write(uconfig, 135) ' Id', &
320 ' Node', &
321 ' Node', &
322 '', &
323 ''
324 !
325 do j = level11(idomain)%iStart, level11(idomain)%iEnd - l11_noutlets(idomain)
326 i = l11_netperm(j) + level11(idomain)%iStart - 1 ! adjust permutation for multi-domain option
327 write(uconfig, 136) i, l11_fromn(i), l11_ton(i), l11_rorder(i), l11_label(i)
328 end do
329 end if
330 ! draining node at L11
331 write(uconfig, 109) ' Overall', ' Domain', &
332 ' Cell', ' Routing', &
333 ' Id', ' Node Id'
334 do i = 1, level11(idomain)%nCells
335 write(uconfig, 110) i
336 end do
337
338 ! L1 level information
339 write(uconfig, 111) ' Modeling', ' Routing', ' Effective', &
340 ' Cell', ' Cell Id', ' Area', &
341 ' Id', ' [-]', ' [km2]'
342
343 do i = 1, level1(idomain)%nCells
344 write(uconfig, 113) i, l1_l11_id(i), level1(idomain)%CellArea(i) * 1.0e-6_dp
345 end do
346 write(uconfig, 114) ' Total[km2]', sum(level1(idomain)%CellArea) * 1.0e-6_dp
347 end if
348 !
349 end do
350
351 write(uconfig, *)
352 close(uconfig)
353
354 !! Formats
355 100 format (a80)
356 102 format (/ 30('-') / a30 / 30('-'))
357 103 format (a20, 10x, i10)
358 104 format (/ 75('-') / 5a10, 5x, 2a10 / 5a10, 5x, 2a10)
359 105 format (5a10, 5x, 2a10 / 75('-'))
360 106 format (5i10, 5x, 2f10.3)
361 107 format (2a10, 2a15)
362 108 format (2i10, 2f15.3)
363 !
364 109 format (/ 20('-') / 2a10 / 2a10 / 2a10 / 20('-'))
365 110 format (i10)
366 !
367 111 format (/ 30('-') / 3a10 / 3a10 / 3a10 / 30('-'))
368 113 format (2i10, 1f10.3)
369 114 format (30('-') / a15, 5x, 1f10.3 /)
370 !
371 115 format (/61('-')/ a50, a10 /61('-'))
372 116 format (39x, a22 / 25x, a36)
373 117 format (3(a25, 6(i6)))
374 !
375 118 format (/50('-')/ a40, a10 /50('-'))
376 119 format (a10, a10, a20, a20/)
377 120 format (i10, i10, 10x, i10, a20)
378 !
379 121 format (/55('-')/ a55 /55('-'))
380 122 format (a10, 3a15, a35)
381 123 format (i10, 3f15.3, a35)
382 !
383 126 format (a30, 9x, l1)
384 !
385 134 format (/ 50('-') / 5a10 / 5a10)
386 135 format (5a10 / 50('-'))
387 136 format (5i10)
388 !
389 200 format (80('-'))
390 201 format (a80)
391 202 format (/50('-')/ a50 /50('-'))
392 !
393 218 format (/ 80('-')/ 26x, a24, 26x, /80('-'))
394 222 format (/80('-')/ 26x, a21 /80('-'))
395 224 format (a40, 5x, a256)
396
397 301 format (a7, i2, a32, f15.0)
398 302 format (a7, i2, a32, es20.8)
399 end Subroutine write_configfile
400
401
402 ! ------------------------------------------------------------------
403
404 ! NAME
405 ! write_optifile
406
407 ! PURPOSE
408 !> \brief Write briefly final optimization results.
409
410 !> \details Write overall best objective function and the best optimized parameter set to a file_opti.
411
412 ! INTENT(IN)
413 !> \param[in] "real(dp) :: best_OF" best objective function value as returnedby the
414 !> optimization routine
415 !> \param[in] "real(dp), dimension(:) :: best_paramSet" best associated global parameter setCalled only
416 !> when optimize is .TRUE.
417 !> \param[in] "character(len = *), dimension(:) :: param_names"
418
419 ! HISTORY
420 !> \authors David Schaefer
421
422 !> \date July 2013
423
424 ! Modifications:
425 ! Rohini Kumar Aug 2013 - change in structure of the code including call statements
426 ! Juliane Mai Oct 2013 - clear parameter names added
427 ! - double precision written
428 ! Robert Schweppe Jun 2018 - refactoring and reformatting
429 ! M. Cuneyd Demirel, Simon Stisen Jun 2020 - added Feddes and FC dependency on root fraction coefficient processCase(3) = 4
430
431 subroutine write_optifile(best_OF, best_paramSet, param_names)
432
435 use mo_string_utils, only : num2str
436 use mo_os, only : check_path_isdir
437
438 implicit none
439
440 ! best objective function value as returnedby the optimization routine
441 real(dp), intent(in) :: best_of
442
443 ! best associated global parameter setCalled only when optimize is .TRUE.
444 real(dp), dimension(:), intent(in) :: best_paramset
445
446 character(len = *), dimension(:), intent(in) :: param_names
447
448 character(256) :: fname, formheader, formparams
449
450 integer(i4) :: ii, err, n_params
451
452
453 ! number of parameters
454 n_params = size(best_paramset)
455
456 ! open file
457 fname = trim(adjustl(dirconfigout)) // trim(adjustl(file_opti))
458 !checking whether the directory exists where the file shall be created or opened
459 call check_path_isdir(trim(adjustl(dirconfigout)), raise=.true.)
460 open(uopti, file = fname, status = 'unknown', action = 'write', iostat = err, recl = (n_params + 1) * 40)
461 if(err .ne. 0) then
462 call error_message(' IOError while openening "', trim(fname), '". Error-Code ', num2str(err))
463 end if
464
465 ! header
466 write(formheader, *) '(a40,', n_params, 'a40)'
467 ! len(param_names(1))=256 but only 39 characters taken here
468 ! write(uopti, formHeader) 'OF', (trim(adjustl(param_names(ii))), ii=1, n_params)
469 write(uopti, formheader) 'OF', (trim(adjustl(param_names(ii)(1 : 39))), ii = 1, n_params)
470
471 ! output
472 write(formparams, *) '( es40.14, ', n_params, '(es40.14) )'
473 write(uopti, formparams) best_of, (best_paramset(ii), ii = 1, n_params)
474
475 ! close file
476 close(uopti)
477
478 ! screen output
479 call message()
480 call message(' Optimized parameters written to ', trim(fname))
481
482 end subroutine write_optifile
483
484 ! ------------------------------------------------------------------
485
486 ! NAME
487 ! write_optinamelist
488
489 ! PURPOSE
490 !> \brief Write final, optimized parameter set in a namelist format.
491
492 !> \details Write final, optimized parameter set in a namelist format.
493 !> Only parameters of processes which were switched on are written to the namelist.
494 !> All others are discarded.
495
496 ! INTENT(IN)
497 !> \param[in] "integer(i4), dimension(nProcesses, 3) :: processMatrix" information about which
498 !> process
499 !> case was used
500 !> \param[in] "real(dp), dimension(:, :) :: parameters" (min, max, opti)
501 !> \param[in] "logical, dimension(size(parameters, 1)) :: maskpara" .true. if parameter was
502 !> calibrated
503 !> \param[in] "character(len = *), dimension(size(parameters, 1)) :: parameters_name" clear names of parameters
504
505 ! HISTORY
506 !> \authors Juliane Mai
507
508 !> \date Dec 2013
509
510 ! Modifications:
511 ! Stephan Thober Nov 2016 - moved nProcesses to common variables
512 ! Stephan Thober Nov 2016 - write namelist for routing process 2
513 ! Robert Schweppe Jun 2018 - refactoring and reformatting
514
515 subroutine write_optinamelist(processMatrix, parameters, maskpara, parameters_name)
516
519 use mo_string_utils, only : num2str
520 use mo_os, only : check_path_isdir
521
522 implicit none
523
524 ! information about which process
525 ! case was used
526 integer(i4), dimension(nProcesses, 3), intent(in) :: processmatrix
527
528 ! (min, max, opti)
529 real(dp), dimension(:, :), intent(in) :: parameters
530
531 ! .true. if parameter was calibrated
532 logical, dimension(size(parameters, 1)), intent(in) :: maskpara
533
534 ! clear names of parameters
535 character(len = *), dimension(size(parameters, 1)), intent(in) :: parameters_name
536
537 character(256) :: fname
538
539 character(len = 28), dimension(nProcesses) :: process_descr
540
541 integer(i4) :: err, flag
542
543 integer(i4) :: iproc, ipar, ipar_start
544
545
546 process_descr(1) = 'interception'
547 process_descr(2) = 'snow'
548 process_descr(3) = 'soilmoisture'
549 process_descr(4) = 'directSealedAreaRunoff'
550 process_descr(5) = 'potential evapotranspiration'
551 process_descr(6) = 'interflow'
552 process_descr(7) = 'percolation'
553 process_descr(8) = 'routing'
554 process_descr(9) = 'geology'
555 process_descr(10) = 'neutrons'
556
557 ! open file
558 fname = trim(adjustl(dirconfigout)) // trim(adjustl(file_opti_nml))
559 !checking whether the directory exists where the file shall be created or opened
560 call check_path_isdir(trim(adjustl(dirconfigout)), raise=.true.)
561 open(uopti_nml, file = fname, status = 'unknown', action = 'write', iostat = err)
562 if(err .ne. 0) then
563 call error_message(' IOError while openening "', trim(fname), '". Error-Code ', num2str(err))
564 end if
565
566 write(uopti_nml, *) '!global_parameters'
567 write(uopti_nml, '( A47,T50,3(A20,2x),2(A8,1x) )') "!PARAMETER", "lower_bound", "upper_bound", "value", "FLAG", "SCALING"
568
569 ipar_start = 1
570 do iproc = 1, nprocesses
571
572 write(uopti_nml, *) '! ', trim(adjustl(process_descr(iproc)))
573
574 select case (iproc)
575 case(1)
576 if (processmatrix(iproc, 1) .eq. 1) then
577 write(uopti_nml, *) '&interception1'
578 end if
579 case(2)
580 if (processmatrix(iproc, 1) .eq. 1) then
581 write(uopti_nml, *) '&snow1'
582 end if
583 case(3)
584 select case (processmatrix(iproc, 1))
585 case(1)
586 write(uopti_nml, *) '&soilmoisture1'
587 case(2)
588 write(uopti_nml, *) '&soilmoisture2'
589 case(3)
590 write(uopti_nml, *) '&soilmoisture3'
591 case(4)
592 write(uopti_nml, *) '&soilmoisture4'
593 end select
594 case(4)
595 if (processmatrix(iproc, 1) .eq. 1) then
596 write(uopti_nml, *) '&directRunoff1'
597 end if
598 case(5)
599 select case (processmatrix(iproc, 1))
600 case(-1)
601 write(uopti_nml, *) '&PETminus1'
602 case(0)
603 write(uopti_nml, *) '&PET0'
604 case(1)
605 write(uopti_nml, *) '&PET1'
606 case(2)
607 write(uopti_nml, *) '&PET2'
608 case(3)
609 write(uopti_nml, *) '&PET3'
610 end select
611 case(6)
612 if (processmatrix(iproc, 1) .eq. 1) then
613 write(uopti_nml, *) '&interflow1'
614 end if
615 case(7)
616 if (processmatrix(iproc, 1) .eq. 1) then
617 write(uopti_nml, *) '&percolation1'
618 end if
619 case(8)
620 if (processmatrix(iproc, 1) .eq. 1) then
621 write(uopti_nml, *) '&routing1'
622 end if
623 if (processmatrix(iproc, 1) .eq. 2) then
624 write(uopti_nml, *) '&routing2'
625 end if
626 if (processmatrix(iproc, 1) .eq. 3) then
627 write(uopti_nml, *) '&routing3'
628 end if
629 case(9)
630 if (processmatrix(iproc, 1) .eq. 1) then
631 write(uopti_nml, *) '&geoparameter'
632 end if
633 case(10)
634 if (processmatrix(iproc, 1) .ge. 1) then
635 write(uopti_nml, *) '&neutrons1'
636 end if
637 end select
638
639 do ipar = ipar_start, processmatrix(iproc, 3)
640
641 if (maskpara(ipar)) then
642 flag = 1
643 else
644 flag = 0
645 end if
646
647 write(uopti_nml, '( A47," = ",T50,3(f20.12,", "),I8,", 1" )') &
648 trim(adjustl(parameters_name(ipar))), &
649 parameters(ipar, 1), &
650 parameters(ipar, 2), &
651 parameters(ipar, 3), &
652 flag
653 end do
654
655 ipar_start = processmatrix(iproc, 3) + 1
656
657 write(uopti_nml, *) '/'
658 write(uopti_nml, *) ' '
659
660 end do ! loop over processes
661
662 ! close file
663 close(uopti_nml)
664
665 ! screen output
666 call message()
667 call message(' Optimized parameters written in namelist format to ', trim(fname))
668
669 end subroutine write_optinamelist
670
671END MODULE mo_write_ascii
Provides constants commonly used by mHM, mRM and MPR.
real(dp), parameter, public nodata_dp
Provides file names and units for mRM.
integer, parameter uconfig
Unit for file defining mHM's outputs.
character(len= *), parameter file_config
file defining mHM's outputs
Provides file names and units for mHM.
integer, parameter uopti
Unit for file optimization outputs (objective and parameter set)
character(len=*), parameter file_opti
file defining optimization outputs (objective and parameter set)
character(len=*), parameter file_opti_nml
file defining optimization outputs in a namelist format (parameter set)
integer, parameter uopti_nml
Unit for file optimization outputs in a namelist format (parameter set)
Provides structures needed by mHM, mRM and/or mpr.
type(period), dimension(:), allocatable, public warmper
real(dp), dimension(:), allocatable, public resolutionrouting
integer(i4), dimension(:, :), allocatable, public lcyearid
type(period), dimension(:), allocatable, public simper
type(period), dimension(:), allocatable, public evalper
Provides structures needed by mHM, mRM and/or mpr.
integer(i4), parameter, public nprocesses
character(256), dimension(:), allocatable, public mhmfilerestartout
real(dp), dimension(:), allocatable, public resolutionhydrology
logical, public write_restart
real(dp), dimension(:, :), allocatable, target, public global_parameters
character(256), dimension(:), allocatable, public lcfilename
character(256), dimension(:), allocatable, public global_parameters_name
type(domain_meta), public domainmeta
character(256), public dirconfigout
integer(i4), public nlcoverscene
character(256), dimension(:), allocatable, public dirlcover
integer(i4), dimension(:), allocatable, public lc_year_end
character(256), dimension(:), allocatable, public dirout
character(256), dimension(:), allocatable, public dirmorpho
integer(i4), public iflag_cordinate_sys
integer(i4), dimension(nprocesses, 3), public processmatrix
type(grid), dimension(:), allocatable, target, public level1
type(grid), dimension(:), allocatable, target, public level0
integer(i4), dimension(:), allocatable, public lc_year_start
Provides file names and units for mHM.
Definition mo_file.F90:29
character(len=*), parameter version
Current mHM model version (will be set to )
Definition mo_file.F90:33
Global variables for mRM only.
type(gaugingstation), public inflowgauge
integer(i4), dimension(:), allocatable, public l11_netperm
integer(i4), dimension(:), allocatable, public l1_l11_id
integer(i4), dimension(:), allocatable, public l11_label
character(256), dimension(:), allocatable, public dirgauges
type(gaugingstation), public gauge
integer(i4), dimension(:), allocatable, public l11_fromn
real(dp), dimension(:), allocatable, public l11_length
integer(i4), dimension(:), allocatable, public l11_ton
type(grid), dimension(:), allocatable, target, public level11
real(dp), dimension(:), allocatable, public l11_slope
integer(i4), dimension(:), allocatable, public l11_noutlets
integer(i4), public ninflowgaugestotal
integer(i4), dimension(:), allocatable, public l11_rorder
Module to write ascii file output.
subroutine, public write_configfile(dirprecipitation, dirreferenceet, dirtemperature)
This modules writes the results of the configuration into an ASCII-file.
subroutine, public write_optinamelist(processmatrix, parameters, maskpara, parameters_name)
Write final, optimized parameter set in a namelist format.
subroutine, public write_optifile(best_of, best_paramset, param_names)
Write briefly final optimization results.