Skip to content

Commit c5da9b3

Browse files
refactor(debug): fix source to allow debug executable to run tests (#1959)
* refactor(debug): changes to allow debug version to run tests * allow zero-sized auxvar to be passed properly without array bounds runtime error * convert charstring routine to recursive to allow operator overloading to work with debug * fprettify * remove gfortran-12 macos pin
1 parent 1fd801d commit c5da9b3

File tree

10 files changed

+42
-21
lines changed

10 files changed

+42
-21
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ jobs:
222222
repository: MODFLOW-USGS/modflow6-examples
223223
path: modflow6-examples
224224

225-
- name: Setup ${{ env.FC }} ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || env.FC_V }}
225+
- name: Setup ${{ env.FC }} ${{ env.FC_V }}
226226
uses: fortran-lang/setup-fortran@v1
227227
with:
228228
compiler: gcc
229-
version: ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || env.FC_V }}
229+
version: ${{ env.FC_V }}
230230

231231
- name: Setup pixi
232232
uses: prefix-dev/[email protected]

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ jobs:
127127
bash
128128
powershell
129129
130-
- name: Setup ${{ matrix.compiler }} ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || matrix.version }}
130+
- name: Setup ${{ matrix.compiler }} ${{ matrix.version }}
131131
if: (!(runner.os == 'Windows' && matrix.parallel))
132132
id: setup-fortran
133133
uses: fortran-lang/setup-fortran@v1
134134
with:
135135
compiler: ${{ matrix.compiler }}
136-
version: ${{ contains(fromJSON('["macos-14"]'), matrix.os) && 12 || matrix.version }}
136+
version: ${{ matrix.version }}
137137

138138
- name: Set version number
139139
id: set_version

src/Exchange/exg-gwegwe.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ subroutine gwe_gwe_bdsav_model(this, model)
495495
real(DP) :: ratin, ratout, rrate
496496
logical(LGP) :: is_for_model1
497497
integer(I4B) :: isuppress_output
498+
real(DP), dimension(this%naux) :: auxrow
498499
!
499500
! -- initialize local variables
500501
isuppress_output = 0
@@ -620,13 +621,16 @@ subroutine gwe_gwe_bdsav_model(this, model)
620621
n1u = this%v_model1%dis_get_nodeuser(n1)
621622
n2u = this%v_model2%dis_get_nodeuser(n2)
622623
if (ibinun /= 0) then
624+
if (this%naux > 0) then
625+
auxrow(:) = this%auxvar(:, i)
626+
end if
623627
if (is_for_model1) then
624628
call model%dis%record_mf6_list_entry( &
625-
ibinun, n1u, n2u, rrate, this%naux, this%auxvar(:, i), &
629+
ibinun, n1u, n2u, rrate, this%naux, auxrow, &
626630
.false., .false.)
627631
else
628632
call model%dis%record_mf6_list_entry( &
629-
ibinun, n2u, n1u, -rrate, this%naux, this%auxvar(:, i), &
633+
ibinun, n2u, n1u, -rrate, this%naux, auxrow, &
630634
.false., .false.)
631635
end if
632636
end if

src/Exchange/exg-gwfgwf.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ subroutine gwf_gwf_bdsav_model(this, model)
10681068
integer(I4B) :: ibinun
10691069
real(DP) :: ratin, ratout, rrate
10701070
logical(LGP) :: is_for_model1
1071+
real(DP), dimension(this%naux) :: auxrow
10711072
!
10721073
budtxt(1) = ' FLOW-JA-FACE'
10731074
packname = 'EXG '//this%name
@@ -1188,13 +1189,16 @@ subroutine gwf_gwf_bdsav_model(this, model)
11881189
n1u = this%v_model1%dis_get_nodeuser(n1)
11891190
n2u = this%v_model2%dis_get_nodeuser(n2)
11901191
if (ibinun /= 0) then
1192+
if (this%naux > 0) then
1193+
auxrow(:) = this%auxvar(:, i)
1194+
end if
11911195
if (is_for_model1) then
11921196
call model%dis%record_mf6_list_entry(ibinun, n1u, n2u, rrate, &
1193-
this%naux, this%auxvar(:, i), &
1197+
this%naux, auxrow, &
11941198
.false., .false.)
11951199
else
11961200
call model%dis%record_mf6_list_entry(ibinun, n2u, n1u, -rrate, &
1197-
this%naux, this%auxvar(:, i), &
1201+
this%naux, auxrow, &
11981202
.false., .false.)
11991203
end if
12001204
end if

src/Exchange/exg-gwtgwt.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ subroutine gwt_gwt_bdsav_model(this, model)
492492
real(DP) :: ratin, ratout, rrate
493493
logical(LGP) :: is_for_model1
494494
integer(I4B) :: isuppress_output
495+
real(DP), dimension(this%naux) :: auxrow
495496
!
496497
! -- initialize local variables
497498
isuppress_output = 0
@@ -617,13 +618,16 @@ subroutine gwt_gwt_bdsav_model(this, model)
617618
n1u = this%v_model1%dis_get_nodeuser(n1)
618619
n2u = this%v_model2%dis_get_nodeuser(n2)
619620
if (ibinun /= 0) then
621+
if (this%naux > 0) then
622+
auxrow(:) = this%auxvar(:, i)
623+
end if
620624
if (is_for_model1) then
621625
call model%dis%record_mf6_list_entry( &
622-
ibinun, n1u, n2u, rrate, this%naux, this%auxvar(:, i), &
626+
ibinun, n1u, n2u, rrate, this%naux, auxrow, &
623627
.false., .false.)
624628
else
625629
call model%dis%record_mf6_list_entry( &
626-
ibinun, n2u, n1u, -rrate, this%naux, this%auxvar(:, i), &
630+
ibinun, n2u, n1u, -rrate, this%naux, auxrow, &
627631
.false., .false.)
628632
end if
629633
end if

src/Exchange/exg-swfgwf.f90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ end subroutine swf_gwf_bdsav
10521052
! integer(I4B) :: ibinun
10531053
! real(DP) :: ratin, ratout, rrate
10541054
! logical(LGP) :: is_for_model1
1055+
! real(DP), dimension(this%naux) :: auxrow
10551056
! !
10561057
! budtxt(1) = ' FLOW-JA-FACE'
10571058
! packname = 'EXG '//this%name
@@ -1171,12 +1172,15 @@ end subroutine swf_gwf_bdsav
11711172
! n2u = this%v_model2%dis_get_nodeuser(n2)
11721173
! if (ibinun /= 0) then
11731174
! if (is_for_model1) then
1174-
! call model%dis%record_mf6_list_entry(ibinun, n1u, n2u, rrate, &
1175-
! this%naux, this%auxvar(:, i), &
1175+
! if (size(auxrow) > 0) then
1176+
! auxrow(:) = this%auxvar(:, i)
1177+
! end if
1178+
! call model%dis%record_mf6_list_entry(ibinun, n1u, n2u, rrate, &
1179+
! this%naux, auxrow, &
11761180
! .false., .false.)
11771181
! else
11781182
! call model%dis%record_mf6_list_entry(ibinun, n2u, n1u, -rrate, &
1179-
! this%naux, this%auxvar(:, i), &
1183+
! this%naux, auxrow, &
11801184
! .false., .false.)
11811185
! end if
11821186
! end if

src/Model/GroundWaterTransport/gwt-ist.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,13 @@ subroutine ist_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap)
523523
integer(I4B), intent(in) :: ibudfl !< flag indication if cell-by-cell data should be saved
524524
integer(I4B), intent(in) :: icbcun !< unit number for cell-by-cell output
525525
integer(I4B), dimension(:), optional, intent(in) :: imap !< mapping vector
526-
! -- loca
526+
! -- local
527527
integer(I4B) :: n
528528
integer(I4B) :: ibinun
529529
integer(I4B) :: nbound
530530
integer(I4B) :: naux
531531
real(DP) :: rate
532+
real(DP), dimension(0) :: auxrow
532533
!
533534
! -- Set unit number for binary output
534535
if (this%ipakcb < 0) then
@@ -566,7 +567,7 @@ subroutine ist_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap)
566567
! -- If saving cell-by-cell flows in list, write flow
567568
if (ibinun /= 0) then
568569
call this%dis%record_mf6_list_entry(ibinun, n, n, rate, &
569-
naux, this%auxvar(:, n), &
570+
naux, auxrow, &
570571
olconv=.TRUE., &
571572
olconv2=.TRUE.)
572573
end if

src/Model/ModelUtilities/BoundaryPackage.f90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,7 @@ subroutine save_print_model_flows(icbcfl, ibudfl, icbcun, iprflow, &
19621962
integer(I4B) :: ibinun
19631963
integer(I4B) :: nboundcount
19641964
real(DP) :: rrate
1965+
real(DP), dimension(naux) :: auxrow
19651966
! -- for observations
19661967
character(len=LENBOUNDNAME) :: bname
19671968
!
@@ -2051,8 +2052,11 @@ subroutine save_print_model_flows(icbcfl, ibudfl, icbcun, iprflow, &
20512052
if (ibinun /= 0) then
20522053
n2 = i
20532054
if (present(imap)) n2 = imap(i)
2055+
if (naux > 0) then
2056+
auxrow(:) = auxvar(:, i)
2057+
end if
20542058
call dis%record_mf6_list_entry(ibinun, node, n2, rrate, naux, &
2055-
auxvar(:, i), olconv2=.FALSE.)
2059+
auxrow, olconv2=.FALSE.)
20562060
end if
20572061
end if
20582062
!

src/Model/TransportModel/tsp-ssm.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,16 @@ subroutine ssm_ot_flow(this, icbcfl, ibudfl, icbcun)
565565
real(DP) :: qssm
566566
real(DP) :: cssm
567567
integer(I4B) :: naux
568-
real(DP), dimension(0, 0) :: auxvar
568+
real(DP), dimension(0) :: auxrow
569569
character(len=LENAUXNAME), dimension(0) :: auxname
570570
! -- for observations
571571
character(len=LENBOUNDNAME) :: bname
572572
! -- formats
573573
character(len=*), parameter :: fmttkk = &
574574
&"(1X,/1X,A,' PERIOD ',I0,' STEP ',I0)"
575575
!
576-
! -- set maxrows
576+
! -- initialize
577+
naux = 0
577578
maxrows = 0
578579
if (ibudfl /= 0 .and. this%iprflow /= 0) then
579580
call this%outputtab%set_kstpkper(kstp, kper)
@@ -608,7 +609,6 @@ subroutine ssm_ot_flow(this, icbcfl, ibudfl, icbcun)
608609
!
609610
! -- If cell-by-cell flows will be saved as a list, write header.
610611
if (ibinun /= 0) then
611-
naux = 0
612612
call this%dis%record_srcdst_list_header(text, this%name_model, &
613613
this%name_model, this%name_model, &
614614
this%packName, naux, auxname, &
@@ -652,7 +652,7 @@ subroutine ssm_ot_flow(this, icbcfl, ibudfl, icbcun)
652652
if (ibinun /= 0) then
653653
n2 = i
654654
call this%dis%record_mf6_list_entry(ibinun, node, n2, rrate, &
655-
naux, auxvar(:, i), &
655+
naux, auxrow, &
656656
olconv2=.FALSE.)
657657
end if
658658
!

src/Utilities/CharString.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module CharacterStringModule
4242

4343
contains
4444

45-
subroutine assign_to_charstring(lhs, rhs)
45+
recursive subroutine assign_to_charstring(lhs, rhs)
4646
class(CharacterStringType), intent(out) :: lhs
4747
character(len=*), intent(in) :: rhs
4848
logical :: allocate_charstring

0 commit comments

Comments
 (0)