Skip to content

Commit a8582ac

Browse files
committed
latest progress
1 parent d91d9c8 commit a8582ac

File tree

1 file changed

+76
-3
lines changed

1 file changed

+76
-3
lines changed

src/Model/GroundWaterEnergy/gwe-sfe.f90

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
! EXT-INFLOW idxbudiflw EXT-INFLOW rhow * cpw * q * tiflw
2121
! EXT-OUTFLOW idxbudoutf EXT-OUTFLOW rhow * cpw * q * tfeat
2222

23-
! -- terms not associated with SFR
24-
! STRMBD-COND none STRMBD-COND ctherm * (tcell - tfeat) (ctherm is a thermal conductance for the streambed)
23+
! -- SFE terms
24+
! STRMBD-COND idxbudsbcd STRMBD-COND ktf * wa / sbthk * (t_cell - t_feat)
25+
! SENSIBLE HEAT FLUX idxbudshf SENS HEAT cd * rho_a * C_p_a * wspd * (t_air - t_feat)
2526

2627
! -- terms from a flow file that should be skipped
2728
! CONSTANT none none none
@@ -102,6 +103,7 @@ module GweSfeModule
102103
procedure :: sfe_iflw_term
103104
procedure :: sfe_outf_term
104105
procedure, private :: sfe_sbcd_term
106+
procedure :: sfe_shf_term
105107
procedure :: pak_df_obs => sfe_df_obs
106108
procedure :: pak_rp_obs => sfe_rp_obs
107109
procedure :: pak_bd_obs => sfe_bd_obs
@@ -503,6 +505,17 @@ subroutine sfe_fc_expanded(this, rhs, ia, idxglo, matrix_sln)
503505
call matrix_sln%add_value_pos(ipossymoffd, hcofval)
504506
end if
505507
end do
508+
!
509+
! -- Add sensible heat flux contribution
510+
if (this%inshf /= 0) then
511+
do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
512+
call this%sfe_shf_term(j, n1, n2, rrate, rhsval, hcofval)
513+
iloc = this%idxlocnode(n1)
514+
iposd = this%idxpakdiag(n1)
515+
call matrix_sln%add_value_pos(iposd, hcofval)
516+
rhs(iloc) = rhs(iloc) + rhsval
517+
end do
518+
end if
506519
end subroutine sfe_fc_expanded
507520

508521
!> @ brief Add terms specific to sfr to the explicit sfe solve
@@ -556,6 +569,7 @@ subroutine sfe_solve(this)
556569
end if
557570
!
558571
! Note: explicit streambed conduction terms???
572+
! Note: explicit sensible heat flux terms?
559573
end subroutine sfe_solve
560574

561575
!> @brief Function to return the number of budget terms just for this package.
@@ -574,7 +588,8 @@ function sfe_get_nbudterms(this) result(nbudterms)
574588
! 3. runoff
575589
! 4. ext-inflow
576590
! 5. ext-outflow
577-
! 6. strmbd-cond
591+
! 6. strmbed-cond
592+
! 7. sensible heat flux
578593
nbudterms = 6
579594
end function sfe_get_nbudterms
580595

@@ -676,6 +691,28 @@ subroutine sfe_setup_budobj(this, idx)
676691
n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
677692
call this%budobj%budterm(idx)%update_term(n1, n2, q)
678693
end do
694+
!
695+
! -- Sensible heat flux
696+
if (this%inshf /= 0) then
697+
text = ' SENSIBLE-HEAT'
698+
idx = idx + 1
699+
maxlist = this%flowbudptr%budterm(this%idxbudsbcd)%maxlist
700+
naux = 0
701+
call this%budobj%budterm(idx)%initialize(text, &
702+
this%name_model, &
703+
this%packName, &
704+
this%name_model, &
705+
this%packName, &
706+
maxlist, .false., .false., &
707+
naux)
708+
call this%budobj%budterm(idx)%reset(maxlist)
709+
q = DZERO
710+
do n = 1, maxlist
711+
n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
712+
n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
713+
call this%budobj%budterm(idx)%update_term(n1, n2, q)
714+
end do
715+
end if
679716
end subroutine sfe_setup_budobj
680717

681718
!> @brief Copy flow terms into this%budobj
@@ -765,6 +802,18 @@ subroutine sfe_fill_budobj(this, idx, x, flowja, ccratin, ccratout)
765802
flowja(idiag) = flowja(idiag) - q
766803
end if
767804
end do
805+
!
806+
! -- Sensible-heat
807+
if (this%inshf /= 0) then
808+
idx = idx + 1
809+
nlist = this%flowbudptr%budterm(this%idxbudgwf)%nlist
810+
call this%budobj%budterm(idx)%reset(nlist)
811+
do j = 1, nlist
812+
call this%sfe_shf_term(j, n1, n2, q)
813+
call this%budobj%budterm(idx)%update_term(n1, n2, q)
814+
call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
815+
end do
816+
end if
768817
end subroutine sfe_fill_budobj
769818

770819
!> @brief Allocate scalars specific to the streamflow energy transport (SFE)
@@ -935,6 +984,30 @@ subroutine sfe_evap_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
935984
if (present(rhsval)) rhsval = -rrate
936985
if (present(hcofval)) hcofval = DZERO
937986
end subroutine sfe_evap_term
987+
988+
!> @brief Sensible Heat Flux (SHF) term
989+
!<
990+
subroutine sfe_shf_term(this, ientry, n1, n2, rrate, rhsval, hcofval)
991+
! -- dummy
992+
class(GweSfeType) :: this
993+
integer(I4B), intent(in) :: ientry
994+
integer(I4B), intent(inout) :: n1
995+
integer(I4B), intent(inout) :: n2
996+
real(DP), intent(inout), optional :: rrate
997+
real(DP), intent(inout), optional :: rhsval
998+
real(DP), intent(inout), optional :: hcofval
999+
! -- local
1000+
real(DP) :: sensheat
1001+
!
1002+
n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(ientry)
1003+
n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(ientry)
1004+
!
1005+
sensheat = 4180.0 ! Fix this value for now, eventually it will need to come from shf equantion
1006+
! and be multiplied by the shared surface area, I think.
1007+
if (present(rrate)) rrate = sensheat
1008+
if (present(rhsval)) rhsval = sensheat
1009+
if (present(hcofval)) hcofval = DZERO
1010+
end subroutine sfe_shf_term
9381011

9391012
!> @brief Runoff term
9401013
!<

0 commit comments

Comments
 (0)