479
482
483 class(GwtExchangeType) :: this
484 class(GwtModelType), pointer :: model
485
486 character(len=LENBOUNDNAME) :: bname
487 character(len=LENPACKAGENAME + 4) :: packname
488 character(len=LENBUDTXT), dimension(1) :: budtxt
489 type(TableType), pointer :: output_tab
490 class(VirtualModelType), pointer :: nbr_model
491 character(len=20) :: nodestr
492 integer(I4B) :: ntabrows
493 integer(I4B) :: nodeu
494 integer(I4B) :: i, n1, n2, n1u, n2u
495 integer(I4B) :: ibinun
496 real(DP) :: ratin, ratout, rrate
497 logical(LGP) :: is_for_model1
498 integer(I4B) :: isuppress_output
499 real(DP), dimension(this%naux) :: auxrow
500
501
502 isuppress_output = 0
503 budtxt(1) = ' FLOW-JA-FACE'
504 packname = 'EXG '//this%name
505 packname = adjustr(packname)
506 if (associated(model, this%gwtmodel1)) then
507 output_tab => this%outputtab1
508 nbr_model => this%v_model2
509 is_for_model1 = .true.
510 else
511 output_tab => this%outputtab2
512 nbr_model => this%v_model1
513 is_for_model1 = .false.
514 end if
515
516
517 if (this%iprflow /= 0) then
518
519
520 if (model%oc%oc_save('BUDGET')) then
521 call output_tab%set_title(packname)
522 end if
523
524
525 call output_tab%set_kstpkper(
kstp,
kper)
526
527
528 ntabrows = 0
529 do i = 1, this%nexg
530 n1 = this%nodem1(i)
531 n2 = this%nodem2(i)
532
533
534 if (this%v_model1%ibound%get(n1) /= 0 .and. &
535 this%v_model2%ibound%get(n2) /= 0) then
536 ntabrows = ntabrows + 1
537 end if
538 end do
539 if (ntabrows > 0) then
540 call output_tab%set_maxbound(ntabrows)
541 end if
542 end if
543
544
545
546
547 if (this%ipakcb /= 0) then
548 ibinun = model%oc%oc_save_unit('BUDGET')
549 else
550 ibinun = 0
551 end if
552
553
554
555 if (.not. model%oc%oc_save('BUDGET')) ibinun = 0
556 if (isuppress_output /= 0) then
557 ibinun = 0
558 end if
559
560
561 if (ibinun /= 0) then
562 call model%dis%record_srcdst_list_header(budtxt(1), &
563 model%name, &
564 this%name, &
565 nbr_model%name, &
566 this%name, &
567 this%naux, this%auxname, &
568 ibinun, this%nexg, &
569 model%iout)
570 end if
571
572
575
576
577 do i = 1, this%nexg
578
579
580 if (this%inamedbound > 0) then
581 bname = this%boundname(i)
582 else
583 bname = ''
584 end if
585
586
588 n1 = this%nodem1(i)
589 n2 = this%nodem2(i)
590
591
592 if (this%v_model1%ibound%get(n1) /= 0 .and. &
593 this%v_model2%ibound%get(n2) /= 0) then
594 rrate = this%simvals(i)
595
596
597 if (this%iprflow /= 0) then
598 if (model%oc%oc_save('BUDGET')) then
599
600
601 if (is_for_model1) then
602 nodeu = model%dis%get_nodeuser(n1)
603 call model%dis%nodeu_to_string(nodeu, nodestr)
604 call output_tab%print_list_entry(i, trim(adjustl(nodestr)), &
605 rrate, bname)
606 else
607 nodeu = model%dis%get_nodeuser(n2)
608 call model%dis%nodeu_to_string(nodeu, nodestr)
609 call output_tab%print_list_entry(i, trim(adjustl(nodestr)), &
610 -rrate, bname)
611 end if
612 end if
613 end if
614 if (rrate <
dzero)
then
615 ratout = ratout - rrate
616 else
617 ratin = ratin + rrate
618 end if
619 end if
620
621
622 n1u = this%v_model1%dis_get_nodeuser(n1)
623 n2u = this%v_model2%dis_get_nodeuser(n2)
624 if (ibinun /= 0) then
625 if (this%naux > 0) then
626 auxrow(:) = this%auxvar(:, i)
627 end if
628 if (is_for_model1) then
629 call model%dis%record_mf6_list_entry( &
630 ibinun, n1u, n2u, rrate, this%naux, auxrow, &
631 .false., .false.)
632 else
633 call model%dis%record_mf6_list_entry( &
634 ibinun, n2u, n1u, -rrate, this%naux, auxrow, &
635 .false., .false.)
636 end if
637 end if
638
639 end do
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number