MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
gwesfemodule Module Reference

Data Types

type  gwesfetype
 

Functions/Subroutines

subroutine, public sfe_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, gwecommon, dvt, dvu, dvua)
 Create a new sfe package. More...
 
subroutine find_sfe_package (this)
 Find corresponding sfe package. More...
 
subroutine sfe_fc_expanded (this, rhs, ia, idxglo, matrix_sln)
 Add matrix terms related to SFE. More...
 
subroutine sfe_solve (this)
 @ brief Add terms specific to sfr to the explicit sfe solve More...
 
integer(i4b) function sfe_get_nbudterms (this)
 Function to return the number of budget terms just for this package. More...
 
subroutine sfe_setup_budobj (this, idx)
 Set up the budget object that stores all the sfe flows. More...
 
subroutine sfe_fill_budobj (this, idx, x, flowja, ccratin, ccratout)
 Copy flow terms into thisbudobj. More...
 
subroutine allocate_scalars (this)
 Allocate scalars specific to the streamflow energy transport (SFE) package. More...
 
subroutine sfe_allocate_arrays (this)
 Allocate arrays specific to the streamflow energy transport (SFE) package. More...
 
subroutine sfe_da (this)
 Deallocate memory. More...
 
subroutine sfe_rain_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Rain term. More...
 
subroutine sfe_evap_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Evaporative term. More...
 
subroutine sfe_roff_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Runoff term. More...
 
subroutine sfe_iflw_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Inflow Term. More...
 
subroutine sfe_outf_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Outflow term. More...
 
subroutine sfe_df_obs (this)
 Observations. More...
 
subroutine sfe_rp_obs (this, obsrv, found)
 Process package specific obs. More...
 
subroutine sfe_bd_obs (this, obstypeid, jj, v, found)
 Calculate observation value and pass it back to APT. More...
 
subroutine sfe_set_stressperiod (this, itemno, keyword, found)
 Sets the stress period attributes for keyword use. More...
 

Variables

character(len= *), parameter ftype = 'SFE'
 
character(len= *), parameter flowtype = 'SFR'
 
character(len=16) text = ' SFE'
 

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine gwesfemodule::allocate_scalars ( class(gwesfetype this)
private

Definition at line 663 of file gwe-sfe.f90.

664  ! -- modules
666  ! -- dummy
667  class(GweSfeType) :: this
668  !
669  ! -- Allocate scalars in TspAptType
670  call this%TspAptType%allocate_scalars()
671  !
672  ! -- Allocate
673  call mem_allocate(this%idxbudrain, 'IDXBUDRAIN', this%memoryPath)
674  call mem_allocate(this%idxbudevap, 'IDXBUDEVAP', this%memoryPath)
675  call mem_allocate(this%idxbudroff, 'IDXBUDROFF', this%memoryPath)
676  call mem_allocate(this%idxbudiflw, 'IDXBUDIFLW', this%memoryPath)
677  call mem_allocate(this%idxbudoutf, 'IDXBUDOUTF', this%memoryPath)
678  call mem_allocate(this%idxbudsbcd, 'IDXBUDSBCD', this%memoryPath)
679  !
680  ! -- Initialize
681  this%idxbudrain = 0
682  this%idxbudevap = 0
683  this%idxbudroff = 0
684  this%idxbudiflw = 0
685  this%idxbudoutf = 0
686  this%idxbudsbcd = 0

◆ find_sfe_package()

subroutine gwesfemodule::find_sfe_package ( class(gwesfetype this)
private

Definition at line 161 of file gwe-sfe.f90.

162  ! -- modules
164  ! -- dummy
165  class(GweSfeType) :: this
166  ! -- local
167  character(len=LINELENGTH) :: errmsg
168  class(BndType), pointer :: packobj
169  integer(I4B) :: ip, icount
170  integer(I4B) :: nbudterm
171  logical :: found
172  !
173  ! -- Initialize found to false, and error later if flow package cannot
174  ! be found
175  found = .false.
176  !
177  ! -- If user is specifying flows in a binary budget file, then set up
178  ! the budget file reader, otherwise set a pointer to the flow package
179  ! budobj
180  if (this%fmi%flows_from_file) then
181  call this%fmi%set_aptbudobj_pointer(this%flowpackagename, this%flowbudptr)
182  if (associated(this%flowbudptr)) found = .true.
183  !
184  else
185  if (associated(this%fmi%gwfbndlist)) then
186  ! -- Look through gwfbndlist for a flow package with the same name as
187  ! this transport package name
188  do ip = 1, this%fmi%gwfbndlist%Count()
189  packobj => getbndfromlist(this%fmi%gwfbndlist, ip)
190  if (packobj%packName == this%flowpackagename) then
191  found = .true.
192  !
193  ! -- Store BndType pointer to packobj, and then
194  ! use the select type to point to the budobj in flow package
195  this%flowpackagebnd => packobj
196  select type (packobj)
197  type is (sfrtype)
198  this%flowbudptr => packobj%budobj
199  end select
200  end if
201  if (found) exit
202  end do
203  end if
204  end if
205  !
206  ! -- Error if flow package not found
207  if (.not. found) then
208  write (errmsg, '(a)') 'Could not find flow package with name '&
209  &//trim(adjustl(this%flowpackagename))//'.'
210  call store_error(errmsg)
211  call this%parser%StoreErrorUnit()
212  end if
213  !
214  ! -- Allocate space for idxbudssm, which indicates whether this is a
215  ! special budget term or one that is a general source and sink
216  nbudterm = this%flowbudptr%nbudterm
217  call mem_allocate(this%idxbudssm, nbudterm, 'IDXBUDSSM', this%memoryPath)
218  !
219  ! -- Process budget terms and identify special budget terms
220  write (this%iout, '(/, a, a)') &
221  'PROCESSING '//ftype//' INFORMATION FOR ', this%packName
222  write (this%iout, '(a)') ' IDENTIFYING FLOW TERMS IN '//flowtype//' PACKAGE'
223  write (this%iout, '(a, i0)') &
224  ' NUMBER OF '//flowtype//' = ', this%flowbudptr%ncv
225  icount = 1
226  do ip = 1, this%flowbudptr%nbudterm
227  select case (trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)))
228  case ('FLOW-JA-FACE')
229  this%idxbudfjf = ip
230  this%idxbudssm(ip) = 0
231  case ('GWF')
232  this%idxbudgwf = ip
233  this%idxbudssm(ip) = 0
234  case ('STORAGE')
235  this%idxbudsto = ip
236  this%idxbudssm(ip) = 0
237  case ('RAINFALL')
238  this%idxbudrain = ip
239  this%idxbudssm(ip) = 0
240  case ('EVAPORATION')
241  this%idxbudevap = ip
242  this%idxbudssm(ip) = 0
243  case ('RUNOFF')
244  this%idxbudroff = ip
245  this%idxbudssm(ip) = 0
246  case ('EXT-INFLOW')
247  this%idxbudiflw = ip
248  this%idxbudssm(ip) = 0
249  case ('EXT-OUTFLOW')
250  this%idxbudoutf = ip
251  this%idxbudssm(ip) = 0
252  case ('TO-MVR')
253  this%idxbudtmvr = ip
254  this%idxbudssm(ip) = 0
255  case ('FROM-MVR')
256  this%idxbudfmvr = ip
257  this%idxbudssm(ip) = 0
258  case ('AUXILIARY')
259  this%idxbudaux = ip
260  this%idxbudssm(ip) = 0
261  case default
262  !
263  ! -- Set idxbudssm equal to a column index for where the temperatures
264  ! are stored in the concbud(nbudssm, ncv) array
265  this%idxbudssm(ip) = icount
266  icount = icount + 1
267  end select
268  write (this%iout, '(a, i0, " = ", a,/, a, i0)') &
269  ' TERM ', ip, trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)), &
270  ' MAX NO. OF ENTRIES = ', this%flowbudptr%budterm(ip)%maxlist
271  end do
272  write (this%iout, '(a, //)') 'DONE PROCESSING '//ftype//' INFORMATION'
273  !
274  ! -- Streambed conduction term
275  this%idxbudsbcd = this%idxbudgwf
Here is the call graph for this function:

◆ sfe_allocate_arrays()

subroutine gwesfemodule::sfe_allocate_arrays ( class(gwesfetype), intent(inout)  this)

Definition at line 692 of file gwe-sfe.f90.

693  ! -- modules
695  ! -- dummy
696  class(GweSfeType), intent(inout) :: this
697  ! -- local
698  integer(I4B) :: n
699  !
700  ! -- Time series
701  call mem_allocate(this%temprain, this%ncv, 'TEMPRAIN', this%memoryPath)
702  call mem_allocate(this%tempevap, this%ncv, 'TEMPEVAP', this%memoryPath)
703  call mem_allocate(this%temproff, this%ncv, 'TEMPROFF', this%memoryPath)
704  call mem_allocate(this%tempiflw, this%ncv, 'TEMPIFLW', this%memoryPath)
705  !
706  ! -- Call standard TspAptType allocate arrays
707  call this%TspAptType%apt_allocate_arrays()
708  !
709  ! -- Initialize
710  do n = 1, this%ncv
711  this%temprain(n) = dzero
712  this%tempevap(n) = dzero
713  this%temproff(n) = dzero
714  this%tempiflw(n) = dzero
715  end do

◆ sfe_bd_obs()

subroutine gwesfemodule::sfe_bd_obs ( class(gwesfetype), intent(inout)  this,
character(len=*), intent(in)  obstypeid,
integer(i4b), intent(in)  jj,
real(dp), intent(inout)  v,
logical, intent(inout)  found 
)
private

Definition at line 978 of file gwe-sfe.f90.

979  ! -- dummy
980  class(GweSfeType), intent(inout) :: this
981  character(len=*), intent(in) :: obstypeid
982  real(DP), intent(inout) :: v
983  integer(I4B), intent(in) :: jj
984  logical, intent(inout) :: found
985  ! -- local
986  integer(I4B) :: n1, n2
987  !
988  found = .true.
989  select case (obstypeid)
990  case ('RAINFALL')
991  if (this%iboundpak(jj) /= 0) then
992  call this%sfe_rain_term(jj, n1, n2, v)
993  end if
994  case ('EVAPORATION')
995  if (this%iboundpak(jj) /= 0) then
996  call this%sfe_evap_term(jj, n1, n2, v)
997  end if
998  case ('RUNOFF')
999  if (this%iboundpak(jj) /= 0) then
1000  call this%sfe_roff_term(jj, n1, n2, v)
1001  end if
1002  case ('EXT-INFLOW')
1003  if (this%iboundpak(jj) /= 0) then
1004  call this%sfe_iflw_term(jj, n1, n2, v)
1005  end if
1006  case ('EXT-OUTFLOW')
1007  if (this%iboundpak(jj) /= 0) then
1008  call this%sfe_outf_term(jj, n1, n2, v)
1009  end if
1010  case default
1011  found = .false.
1012  end select

◆ sfe_create()

subroutine, public gwesfemodule::sfe_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname,
type(tspfmitype), pointer  fmi,
real(dp), intent(in), pointer  eqnsclfac,
type(gweinputdatatype), intent(in), target  gwecommon,
character(len=*), intent(in)  dvt,
character(len=*), intent(in)  dvu,
character(len=*), intent(in)  dvua 
)
Parameters
[in]eqnsclfacGoverning equation scale factor
[in]gwecommonShared data container for use by multiple GWE packages
[in]dvtFor GWE, set to "TEMPERATURE" in TspAptType
[in]dvuFor GWE, set to "energy" in TspAptType
[in]dvuaFor GWE, set to "E" in TspAptType

Definition at line 100 of file gwe-sfe.f90.

102  ! -- dummy
103  class(BndType), pointer :: packobj
104  integer(I4B), intent(in) :: id
105  integer(I4B), intent(in) :: ibcnum
106  integer(I4B), intent(in) :: inunit
107  integer(I4B), intent(in) :: iout
108  character(len=*), intent(in) :: namemodel
109  character(len=*), intent(in) :: pakname
110  type(TspFmiType), pointer :: fmi
111  real(DP), intent(in), pointer :: eqnsclfac !< Governing equation scale factor
112  type(GweInputDataType), intent(in), target :: gwecommon !< Shared data container for use by multiple GWE packages
113  character(len=*), intent(in) :: dvt !< For GWE, set to "TEMPERATURE" in TspAptType
114  character(len=*), intent(in) :: dvu !< For GWE, set to "energy" in TspAptType
115  character(len=*), intent(in) :: dvua !< For GWE, set to "E" in TspAptType
116  ! -- local
117  type(GweSfeType), pointer :: sfeobj
118  !
119  ! -- Allocate the object and assign values to object variables
120  allocate (sfeobj)
121  packobj => sfeobj
122  !
123  ! -- Create name and memory path
124  call packobj%set_names(ibcnum, namemodel, pakname, ftype)
125  packobj%text = text
126  !
127  ! -- Allocate scalars
128  call sfeobj%allocate_scalars()
129  !
130  ! -- Initialize package
131  call packobj%pack_initialize()
132  !
133  packobj%inunit = inunit
134  packobj%iout = iout
135  packobj%id = id
136  packobj%ibcnum = ibcnum
137  packobj%ncolbnd = 1
138  packobj%iscloc = 1
139  !
140  ! -- Store pointer to flow model interface. When the GwfGwt exchange is
141  ! created, it sets fmi%bndlist so that the GWT model has access to all
142  ! the flow packages
143  sfeobj%fmi => fmi
144  !
145  ! -- Store pointer to governing equation scale factor
146  sfeobj%eqnsclfac => eqnsclfac
147  !
148  ! -- Store pointer to shared data module for accessing cpw, rhow
149  ! for the budget calculations, and for accessing the latent heat of
150  ! vaporization for evaporative cooling.
151  sfeobj%gwecommon => gwecommon
152  !
153  ! -- Set labels that will be used in generalized APT class
154  sfeobj%depvartype = dvt
155  sfeobj%depvarunit = dvu
156  sfeobj%depvarunitabbrev = dvua
Here is the caller graph for this function:

◆ sfe_da()

subroutine gwesfemodule::sfe_da ( class(gwesfetype this)

Definition at line 720 of file gwe-sfe.f90.

721  ! -- modules
723  ! -- dummy
724  class(GweSfeType) :: this
725  !
726  ! -- Deallocate scalars
727  call mem_deallocate(this%idxbudrain)
728  call mem_deallocate(this%idxbudevap)
729  call mem_deallocate(this%idxbudroff)
730  call mem_deallocate(this%idxbudiflw)
731  call mem_deallocate(this%idxbudoutf)
732  call mem_deallocate(this%idxbudsbcd)
733  !
734  ! -- Deallocate time series
735  call mem_deallocate(this%temprain)
736  call mem_deallocate(this%tempevap)
737  call mem_deallocate(this%temproff)
738  call mem_deallocate(this%tempiflw)
739  !
740  ! -- Deallocate scalars in TspAptType
741  call this%TspAptType%bnd_da()

◆ sfe_df_obs()

subroutine gwesfemodule::sfe_df_obs ( class(gwesfetype this)
private

Store the observation type supported by the APT package and override BndTypebnd_df_obs

Definition at line 878 of file gwe-sfe.f90.

879  ! -- modules
880  ! -- dummy
881  class(GweSfeType) :: this
882  ! -- local
883  integer(I4B) :: indx
884  !
885  ! -- Store obs type and assign procedure pointer
886  ! for temperature observation type.
887  call this%obs%StoreObsType('temperature', .false., indx)
888  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
889  !
890  ! -- Store obs type and assign procedure pointer
891  ! for flow between reaches.
892  call this%obs%StoreObsType('flow-ja-face', .true., indx)
893  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid12
894  !
895  ! -- Store obs type and assign procedure pointer
896  ! for from-mvr observation type.
897  call this%obs%StoreObsType('from-mvr', .true., indx)
898  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
899  !
900  ! -- Store obs type and assign procedure pointer
901  ! for to-mvr observation type.
902  call this%obs%StoreObsType('to-mvr', .true., indx)
903  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
904  !
905  ! -- Store obs type and assign procedure pointer
906  ! for storage observation type.
907  call this%obs%StoreObsType('storage', .true., indx)
908  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
909  !
910  ! -- Store obs type and assign procedure pointer
911  ! for constant observation type.
912  call this%obs%StoreObsType('constant', .true., indx)
913  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
914  !
915  ! -- Store obs type and assign procedure pointer
916  ! for observation type: sfe
917  call this%obs%StoreObsType('sfe', .true., indx)
918  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
919  !
920  ! -- Store obs type and assign procedure pointer
921  ! for rainfall observation type.
922  call this%obs%StoreObsType('rainfall', .true., indx)
923  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
924  !
925  ! -- Store obs type and assign procedure pointer
926  ! for evaporation observation type.
927  call this%obs%StoreObsType('evaporation', .true., indx)
928  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
929  !
930  ! -- Store obs type and assign procedure pointer
931  ! for runoff observation type.
932  call this%obs%StoreObsType('runoff', .true., indx)
933  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
934  !
935  ! -- Store obs type and assign procedure pointer
936  ! for inflow observation type.
937  call this%obs%StoreObsType('ext-inflow', .true., indx)
938  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
939  !
940  ! -- Store obs type and assign procedure pointer
941  ! for ext-outflow observation type.
942  call this%obs%StoreObsType('ext-outflow', .true., indx)
943  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
Here is the call graph for this function:

◆ sfe_evap_term()

subroutine gwesfemodule::sfe_evap_term ( class(gwesfetype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)
private

Definition at line 770 of file gwe-sfe.f90.

771  ! -- dummy
772  class(GweSfeType) :: this
773  integer(I4B), intent(in) :: ientry
774  integer(I4B), intent(inout) :: n1
775  integer(I4B), intent(inout) :: n2
776  real(DP), intent(inout), optional :: rrate
777  real(DP), intent(inout), optional :: rhsval
778  real(DP), intent(inout), optional :: hcofval
779  ! -- local
780  real(DP) :: qbnd
781  real(DP) :: heatlat
782  !
783  n1 = this%flowbudptr%budterm(this%idxbudevap)%id1(ientry)
784  n2 = this%flowbudptr%budterm(this%idxbudevap)%id2(ientry)
785  ! -- note that qbnd is negative for evap
786  qbnd = this%flowbudptr%budterm(this%idxbudevap)%flow(ientry)
787  heatlat = this%gwecommon%gwerhow * this%gwecommon%gwelatheatvap
788  if (present(rrate)) rrate = qbnd * heatlat
789  !!if (present(rhsval)) rhsval = -rrate / this%eqnsclfac ! kluge note: divided by eqnsclfac for fc purposes because rrate is in terms of energy
790  if (present(rhsval)) rhsval = -rrate
791  if (present(hcofval)) hcofval = dzero

◆ sfe_fc_expanded()

subroutine gwesfemodule::sfe_fc_expanded ( class(gwesfetype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

This will be called from TspAptTypeapt_fc_expanded() in order to add matrix terms specifically for SFE

Definition at line 283 of file gwe-sfe.f90.

284  ! -- dummy
285  class(GweSfeType) :: this
286  real(DP), dimension(:), intent(inout) :: rhs
287  integer(I4B), dimension(:), intent(in) :: ia
288  integer(I4B), dimension(:), intent(in) :: idxglo
289  class(MatrixBaseType), pointer :: matrix_sln
290  ! -- local
291  integer(I4B) :: j, n, n1, n2
292  integer(I4B) :: iloc
293  integer(I4B) :: iposd, iposoffd
294  integer(I4B) :: ipossymd, ipossymoffd
295  integer(I4B) :: auxpos
296  real(DP) :: rrate
297  real(DP) :: rhsval
298  real(DP) :: hcofval
299  real(DP) :: ctherm
300  real(DP) :: wa !< wetted area
301  real(DP) :: ktf !< thermal conductivity of streambed material
302  real(DP) :: s !< thickness of conductive streambed material
303  !
304  ! -- Add rainfall contribution
305  if (this%idxbudrain /= 0) then
306  do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
307  call this%sfe_rain_term(j, n1, n2, rrate, rhsval, hcofval)
308  iloc = this%idxlocnode(n1)
309  iposd = this%idxpakdiag(n1)
310  call matrix_sln%add_value_pos(iposd, hcofval)
311  rhs(iloc) = rhs(iloc) + rhsval
312  end do
313  end if
314  !
315  ! -- Add evaporation contribution
316  if (this%idxbudevap /= 0) then
317  do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
318  call this%sfe_evap_term(j, n1, n2, rrate, rhsval, hcofval)
319  iloc = this%idxlocnode(n1)
320  iposd = this%idxpakdiag(n1)
321  call matrix_sln%add_value_pos(iposd, hcofval)
322  rhs(iloc) = rhs(iloc) + rhsval
323  end do
324  end if
325  !
326  ! -- Add runoff contribution
327  if (this%idxbudroff /= 0) then
328  do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
329  call this%sfe_roff_term(j, n1, n2, rrate, rhsval, hcofval)
330  iloc = this%idxlocnode(n1)
331  iposd = this%idxpakdiag(n1)
332  call matrix_sln%add_value_pos(iposd, hcofval)
333  rhs(iloc) = rhs(iloc) + rhsval
334  end do
335  end if
336  !
337  ! -- Add inflow contribution
338  if (this%idxbudiflw /= 0) then
339  do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
340  call this%sfe_iflw_term(j, n1, n2, rrate, rhsval, hcofval)
341  iloc = this%idxlocnode(n1)
342  iposd = this%idxpakdiag(n1)
343  call matrix_sln%add_value_pos(iposd, hcofval)
344  rhs(iloc) = rhs(iloc) + rhsval
345  end do
346  end if
347  !
348  ! -- Add outflow contribution
349  if (this%idxbudoutf /= 0) then
350  do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
351  call this%sfe_outf_term(j, n1, n2, rrate, rhsval, hcofval)
352  iloc = this%idxlocnode(n1)
353  iposd = this%idxpakdiag(n1)
354  call matrix_sln%add_value_pos(iposd, hcofval)
355  rhs(iloc) = rhs(iloc) + rhsval
356  end do
357  end if
358  !
359  ! -- Add streambed conduction contribution
360  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
361  !
362  ! -- Set n to feature number and process if active feature
363  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
364  if (this%iboundpak(n) /= 0) then
365  !
366  ! -- Set acoef and rhs to negative so they are relative to sfe and not gwe
367  auxpos = this%flowbudptr%budterm(this%idxbudgwf)%naux
368  wa = this%flowbudptr%budterm(this%idxbudgwf)%auxvar(auxpos, j)
369  ktf = this%ktf(n)
370  s = this%rfeatthk(n)
371  ctherm = ktf * wa / s
372  !
373  ! -- Add to sfe row
374  iposd = this%idxdglo(j)
375  iposoffd = this%idxoffdglo(j)
376  call matrix_sln%add_value_pos(iposd, -ctherm)
377  call matrix_sln%add_value_pos(iposoffd, ctherm)
378  !
379  ! -- Add to gwe row for sfe connection
380  ipossymd = this%idxsymdglo(j)
381  ipossymoffd = this%idxsymoffdglo(j)
382  call matrix_sln%add_value_pos(ipossymd, -ctherm)
383  call matrix_sln%add_value_pos(ipossymoffd, ctherm)
384  end if
385  end do

◆ sfe_fill_budobj()

subroutine gwesfemodule::sfe_fill_budobj ( class(gwesfetype this,
integer(i4b), intent(inout)  idx,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
real(dp), intent(inout)  ccratin,
real(dp), intent(inout)  ccratout 
)

Definition at line 563 of file gwe-sfe.f90.

564  ! -- dummy
565  class(GweSfeType) :: this
566  integer(I4B), intent(inout) :: idx
567  real(DP), dimension(:), intent(in) :: x
568  real(DP), dimension(:), contiguous, intent(inout) :: flowja
569  real(DP), intent(inout) :: ccratin
570  real(DP), intent(inout) :: ccratout
571  ! -- local
572  integer(I4B) :: j, n1, n2
573  integer(I4B) :: nlist
574  integer(I4B) :: igwfnode
575  integer(I4B) :: idiag
576  integer(I4B) :: auxpos
577  real(DP) :: q
578  real(DP) :: ctherm
579  real(DP) :: wa !< wetted area
580  real(DP) :: ktf !< thermal conductivity of streambed material
581  real(DP) :: s !< thickness of conductive streambed materia
582  !
583  ! -- Rain
584  idx = idx + 1
585  nlist = this%flowbudptr%budterm(this%idxbudrain)%nlist
586  call this%budobj%budterm(idx)%reset(nlist)
587  do j = 1, nlist
588  call this%sfe_rain_term(j, n1, n2, q)
589  call this%budobj%budterm(idx)%update_term(n1, n2, q)
590  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
591  end do
592  !
593  ! -- Evaporation
594  idx = idx + 1
595  nlist = this%flowbudptr%budterm(this%idxbudevap)%nlist
596  call this%budobj%budterm(idx)%reset(nlist)
597  do j = 1, nlist
598  call this%sfe_evap_term(j, n1, n2, q)
599  call this%budobj%budterm(idx)%update_term(n1, n2, q)
600  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
601  end do
602  !
603  ! -- Runoff
604  idx = idx + 1
605  nlist = this%flowbudptr%budterm(this%idxbudroff)%nlist
606  call this%budobj%budterm(idx)%reset(nlist)
607  do j = 1, nlist
608  call this%sfe_roff_term(j, n1, n2, q)
609  call this%budobj%budterm(idx)%update_term(n1, n2, q)
610  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
611  end do
612  !
613  ! -- Ext-inflow
614  idx = idx + 1
615  nlist = this%flowbudptr%budterm(this%idxbudiflw)%nlist
616  call this%budobj%budterm(idx)%reset(nlist)
617  do j = 1, nlist
618  call this%sfe_iflw_term(j, n1, n2, q)
619  call this%budobj%budterm(idx)%update_term(n1, n2, q)
620  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
621  end do
622  !
623  ! -- Ext-outflow
624  idx = idx + 1
625  nlist = this%flowbudptr%budterm(this%idxbudoutf)%nlist
626  call this%budobj%budterm(idx)%reset(nlist)
627  do j = 1, nlist
628  call this%sfe_outf_term(j, n1, n2, q)
629  call this%budobj%budterm(idx)%update_term(n1, n2, q)
630  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
631  end do
632  !
633  ! -- Strmbd-cond
634  idx = idx + 1
635  call this%budobj%budterm(idx)%reset(this%maxbound)
636  do j = 1, this%flowbudptr%budterm(this%idxbudsbcd)%nlist
637  q = dzero
638  n1 = this%flowbudptr%budterm(this%idxbudsbcd)%id1(j)
639  if (this%iboundpak(n1) /= 0) then
640  igwfnode = this%flowbudptr%budterm(this%idxbudsbcd)%id2(j)
641  ! -- For now, there is only 1 aux variable under 'GWF'
642  auxpos = this%flowbudptr%budterm(this%idxbudgwf)%naux
643  wa = this%flowbudptr%budterm(this%idxbudgwf)%auxvar(auxpos, j)
644  ktf = this%ktf(n1)
645  s = this%rfeatthk(n1)
646  ctherm = ktf * wa / s
647  q = ctherm * (x(igwfnode) - this%xnewpak(n1))
648  end if
649  call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
650  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
651  if (this%iboundpak(n1) /= 0) then
652  ! -- Contribution to gwe cell budget
653  this%simvals(n1) = this%simvals(n1) - q
654  idiag = this%dis%con%ia(igwfnode)
655  flowja(idiag) = flowja(idiag) - q
656  end if
657  end do

◆ sfe_get_nbudterms()

integer(i4b) function gwesfemodule::sfe_get_nbudterms ( class(gwesfetype this)
private

This overrides a function in the parent class.

Definition at line 445 of file gwe-sfe.f90.

446  ! -- dummy
447  class(GweSfeType) :: this
448  ! -- return
449  integer(I4B) :: nbudterms
450  !
451  ! -- Number of budget terms is 6:
452  ! 1. rainfall
453  ! 2. evaporation
454  ! 3. runoff
455  ! 4. ext-inflow
456  ! 5. ext-outflow
457  ! 6. streambed-cond
458  nbudterms = 6

◆ sfe_iflw_term()

subroutine gwesfemodule::sfe_iflw_term ( class(gwesfetype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)
private

Accounts for energy added via streamflow entering into a stream channel; for example, energy entering the model domain via a specified flow in a stream channel.

Definition at line 824 of file gwe-sfe.f90.

825  ! -- dummy
826  class(GweSfeType) :: this
827  integer(I4B), intent(in) :: ientry
828  integer(I4B), intent(inout) :: n1
829  integer(I4B), intent(inout) :: n2
830  real(DP), intent(inout), optional :: rrate
831  real(DP), intent(inout), optional :: rhsval
832  real(DP), intent(inout), optional :: hcofval
833  ! -- local
834  real(DP) :: qbnd
835  real(DP) :: ctmp
836  !
837  n1 = this%flowbudptr%budterm(this%idxbudiflw)%id1(ientry)
838  n2 = this%flowbudptr%budterm(this%idxbudiflw)%id2(ientry)
839  qbnd = this%flowbudptr%budterm(this%idxbudiflw)%flow(ientry)
840  ctmp = this%tempiflw(n1)
841  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
842  if (present(rhsval)) rhsval = -rrate
843  if (present(hcofval)) hcofval = dzero

◆ sfe_outf_term()

subroutine gwesfemodule::sfe_outf_term ( class(gwesfetype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)
private

Accounts for the energy leaving a stream channel, for example, energy exiting the model domain via a flow in a stream channel flowing out of the active domain.

Definition at line 851 of file gwe-sfe.f90.

852  ! -- dummy
853  class(GweSfeType) :: this
854  integer(I4B), intent(in) :: ientry
855  integer(I4B), intent(inout) :: n1
856  integer(I4B), intent(inout) :: n2
857  real(DP), intent(inout), optional :: rrate
858  real(DP), intent(inout), optional :: rhsval
859  real(DP), intent(inout), optional :: hcofval
860  ! -- local
861  real(DP) :: qbnd
862  real(DP) :: ctmp
863  !
864  n1 = this%flowbudptr%budterm(this%idxbudoutf)%id1(ientry)
865  n2 = this%flowbudptr%budterm(this%idxbudoutf)%id2(ientry)
866  qbnd = this%flowbudptr%budterm(this%idxbudoutf)%flow(ientry)
867  ctmp = this%xnewpak(n1)
868  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
869  if (present(rhsval)) rhsval = dzero
870  if (present(hcofval)) hcofval = qbnd * this%eqnsclfac

◆ sfe_rain_term()

subroutine gwesfemodule::sfe_rain_term ( class(gwesfetype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Definition at line 746 of file gwe-sfe.f90.

747  ! -- dummy
748  class(GweSfeType) :: this
749  integer(I4B), intent(in) :: ientry
750  integer(I4B), intent(inout) :: n1
751  integer(I4B), intent(inout) :: n2
752  real(DP), intent(inout), optional :: rrate
753  real(DP), intent(inout), optional :: rhsval
754  real(DP), intent(inout), optional :: hcofval
755  ! -- local
756  real(DP) :: qbnd
757  real(DP) :: ctmp
758  !
759  n1 = this%flowbudptr%budterm(this%idxbudrain)%id1(ientry)
760  n2 = this%flowbudptr%budterm(this%idxbudrain)%id2(ientry)
761  qbnd = this%flowbudptr%budterm(this%idxbudrain)%flow(ientry)
762  ctmp = this%temprain(n1)
763  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac ! kluge note: think about budget / sensible heat issue
764  if (present(rhsval)) rhsval = -rrate
765  if (present(hcofval)) hcofval = dzero

◆ sfe_roff_term()

subroutine gwesfemodule::sfe_roff_term ( class(gwesfetype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)
private

Definition at line 796 of file gwe-sfe.f90.

797  ! -- dummy
798  class(GweSfeType) :: this
799  integer(I4B), intent(in) :: ientry
800  integer(I4B), intent(inout) :: n1
801  integer(I4B), intent(inout) :: n2
802  real(DP), intent(inout), optional :: rrate
803  real(DP), intent(inout), optional :: rhsval
804  real(DP), intent(inout), optional :: hcofval
805  ! -- local
806  real(DP) :: qbnd
807  real(DP) :: ctmp
808  !
809  n1 = this%flowbudptr%budterm(this%idxbudroff)%id1(ientry)
810  n2 = this%flowbudptr%budterm(this%idxbudroff)%id2(ientry)
811  qbnd = this%flowbudptr%budterm(this%idxbudroff)%flow(ientry)
812  ctmp = this%temproff(n1)
813  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
814  if (present(rhsval)) rhsval = -rrate
815  if (present(hcofval)) hcofval = dzero

◆ sfe_rp_obs()

subroutine gwesfemodule::sfe_rp_obs ( class(gwesfetype), intent(inout)  this,
type(observetype), intent(inout)  obsrv,
logical, intent(inout)  found 
)
private

Method to process specific observations for this package.

Parameters
[in,out]thispackage class
[in,out]obsrvobservation object
[in,out]foundindicate whether observation was found

Definition at line 950 of file gwe-sfe.f90.

951  ! -- dummy
952  class(GweSfeType), intent(inout) :: this !< package class
953  type(ObserveType), intent(inout) :: obsrv !< observation object
954  logical, intent(inout) :: found !< indicate whether observation was found
955  ! -- local
956  !
957  found = .true.
958  select case (obsrv%ObsTypeId)
959  case ('RAINFALL')
960  call this%rp_obs_byfeature(obsrv)
961  case ('EVAPORATION')
962  call this%rp_obs_byfeature(obsrv)
963  case ('RUNOFF')
964  call this%rp_obs_byfeature(obsrv)
965  case ('EXT-INFLOW')
966  call this%rp_obs_byfeature(obsrv)
967  case ('EXT-OUTFLOW')
968  call this%rp_obs_byfeature(obsrv)
969  case ('TO-MVR')
970  call this%rp_obs_byfeature(obsrv)
971  case default
972  found = .false.
973  end select

◆ sfe_set_stressperiod()

subroutine gwesfemodule::sfe_set_stressperiod ( class(gwesfetype), intent(inout)  this,
integer(i4b), intent(in)  itemno,
character(len=*), intent(in)  keyword,
logical, intent(inout)  found 
)
private

Definition at line 1017 of file gwe-sfe.f90.

1018  ! -- modules
1020  ! -- dummy
1021  class(GweSfeType), intent(inout) :: this
1022  integer(I4B), intent(in) :: itemno
1023  character(len=*), intent(in) :: keyword
1024  logical, intent(inout) :: found
1025  ! -- local
1026  character(len=LINELENGTH) :: text
1027  integer(I4B) :: ierr
1028  integer(I4B) :: jj
1029  real(DP), pointer :: bndElem => null()
1030  !
1031  ! RAINFALL <rainfall>
1032  ! EVAPORATION <evaporation>
1033  ! RUNOFF <runoff>
1034  ! INFLOW <inflow>
1035  ! WITHDRAWAL <withdrawal>
1036  !
1037  found = .true.
1038  select case (keyword)
1039  case ('RAINFALL')
1040  ierr = this%apt_check_valid(itemno)
1041  if (ierr /= 0) then
1042  goto 999
1043  end if
1044  call this%parser%GetString(text)
1045  jj = 1
1046  bndelem => this%temprain(itemno)
1047  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1048  this%packName, 'BND', this%tsManager, &
1049  this%iprpak, 'RAINFALL')
1050  case ('EVAPORATION')
1051  ierr = this%apt_check_valid(itemno)
1052  if (ierr /= 0) then
1053  goto 999
1054  end if
1055  call this%parser%GetString(text)
1056  jj = 1
1057  bndelem => this%tempevap(itemno)
1058  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1059  this%packName, 'BND', this%tsManager, &
1060  this%iprpak, 'EVAPORATION')
1061  case ('RUNOFF')
1062  ierr = this%apt_check_valid(itemno)
1063  if (ierr /= 0) then
1064  goto 999
1065  end if
1066  call this%parser%GetString(text)
1067  jj = 1
1068  bndelem => this%temproff(itemno)
1069  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1070  this%packName, 'BND', this%tsManager, &
1071  this%iprpak, 'RUNOFF')
1072  case ('INFLOW')
1073  ierr = this%apt_check_valid(itemno)
1074  if (ierr /= 0) then
1075  goto 999
1076  end if
1077  call this%parser%GetString(text)
1078  jj = 1
1079  bndelem => this%tempiflw(itemno)
1080  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1081  this%packName, 'BND', this%tsManager, &
1082  this%iprpak, 'INFLOW')
1083  case default
1084  !
1085  ! -- Keyword not recognized so return to caller with found = .false.
1086  found = .false.
1087  end select
1088  !
1089 999 continue
subroutine, public read_value_or_time_series_adv(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, varName)
Call this subroutine from advanced packages to define timeseries link for a variable (varName).
Here is the call graph for this function:

◆ sfe_setup_budobj()

subroutine gwesfemodule::sfe_setup_budobj ( class(gwesfetype this,
integer(i4b), intent(inout)  idx 
)
private

Definition at line 463 of file gwe-sfe.f90.

464  ! -- modules
465  use constantsmodule, only: lenbudtxt
466  ! -- dummy
467  class(GweSfeType) :: this
468  integer(I4B), intent(inout) :: idx
469  ! -- local
470  integer(I4B) :: n, n1, n2
471  integer(I4B) :: maxlist, naux
472  real(DP) :: q
473  character(len=LENBUDTXT) :: text
474  !
475  ! --
476  text = ' RAINFALL'
477  idx = idx + 1
478  maxlist = this%flowbudptr%budterm(this%idxbudrain)%maxlist
479  naux = 0
480  call this%budobj%budterm(idx)%initialize(text, &
481  this%name_model, &
482  this%packName, &
483  this%name_model, &
484  this%packName, &
485  maxlist, .false., .false., &
486  naux)
487  !
488  ! --
489  text = ' EVAPORATION'
490  idx = idx + 1
491  maxlist = this%flowbudptr%budterm(this%idxbudevap)%maxlist
492  naux = 0
493  call this%budobj%budterm(idx)%initialize(text, &
494  this%name_model, &
495  this%packName, &
496  this%name_model, &
497  this%packName, &
498  maxlist, .false., .false., &
499  naux)
500  !
501  ! --
502  text = ' RUNOFF'
503  idx = idx + 1
504  maxlist = this%flowbudptr%budterm(this%idxbudroff)%maxlist
505  naux = 0
506  call this%budobj%budterm(idx)%initialize(text, &
507  this%name_model, &
508  this%packName, &
509  this%name_model, &
510  this%packName, &
511  maxlist, .false., .false., &
512  naux)
513  !
514  ! --
515  text = ' EXT-INFLOW'
516  idx = idx + 1
517  maxlist = this%flowbudptr%budterm(this%idxbudiflw)%maxlist
518  naux = 0
519  call this%budobj%budterm(idx)%initialize(text, &
520  this%name_model, &
521  this%packName, &
522  this%name_model, &
523  this%packName, &
524  maxlist, .false., .false., &
525  naux)
526  !
527  ! --
528  text = ' EXT-OUTFLOW'
529  idx = idx + 1
530  maxlist = this%flowbudptr%budterm(this%idxbudoutf)%maxlist
531  naux = 0
532  call this%budobj%budterm(idx)%initialize(text, &
533  this%name_model, &
534  this%packName, &
535  this%name_model, &
536  this%packName, &
537  maxlist, .false., .false., &
538  naux)
539  !
540  ! -- Conduction through the wetted streambed
541  text = ' STREAMBED-COND'
542  idx = idx + 1
543  maxlist = this%flowbudptr%budterm(this%idxbudsbcd)%maxlist
544  naux = 0
545  call this%budobj%budterm(idx)%initialize(text, &
546  this%name_model, &
547  this%packName, &
548  this%name_model, &
549  this%packName, &
550  maxlist, .false., .false., &
551  naux)
552  call this%budobj%budterm(idx)%reset(maxlist)
553  q = dzero
554  do n = 1, maxlist
555  n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
556  n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
557  call this%budobj%budterm(idx)%update_term(n1, n2, q)
558  end do
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37

◆ sfe_solve()

subroutine gwesfemodule::sfe_solve ( class(gwesfetype this)
private

Definition at line 390 of file gwe-sfe.f90.

391  ! -- dummy
392  class(GweSfeType) :: this
393  ! -- local
394  integer(I4B) :: j
395  integer(I4B) :: n1, n2
396  real(DP) :: rrate
397  !
398  ! -- Add rainfall contribution
399  if (this%idxbudrain /= 0) then
400  do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
401  call this%sfe_rain_term(j, n1, n2, rrate)
402  this%dbuff(n1) = this%dbuff(n1) + rrate
403  end do
404  end if
405  !
406  ! -- Add evaporation contribution
407  if (this%idxbudevap /= 0) then
408  do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
409  call this%sfe_evap_term(j, n1, n2, rrate)
410  this%dbuff(n1) = this%dbuff(n1) + rrate
411  end do
412  end if
413  !
414  ! -- Add runoff contribution
415  if (this%idxbudroff /= 0) then
416  do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
417  call this%sfe_roff_term(j, n1, n2, rrate)
418  this%dbuff(n1) = this%dbuff(n1) + rrate
419  end do
420  end if
421  !
422  ! -- Add inflow contribution
423  if (this%idxbudiflw /= 0) then
424  do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
425  call this%sfe_iflw_term(j, n1, n2, rrate)
426  this%dbuff(n1) = this%dbuff(n1) + rrate
427  end do
428  end if
429  !
430  ! -- Add outflow contribution
431  if (this%idxbudoutf /= 0) then
432  do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
433  call this%sfe_outf_term(j, n1, n2, rrate)
434  this%dbuff(n1) = this%dbuff(n1) + rrate
435  end do
436  end if
437  !
438  ! Note: explicit streambed conduction terms???

Variable Documentation

◆ flowtype

character(len=*), parameter gwesfemodule::flowtype = 'SFR'
private

Definition at line 54 of file gwe-sfe.f90.

54  character(len=*), parameter :: flowtype = 'SFR'

◆ ftype

character(len=*), parameter gwesfemodule::ftype = 'SFE'
private

Definition at line 53 of file gwe-sfe.f90.

53  character(len=*), parameter :: ftype = 'SFE'

◆ text

character(len=16) gwesfemodule::text = ' SFE'
private

Definition at line 55 of file gwe-sfe.f90.

55  character(len=16) :: text = ' SFE'