26 character(len=LENFTYPE) ::
ftype =
'SPC'
36 character(len=LENMODELNAME) :: name_model =
''
37 character(len=LENPACKAGENAME) :: packname =
''
38 character(len=LENPACKAGENAME) :: packnameflow =
''
39 character(len=LENVARNAME) :: depvarname =
''
40 character(len=LENMEMPATH) :: memorypath =
''
41 character(len=LENMEMPATH) :: input_mempath =
''
42 character(len=LINELENGTH) :: input_fname =
''
43 integer(I4B),
pointer :: id => null()
44 integer(I4B),
pointer :: iout => null()
45 integer(I4B),
pointer :: maxbound => null()
46 integer(I4B),
pointer :: iprpak => null()
47 logical(LGP),
pointer :: readasarrays => null()
48 logical(LGP) :: ts_active = .false.
49 real(dp),
dimension(:),
pointer,
contiguous :: dblvec => null()
73 subroutine initialize(this, dis, id, input_mempath, iout, name_model, &
74 packNameFlow, dvn, input_fname)
78 integer(I4B),
intent(in) :: id
79 character(len=*),
intent(in) :: input_mempath
80 integer(I4B),
intent(in) :: iout
81 character(len=*),
intent(in) :: name_model
82 character(len=*),
intent(in) :: packNameFlow
83 character(len=*),
intent(in) :: dvn
84 character(len=*),
intent(in) :: input_fname
86 integer(I4B),
pointer :: maxbound_ptr
88 logical(LGP) :: found_print_input
90 write (this%packName,
'(a,i0)')
'SPC-', id
92 call this%allocate_scalars()
94 this%name_model = name_model
96 this%input_mempath = input_mempath
97 this%input_fname = input_fname
100 this%packNameFlow = packnameflow
101 this%depvarname = dvn
105 call get_isize(
'READASARRAYS', input_mempath, isize)
106 this%readasarrays = (isize > 0)
109 if (this%readasarrays)
then
110 this%maxbound = dis%get_ncpl()
112 call mem_setptr(maxbound_ptr,
'MAXBOUND', input_mempath)
113 this%maxbound = maxbound_ptr
116 call this%allocate_arrays()
119 call mem_set_value(this%iprpak,
'PRINT_INPUT', this%input_mempath, &
121 if (found_print_input)
then
122 write (this%iout,
'(4x,a)')
'TIME-VARYING INPUT WILL BE PRINTED.'
126 call get_isize(
'TS6_FILENAME', input_mempath, isize)
127 if (isize > 0) this%ts_active = .true.
128 call get_isize(
'TAS6_FILENAME', input_mempath, isize)
129 if (isize > 0) this%ts_active = .true.
131 write (this%iout,
'(4x,a,a,a,a,a)')
'USING SPC INPUT FILE ', &
132 trim(input_fname),
' TO SET ', trim(dvn), &
133 'S FOR PACKAGE '//trim(packnameflow)
150 call mem_allocate(this%maxbound,
'MAXBOUND', this%memoryPath)
151 call mem_allocate(this%iprpak,
'IPRPAK', this%memoryPath)
152 call mem_allocate(this%readasarrays,
'READASARRAYS', this%memoryPath)
158 this%readasarrays = .false.
171 call mem_allocate(this%dblvec, this%maxbound,
'DBLVEC', this%memoryPath)
173 do i = 1, this%maxbound
174 this%dblvec(i) =
dzero
183 function get_value(this, ientry, nbound_flow)
result(value)
185 integer(I4B),
intent(in) :: ientry
186 integer(I4B),
intent(in) :: nbound_flow
189 if (this%readasarrays)
then
198 if (nbound_flow == this%maxbound)
then
201 value = this%dblvec(ientry)
206 nu = this%dis%get_nodeuser(ientry)
207 value = this%dblvec(nu)
210 value = this%dblvec(ientry)
224 integer(I4B),
pointer :: nbound
225 integer(I4B),
dimension(:),
pointer,
contiguous :: bndno_arr
226 real(DP),
dimension(:),
pointer,
contiguous :: val_arr
229 character(len=*),
parameter :: fmthdr = &
230 &
"(1X,/1X,'INPUT VALUES FOR ',A,' PACKAGE (PACKAGE ',A,')')"
231 character(len=*),
parameter :: fmtdvhdr = &
233 character(len=*),
parameter :: fmtdvval = &
236 if (this%readasarrays)
then
238 call mem_setptr(val_arr, trim(this%depvarname), this%input_mempath)
239 do n = 1, this%maxbound
240 this%dblvec(n) = val_arr(n)
242 if (this%iprpak /= 0)
then
243 write (this%iout, fmthdr) trim(this%depvarname), &
244 trim(this%packNameFlow)
245 write (this%iout, fmtdvhdr) trim(this%depvarname)
246 do n = 1, this%maxbound
247 write (this%iout, fmtdvval) n, this%dblvec(n)
252 call mem_setptr(nbound,
'NBOUND', this%input_mempath)
253 call mem_setptr(bndno_arr,
'BNDNO', this%input_mempath)
254 call mem_setptr(val_arr, trim(this%depvarname), this%input_mempath)
256 if (val_arr(n) /=
dnodata)
then
257 this%dblvec(bndno_arr(n)) = val_arr(n)
260 if (this%iprpak /= 0)
then
261 write (this%iout, fmthdr) trim(this%depvarname), &
262 trim(this%packNameFlow)
263 write (this%iout, fmtdvhdr) trim(this%depvarname)
264 do n = 1, this%maxbound
265 write (this%iout, fmtdvval) n, this%dblvec(n)
277 subroutine spc_rp(this, nbound_flowpack, budtxt)
280 integer(I4B),
intent(in) :: nbound_flowpack
281 character(len=*),
intent(in) :: budtxt
283 integer(I4B),
pointer :: iper
285 character(len=*),
parameter :: fmtlsp = &
286 &
"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
288 call mem_setptr(iper,
'IPER', this%input_mempath)
289 if (iper /=
kper)
then
290 write (this%iout, fmtlsp) trim(
ftype)
295 if (this%ts_active)
return
297 call this%apply_input_values()
298 call this%check_flow_package(nbound_flowpack, budtxt)
306 subroutine spc_ad(this, nbound_flowpack, budtxt)
309 integer(I4B),
intent(in) :: nbound_flowpack
310 character(len=*),
intent(in) :: budtxt
313 if (.not. this%ts_active)
return
315 call this%apply_input_values()
316 call this%check_flow_package(nbound_flowpack, budtxt)
345 integer(I4B),
intent(in) :: nbound_flowpack
346 character(len=*),
intent(in) :: budtxt
349 if (this%maxbound < nbound_flowpack)
then
350 write (
errmsg,
'(a,a,a,i0,a,i0,a)') &
351 'The SPC Package corresponding to flow package ', &
352 trim(this%packNameFlow), &
353 ' has MAXBOUND set less than the number of boundaries &
354 &active in this package. Found MAXBOUND equal ', &
356 ' and number of flow boundaries (NBOUND) equal ', &
358 '. Increase MAXBOUND in the SPC input file for this package.'
365 select case (trim(adjustl(budtxt)))
367 if (.not. this%readasarrays)
then
368 write (
errmsg,
'(a,a,a)') &
369 'Array-based recharge must be used with array-based stress package &
370 &concentrations. GWF Package ', trim(this%packNameFlow),
' is being &
371 &used with list-based SPC6 input. Use array-based SPC6 input instead.'
376 if (.not. this%readasarrays)
then
377 write (
errmsg,
'(a,a,a)') &
378 'Array-based evapotranspiration must be used with array-based stress &
379 &package concentrations. GWF Package ', trim(this%packNameFlow), &
380 &
' is being used with list-based SPC6 input. Use array-based SPC6 &
386 if (this%readasarrays)
then
387 write (
errmsg,
'(a,a,a)') &
388 'List-based packages must be used with list-based stress &
389 &package concentrations. GWF Package ', trim(this%packNameFlow), &
390 &
' is being used with array-based SPC6 input. Use list-based SPC6 &
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenpackagename
maximum length of the package name
real(dp), parameter dnodata
real no data constant
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b), pointer, public kper
current stress period number
This module contains the TspSpc Module.
subroutine spc_ad(this, nbound_flowpack, budtxt)
Advance.
subroutine spc_da(this)
Deallocate variables.
character(len=lenftype) ftype
subroutine initialize(this, dis, id, input_mempath, iout, name_model, packNameFlow, dvn, input_fname)
Initialize the SPC type.
subroutine check_flow_package(this, nbound_flowpack, budtxt)
Check flow package consistency.
real(dp) function get_value(this, ientry, nbound_flow)
Get the data value from this package.
subroutine allocate_scalars(this)
Allocate package scalars.
subroutine apply_input_values(this)
Apply current input mempath values to dblvec.
subroutine allocate_arrays(this)
Allocate package arrays.
subroutine spc_rp(this, nbound_flowpack, budtxt)
Read and prepare stress period data.
Derived type for managing SPC input.