Subroutine to write the cross-section tables to the model listing file.
573
574 class(SfrCrossSection) :: this
575 real(DP), dimension(this%nreaches), intent(in) :: widths
576 real(DP), dimension(this%nreaches), intent(in) :: roughs
577 integer(I4B), intent(in), optional :: kstp
578 integer(I4B), intent(in), optional :: kper
579
580 character(len=LINELENGTH) :: title
581 character(len=LINELENGTH) :: text
582 character(len=LINELENGTH) :: filename
583 character(len=10) :: cvalid
584 logical(LGP) :: transient
585 integer(I4B) :: kkstp
586 integer(I4B) :: kkper
587 integer(I4B) :: irch
588 integer(I4B) :: n
589 integer(I4B) :: ntabcols
590 integer(I4B) :: ninvalid_reaches
591 real(DP) :: width
592 real(DP) :: xfraction
593 real(DP) :: rough
594 real(DP) :: r
595 integer(I4B), dimension(this%nreaches) :: reach_fail
596
597
598 kkstp = 0
599 kkper = 0
600
601
602 if (present(kstp)) then
603 kkstp = kstp
604 end if
605 if (present(kper)) then
606 kkper = kper
607 end if
608
609
610 if (kkstp > 0 .and. kkper > 0) then
611 transient = .true.
612 else
613 transient = .false.
614 end if
615
616
617 do irch = 1, this%nreaches
618 filename = this%filenames(irch)
619 reach_fail(irch) = 0
620
621
622 if (trim(adjustl(filename)) /= 'NONE') then
623 do n = 1, this%npoints(irch)
624 if (.not. this%cross_sections(irch)%valid(n)) then
625 reach_fail(irch) = reach_fail(irch) + 1
626 end if
627 end do
628 end if
629 end do
630
631
632 do irch = 1, this%nreaches
633 filename = this%filenames(irch)
634
635
636 if (trim(adjustl(filename)) /= 'NONE') then
637
638
639
640 if (this%iprpak > 0 .or. reach_fail(irch) > 0) then
641
642
643 if (reach_fail(irch) > 0) then
644 ntabcols = 6
645 else
646 ntabcols = 5
647 end if
648
649
650 write (title, '(a,1x,i0,1x,3a)') &
651 'CROSS_SECTION DATA FOR REACH', irch, "FROM TAB6 FILE ('", &
652 trim(adjustl(filename)), "')"
653 call table_cr(this%inputtab, trim(adjustl(filename)), title)
654 call this%inputtab%table_df(this%npoints(irch), ntabcols, &
655 this%iout, finalize=.false., &
656 transient=transient)
657 if (transient) then
658 call this%inputtab%set_kstpkper(kkstp, kkper)
659 end if
660 text = 'XFRACTION'
661 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
662 text = 'STATION'
663 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
664 text = 'HEIGHT'
665 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
666 text = "MANFRACTION"
667 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
668 text = "MANNING'S ROUGHNESS COEFFICIENT"
669 call this%inputtab%initialize_column(text, 20, alignment=
tableft)
670 if (reach_fail(irch) > 0) then
671 text = 'NEEDS ADJUSTMENT'
672 call this%inputtab%initialize_column(text, 10, alignment=
tableft)
673 end if
674
675
676 width = widths(irch)
677 rough = roughs(irch)
678
679
680 do n = 1, this%npoints(irch)
681 xfraction = this%cross_sections(irch)%station(n) / width
682 r = this%cross_sections(irch)%roughfraction(n) * rough
683 call this%inputtab%add_term(xfraction)
684 call this%inputtab%add_term(this%cross_sections(irch)%station(n))
685 call this%inputtab%add_term(this%cross_sections(irch)%height(n))
686 call this%inputtab%add_term(&
687 &this%cross_sections(irch)%roughfraction(n))
688 call this%inputtab%add_term(r)
689 if (reach_fail(irch) > 0) then
690 if (this%cross_sections(irch)%valid(n)) then
691 cvalid = ''
692 else
693 cvalid = 'TRUE'
694 end if
695 call this%inputtab%add_term(cvalid)
696 end if
697 end do
698
699
700 call this%inputtab%finalize_table()
701 end if
702 end if
703 end do
704
705
706 if (this%invalid > 0) then
707 ninvalid_reaches = 0
708 do irch = 1, this%nreaches
709 if (reach_fail(irch) > 0) then
710 ninvalid_reaches = ninvalid_reaches + 1
711 end if
712 end do
713 write (warnmsg, '(a,1x,i0,7(1x,a))') &
714 'Cross-section data for', ninvalid_reaches, &
715 'reaches include one or more points that result in a', &
716 'non-unique depth-conveyance relation. This occurs when', &
717 'there are horizontal sections at non-zero heights', &
718 '(for example, flat overbank sections). This can usually', &
719 'be resolved by adding a small slope to these flat', &
720 'sections. See the cross-section tables in the model', &
721 'listing file for more information.'
723 end if
This module contains simulation constants.
@ tableft
left justified table column
This module contains simulation methods.
subroutine, public store_warning(msg, substring)
Store warning message.