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 =
''
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 if (this%readasarrays)
then
172 call mem_allocate(this%dblvec, this%maxbound,
'DBLVEC', this%memoryPath)
173 do i = 1, this%maxbound
174 this%dblvec(i) =
dzero
179 call mem_setptr(this%dblvec, trim(this%depvarname), this%input_mempath)
188 function get_value(this, ientry, nbound_flow)
result(value)
190 integer(I4B),
intent(in) :: ientry
191 integer(I4B),
intent(in) :: nbound_flow
194 if (this%readasarrays)
then
203 if (nbound_flow == this%maxbound)
then
206 value = this%dblvec(ientry)
211 nu = this%dis%get_nodeuser(ientry)
212 value = this%dblvec(nu)
215 value = this%dblvec(ientry)
229 real(DP),
dimension(:),
pointer,
contiguous :: val_arr
232 character(len=*),
parameter :: fmthdr = &
233 &
"(1X,/1X,'INPUT VALUES FOR ',A,' PACKAGE (PACKAGE ',A,')')"
234 character(len=*),
parameter :: fmtdvhdr = &
236 character(len=*),
parameter :: fmtdvval = &
239 if (this%readasarrays)
then
240 call mem_setptr(val_arr, trim(this%depvarname), this%input_mempath)
241 do n = 1, this%maxbound
242 this%dblvec(n) = val_arr(n)
245 if (this%iprpak /= 0)
then
246 write (this%iout, fmthdr) trim(this%depvarname), &
247 trim(this%packNameFlow)
248 write (this%iout, fmtdvhdr) trim(this%depvarname)
249 do n = 1, this%maxbound
250 write (this%iout, fmtdvval) n, this%dblvec(n)
265 integer(I4B),
pointer :: iper
267 character(len=*),
parameter :: fmtlsp = &
268 &
"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
270 call mem_setptr(iper,
'IPER', this%input_mempath)
271 if (iper /=
kper)
then
272 write (this%iout, fmtlsp) trim(
ftype)
277 if (this%ts_active)
return
279 call this%apply_input_values()
287 subroutine spc_ad(this, nbound_flowpack, budtxt)
290 integer(I4B),
intent(in) :: nbound_flowpack
291 character(len=*),
intent(in) :: budtxt
296 call this%check_flow_package(nbound_flowpack, budtxt)
299 if (.not. this%ts_active)
return
301 call this%apply_input_values()
313 if (this%readasarrays)
then
316 nullify (this%dblvec)
334 integer(I4B),
intent(in) :: nbound_flowpack
335 character(len=*),
intent(in) :: budtxt
338 if (this%maxbound < nbound_flowpack)
then
339 write (
errmsg,
'(a,a,a,i0,a,i0,a)') &
340 'The SPC Package corresponding to flow package ', &
341 trim(this%packNameFlow), &
342 ' has MAXBOUND set less than the number of boundaries &
343 &active in this package. Found MAXBOUND equal ', &
345 ' and number of flow boundaries (NBOUND) equal ', &
347 '. Increase MAXBOUND in the SPC input file for this package.'
354 select case (trim(adjustl(budtxt)))
356 if (.not. this%readasarrays)
then
357 write (
errmsg,
'(a,a,a)') &
358 'Array-based recharge must be used with array-based stress package &
359 &concentrations. GWF Package ', trim(this%packNameFlow),
' is being &
360 &used with list-based SPC6 input. Use array-based SPC6 input instead.'
365 if (.not. this%readasarrays)
then
366 write (
errmsg,
'(a,a,a)') &
367 'Array-based evapotranspiration must be used with array-based stress &
368 &package concentrations. GWF Package ', trim(this%packNameFlow), &
369 &
' is being used with list-based SPC6 input. Use array-based SPC6 &
375 if (this%readasarrays)
then
376 write (
errmsg,
'(a,a,a)') &
377 'List-based packages must be used with list-based stress &
378 &package concentrations. GWF Package ', trim(this%packNameFlow), &
379 &
' is being used with array-based SPC6 input. Use list-based SPC6 &
subroutine allocate_scalars(this, name_model, input_mempath)
Allocate and initialize scalar variables.
subroutine allocate_arrays(this)
Allocate and initialize arrays.
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
@ dis
DIS6 discretization.
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)
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) iout
file unit number for simulation output
character(len=lenmempath), pointer input_mempath
input context mempath for tdis
character(len=linelength), pointer input_fname
input filename for tdis
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 check_flow_package(this, nbound_flowpack, budtxt)
Check flow package consistency.
subroutine spc_rp(this)
Read and prepare stress period data.
real(dp) function get_value(this, ientry, nbound_flow)
Get the data value from this package.
subroutine apply_input_values(this)
Apply current input mempath values to dblvec, then echo them.
subroutine initialize(this, dis, id, input_mempath, iout, name_model, packnameflow, dvn, input_fname)
Initialize the SPC type.
Derived type for managing SPC input.