MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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 684 of file gwe-sfe.f90.

685  ! -- modules
687  ! -- dummy
688  class(GweSfeType) :: this
689  !
690  ! -- Allocate scalars in TspAptType
691  call this%TspAptType%allocate_scalars()
692  !
693  ! -- Allocate
694  call mem_allocate(this%idxbudrain, 'IDXBUDRAIN', this%memoryPath)
695  call mem_allocate(this%idxbudevap, 'IDXBUDEVAP', this%memoryPath)
696  call mem_allocate(this%idxbudroff, 'IDXBUDROFF', this%memoryPath)
697  call mem_allocate(this%idxbudiflw, 'IDXBUDIFLW', this%memoryPath)
698  call mem_allocate(this%idxbudoutf, 'IDXBUDOUTF', this%memoryPath)
699  call mem_allocate(this%idxbudsbcd, 'IDXBUDSBCD', this%memoryPath)
700  !
701  ! -- Initialize
702  this%idxbudrain = 0
703  this%idxbudevap = 0
704  this%idxbudroff = 0
705  this%idxbudiflw = 0
706  this%idxbudoutf = 0
707  this%idxbudsbcd = 0
708  !
709  ! -- Return
710  return

◆ find_sfe_package()

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

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

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

◆ sfe_allocate_arrays()

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

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

717  ! -- modules
719  ! -- dummy
720  class(GweSfeType), intent(inout) :: this
721  ! -- local
722  integer(I4B) :: n
723  !
724  ! -- Time series
725  call mem_allocate(this%temprain, this%ncv, 'TEMPRAIN', this%memoryPath)
726  call mem_allocate(this%tempevap, this%ncv, 'TEMPEVAP', this%memoryPath)
727  call mem_allocate(this%temproff, this%ncv, 'TEMPROFF', this%memoryPath)
728  call mem_allocate(this%tempiflw, this%ncv, 'TEMPIFLW', this%memoryPath)
729  !
730  ! -- Call standard TspAptType allocate arrays
731  call this%TspAptType%apt_allocate_arrays()
732  !
733  ! -- Initialize
734  do n = 1, this%ncv
735  this%temprain(n) = dzero
736  this%tempevap(n) = dzero
737  this%temproff(n) = dzero
738  this%tempiflw(n) = dzero
739  end do
740  !
741  ! -- Return
742  return

◆ 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 1029 of file gwe-sfe.f90.

1030  ! -- dummy
1031  class(GweSfeType), intent(inout) :: this
1032  character(len=*), intent(in) :: obstypeid
1033  real(DP), intent(inout) :: v
1034  integer(I4B), intent(in) :: jj
1035  logical, intent(inout) :: found
1036  ! -- local
1037  integer(I4B) :: n1, n2
1038  !
1039  found = .true.
1040  select case (obstypeid)
1041  case ('RAINFALL')
1042  if (this%iboundpak(jj) /= 0) then
1043  call this%sfe_rain_term(jj, n1, n2, v)
1044  end if
1045  case ('EVAPORATION')
1046  if (this%iboundpak(jj) /= 0) then
1047  call this%sfe_evap_term(jj, n1, n2, v)
1048  end if
1049  case ('RUNOFF')
1050  if (this%iboundpak(jj) /= 0) then
1051  call this%sfe_roff_term(jj, n1, n2, v)
1052  end if
1053  case ('EXT-INFLOW')
1054  if (this%iboundpak(jj) /= 0) then
1055  call this%sfe_iflw_term(jj, n1, n2, v)
1056  end if
1057  case ('EXT-OUTFLOW')
1058  if (this%iboundpak(jj) /= 0) then
1059  call this%sfe_outf_term(jj, n1, n2, v)
1060  end if
1061  case default
1062  found = .false.
1063  end select
1064  !
1065  ! -- Return
1066  return

◆ 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
157  !
158  ! -- Return
159  return
Here is the caller graph for this function:

◆ sfe_da()

subroutine gwesfemodule::sfe_da ( class(gwesfetype this)

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

748  ! -- modules
750  ! -- dummy
751  class(GweSfeType) :: this
752  !
753  ! -- Deallocate scalars
754  call mem_deallocate(this%idxbudrain)
755  call mem_deallocate(this%idxbudevap)
756  call mem_deallocate(this%idxbudroff)
757  call mem_deallocate(this%idxbudiflw)
758  call mem_deallocate(this%idxbudoutf)
759  call mem_deallocate(this%idxbudsbcd)
760  !
761  ! -- Deallocate time series
762  call mem_deallocate(this%temprain)
763  call mem_deallocate(this%tempevap)
764  call mem_deallocate(this%temproff)
765  call mem_deallocate(this%tempiflw)
766  !
767  ! -- Deallocate scalars in TspAptType
768  call this%TspAptType%bnd_da()
769  !
770  ! -- Return
771  return

◆ 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 923 of file gwe-sfe.f90.

924  ! -- modules
925  ! -- dummy
926  class(GweSfeType) :: this
927  ! -- local
928  integer(I4B) :: indx
929  !
930  ! -- Store obs type and assign procedure pointer
931  ! for temperature observation type.
932  call this%obs%StoreObsType('temperature', .false., indx)
933  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
934  !
935  ! -- Store obs type and assign procedure pointer
936  ! for flow between reaches.
937  call this%obs%StoreObsType('flow-ja-face', .true., indx)
938  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid12
939  !
940  ! -- Store obs type and assign procedure pointer
941  ! for from-mvr observation type.
942  call this%obs%StoreObsType('from-mvr', .true., indx)
943  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
944  !
945  ! -- Store obs type and assign procedure pointer
946  ! for to-mvr observation type.
947  call this%obs%StoreObsType('to-mvr', .true., indx)
948  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
949  !
950  ! -- Store obs type and assign procedure pointer
951  ! for storage observation type.
952  call this%obs%StoreObsType('storage', .true., indx)
953  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
954  !
955  ! -- Store obs type and assign procedure pointer
956  ! for constant observation type.
957  call this%obs%StoreObsType('constant', .true., indx)
958  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
959  !
960  ! -- Store obs type and assign procedure pointer
961  ! for observation type: sfe
962  call this%obs%StoreObsType('sfe', .true., indx)
963  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
964  !
965  ! -- Store obs type and assign procedure pointer
966  ! for rainfall observation type.
967  call this%obs%StoreObsType('rainfall', .true., indx)
968  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
969  !
970  ! -- Store obs type and assign procedure pointer
971  ! for evaporation observation type.
972  call this%obs%StoreObsType('evaporation', .true., indx)
973  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
974  !
975  ! -- Store obs type and assign procedure pointer
976  ! for runoff observation type.
977  call this%obs%StoreObsType('runoff', .true., indx)
978  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
979  !
980  ! -- Store obs type and assign procedure pointer
981  ! for inflow observation type.
982  call this%obs%StoreObsType('ext-inflow', .true., indx)
983  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
984  !
985  ! -- Store obs type and assign procedure pointer
986  ! for ext-outflow observation type.
987  call this%obs%StoreObsType('ext-outflow', .true., indx)
988  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
989  !
990  ! -- Return
991  return
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 803 of file gwe-sfe.f90.

804  ! -- dummy
805  class(GweSfeType) :: this
806  integer(I4B), intent(in) :: ientry
807  integer(I4B), intent(inout) :: n1
808  integer(I4B), intent(inout) :: n2
809  real(DP), intent(inout), optional :: rrate
810  real(DP), intent(inout), optional :: rhsval
811  real(DP), intent(inout), optional :: hcofval
812  ! -- local
813  real(DP) :: qbnd
814  real(DP) :: heatlat
815  !
816  n1 = this%flowbudptr%budterm(this%idxbudevap)%id1(ientry)
817  n2 = this%flowbudptr%budterm(this%idxbudevap)%id2(ientry)
818  ! -- note that qbnd is negative for evap
819  qbnd = this%flowbudptr%budterm(this%idxbudevap)%flow(ientry)
820  heatlat = this%gwecommon%gwerhow * this%gwecommon%gwelatheatvap
821  if (present(rrate)) rrate = qbnd * heatlat
822  !!if (present(rhsval)) rhsval = -rrate / this%eqnsclfac ! kluge note: divided by eqnsclfac for fc purposes because rrate is in terms of energy
823  if (present(rhsval)) rhsval = -rrate
824  if (present(hcofval)) hcofval = dzero
825  !
826  ! -- Return
827  return

◆ 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 289 of file gwe-sfe.f90.

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

◆ 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 581 of file gwe-sfe.f90.

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

◆ 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 457 of file gwe-sfe.f90.

458  ! -- dummy
459  class(GweSfeType) :: this
460  ! -- return
461  integer(I4B) :: nbudterms
462  !
463  ! -- Number of budget terms is 6:
464  ! 1. rainfall
465  ! 2. evaporation
466  ! 3. runoff
467  ! 4. ext-inflow
468  ! 5. ext-outflow
469  ! 6. streambed-cond
470  nbudterms = 6
471  !
472  ! -- Return
473  return

◆ 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 863 of file gwe-sfe.f90.

864  ! -- dummy
865  class(GweSfeType) :: this
866  integer(I4B), intent(in) :: ientry
867  integer(I4B), intent(inout) :: n1
868  integer(I4B), intent(inout) :: n2
869  real(DP), intent(inout), optional :: rrate
870  real(DP), intent(inout), optional :: rhsval
871  real(DP), intent(inout), optional :: hcofval
872  ! -- local
873  real(DP) :: qbnd
874  real(DP) :: ctmp
875  !
876  n1 = this%flowbudptr%budterm(this%idxbudiflw)%id1(ientry)
877  n2 = this%flowbudptr%budterm(this%idxbudiflw)%id2(ientry)
878  qbnd = this%flowbudptr%budterm(this%idxbudiflw)%flow(ientry)
879  ctmp = this%tempiflw(n1)
880  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
881  if (present(rhsval)) rhsval = -rrate
882  if (present(hcofval)) hcofval = dzero
883  !
884  ! -- Return
885  return

◆ 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 893 of file gwe-sfe.f90.

894  ! -- dummy
895  class(GweSfeType) :: this
896  integer(I4B), intent(in) :: ientry
897  integer(I4B), intent(inout) :: n1
898  integer(I4B), intent(inout) :: n2
899  real(DP), intent(inout), optional :: rrate
900  real(DP), intent(inout), optional :: rhsval
901  real(DP), intent(inout), optional :: hcofval
902  ! -- local
903  real(DP) :: qbnd
904  real(DP) :: ctmp
905  !
906  n1 = this%flowbudptr%budterm(this%idxbudoutf)%id1(ientry)
907  n2 = this%flowbudptr%budterm(this%idxbudoutf)%id2(ientry)
908  qbnd = this%flowbudptr%budterm(this%idxbudoutf)%flow(ientry)
909  ctmp = this%xnewpak(n1)
910  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
911  if (present(rhsval)) rhsval = dzero
912  if (present(hcofval)) hcofval = qbnd * this%eqnsclfac
913  !
914  ! -- Return
915  return

◆ 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 776 of file gwe-sfe.f90.

777  ! -- dummy
778  class(GweSfeType) :: this
779  integer(I4B), intent(in) :: ientry
780  integer(I4B), intent(inout) :: n1
781  integer(I4B), intent(inout) :: n2
782  real(DP), intent(inout), optional :: rrate
783  real(DP), intent(inout), optional :: rhsval
784  real(DP), intent(inout), optional :: hcofval
785  ! -- local
786  real(DP) :: qbnd
787  real(DP) :: ctmp
788  !
789  n1 = this%flowbudptr%budterm(this%idxbudrain)%id1(ientry)
790  n2 = this%flowbudptr%budterm(this%idxbudrain)%id2(ientry)
791  qbnd = this%flowbudptr%budterm(this%idxbudrain)%flow(ientry)
792  ctmp = this%temprain(n1)
793  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac ! kluge note: think about budget / sensible heat issue
794  if (present(rhsval)) rhsval = -rrate
795  if (present(hcofval)) hcofval = dzero
796  !
797  ! -- Return
798  return

◆ 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 832 of file gwe-sfe.f90.

833  ! -- dummy
834  class(GweSfeType) :: this
835  integer(I4B), intent(in) :: ientry
836  integer(I4B), intent(inout) :: n1
837  integer(I4B), intent(inout) :: n2
838  real(DP), intent(inout), optional :: rrate
839  real(DP), intent(inout), optional :: rhsval
840  real(DP), intent(inout), optional :: hcofval
841  ! -- local
842  real(DP) :: qbnd
843  real(DP) :: ctmp
844  !
845  n1 = this%flowbudptr%budterm(this%idxbudroff)%id1(ientry)
846  n2 = this%flowbudptr%budterm(this%idxbudroff)%id2(ientry)
847  qbnd = this%flowbudptr%budterm(this%idxbudroff)%flow(ientry)
848  ctmp = this%temproff(n1)
849  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
850  if (present(rhsval)) rhsval = -rrate
851  if (present(hcofval)) hcofval = dzero
852  !
853  ! -- Return
854  return

◆ 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 998 of file gwe-sfe.f90.

999  ! -- dummy
1000  class(GweSfeType), intent(inout) :: this !< package class
1001  type(ObserveType), intent(inout) :: obsrv !< observation object
1002  logical, intent(inout) :: found !< indicate whether observation was found
1003  ! -- local
1004  !
1005  found = .true.
1006  select case (obsrv%ObsTypeId)
1007  case ('RAINFALL')
1008  call this%rp_obs_byfeature(obsrv)
1009  case ('EVAPORATION')
1010  call this%rp_obs_byfeature(obsrv)
1011  case ('RUNOFF')
1012  call this%rp_obs_byfeature(obsrv)
1013  case ('EXT-INFLOW')
1014  call this%rp_obs_byfeature(obsrv)
1015  case ('EXT-OUTFLOW')
1016  call this%rp_obs_byfeature(obsrv)
1017  case ('TO-MVR')
1018  call this%rp_obs_byfeature(obsrv)
1019  case default
1020  found = .false.
1021  end select
1022  !
1023  ! -- Return
1024  return

◆ 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 1071 of file gwe-sfe.f90.

1072  ! -- modules
1074  ! -- dummy
1075  class(GweSfeType), intent(inout) :: this
1076  integer(I4B), intent(in) :: itemno
1077  character(len=*), intent(in) :: keyword
1078  logical, intent(inout) :: found
1079  ! -- local
1080  character(len=LINELENGTH) :: text
1081  integer(I4B) :: ierr
1082  integer(I4B) :: jj
1083  real(DP), pointer :: bndElem => null()
1084  !
1085  ! RAINFALL <rainfall>
1086  ! EVAPORATION <evaporation>
1087  ! RUNOFF <runoff>
1088  ! INFLOW <inflow>
1089  ! WITHDRAWAL <withdrawal>
1090  !
1091  found = .true.
1092  select case (keyword)
1093  case ('RAINFALL')
1094  ierr = this%apt_check_valid(itemno)
1095  if (ierr /= 0) then
1096  goto 999
1097  end if
1098  call this%parser%GetString(text)
1099  jj = 1
1100  bndelem => this%temprain(itemno)
1101  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1102  this%packName, 'BND', this%tsManager, &
1103  this%iprpak, 'RAINFALL')
1104  case ('EVAPORATION')
1105  ierr = this%apt_check_valid(itemno)
1106  if (ierr /= 0) then
1107  goto 999
1108  end if
1109  call this%parser%GetString(text)
1110  jj = 1
1111  bndelem => this%tempevap(itemno)
1112  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1113  this%packName, 'BND', this%tsManager, &
1114  this%iprpak, 'EVAPORATION')
1115  case ('RUNOFF')
1116  ierr = this%apt_check_valid(itemno)
1117  if (ierr /= 0) then
1118  goto 999
1119  end if
1120  call this%parser%GetString(text)
1121  jj = 1
1122  bndelem => this%temproff(itemno)
1123  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1124  this%packName, 'BND', this%tsManager, &
1125  this%iprpak, 'RUNOFF')
1126  case ('INFLOW')
1127  ierr = this%apt_check_valid(itemno)
1128  if (ierr /= 0) then
1129  goto 999
1130  end if
1131  call this%parser%GetString(text)
1132  jj = 1
1133  bndelem => this%tempiflw(itemno)
1134  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1135  this%packName, 'BND', this%tsManager, &
1136  this%iprpak, 'INFLOW')
1137  case default
1138  !
1139  ! -- Keyword not recognized so return to caller with found = .false.
1140  found = .false.
1141  end select
1142  !
1143 999 continue
1144  !
1145  ! -- Return
1146  return
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 478 of file gwe-sfe.f90.

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

◆ sfe_solve()

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

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

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

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'