347 class(FlowModelInterfaceType) :: this
349 character(len=LINELENGTH) :: keyword, fname
351 integer(I4B) :: inunit
353 integer(I4B) :: nodes
354 logical :: isfound, endOfBlock
355 logical :: blockrequired
357 integer(I4B),
allocatable :: idomain1d(:), idomain2d(:, :), idomain3d(:, :, :)
359 character(len=*),
parameter :: fmtdiserr = &
360 "('Models do not have the same discretization&
362 & GWF model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
363 & This model has ', i0, ' user nodes and ', i0, ' reduced nodes.&
364 & Ensure discretization packages, including IDOMAIN, are identical.')"
365 character(len=*),
parameter :: fmtidomerr = &
366 "('Models do not have the same discretization&
368 & Models have different IDOMAIN arrays.&
369 & Ensure discretization packages, including IDOMAIN, are identical.')"
373 blockrequired = .true.
376 call this%parser%GetBlock(
'PACKAGEDATA', isfound, ierr, &
377 blockrequired=blockrequired, &
378 supportopenclose=.true.)
382 write (this%iout,
'(1x,a)')
'PROCESSING FMI PACKAGEDATA'
384 call this%parser%GetNextLine(endofblock)
386 call this%parser%GetStringCaps(keyword)
387 select case (keyword)
389 call this%parser%GetStringCaps(keyword)
390 if (keyword /=
'FILEIN')
then
391 call store_error(
'GWFBUDGET KEYWORD MUST BE FOLLOWED BY '// &
392 '"FILEIN" then by filename.')
393 call this%parser%StoreErrorUnit()
395 call this%parser%GetString(fname)
397 inquire (file=trim(fname), exist=exist)
398 if (.not. exist)
then
399 call store_error(
'Could not find file '//trim(fname))
400 call this%parser%StoreErrorUnit()
402 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
405 call this%initialize_bfr()
407 call this%parser%GetStringCaps(keyword)
408 if (keyword /=
'FILEIN')
then
409 call store_error(
'GWFHEAD KEYWORD MUST BE FOLLOWED BY '// &
410 '"FILEIN" then by filename.')
411 call this%parser%StoreErrorUnit()
413 call this%parser%GetString(fname)
414 inquire (file=trim(fname), exist=exist)
415 if (.not. exist)
then
416 call store_error(
'Could not find file '//trim(fname))
417 call this%parser%StoreErrorUnit()
420 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
423 call this%initialize_hfr()
425 call this%parser%GetStringCaps(keyword)
426 if (keyword /=
'FILEIN')
then
427 call store_error(
'GWFMOVER KEYWORD MUST BE FOLLOWED BY '// &
428 '"FILEIN" then by filename.')
429 call this%parser%StoreErrorUnit()
431 call this%parser%GetString(fname)
433 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
436 call budgetobject_cr_bfr(this%mvrbudobj,
'MVT', this%iumvr, &
438 call this%mvrbudobj%fill_from_bfr(this%dis, this%iout)
440 call this%parser%GetStringCaps(keyword)
441 if (keyword /=
'FILEIN')
then
442 call store_error(
'GWFGRID KEYWORD MUST BE FOLLOWED BY '// &
443 '"FILEIN" then by filename.')
444 call this%parser%StoreErrorUnit()
446 call this%parser%GetString(fname)
448 call openfile(inunit, this%iout, fname,
'DATA(BINARY)', &
451 call this%gfr%initialize(this%iugrb)
454 select case (this%gfr%grid_type)
456 select type (dis => this%dis)
458 nodes = this%gfr%read_int(
"NCELLS")
459 if (nodes /= this%dis%nodes)
then
460 write (errmsg, fmtdiserr) trim(this%text)
463 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
464 idomain3d = reshape(idomain1d, [ &
465 this%gfr%read_int(
"NCOL"), &
466 this%gfr%read_int(
"NROW"), &
467 this%gfr%read_int(
"NLAY") &
469 if (.not. all(dis%idomain == idomain3d))
then
470 write (errmsg, fmtidomerr) trim(this%text)
475 select type (dis => this%dis)
477 nodes = this%gfr%read_int(
"NCELLS")
478 if (nodes /= this%dis%nodes)
then
479 write (errmsg, fmtdiserr) trim(this%text)
482 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
483 idomain2d = reshape(idomain1d, [ &
484 this%gfr%read_int(
"NCPL"), &
485 this%gfr%read_int(
"NLAY") &
487 if (.not. all(dis%idomain == idomain2d))
then
488 write (errmsg, fmtidomerr) trim(this%text)
493 select type (dis => this%dis)
495 nodes = this%gfr%read_int(
"NODES")
496 if (nodes /= this%dis%nodes)
then
497 write (errmsg, fmtdiserr) trim(this%text)
500 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
501 if (.not. all(dis%idomain == idomain1d))
then
502 write (errmsg, fmtidomerr) trim(this%text)
507 select type (dis => this%dis)
509 nodes = this%gfr%read_int(
"NCELLS")
510 if (nodes /= this%dis%nodes)
then
511 write (errmsg, fmtdiserr) trim(this%text)
514 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
515 idomain2d = reshape(idomain1d, [ &
516 this%gfr%read_int(
"NCOL"), &
517 this%gfr%read_int(
"NROW") &
519 if (.not. all(dis%idomain == idomain2d))
then
520 write (errmsg, fmtidomerr) trim(this%text)
525 select type (dis => this%dis)
527 nodes = this%gfr%read_int(
"NODES")
528 if (nodes /= this%dis%nodes)
then
529 write (errmsg, fmtdiserr) trim(this%text)
532 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
533 if (.not. all(dis%idomain == idomain1d))
then
534 write (errmsg, fmtidomerr) trim(this%text)
539 select type (dis => this%dis)
541 nodes = this%gfr%read_int(
"NCELLS")
542 if (nodes /= this%dis%nodes)
then
543 write (errmsg, fmtdiserr) trim(this%text)
546 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
547 if (.not. all(dis%idomain == idomain1d))
then
548 write (errmsg, fmtidomerr) trim(this%text)
554 if (
allocated(idomain3d))
deallocate (idomain3d)
555 if (
allocated(idomain2d))
deallocate (idomain2d)
556 if (
allocated(idomain1d))
deallocate (idomain1d)
558 call this%gfr%finalize()
560 write (errmsg,
'(a,3(1x,a))') &
561 'UNKNOWN', trim(adjustl(this%text)),
'PACKAGEDATA:', trim(keyword)
565 write (this%iout,
'(1x,a)')
'END OF FMI PACKAGEDATA'
integer(i4b), parameter lenpackagename
maximum length of the package name
Structured grid discretization.
Structured grid discretization.
Unstructured grid discretization.
Vertex grid discretization.
Vertex grid discretization.