27 use swfdfwmodule,
only: swfdfwtype
35 character(len=LENFTYPE) ::
ftype =
'EVP'
36 character(len=LENPACKAGENAME) ::
text =
' EVP'
40 real(dp),
dimension(:),
pointer,
contiguous :: evaporation => null()
41 integer(I4B),
pointer :: iflowred => null()
42 real(dp),
pointer :: reduction_depth => null()
43 logical,
pointer,
private :: read_as_arrays
46 type(swfdfwtype),
pointer :: dfw
78 subroutine evp_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, &
79 mempath, dis, dfw, cxs)
81 class(
bndtype),
pointer :: packobj
82 integer(I4B),
intent(in) :: id
83 integer(I4B),
intent(in) :: ibcnum
84 integer(I4B),
intent(in) :: inunit
85 integer(I4B),
intent(in) :: iout
86 character(len=*),
intent(in) :: namemodel
87 character(len=*),
intent(in) :: pakname
88 character(len=*),
intent(in) :: mempath
90 type(swfdfwtype),
pointer,
intent(in) :: dfw
100 call packobj%set_names(ibcnum, namemodel, pakname,
ftype, mempath)
104 call evpobj%evp_allocate_scalars()
107 call packobj%pack_initialize()
109 packobj%inunit = inunit
112 packobj%ibcnum = ibcnum
132 call this%BndExtType%allocate_scalars()
135 call mem_allocate(this%iflowred,
'IFLOWRED', this%memoryPath)
136 call mem_allocate(this%reduction_depth,
'REDUCTION_DEPTH', this%memoryPath)
137 allocate (this%read_as_arrays)
141 this%reduction_depth =
dem6
142 this%read_as_arrays = .false.
152 integer(I4B),
dimension(:),
pointer,
contiguous,
optional :: nodelist
153 real(DP),
dimension(:, :),
pointer,
contiguous,
optional :: auxvar
156 call this%BndExtType%allocate_arrays(nodelist, auxvar)
159 call mem_setptr(this%evaporation,
'EVAPORATION', this%input_mempath)
162 call mem_checkin(this%evaporation,
'EVAPORATION', this%memoryPath, &
163 'EVAPORATION', this%input_mempath)
175 logical(LGP) :: found_readasarrays = .false.
178 call this%BndExtType%source_options()
181 call mem_set_value(this%read_as_arrays,
'READASARRAYS', this%input_mempath, &
185 call this%log_evp_options(found_readasarrays)
194 logical(LGP),
intent(in) :: found_readasarrays
196 character(len=*),
parameter :: fmtreadasarrays = &
197 &
"(4x, 'EVAPORATION INPUT WILL BE READ AS ARRAY(S).')"
200 write (this%iout,
'(/1x,a)')
'PROCESSING '//trim(adjustl(this%text)) &
203 if (found_readasarrays)
then
204 write (this%iout, fmtreadasarrays)
208 write (this%iout,
'(1x,a)') &
209 'END OF '//trim(adjustl(this%text))//
' OPTIONS'
218 if (this%read_as_arrays)
then
222 this%maxbound = this%dis%get_ncpl()
225 if (this%maxbound <= 0)
then
227 'MAXBOUND must be an integer greater than zero.'
235 call this%BndExtType%source_dimensions()
241 call this%define_listlabel()
250 if (this%read_as_arrays)
then
251 call this%default_nodelist()
266 if (this%iper /=
kper)
return
268 if (this%read_as_arrays)
then
272 call this%BndExtType%bnd_rp()
276 if (this%iprpak /= 0)
then
277 call this%write_list()
287 character(len=30) :: nodestr
288 integer(I4B) :: i, nr
289 character(len=*),
parameter :: fmterr = &
290 &
"('Specified stress ',i0, &
291 &' evaporation (',g0,') is less than zero for cell', a)"
294 do i = 1, this%nbound
295 nr = this%nodelist(i)
297 if (this%evaporation(i) <
dzero)
then
298 call this%dis%noder_to_string(nr, nodestr)
299 write (
errmsg, fmt=fmterr) i, this%evaporation(i), trim(nodestr)
327 real(DP),
dimension(:),
pointer :: reach_length
330 if (this%nbound == 0)
return
333 reach_length => this%reach_length_pointer()
337 do i = 1, this%nbound
340 node = this%nodelist(i)
350 if (this%ibound(node) <= 0)
then
360 evap = this%evaporation(i)
361 if (this%iauxmultcol > 0)
then
362 evap = evap * this%auxvar(this%iauxmultcol, i)
366 if (this%dis%is_1d())
then
367 rlen = reach_length(node)
371 q = -this%get_qevp(node, rlen, this%xnew(node), this%xold(node), evap)
380 qeps = -this%get_qevp(node, rlen, this%xnew(node) + eps, &
381 this%xold(node), evap)
384 derv = (qeps - q) / eps
388 this%rhs(i) = this%rhs(i) + derv * this%xnew(node)
403 function get_qevp(this, node, rlen, snew, sold, evaporation)
result(qevp)
406 integer(I4B),
intent(in) :: node
407 real(dp),
intent(in) :: rlen
408 real(dp),
intent(in) :: snew
409 real(dp),
intent(in) :: sold
410 real(dp),
intent(in) :: evaporation
414 integer(I4B) :: idcxs
422 real(dp) :: width_channel
427 bt = this%dis%bot(node)
430 if (this%dis%is_2d())
then
432 area = this%dis%get_area(node)
433 else if (this%dis%is_1d())
then
435 idcxs = this%dfw%idcxs(node)
436 call this%dis%get_flow_width(node, node, 0, width_channel, dummy)
439 anew = this%cxs%get_area(idcxs, width_channel, depth)
441 aold = this%cxs%get_area(idcxs, width_channel, depth)
442 wavg = this%cxs%get_wetted_top_width(idcxs, width_channel, depth)
444 if (abs(denom) >
dprec)
then
445 wavg = (anew - aold) / (snew - sold)
452 qmult = this%get_evap_reduce_mult(snew, bt)
455 qevp = evaporation * area * qmult
464 real(dp),
intent(in) :: stage
465 real(dp),
intent(in) :: bottom
472 if (this%iflowred == 1)
then
473 tp = bottom + this%reduction_depth
481 subroutine evp_fc(this, rhs, ia, idxglo, matrix_sln)
484 real(DP),
dimension(:),
intent(inout) :: rhs
485 integer(I4B),
dimension(:),
intent(in) :: ia
486 integer(I4B),
dimension(:),
intent(in) :: idxglo
489 integer(I4B) :: i, n, ipos
492 do i = 1, this%nbound
495 rhs(n) = rhs(n) + this%rhs(i)
497 call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
509 call this%BndExtType%bnd_da()
514 deallocate (this%read_as_arrays)
517 call mem_deallocate(this%evaporation,
'EVAPORATION', this%memoryPath)
533 this%listlabel = trim(this%filtyp)//
' NO.'
534 if (this%dis%ndim == 3)
then
535 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
536 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'ROW'
537 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'COL'
538 elseif (this%dis%ndim == 2)
then
539 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'LAYER'
540 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'CELL2D'
542 write (this%listlabel,
'(a, a7)') trim(this%listlabel),
'NODE'
544 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'EVAPORATION'
547 if (this%inamedbound == 1)
then
548 write (this%listlabel,
'(a, a16)') trim(this%listlabel),
'BOUNDARY NAME'
558 integer(I4B) :: nodeu, noder
563 do nodeu = 1, this%maxbound
564 noder = this%dis%get_nodenumber(nodeu, 0)
565 this%nodelist(nodeu) = noder
569 this%nbound = this%maxbound
598 call this%obs%StoreObsType(
'evp', .true., indx)
609 integer(I4B),
intent(in) :: col
610 integer(I4B),
intent(in) :: row
616 if (this%iauxmultcol > 0)
then
617 bndval = this%evaporation(row) * this%auxvar(this%iauxmultcol, row)
619 bndval = this%evaporation(row)
622 errmsg =
'Programming error. EVP bound value requested column '&
623 &
'outside range of ncolbnd (1).'
633 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
real(dp), parameter dhalf
real constant 1/2
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
real(dp), parameter dem6
real constant 1e-6
real(dp), parameter dzero
real constant zero
real(dp), parameter dprec
real constant machine precision
integer(i4b), parameter maxcharlen
maximum length of char string
real(dp), parameter done
real constant 1
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.
real(dp) function, public get_perturbation(x)
Calculate a numerical perturbation given the value of x.
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
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
This module contains the evaporation (EVP) package methods.
character(len=lenpackagename) text
real(dp) function get_qevp(this, node, rlen, snew, sold, evaporation)
Calculate qevp.
subroutine evp_da(this)
Deallocate memory.
subroutine evp_allocate_scalars(this)
Allocate scalar members.
subroutine evp_df_obs(this)
Implements bnd_df_obs.
subroutine evp_ck(this)
Ensure evaporation is positive.
subroutine evp_cf(this)
Formulate the HCOF and RHS terms.
logical function evp_obs_supported(this)
Overrides BndTypebnd_obs_supported()
subroutine evp_fc(this, rhs, ia, idxglo, matrix_sln)
Copy rhs and hcof into solution rhs and amat.
subroutine, public evp_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath, dis, dfw, cxs)
Create a Evaporation Package.
subroutine evp_rp(this)
Read and Prepare.
subroutine evp_define_listlabel(this)
Define the list heading that is written to iout when PRINT_INPUT option is used.
subroutine evp_allocate_arrays(this, nodelist, auxvar)
Allocate package arrays.
subroutine evp_source_dimensions(this)
Source the dimensions for this package.
real(dp) function evp_bound_value(this, col, row)
Return requested boundary value.
real(dp) function, dimension(:), pointer reach_length_pointer(this)
subroutine evp_source_options(this)
Source options specific to EVPType.
subroutine evp_read_initial_attr(this)
Part of allocate and read.
subroutine default_nodelist(this)
Assign default nodelist when READASARRAYS is specified.
subroutine log_evp_options(this, found_readasarrays)
Log options specific to SwfEvpType.
real(dp) function get_evap_reduce_mult(this, stage, bottom)
Calculate multiplier to reduce evap as depth goes to zero.
character(len=lenftype) ftype
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 ...