347 class(FlowModelInterfaceType) :: this
349 character(len=LINELENGTH) :: keyword, fname
351 integer(I4B) :: inunit
353 integer(I4B) :: user_nodes
354 logical :: isfound, endOfBlock
355 logical :: blockrequired
357 integer(I4B),
allocatable :: idomain1d(:), idomain2d(:, :), idomain3d(:, :, :)
359 character(len=*),
parameter :: fmtdiserr = &
360 "('Error in ',a,': Models do not have the same discretization. &
361 &GWF model has ', i0, ' user nodes, this model has ', i0, '. &
362 &Ensure discretization packages, including IDOMAIN, are identical.')"
363 character(len=*),
parameter :: fmtidomerr = &
364 "('Error in ',a,': models do not have the same discretization. &
365 &Models have different IDOMAIN arrays. &
366 &Ensure discretization packages, including IDOMAIN, are identical.')"
370 blockrequired = .true.
373 call this%parser%GetBlock(
'PACKAGEDATA', isfound, ierr, &
374 blockrequired=blockrequired, &
375 supportopenclose=.true.)
379 write (this%iout,
'(1x,a)')
'PROCESSING FMI PACKAGEDATA'
381 call this%parser%GetNextLine(endofblock)
383 call this%parser%GetStringCaps(keyword)
384 select case (keyword)
386 call this%parser%GetStringCaps(keyword)
387 if (keyword /=
'FILEIN')
then
388 call store_error(
'GWFBUDGET KEYWORD MUST BE FOLLOWED BY '// &
389 '"FILEIN" then by filename.')
390 call this%parser%StoreErrorUnit()
392 call this%parser%GetString(fname)
394 inquire (file=trim(fname), exist=exist)
395 if (.not. exist)
then
396 call store_error(
'Could not find file '//trim(fname))
397 call this%parser%StoreErrorUnit()
399 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
402 call this%initialize_bfr()
404 call this%parser%GetStringCaps(keyword)
405 if (keyword /=
'FILEIN')
then
406 call store_error(
'GWFHEAD KEYWORD MUST BE FOLLOWED BY '// &
407 '"FILEIN" then by filename.')
408 call this%parser%StoreErrorUnit()
410 call this%parser%GetString(fname)
411 inquire (file=trim(fname), exist=exist)
412 if (.not. exist)
then
413 call store_error(
'Could not find file '//trim(fname))
414 call this%parser%StoreErrorUnit()
417 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
420 call this%initialize_hfr()
422 call this%parser%GetStringCaps(keyword)
423 if (keyword /=
'FILEIN')
then
424 call store_error(
'GWFMOVER KEYWORD MUST BE FOLLOWED BY '// &
425 '"FILEIN" then by filename.')
426 call this%parser%StoreErrorUnit()
428 call this%parser%GetString(fname)
430 call openfile(inunit, this%iout, fname,
'DATA(BINARY)',
form, &
433 call budgetobject_cr_bfr(this%mvrbudobj,
'MVT', this%iumvr, &
435 call this%mvrbudobj%fill_from_bfr(this%dis, this%iout)
437 call this%parser%GetStringCaps(keyword)
438 if (keyword /=
'FILEIN')
then
439 call store_error(
'GWFGRID KEYWORD MUST BE FOLLOWED BY '// &
440 '"FILEIN" then by filename.')
441 call this%parser%StoreErrorUnit()
443 call this%parser%GetString(fname)
445 call openfile(inunit, this%iout, fname,
'DATA(BINARY)', &
448 call this%gfr%initialize(this%iugrb)
451 select case (this%gfr%grid_type)
453 select type (dis => this%dis)
455 user_nodes = this%gfr%read_int(
"NCELLS")
456 if (user_nodes /= this%dis%nodesuser)
then
457 write (errmsg, fmtdiserr) &
458 trim(this%text), user_nodes, this%dis%nodesuser
461 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
462 idomain3d = reshape(idomain1d, [ &
463 this%gfr%read_int(
"NCOL"), &
464 this%gfr%read_int(
"NROW"), &
465 this%gfr%read_int(
"NLAY") &
467 if (.not. all(dis%idomain == idomain3d))
then
468 write (errmsg, fmtidomerr) trim(this%text)
473 select type (dis => this%dis)
475 user_nodes = this%gfr%read_int(
"NCELLS")
476 if (user_nodes /= this%dis%nodesuser)
then
477 write (errmsg, fmtdiserr) &
478 trim(this%text), user_nodes, this%dis%nodesuser
481 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
482 idomain2d = reshape(idomain1d, [ &
483 this%gfr%read_int(
"NCPL"), &
484 this%gfr%read_int(
"NLAY") &
486 if (.not. all(dis%idomain == idomain2d))
then
487 write (errmsg, fmtidomerr) trim(this%text)
492 select type (dis => this%dis)
494 user_nodes = this%gfr%read_int(
"NODES")
495 if (user_nodes /= this%dis%nodesuser)
then
496 write (errmsg, fmtdiserr) &
497 trim(this%text), user_nodes, this%dis%nodesuser
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 user_nodes = this%gfr%read_int(
"NCELLS")
510 if (user_nodes /= this%dis%nodesuser)
then
511 write (errmsg, fmtdiserr) &
512 trim(this%text), user_nodes, this%dis%nodesuser
515 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
516 idomain2d = reshape(idomain1d, [ &
517 this%gfr%read_int(
"NCOL"), &
518 this%gfr%read_int(
"NROW") &
520 if (.not. all(dis%idomain == idomain2d))
then
521 write (errmsg, fmtidomerr) trim(this%text)
526 select type (dis => this%dis)
528 user_nodes = this%gfr%read_int(
"NODES")
529 if (user_nodes /= this%dis%nodesuser)
then
530 write (errmsg, fmtdiserr) &
531 trim(this%text), user_nodes, this%dis%nodesuser
534 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
535 if (.not. all(dis%idomain == idomain1d))
then
536 write (errmsg, fmtidomerr) trim(this%text)
541 select type (dis => this%dis)
543 user_nodes = this%gfr%read_int(
"NCELLS")
544 if (user_nodes /= this%dis%nodesuser)
then
545 write (errmsg, fmtdiserr) &
546 trim(this%text), user_nodes, this%dis%nodesuser
549 idomain1d = this%gfr%read_int_1d(
"IDOMAIN")
550 if (.not. all(dis%idomain == idomain1d))
then
551 write (errmsg, fmtidomerr) trim(this%text)
557 if (
allocated(idomain3d))
deallocate (idomain3d)
558 if (
allocated(idomain2d))
deallocate (idomain2d)
559 if (
allocated(idomain1d))
deallocate (idomain1d)
561 call this%gfr%finalize()
563 write (errmsg,
'(a,3(1x,a))') &
564 'UNKNOWN', trim(adjustl(this%text)),
'PACKAGEDATA:', trim(keyword)
568 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.