-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHMC_Module_Info_Point.f90
More file actions
237 lines (198 loc) · 10.9 KB
/
HMC_Module_Info_Point.f90
File metadata and controls
237 lines (198 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
!--------------------------------------------------------------------------------
! File: HMC_Module_Info_Point.f90
! Author(s): Fabio Delogu, Francesco Silvestro, Simone Gabellani
! Created on May, 20 2014, 9:57 AM
!
! Module to get info point
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Module Header
module HMC_Module_Info_Point
!--------------------------------------------------------------------------------
! External module(s) and implicit none
use HMC_Module_Namelist, only: oHMC_Namelist
use HMC_Module_Vars_Loader, only: oHMC_Vars
use HMC_Module_Tools_Debug
use HMC_Module_Tools_Generic, only: HMC_Tools_Generic_FindFileLength
implicit none
!--------------------------------------------------------------------------------
contains
!--------------------------------------------------------------------------------
! Subroutine to get section(s) dimension(s)
subroutine HMC_Info_Point_Section_GetDims(iID, iNSection)
!--------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
integer(kind = 4) :: iNSection
character(len = 256) :: sDomainName, sPathData
character(len = 700) :: sFileName
logical :: bFileExist
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Initialize variable(s)
iNSection = -9999;
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Get information
sDomainName = oHMC_Namelist(iID)%sDomainName
sPathData = oHMC_Namelist(iID)%sPathData_Static_Point
! Info
call mprintf(.true., iINFO_Main, ' Define section data dims ... ')
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Get Lake(s) dims
sFileName = trim(sPathData)//trim(sDomainName)//'.info_section.txt'
inquire (file = trim(sFileName), exist = bFileExist)
if ( .not. bFileExist ) then
call mprintf(.true., iWARN, 'No section file info found '//trim(sFileName) )
iNSection = -9999;
else
! Open and read ASCII grid file
open(unit = 1,file=trim(sFileName), status='old')
call HMC_Tools_Generic_FindFileLength(1, iNSection, 0)
close(1)
endif
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Dims from local to global workspace
oHMC_Namelist(iID)%iNSection = iNSection
! Info
call mprintf(.true., iINFO_Main, ' Define section data dims ... OK')
!--------------------------------------------------------------------------------
end subroutine HMC_Info_Point_Section_GetDims
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Subroutine to get water-body dimension(s)
subroutine HMC_Info_Point_WaterBody_GetDims(iID, iNLake)
!--------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
integer(kind = 4) :: iNLake
character(len = 256) :: sDomainName, sPathData
character(len = 700) :: sFileName
logical :: bFileExist
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Initialize variable(s)
iNLake = -9999;
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Get information
sDomainName = oHMC_Namelist(iID)%sDomainName
sPathData = oHMC_Namelist(iID)%sPathData_Static_Point
! Info
call mprintf(.true., iINFO_Main, ' Define lake(s) data dims ... ')
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Get Lake(s) dims
sFileName = trim(sPathData)//trim(sDomainName)//'.info_lake.txt'
inquire (file = trim(sFileName), exist = bFileExist)
if ( .not. bFileExist ) then
call mprintf(.true., iWARN, 'No lake(s) file info found '//trim(sFileName) )
iNLake = -9999;
else
! Open and read ASCII grid file
open(unit = 1,file=trim(sFileName), status='old')
read(1,*) iNLake
close(1)
endif
!--------------------------------------------------------------------------------
!--------------------------------------------------------------------------------
! Dims from local to global workspace
oHMC_Namelist(iID)%iNLake = iNLake
! Info
call mprintf(.true., iINFO_Main, ' Define lake(s) data dims ... OK')
!--------------------------------------------------------------------------------
end subroutine HMC_Info_Point_WaterBody_GetDims
!--------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Subroutine to get water-body dimension(s)
subroutine HMC_Info_Point_HydraulicStructure_GetDims(iID, &
iNDam, iNPlant, iNJoint, iNCatch, iNRelease)
!------------------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
integer(kind = 4) :: iNDam, iNPlant, iNJoint, iNCatch, iNRelease
character(len = 256) :: sDomainName, sPathData
character(len = 700) :: sFileName
logical :: bFileExist
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Initialize variable(s)
iNDam = -9999; iNPlant = -9999;
iNJoint = -9999;
iNCatch = -9999; iNRelease = -9999;
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get information
sDomainName = oHMC_Namelist(iID)%sDomainName
sPathData = oHMC_Namelist(iID)%sPathData_Static_Point
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get dam(s)
call mprintf(.true., iINFO_Main, ' Define dam(s) data dims ... ')
! Get filename
sFileName = trim(sPathData)//trim(sDomainName)//'.info_dam.txt'
inquire (file = trim(sFileName), exist = bFileExist)
if ( .not. bFileExist ) then
call mprintf(.true., iWARN, 'No dam(s) file info found '//trim(sFileName) )
iNDam = -9999; iNPlant = -9999
else
! Open and read ascii grid file
open(unit = 1,file=sFileName, status='old')
read(1,*) iNDam
read(1,*) iNPlant
close(1)
endif
! Info
call mprintf(.true., iINFO_Main, ' Define dam(s) data dims ... OK')
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get joint(s)
call mprintf(.true., iINFO_Main, ' Define joint(s) data dims ... ')
! Get filename
sFileName = trim(sPathData)//trim(sDomainName)//'.info_joint.txt'
inquire (file = trim(sFileName), exist = bFileExist)
if ( .not. bFileExist ) then
call mprintf(.true., iWARN, 'No joint(s) file info found '//trim(sFileName) )
iNJoint = -9999;
else
! Open and read ascii grid file
open(unit = 1,file=sFileName, status='old')
read(1,*) iNJoint
close(1)
endif
! Info
call mprintf(.true., iINFO_Main, ' Define joint(s) data dims ... OK')
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get intake(s)
call mprintf(.true., iINFO_Main, ' Define intake(s) data dims ... ')
! Get filename
sFileName = trim(sPathData)//trim(sDomainName)//'.info_intake.txt'
inquire (file = trim(sFileName), exist = bFileExist)
if ( .not. bFileExist ) then
call mprintf(.true., iWARN, 'No intake(s) file info found '//trim(sFileName) )
iNCatch = -9999; iNRelease = -9999;
else
! Open and read ascii grid file
open(unit = 1,file=sFileName, status='old')
read(1,*) iNCatch
read(1,*) iNRelease
close(1)
endif
! Info
call mprintf(.true., iINFO_Main, ' Define intake(s) data dims ... OK')
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Dims from local to global workspace
oHMC_Namelist(iID)%iNDam = iNDam
oHMC_Namelist(iID)%iNPlant = iNPlant
oHMC_Namelist(iID)%iNJoint = iNJoint
oHMC_Namelist(iID)%iNCatch = iNCatch
oHMC_Namelist(iID)%iNRelease = iNRelease
!------------------------------------------------------------------------------------------
end subroutine HMC_Info_Point_HydraulicStructure_GetDims
!------------------------------------------------------------------------------------------
end module HMC_Module_Info_Point
!--------------------------------------------------------------------------------