21 character(len=LENFTYPE) ::
ftype =
'EVT'
22 character(len=LENPACKAGENAME) ::
text =
' EVT'
23 character(len=LENPACKAGENAME) ::
texta =
' EVTA'
27 logical,
pointer,
private :: segsdefined
28 logical,
pointer,
private :: fixed_cell
29 logical,
pointer,
private :: read_as_arrays
30 logical,
pointer,
private :: surfratespecified
32 integer(I4B),
pointer,
private :: nseg => null()
34 real(dp),
dimension(:),
pointer,
contiguous :: surface => null()
35 real(dp),
dimension(:),
pointer,
contiguous :: rate => null()
36 real(dp),
dimension(:),
pointer,
contiguous :: depth => null()
37 real(dp),
dimension(:, :),
pointer,
contiguous :: pxdp => null()
38 real(dp),
dimension(:, :),
pointer,
contiguous :: petm => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: petm0 => null()
40 integer(I4B),
dimension(:),
pointer,
contiguous :: nodesontop => null()
67 subroutine evt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
70 class(
bndtype),
pointer :: packobj
71 integer(I4B),
intent(in) :: id
72 integer(I4B),
intent(in) :: ibcnum
73 integer(I4B),
intent(in) :: inunit
74 integer(I4B),
intent(in) :: iout
75 character(len=*),
intent(in) :: namemodel
76 character(len=*),
intent(in) :: pakname
77 character(len=*),
intent(in) :: mempath
79 type(
evttype),
pointer :: evtobj
86 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
90 call evtobj%evt_allocate_scalars()
93 call packobj%pack_initialize()
95 packobj%inunit = inunit
98 packobj%ibcnum = ibcnum
108 class(
evttype),
intent(inout) :: this
111 call this%BndExtType%allocate_scalars()
117 allocate (this%segsdefined)
118 allocate (this%fixed_cell)
119 allocate (this%read_as_arrays)
120 allocate (this%surfratespecified)
124 this%segsdefined = .true.
125 this%fixed_cell = .false.
126 this%read_as_arrays = .false.
127 this%surfratespecified = .false.
137 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
138 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
141 call this%BndExtType%allocate_arrays(nodelist, auxvar)
144 call mem_setptr(this%surface,
'SURFACE', this%input_mempath)
145 call mem_setptr(this%rate,
'RATE', this%input_mempath)
146 call mem_setptr(this%depth,
'DEPTH', this%input_mempath)
149 call mem_checkin(this%surface,
'SURFACE', this%memoryPath, &
150 'SURFACE', this%input_mempath)
151 call mem_checkin(this%rate,
'RATE', this%memoryPath, &
152 'RATE', this%input_mempath)
153 call mem_checkin(this%depth,
'DEPTH', this%memoryPath, &
154 'DEPTH', this%input_mempath)
157 if (.not. this%read_as_arrays)
then
158 if (this%nseg > 1)
then
161 call mem_setptr(this%pxdp,
'PXDP', this%input_mempath)
162 call mem_setptr(this%petm,
'PETM', this%input_mempath)
165 call mem_checkin(this%pxdp,
'PXDP', this%memoryPath, &
166 'PXDP', this%input_mempath)
167 call mem_checkin(this%petm,
'PETM', this%memoryPath, &
168 'PETM', this%input_mempath)
171 if (this%surfratespecified)
then
174 call mem_setptr(this%petm0,
'PETM0', this%input_mempath)
177 call mem_checkin(this%petm0,
'PETM0', this%memoryPath, &
178 'PETM0', this%input_mempath)
189 class(
evttype),
intent(inout) :: this
191 logical(LGP) :: found_fixed_cell = .false.
192 logical(LGP) :: found_readasarrays = .false.
193 logical(LGP) :: found_surfratespec = .false.
196 call this%BndExtType%source_options()
200 this%input_mempath, found_fixed_cell)
202 this%input_mempath, found_readasarrays)
204 this%input_mempath, found_surfratespec)
206 if (found_readasarrays)
then
207 if (this%dis%supports_layers())
then
210 errmsg =
'READASARRAYS option is not compatible with selected'// &
211 ' discretization type.'
217 if (found_readasarrays .and. found_surfratespec)
then
218 if (this%read_as_arrays)
then
219 errmsg =
'READASARRAYS option is not compatible with the'// &
220 ' SURF_RATE_SPECIFIED option.'
227 call this%evt_log_options(found_fixed_cell, found_readasarrays, &
240 class(
evttype),
intent(inout) :: this
241 logical(LGP),
intent(in) :: found_fixed_cell
242 logical(LGP),
intent(in) :: found_readasarrays
243 logical(LGP),
intent(in) :: found_surfratespec
245 character(len=*),
parameter :: fmtihact = &
246 &
"(4x, 'EVAPOTRANSPIRATION WILL BE APPLIED TO HIGHEST ACTIVE CELL.')"
247 character(len=*),
parameter :: fmtfixedcell = &
248 &
"(4x, 'EVAPOTRANSPIRATION WILL BE APPLIED TO SPECIFIED CELL.')"
249 character(len=*),
parameter :: fmtreadasarrays = &
250 &
"(4x, 'EVAPOTRANSPIRATION INPUT WILL BE READ AS ARRAYS.')"
251 character(len=*),
parameter :: fmtsrz = &
252 &
"(4x, 'ET RATE AT SURFACE WILL BE ZERO.')"
253 character(len=*),
parameter :: fmtsrs = &
254 &
"(4x, 'ET RATE AT SURFACE WILL BE AS SPECIFIED BY PETM0.')"
257 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
260 if (found_fixed_cell)
then
261 write (this%iout, fmtfixedcell)
264 if (found_readasarrays)
then
265 write (this%iout, fmtreadasarrays)
268 if (found_surfratespec)
then
269 write (this%iout, fmtsrs)
273 write (this%iout,
'(1x,a)') &
274 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
283 class(
evttype),
intent(inout) :: this
285 logical(LGP) :: found_nseg = .false.
287 character(len=*),
parameter :: fmtnsegerr = &
288 &
"('Error: In EVT, NSEG must be > 0 but is specified as ',i0)"
293 if (this%read_as_arrays)
then
294 this%maxbound = this%dis%get_ncpl()
297 if (this%maxbound <= 0)
then
299 'MAXBOUND must be an integer greater than zero.'
307 call this%BndExtType%source_dimensions()
310 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
314 call mem_set_value(this%nseg,
'NSEG', this%input_mempath, found_nseg)
318 write (this%iout,
'(4x,a,i0)')
'NSEG = ', this%nseg
320 if (this%nseg < 1)
then
321 write (
errmsg, fmtnsegerr) this%nseg
325 elseif (this%nseg > 1)
then
327 if (this%read_as_arrays)
then
328 errmsg =
'In the EVT package, NSEG cannot be greater than 1'// &
329 ' when READASARRAYS is used.'
338 write (this%iout,
'(1x,a)') &
339 'END OF '//trim(adjustl(this%text))//
' DIMENSIONS'
345 call this%define_listlabel()
354 class(
evttype),
intent(inout) :: this
356 if (this%read_as_arrays)
then
357 call this%default_nodelist()
369 class(
evttype),
intent(inout) :: this
371 if (this%iper /=
kper)
return
373 if (this%read_as_arrays)
then
377 this%dis, this%input_mempath)
382 call this%BndExtType%bnd_rp()
385 if (this%nseg > 1)
then
386 call this%check_pxdp()
390 if (this%iprpak /= 0)
then
391 call this%write_list()
397 if (.not. this%fixed_cell)
call this%set_nodesontop()
408 class(
evttype),
intent(inout) :: this
413 integer(I4B) :: ierrmono
416 character(len=15) :: nodestr
418 character(len=*),
parameter :: fmtpxdp0 = &
419 &
"('PXDP must be between 0 and 1. Found ', G0, ' for cell ', A)"
420 character(len=*),
parameter :: fmtpxdp = &
421 &
"('PXDP is not monotonically increasing for cell ', A)"
425 do n = 1, this%nbound
426 node = this%nodelist(n)
429 segloop:
do i = 1, this%nseg
432 if (i < this%nseg)
then
433 pxdp2 = this%pxdp(i, n)
434 if (pxdp2 <=
dzero .or. pxdp2 >=
done)
then
435 call this%dis%noder_to_string(node, nodestr)
436 write (
errmsg, fmtpxdp0) pxdp2, trim(nodestr)
444 if (pxdp2 - pxdp1 <
dzero)
then
445 if (ierrmono == 0)
then
447 call this%dis%noder_to_string(node, nodestr)
448 write (
errmsg, fmtpxdp) trim(nodestr)
467 class(
evttype),
intent(inout) :: this
472 if (.not.
associated(this%nodesontop))
then
473 allocate (this%nodesontop(this%maxbound))
477 do n = 1, this%nbound
478 this%nodesontop(n) = this%nodelist(n)
488 integer(I4B) :: i, iseg, node
489 integer(I4B) :: idxdepth, idxrate
490 real(DP) :: c, d, h, s, x
492 real(DP) :: petm1, petm2, pxdp1, pxdp2, thcof, trhs
495 if (this%nbound == 0)
return
498 do i = 1, this%nbound
501 if (this%fixed_cell)
then
502 node = this%nodelist(i)
504 node = this%nodesontop(i)
515 if (.not. this%fixed_cell)
then
516 if (this%ibound(node) == 0) &
517 call this%dis%highest_active(node, this%ibound)
518 this%nodelist(i) = node
526 if (this%ibound(node) > 0 .and. this%ibound(node) /=
iwetlake)
then
528 if (this%iauxmultcol > 0)
then
529 c = this%rate(i) * this%dis%get_area(node) * &
530 this%auxvar(this%iauxmultcol, i)
532 c = this%rate(i) * this%dis%get_area(node)
536 if (this%surfratespecified)
then
537 petm0 = this%petm0(i)
542 if (this%surfratespecified)
then
544 this%rhs(i) = this%rhs(i) + petm0 * c
547 this%rhs(i) = this%rhs(i) + c
555 if (this%nseg > 1)
then
568 if (this%surfratespecified)
then
579 segloop:
do iseg = 1, this%nseg
582 if (iseg < this%nseg)
then
584 idxdepth = idxdepth + 1
585 idxrate = idxrate + 1
587 pxdp2 = this%pxdp(idxdepth, i)
588 petm2 = this%petm(idxrate, i)
593 if (d <= pxdp2 * x)
then
604 thcof = -(petm1 - petm2) * c / ((pxdp2 - pxdp1) * x)
605 trhs = thcof * (s - pxdp1 * x) + petm1 * c
612 this%rhs(i) = this%rhs(i) + trhs
613 this%hcof(i) = this%hcof(i) + thcof
623 subroutine evt_fc(this, rhs, ia, idxglo, matrix_sln)
626 real(DP),
dimension(:),
intent(inout) :: rhs
627 integer(I4B),
dimension(:),
intent(in) :: ia
628 integer(I4B),
dimension(:),
intent(in) :: idxglo
631 integer(I4B) :: i, n, ipos
634 do i = 1, this%nbound
638 if (this%ibound(n) ==
iwetlake)
then
643 rhs(n) = rhs(n) + this%rhs(i)
645 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
658 if (
associated(this%nodesontop))
deallocate (this%nodesontop)
663 if (.not. this%read_as_arrays)
then
664 if (this%nseg > 1)
then
669 if (this%surfratespecified)
then
676 deallocate (this%segsdefined)
677 deallocate (this%fixed_cell)
678 deallocate (this%read_as_arrays)
679 deallocate (this%surfratespecified)
682 call this%BndExtType%bnd_da()
690 class(
evttype),
intent(inout) :: this
692 integer(I4B) :: nsegm1, i
695 this%listlabel = trim(this%filtyp)//
' NO.'
696 if (this%dis%ndim == 3)
then
697 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
698 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
699 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
700 elseif (this%dis%ndim == 2)
then
701 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
702 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
704 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
706 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'SURFACE'
707 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'MAX. RATE'
708 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'EXT. DEPTH'
711 nsegm1 = this%nseg - 1
714 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'PXDP'
717 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'PETM'
722 if (this%surfratespecified)
then
723 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'PETM0'
731 if (this%inamedbound == 1)
then
732 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
747 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nodeu, noder, ipos
750 if (this%dis%ndim == 3)
then
751 nlay = this%dis%mshape(1)
752 nrow = this%dis%mshape(2)
753 ncol = this%dis%mshape(3)
754 elseif (this%dis%ndim == 2)
then
755 nlay = this%dis%mshape(1)
757 ncol = this%dis%mshape(2)
765 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
766 noder = this%dis%get_nodenumber(nodeu, 0)
767 this%nodelist(ipos) = noder
773 this%nbound = ipos - 1
777 if (.not. this%fixed_cell)
call this%set_nodesontop()
803 call this%obs%StoreObsType(
'evt', .true., indx)
813 class(
evttype),
intent(inout) :: this
814 integer(I4B),
intent(in) :: col
815 integer(I4B),
intent(in) :: row
826 bndval = this%surface(row)
828 if (this%iauxmultcol > 0)
then
829 bndval = this%rate(row) * this%auxvar(this%iauxmultcol, row)
831 bndval = this%rate(row)
834 bndval = this%depth(row)
837 if (this%nseg > 1)
then
838 if (col < (3 + this%nseg))
then
840 bndval = this%pxdp(idx, row)
841 else if (col < (3 + (2 * this%nseg) - 1))
then
842 idx = col - (3 + this%nseg - 1)
843 bndval = this%petm(idx, row)
844 else if (col == (3 + (2 * this%nseg) - 1))
then
845 if (this%surfratespecified)
then
847 bndval = this%petm0(row)
850 else if (this%surfratespecified)
then
853 bndval = this%petm0(row)
860 write (
errmsg,
'(a,i0,a)') &
861 'Programming error. EVT bound value requested column '&
862 &
'outside range of ncolbnd (', this%ncolbnd,
').'
883 integer(I4B),
dimension(:),
contiguous, &
884 pointer,
intent(inout) :: nodelist
886 character(len=*),
intent(in) :: input_mempath
887 integer(I4B),
intent(inout) :: nbound
888 integer(I4B),
intent(in) :: maxbound
890 character(len=24) :: aname =
' LAYER OR NODE INDEX'
892 integer(I4B),
dimension(:),
contiguous,
pointer :: ievt => null()
893 integer(I4B),
pointer :: inievt => null()
896 call mem_setptr(inievt,
'INIEVT', input_mempath)
899 if (inievt == 1)
then
906 call dis%nlarray_to_nodelist(ievt, nodelist, &
907 maxbound, nbound, aname)
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 iwetlake
integer constant for a dry lake
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
real(dp), parameter done
real constant 1
subroutine evt_log_options(this, found_fixed_cell, found_readasarrays, found_surfratespec)
Source options specific to EvtType.
subroutine evt_source_dimensions(this)
Source the dimensions for this package.
subroutine evt_rp(this)
Read and Prepare.
subroutine set_nodesontop(this)
Store nodelist in nodesontop.
subroutine evt_cf(this)
Formulate the HCOF and RHS terms.
character(len=lenpackagename) text
subroutine default_nodelist(this)
Assign default nodelist when READASARRAYS is specified.
subroutine evt_da(this)
Deallocate.
subroutine evt_df_obs(this)
Store observation type supported by EVT package.
subroutine evt_allocate_arrays(this, nodelist, auxvar)
Allocate package arrays.
real(dp) function evt_bound_value(this, col, row)
Return requested boundary value.
subroutine evt_read_initial_attr(this)
Part of allocate and read.
subroutine evt_source_options(this)
Source options specific to EvtType.
subroutine evt_allocate_scalars(this)
Allocate package scalar members.
subroutine, public evt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new Evapotranspiration Segments Package and point pakobj to the new package.
character(len=lenftype) ftype
subroutine nodelist_update(nodelist, nbound, maxbound, dis, input_mempath)
Update the nodelist based on IEVT input.
subroutine evt_fc(this, rhs, ia, idxglo, matrix_sln)
Copy rhs and hcof into solution rhs and amat.
logical function evt_obs_supported(this)
Return true because EVT package supports observations.
character(len=lenpackagename) texta
subroutine evt_define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
subroutine check_pxdp(this)
Subroutine to check pxdp.
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
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 ...