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