24 use swfdfwmodule,
only: swfdfwtype
32 character(len=LENFTYPE) ::
ftype =
'PCP'
33 character(len=LENPACKAGENAME) ::
text =
' PCP'
37 real(dp),
dimension(:),
pointer,
contiguous :: precipitation => null()
38 logical,
pointer,
private :: read_as_arrays
41 type(swfdfwtype),
pointer :: dfw
71 subroutine pcp_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
72 mempath, dis, dfw, cxs)
74 class(
bndtype),
pointer :: packobj
75 integer(I4B),
intent(in) :: id
76 integer(I4B),
intent(in) :: ibcnum
77 integer(I4B),
intent(in) :: inunit
78 integer(I4B),
intent(in) :: iout
79 character(len=*),
intent(in) :: namemodel
80 character(len=*),
intent(in) :: pakname
81 character(len=*),
intent(in) :: mempath
83 type(swfdfwtype),
pointer,
intent(in) :: dfw
93 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
97 call pcpobj%pcp_allocate_scalars()
100 call packobj%pack_initialize()
102 packobj%inunit = inunit
105 packobj%ibcnum = ibcnum
126 call this%BndExtType%allocate_scalars()
129 allocate (this%read_as_arrays)
132 this%read_as_arrays = .false.
142 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
143 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
146 call this%BndExtType%allocate_arrays(nodelist, auxvar)
149 call mem_setptr(this%precipitation,
'PRECIPITATION', this%input_mempath)
152 call mem_checkin(this%precipitation,
'PRECIPITATION', this%memoryPath, &
153 'PRECIPITATION', this%input_mempath)
165 logical(LGP) :: found_readasarrays = .false.
168 call this%BndExtType%source_options()
171 call mem_set_value(this%read_as_arrays,
'READASARRAYS', this%input_mempath, &
175 call this%log_pcp_options(found_readasarrays)
184 logical(LGP),
intent(in) :: found_readasarrays
186 character(len=*),
parameter :: fmtreadasarrays = &
187 &
"(4x, 'PRECIPITATION INPUT WILL BE READ AS ARRAY(S).')"
190 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
193 if (found_readasarrays)
then
194 write (this%iout, fmtreadasarrays)
198 write (this%iout,
'(1x,a)') &
199 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
208 if (this%read_as_arrays)
then
212 this%maxbound = this%dis%get_ncpl()
215 if (this%maxbound <= 0)
then
217 'MAXBOUND must be an integer greater than zero.'
225 call this%BndExtType%source_dimensions()
231 call this%define_listlabel()
240 if (this%read_as_arrays)
then
241 call this%default_nodelist()
256 if (this%iper /=
kper)
return
258 if (this%read_as_arrays)
then
262 call this%BndExtType%bnd_rp()
272 character(len=30) :: nodestr
273 integer(I4B) :: i, nr
274 character(len=*),
parameter :: fmterr = &
275 &
"('Specified stress ',i0, &
276 &' precipitation (',g0,') is less than zero for cell', a)"
279 do i = 1, this%nbound
280 nr = this%nodelist(i)
282 if (this%precipitation(i) <
dzero)
then
283 call this%dis%noder_to_string(nr, nodestr)
284 write (
errmsg, fmt=fmterr) i, this%precipitation(i), trim(nodestr)
305 integer(I4B) :: idcxs
308 real(DP) :: width_channel
309 real(DP) :: top_width
311 real(DP),
dimension(:),
pointer :: reach_length
314 if (this%nbound == 0)
return
317 reach_length => this%reach_length_pointer()
320 do i = 1, this%nbound
323 node = this%nodelist(i)
336 if (this%dis%is_2d())
then
338 area = this%dis%get_area(node)
339 else if (this%dis%is_1d())
then
341 idcxs = this%dfw%idcxs(node)
342 call this%dis%get_flow_width(node, node, 0, width_channel, &
344 top_width = this%cxs%get_maximum_top_width(idcxs, width_channel)
345 area = reach_length(node) * top_width
349 qpcp = this%precipitation(i) * area
352 if (this%iauxmultcol > 0)
then
353 qpcp = qpcp * this%auxvar(this%iauxmultcol, i)
360 if (this%ibound(node) <= 0)
then
370 subroutine pcp_fc(this, rhs, ia, idxglo, matrix_sln)
373 real(DP),
dimension(:),
intent(inout) :: rhs
374 integer(I4B),
dimension(:),
intent(in) :: ia
375 integer(I4B),
dimension(:),
intent(in) :: idxglo
378 integer(I4B) :: i, n, ipos
381 do i = 1, this%nbound
384 rhs(n) = rhs(n) + this%rhs(i)
386 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
399 call this%BndExtType%bnd_da()
402 deallocate (this%read_as_arrays)
405 call mem_deallocate(this%precipitation,
'PRECIPITATION', this%memoryPath)
421 this%listlabel = trim(this%filtyp)//
' NO.'
422 if (this%dis%ndim == 3)
then
423 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
424 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
425 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
426 elseif (this%dis%ndim == 2)
then
427 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
428 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
430 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
432 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'PRECIPITATION'
435 if (this%inamedbound == 1)
then
436 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
446 integer(I4B) :: nodeu, noder
451 do nodeu = 1, this%maxbound
452 noder = this%dis%get_nodenumber(nodeu, 0)
453 this%nodelist(nodeu) = noder
457 this%nbound = this%maxbound
486 call this%obs%StoreObsType(
'pcp', .true., indx)
497 integer(I4B),
intent(in) :: col
498 integer(I4B),
intent(in) :: row
504 if (this%iauxmultcol > 0)
then
505 bndval = this%precipitation(row) * this%auxvar(this%iauxmultcol, row)
507 bndval = this%precipitation(row)
510 errmsg =
'Programming error. PCP bound value requested column '&
511 &
'outside range of ncolbnd (1).'
521 real(dp),
dimension(:),
pointer :: ptr
This module contains block parser methods.
This module contains the extended boundary package.
This module contains the base boundary package.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenpackagename
maximum length of the package 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 maxcharlen
maximum length of char string
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the derived type ObsType.
subroutine, public defaultobsidprocessor(obsrv, dis, inunitobs, iout)
@ brief Process IDstring provided for each observation
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
This module contains the precipitation (PCP) package methods.
subroutine pcp_source_options(this)
Source options specific to PCPType.
real(dp) function, dimension(:), pointer reach_length_pointer(this)
subroutine pcp_allocate_arrays(this, nodelist, auxvar)
Allocate package arrays.
subroutine pcp_rp(this)
Read and Prepare.
subroutine log_pcp_options(this, found_readasarrays)
Log options specific to SwfPcpType.
subroutine pcp_fc(this, rhs, ia, idxglo, matrix_sln)
Copy rhs and hcof into solution rhs and amat.
character(len=lenftype) ftype
real(dp) function pcp_bound_value(this, col, row)
Return requested boundary value.
subroutine pcp_da(this)
Deallocate memory.
logical function pcp_obs_supported(this)
Overrides BndTypebnd_obs_supported()
subroutine default_nodelist(this)
Assign default nodelist when READASARRAYS is specified.
subroutine pcp_allocate_scalars(this)
Allocate scalar members.
subroutine pcp_read_initial_attr(this)
Part of allocate and read.
subroutine pcp_define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
subroutine pcp_df_obs(this)
Implements bnd_df_obs.
subroutine pcp_source_dimensions(this)
Source the dimensions for this package.
subroutine, public pcp_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, dis, dfw, cxs)
Create a Precipitation Package.
subroutine pcp_ck(this)
Ensure precipitation is positive.
character(len=lenpackagename) text
subroutine pcp_cf(this)
Formulate the HCOF and RHS terms.
integer(i4b), pointer, public kper
current stress period number
This class is used to store a single deferred-length character string. It was designed to work in an ...