445
452
453 class(FlowModelInterfaceType) :: this
454
455 integer(I4B) :: user_nodes
456 integer(I4B), allocatable :: idomain1d(:), idomain2d(:, :), idomain3d(:, :, :)
457
458 character(len=*), parameter :: fmtdiserr = &
459 "('Error in ',a,': Models do not have the same discretization. &
460 &GWF model has ', i0, ' user nodes, this model has ', i0, '. &
461 &Ensure discretization packages, including IDOMAIN, are identical.')"
462 character(len=*), parameter :: fmtidomerr = &
463 "('Error in ',a,': models do not have the same discretization. &
464 &Models have different IDOMAIN arrays. &
465 &Ensure discretization packages, including IDOMAIN, are identical.')"
466
467 call this%gfr%initialize(this%iugrb)
468
469
470 if (this%gfr%has_variable("ICELLTYPE")) then
471 this%igwfceltyp = 1
472 call mem_allocate(this%gwfceltyp, this%dis%nodesuser, &
473 'GWFCELTYP', this%memoryPath)
474 call this%gfr%read_int_1d_into("ICELLTYPE", this%gwfceltyp)
475 end if
476
477
478 select case (this%gfr%grid_type)
479 case ('DIS')
480 select type (dis => this%dis)
482 user_nodes = this%gfr%read_int("NCELLS")
483 if (user_nodes /= this%dis%nodesuser) then
484 write (errmsg, fmtdiserr) &
485 trim(this%text), user_nodes, this%dis%nodesuser
486 call store_error(errmsg, terminate=.true.)
487 end if
488 idomain1d = this%gfr%read_int_1d("IDOMAIN")
489 idomain3d = reshape(idomain1d, [ &
490 this%gfr%read_int("NCOL"), &
491 this%gfr%read_int("NROW"), &
492 this%gfr%read_int("NLAY") &
493 ])
494 if (.not. all(dis%idomain == idomain3d)) then
495 write (errmsg, fmtidomerr) trim(this%text)
496 call store_error(errmsg, terminate=.true.)
497 end if
498 end select
499 case ('DISV')
500 select type (dis => this%dis)
502 user_nodes = this%gfr%read_int("NCELLS")
503 if (user_nodes /= this%dis%nodesuser) then
504 write (errmsg, fmtdiserr) &
505 trim(this%text), user_nodes, this%dis%nodesuser
506 call store_error(errmsg, terminate=.true.)
507 end if
508 idomain1d = this%gfr%read_int_1d("IDOMAIN")
509 idomain2d = reshape(idomain1d, [ &
510 this%gfr%read_int("NCPL"), &
511 this%gfr%read_int("NLAY") &
512 ])
513 if (.not. all(dis%idomain == idomain2d)) then
514 write (errmsg, fmtidomerr) trim(this%text)
515 call store_error(errmsg, terminate=.true.)
516 end if
517 end select
518 case ('DISU')
519 select type (dis => this%dis)
521 user_nodes = this%gfr%read_int("NODES")
522 if (user_nodes /= this%dis%nodesuser) then
523 write (errmsg, fmtdiserr) &
524 trim(this%text), user_nodes, this%dis%nodesuser
525 call store_error(errmsg, terminate=.true.)
526 end if
527 idomain1d = this%gfr%read_int_1d("IDOMAIN")
528 if (.not. all(dis%idomain == idomain1d)) then
529 write (errmsg, fmtidomerr) trim(this%text)
530 call store_error(errmsg, terminate=.true.)
531 end if
532 end select
533 case ('DIS2D')
534 select type (dis => this%dis)
536 user_nodes = this%gfr%read_int("NCELLS")
537 if (user_nodes /= this%dis%nodesuser) then
538 write (errmsg, fmtdiserr) &
539 trim(this%text), user_nodes, this%dis%nodesuser
540 call store_error(errmsg, terminate=.true.)
541 end if
542 idomain1d = this%gfr%read_int_1d("IDOMAIN")
543 idomain2d = reshape(idomain1d, [ &
544 this%gfr%read_int("NCOL"), &
545 this%gfr%read_int("NROW") &
546 ])
547 if (.not. all(dis%idomain == idomain2d)) then
548 write (errmsg, fmtidomerr) trim(this%text)
549 call store_error(errmsg, terminate=.true.)
550 end if
551 end select
552 case ('DISV2D')
553 select type (dis => this%dis)
555 user_nodes = this%gfr%read_int("NODES")
556 if (user_nodes /= this%dis%nodesuser) then
557 write (errmsg, fmtdiserr) &
558 trim(this%text), user_nodes, this%dis%nodesuser
559 call store_error(errmsg, terminate=.true.)
560 end if
561 idomain1d = this%gfr%read_int_1d("IDOMAIN")
562 if (.not. all(dis%idomain == idomain1d)) then
563 write (errmsg, fmtidomerr) trim(this%text)
564 call store_error(errmsg, terminate=.true.)
565 end if
566 end select
567 case ('DISV1D')
568 select type (dis => this%dis)
570 user_nodes = this%gfr%read_int("NCELLS")
571 if (user_nodes /= this%dis%nodesuser) then
572 write (errmsg, fmtdiserr) &
573 trim(this%text), user_nodes, this%dis%nodesuser
574 call store_error(errmsg, terminate=.true.)
575 end if
576 idomain1d = this%gfr%read_int_1d("IDOMAIN")
577 if (.not. all(dis%idomain == idomain1d)) then
578 write (errmsg, fmtidomerr) trim(this%text)
579 call store_error(errmsg, terminate=.true.)
580 end if
581 end select
582 end select
583
584 if (allocated(idomain3d)) deallocate (idomain3d)
585 if (allocated(idomain2d)) deallocate (idomain2d)
586 if (allocated(idomain1d)) deallocate (idomain1d)
587
588 call this%gfr%finalize()
Structured grid discretization.
Structured grid discretization.
Unstructured grid discretization.
Vertex grid discretization.
Vertex grid discretization.