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 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)
261 subroutine spc_rp(this, nbound_flowpack, budtxt)
264 integer(I4B),
intent(in) :: nbound_flowpack
265 character(len=*),
intent(in) :: budtxt
267 integer(I4B),
pointer :: iper
269 character(len=*),
parameter :: fmtlsp = &
270 &
"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
272 call mem_setptr(iper,
'IPER', this%input_mempath)
273 if (iper /=
kper)
then
274 write (this%iout, fmtlsp) trim(
ftype)
279 if (this%ts_active)
return
281 call this%apply_input_values()
282 call this%check_flow_package(nbound_flowpack, budtxt)
290 subroutine spc_ad(this, nbound_flowpack, budtxt)
293 integer(I4B),
intent(in) :: nbound_flowpack
294 character(len=*),
intent(in) :: budtxt
297 if (.not. this%ts_active)
return
299 call this%apply_input_values()
300 call this%check_flow_package(nbound_flowpack, budtxt)
312 if (this%readasarrays)
then
315 nullify (this%dblvec)
333 integer(I4B),
intent(in) :: nbound_flowpack
334 character(len=*),
intent(in) :: budtxt
337 if (this%maxbound < nbound_flowpack)
then
338 write (
errmsg,
'(a,a,a,i0,a,i0,a)') &
339 'The SPC Package corresponding to flow package ', &
340 trim(this%packNameFlow), &
341 ' has MAXBOUND set less than the number of boundaries &
342 &active in this package. Found MAXBOUND equal ', &
344 ' and number of flow boundaries (NBOUND) equal ', &
346 '. Increase MAXBOUND in the SPC input file for this package.'
353 select case (trim(adjustl(budtxt)))
355 if (.not. this%readasarrays)
then
356 write (
errmsg,
'(a,a,a)') &
357 'Array-based recharge must be used with array-based stress package &
358 &concentrations. GWF Package ', trim(this%packNameFlow),
' is being &
359 &used with list-based SPC6 input. Use array-based SPC6 input instead.'
364 if (.not. this%readasarrays)
then
365 write (
errmsg,
'(a,a,a)') &
366 'Array-based evapotranspiration must be used with array-based stress &
367 &package concentrations. GWF Package ', trim(this%packNameFlow), &
368 &
' is being used with list-based SPC6 input. Use array-based SPC6 &
374 if (this%readasarrays)
then
375 write (
errmsg,
'(a,a,a)') &
376 'List-based packages must be used with list-based stress &
377 &package concentrations. GWF Package ', trim(this%packNameFlow), &
378 &
' 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, then echo them.
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.