You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CALL CheckError( ErrStat2, ErrMsg2 ); IF (ErrStat >= AbortErrLev) RETURN
552
558
CALL getDepthFromBathymetry(m%BathymetryGrid, m%BathGrid_Xs, m%BathGrid_Ys, 0.0_DbKi, 0.0_DbKi, p%WtrDpth, nvec) ! set depth at 0,0 as nominal for waves etc
553
559
554
560
@@ -1254,10 +1260,6 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
1254
1260
IF (SUM(m%RodList(l)%OutFlagList) > 0) m%RodList(l)%OutFlagList(1) =1! this first entry signals whether to create any output file at all
1255
1261
! the above letter-index combinations define which OutFlagList entry corresponds to which output type
READ(UnCoef,'(A)',IOSTAT=ErrStat4) Line2 ! skip the first title line
186
194
READ(UnCoef,*,IOSTAT=ErrStat4) nGridX_string, nGridX ! read in the second line as the number of x values in the BathGrid
187
195
READ(UnCoef,*,IOSTAT=ErrStat4) nGridY_string, nGridY ! read in the third line as the number of y values in the BathGrid
188
196
197
+
! error check that the number of x and y values were read in correctly
198
+
IF (ErrStat4 /=0) THEN
199
+
CALL SetErrStat(ErrID_Fatal, "Error reading the number of x and y values from the bathymetry file "//TRIM(inputString), ErrStat3, ErrMsg3, 'MDIO_getBathymetry')
200
+
CLOSE (UnCoef)
201
+
RETURN
202
+
ENDIF
203
+
189
204
! Allocate the bathymetry matrix and associated grid x and y values
190
205
ALLOCATE(BathGrid(nGridY, nGridX), STAT=ErrStat4)
191
206
ALLOCATE(BathGrid_Xs(nGridX), STAT=ErrStat4)
192
207
ALLOCATE(BathGrid_Ys(nGridY), STAT=ErrStat4)
193
208
209
+
! Error check that allocation was successful
210
+
IF (ErrStat4 /=0) THEN
211
+
CALL SetErrStat(ErrID_Fatal, "Error allocating memory for the bathymetry grid from file "//TRIM(inputString), ErrStat3, ErrMsg3, 'MDIO_getBathymetry')
212
+
CLOSE (UnCoef)
213
+
RETURN
214
+
ENDIF
215
+
194
216
DO I =1, nGridY+1! loop through each line in the rest of the bathymetry file
195
217
196
218
READ(UnCoef,'(A)',IOSTAT=ErrStat4) Line2 ! read into a line and call it Line2
197
-
IF (ErrStat4 > 0) EXIT
198
219
199
220
IF (I==1) THEN! if it's the first line in the Bathymetry Grid, then it's a list of all the x values
200
221
READ(Line2, *,IOSTAT=ErrStat4) BathGrid_Xs
201
222
ELSE! if it's not the first line, then the first value is a y value and the rest are the depth values
CALL SetErrStat(ErrID_Fatal, "Error reading the bathymetry file "//TRIM(inputString)//" at table line "//trIM(Num2Lstr(I)), ErrStat3, ErrMsg3, 'MDIO_getBathymetry')
228
+
CLOSE (UnCoef)
229
+
RETURN
230
+
ENDIF
204
231
205
232
END DO
206
233
234
+
CLOSE (UnCoef)
235
+
207
236
IF (I < 2) THEN
208
-
ErrStat3 = ErrID_Fatal
209
-
ErrMsg3 ="Less than the minimum of 2 data lines found in file "//TRIM(inputString)
210
-
CLOSE (UnCoef)
237
+
CALL SetErrStat(ErrID_Fatal, "Less than the minimum of 2 data lines found in file "//TRIM(inputString), ErrStat3, ErrMsg3, 'MDIO_getBathymetry')
211
238
RETURN
212
-
ELSE
213
-
! BathGrid_npoints = nGridX*nGridY ! save the number of points in the grid
0 commit comments