19 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
21 real(dp),
dimension(:),
pointer,
contiguous :: thetam => null()
22 real(dp),
dimension(:),
pointer,
contiguous :: diffc => null()
23 real(dp),
dimension(:),
pointer,
contiguous :: alh => null()
24 real(dp),
dimension(:),
pointer,
contiguous :: alv => null()
25 real(dp),
dimension(:),
pointer,
contiguous :: ath1 => null()
26 real(dp),
dimension(:),
pointer,
contiguous :: ath2 => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: atv => null()
28 integer(I4B),
pointer :: idiffc => null()
29 integer(I4B),
pointer :: idisp => null()
30 integer(I4B),
pointer :: ialh => null()
31 integer(I4B),
pointer :: ialv => null()
32 integer(I4B),
pointer :: iath1 => null()
33 integer(I4B),
pointer :: iath2 => null()
34 integer(I4B),
pointer :: iatv => null()
35 integer(I4B),
pointer :: ixt3doff => null()
36 integer(I4B),
pointer :: ixt3drhs => null()
37 integer(I4B),
pointer :: ixt3d => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: dispcoef => null()
40 integer(I4B),
pointer :: id22 => null()
41 integer(I4B),
pointer :: id33 => null()
42 real(dp),
dimension(:),
pointer,
contiguous :: d11 => null()
43 real(dp),
dimension(:),
pointer,
contiguous :: d22 => null()
44 real(dp),
dimension(:),
pointer,
contiguous :: d33 => null()
45 real(dp),
dimension(:),
pointer,
contiguous :: angle1 => null()
46 real(dp),
dimension(:),
pointer,
contiguous :: angle2 => null()
47 real(dp),
dimension(:),
pointer,
contiguous :: angle3 => null()
48 integer(I4B),
pointer :: iangle1 => null()
49 integer(I4B),
pointer :: iangle2 => null()
50 integer(I4B),
pointer :: iangle3 => null()
77 subroutine dsp_cr(dspobj, name_model, input_mempath, inunit, iout, fmi)
83 character(len=*),
intent(in) :: name_model
84 character(len=*),
intent(in) :: input_mempath
85 integer(I4B),
intent(in) :: inunit
86 integer(I4B),
intent(in) :: iout
90 character(len=*),
parameter :: fmtdsp = &
91 "(1x,/1x,'DSP-- DISPERSION PACKAGE, VERSION 1, 1/24/2018', &
92 &' INPUT READ FROM MEMPATH: ', A, //)"
98 call dspobj%set_names(1, name_model,
'DSP',
'DSP', input_mempath)
101 call dspobj%allocate_scalars()
104 dspobj%inunit = inunit
108 if (dspobj%inunit > 0)
then
111 if (dspobj%iout > 0)
then
112 write (dspobj%iout, fmtdsp) input_mempath
136 if (
present(dspoptions))
then
137 this%ixt3d = dspoptions%ixt3d
140 call this%allocate_arrays(this%dis%nodes)
144 call this%source_options()
145 call this%allocate_arrays(this%dis%nodes)
148 call this%source_griddata()
152 if (this%ixt3d > 0)
then
153 call xt3d_cr(this%xt3d, this%name_model, this%inunit, this%iout, &
155 this%xt3d%ixt3d = this%ixt3d
156 call this%xt3d%xt3d_df(dis)
170 integer(I4B),
intent(in) :: moffset
175 if (this%ixt3d > 0)
call this%xt3d%xt3d_ac(moffset, sparse)
182 subroutine dsp_mc(this, moffset, matrix_sln)
187 integer(I4B),
intent(in) :: moffset
192 if (this%ixt3d > 0)
call this%xt3d%xt3d_mc(moffset, matrix_sln)
203 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
204 real(DP),
dimension(:),
pointer,
contiguous :: thetam
207 character(len=*),
parameter :: fmtdsp = &
208 "(1x,/1x,'DSP-- DISPERSION PACKAGE, VERSION 1, 1/24/2018', &
209 &' INPUT READ FROM UNIT ', i0, //)"
212 this%ibound => ibound
213 this%thetam => thetam
229 if (this%ixt3d > 0)
then
230 call this%xt3d%xt3d_ar(this%fmi%ibdgwfsat0, this%d11, this%id33, &
231 this%d33, this%fmi%gwfsat, this%id22, this%d22, &
232 this%iangle1, this%iangle2, this%iangle3, &
233 this%angle1, this%angle2, this%angle3)
238 call this%calcdispellipse()
241 if (this%fmi%iflowsupdated == 1)
then
242 if (this%ixt3d == 0)
then
243 call this%calcdispcoef()
244 else if (this%ixt3d > 0)
then
245 call this%xt3d%xt3d_fcpc(this%dis%nodes, .false.)
254 subroutine dsp_fc(this, kiter, nodes, nja, matrix_sln, idxglo, rhs, cnew)
258 integer(I4B) :: kiter
259 integer(I4B),
intent(in) :: nodes
260 integer(I4B),
intent(in) :: nja
262 integer(I4B),
intent(in),
dimension(nja) :: idxglo
263 real(DP),
intent(inout),
dimension(nodes) :: rhs
264 real(DP),
intent(inout),
dimension(nodes) :: cnew
266 integer(I4B) :: n, m, idiag, idiagm, ipos, isympos, isymcon
269 if (this%ixt3d > 0)
then
270 call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, cnew)
273 if (this%fmi%ibdgwfsat0(n) == 0) cycle
274 idiag = this%dis%con%ia(n)
275 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
276 if (this%dis%con%mask(ipos) == 0) cycle
277 m = this%dis%con%ja(ipos)
279 if (this%fmi%ibdgwfsat0(m) == 0) cycle
280 isympos = this%dis%con%jas(ipos)
281 dnm = this%dispcoef(isympos)
284 call matrix_sln%add_value_pos(idxglo(ipos), dnm)
285 call matrix_sln%add_value_pos(idxglo(idiag), -dnm)
288 idiagm = this%dis%con%ia(m)
289 isymcon = this%dis%con%isym(ipos)
290 call matrix_sln%add_value_pos(idxglo(isymcon), dnm)
291 call matrix_sln%add_value_pos(idxglo(idiagm), -dnm)
305 real(DP),
intent(inout),
dimension(:) :: cnew
306 real(DP),
intent(inout),
dimension(:) :: flowja
308 integer(I4B) :: n, m, ipos, isympos
312 if (this%ixt3d > 0)
then
313 call this%xt3d%xt3d_flowja(cnew, flowja)
315 do n = 1, this%dis%nodes
316 if (this%fmi%ibdgwfsat0(n) == 0) cycle
317 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
318 m = this%dis%con%ja(ipos)
319 if (this%fmi%ibdgwfsat0(m) == 0) cycle
320 isympos = this%dis%con%jas(ipos)
321 dnm = this%dispcoef(isympos)
322 flowja(ipos) = flowja(ipos) + dnm * (cnew(m) - cnew(n))
341 call this%NumericalPackageType%allocate_scalars()
344 call mem_allocate(this%idiffc,
'IDIFFC', this%memoryPath)
351 call mem_allocate(this%ixt3doff,
'IXT3DOFF', this%memoryPath)
352 call mem_allocate(this%ixt3drhs,
'IXT3DRHS', this%memoryPath)
356 call mem_allocate(this%iangle1,
'IANGLE1', this%memoryPath)
357 call mem_allocate(this%iangle2,
'IANGLE2', this%memoryPath)
358 call mem_allocate(this%iangle3,
'IANGLE3', this%memoryPath)
388 integer(I4B),
intent(in) :: nodes
392 call mem_allocate(this%alh, nodes,
'ALH', trim(this%memoryPath))
393 call mem_allocate(this%alv, nodes,
'ALV', trim(this%memoryPath))
394 call mem_allocate(this%ath1, nodes,
'ATH1', trim(this%memoryPath))
395 call mem_allocate(this%ath2, nodes,
'ATH2', trim(this%memoryPath))
396 call mem_allocate(this%atv, nodes,
'ATV', trim(this%memoryPath))
397 call mem_allocate(this%diffc, nodes,
'DIFFC', trim(this%memoryPath))
398 call mem_allocate(this%d11, nodes,
'D11', trim(this%memoryPath))
399 call mem_allocate(this%d22, nodes,
'D22', trim(this%memoryPath))
400 call mem_allocate(this%d33, nodes,
'D33', trim(this%memoryPath))
401 call mem_allocate(this%angle1, nodes,
'ANGLE1', trim(this%memoryPath))
402 call mem_allocate(this%angle2, nodes,
'ANGLE2', trim(this%memoryPath))
403 call mem_allocate(this%angle3, nodes,
'ANGLE3', trim(this%memoryPath))
406 if (this%ixt3d == 0)
then
407 call mem_allocate(this%dispcoef, this%dis%njas,
'DISPCOEF', &
408 trim(this%memoryPath))
410 call mem_allocate(this%dispcoef, 0,
'DISPCOEF', trim(this%memoryPath))
431 if (this%inunit /= 0)
then
445 if (this%ixt3d > 0)
call this%xt3d%xt3d_da()
449 if (this%ixt3d > 0)
deallocate (this%xt3d)
469 call this%NumericalPackageType%da()
472 this%thetam => null()
482 write (this%iout,
'(1x,a)')
'Setting DSP Options'
483 write (this%iout,
'(4x,a,i0)')
'XT3D formulation [0=INACTIVE, 1=ACTIVE, &
484 &3=ACTIVE RHS] set to: ', this%ixt3d
485 write (this%iout,
'(1x,a,/)')
'End Setting DSP Options'
501 call mem_set_value(this%ixt3doff,
'XT3D_OFF', this%input_mempath, &
503 call mem_set_value(this%ixt3drhs,
'XT3D_RHS', this%input_mempath, &
507 if (found%xt3d_off) this%ixt3d = 0
508 if (found%xt3d_rhs) this%ixt3d = 2
511 if (this%iout > 0)
then
512 call this%log_options(found)
523 write (this%iout,
'(1x,a)')
'Setting DSP Griddata'
525 if (found%diffc)
then
526 write (this%iout,
'(4x,a)')
'DIFFC set from input file'
530 write (this%iout,
'(4x,a)')
'ALH set from input file'
534 write (this%iout,
'(4x,a)')
'ALV set from input file'
538 write (this%iout,
'(4x,a)')
'ATH1 set from input file'
542 write (this%iout,
'(4x,a)')
'ATH2 set from input file'
546 write (this%iout,
'(4x,a)')
'ATV set from input file'
549 write (this%iout,
'(1x,a,/)')
'End Setting DSP Griddata'
565 character(len=LINELENGTH) :: errmsg
567 integer(I4B),
dimension(:),
pointer,
contiguous :: map
572 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
575 call mem_set_value(this%diffc,
'DIFFC', this%input_mempath, map, found%diffc)
576 call mem_set_value(this%alh,
'ALH', this%input_mempath, map, found%alh)
577 call mem_set_value(this%alv,
'ALV', this%input_mempath, map, found%alv)
578 call mem_set_value(this%ath1,
'ATH1', this%input_mempath, map, found%ath1)
579 call mem_set_value(this%ath2,
'ATH2', this%input_mempath, map, found%ath2)
580 call mem_set_value(this%atv,
'ATV', this%input_mempath, map, found%atv)
583 if (found%diffc) this%idiffc = 1
584 if (found%alh) this%ialh = 1
585 if (found%alv) this%ialv = 1
586 if (found%ath1) this%iath1 = 1
587 if (found%ath2) this%iath2 = 1
588 if (found%atv) this%iatv = 1
591 if (.not. found%diffc)
then
592 call mem_reallocate(this%diffc, 0,
'DIFFC', trim(this%memoryPath))
596 if (found%alh) this%idisp = this%idisp + 1
597 if (found%alv) this%idisp = this%idisp + 1
598 if (found%ath1) this%idisp = this%idisp + 1
599 if (found%ath2) this%idisp = this%idisp + 1
602 if (this%idisp > 0)
then
603 if (.not. (found%alh .and. found%ath1))
then
604 write (errmsg,
'(a)') &
605 'if dispersivities are specified then ALH and ATH1 are required.'
609 if (.not. found%alv) &
611 'ALH', trim(this%memoryPath))
613 if (.not. found%ath2) &
615 'ATH1', trim(this%memoryPath))
617 if (.not. found%atv) &
619 'ATH2', trim(this%memoryPath))
629 if (this%iout > 0)
then
630 call this%log_griddata(found)
641 integer(I4B) :: nodes, n
642 real(DP) :: q, qx, qy, qz
643 real(DP) :: alh, alv, ath1, ath2, atv, a
644 real(DP) :: al, at1, at2
645 real(DP) :: qzoqsquared
649 nodes =
size(this%d11)
656 this%angle1(n) =
dzero
657 this%angle2(n) =
dzero
658 this%angle3(n) =
dzero
659 if (this%fmi%ibdgwfsat0(n) == 0) cycle
666 qx = this%fmi%gwfspdis(1, n)
667 qy = this%fmi%gwfspdis(2, n)
668 qz = this%fmi%gwfspdis(3, n)
669 q = qx**2 + qy**2 + qz**2
670 if (q >
dzero) q = sqrt(q)
678 if (this%idisp > 0)
then
686 if (this%idiffc > 0)
then
689 dstar = this%diffc(n) * this%thetam(n)
697 qzoqsquared = (qz / q)**2
698 al = alh * (
done - qzoqsquared) + alv * qzoqsquared
699 at1 = ath1 * (
done - qzoqsquared) + atv * qzoqsquared
700 at2 = ath2 * (
done - qzoqsquared) + atv * qzoqsquared
704 this%d11(n) = al * q + dstar
705 this%d22(n) = at1 * q + dstar
706 this%d33(n) = at2 * q + dstar
709 if (this%idisp > 0)
then
717 this%angle3(n) =
dzero
721 if (q >
dzero) a = qz / q
722 this%angle2(n) = asin(a)
725 a = q * cos(this%angle2(n))
735 elseif (a >=
done)
then
736 this%angle1(n) =
dzero
738 this%angle1(n) = acos(a)
754 integer(I4B) :: nodes, n, m, idiag, ipos
755 real(DP) :: clnm, clmn, dn, dm
756 real(DP) :: vg1, vg2, vg3
757 integer(I4B) :: ihc, isympos
758 integer(I4B) :: iavgmeth
759 real(DP) :: satn, satm, topn, topm, botn, botm
760 real(DP) :: hwva, cond, cn, cm, denom
761 real(DP) :: anm, amn, thksatn, thksatm
767 nodes =
size(this%d11)
769 if (this%fmi%ibdgwfsat0(n) == 0) cycle
770 idiag = this%dis%con%ia(n)
771 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
774 m = this%dis%con%ja(ipos)
778 isympos = this%dis%con%jas(ipos)
779 this%dispcoef(isympos) =
dzero
780 if (this%fmi%ibdgwfsat0(m) == 0) cycle
783 hwva = this%dis%con%hwva(isympos)
784 clnm = this%dis%con%cl1(isympos)
785 clmn = this%dis%con%cl2(isympos)
786 ihc = this%dis%con%ihc(isympos)
787 topn = this%dis%top(n)
788 topm = this%dis%top(m)
789 botn = this%dis%bot(n)
790 botm = this%dis%bot(m)
793 satn = this%fmi%gwfsat(n)
794 satm = this%fmi%gwfsat(m)
799 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, ipos)
800 dn =
hyeff(this%d11(n), this%d22(n), this%d33(n), &
801 this%angle1(n), this%angle2(n), this%angle3(n), &
802 vg1, vg2, vg3, iavgmeth)
803 dm =
hyeff(this%d11(m), this%d22(m), this%d33(m), &
804 this%angle1(m), this%angle2(m), this%angle3(m), &
805 vg1, vg2, vg3, iavgmeth)
810 clnm = satn * (topn - botn) *
dhalf
811 clmn = satm * (topm - botm) *
dhalf
815 if (satn ==
dzero)
then
817 else if (n > m .and. satn <
done)
then
822 if (satm ==
dzero)
then
824 else if (m > n .and. satm <
done)
then
840 thksatn = (topn - botn) * satn
841 thksatm = (topm - botm) * satm
858 if (clnm >
dzero) cn = dn * anm / clnm
860 if (clmn >
dzero) cm = dm * amn / clmn
862 if (denom >
dzero)
then
863 cond = cn * cm / denom
869 this%dispcoef(isympos) = cond
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dpi
real constant
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
This module contains stateless conductance functions.
real(dp) function, public staggered_thkfrac(top, bot, sat, topc, botc)
Calculate the thickness fraction for staggered grids.
subroutine log_options(this, found)
Write user options to list file.
subroutine allocate_scalars(this)
@ brief Allocate scalar variables for package
subroutine dsp_df(this, dis, dspOptions)
Define DSP object.
subroutine dsp_da(this)
@ brief Deallocate memory
subroutine, public dsp_cr(dspobj, name_model, input_mempath, inunit, iout, fmi)
Create a DSP object.
subroutine log_griddata(this, found)
Write dimensions to list file.
subroutine dsp_fc(this, kiter, nodes, nja, matrix_sln, idxglo, rhs, cnew)
Fill coefficient method for package.
subroutine calcdispcoef(this)
Calculate dispersion coefficients.
subroutine dsp_ar(this, ibound, thetam)
Allocate and read method for package.
subroutine dsp_ad(this)
Advance method for the package.
subroutine dsp_mc(this, moffset, matrix_sln)
Map DSP connections.
subroutine source_griddata(this)
Update DSP simulation data from input mempath.
subroutine dsp_cq(this, cnew, flowja)
@ brief Calculate flows for package
subroutine allocate_arrays(this, nodes)
@ brief Allocate arrays for package
subroutine source_options(this)
Update simulation mempath options.
subroutine calcdispellipse(this)
Calculate dispersion coefficients.
subroutine dsp_ac(this, moffset, sparse)
Add connections to DSP.
General-purpose hydrogeologic functions.
real(dp) function, public hyeff(k11, k22, k33, ang1, ang2, ang3, vg1, vg2, vg3, iavgmeth)
Calculate the effective horizontal hydraulic conductivity from an ellipse using a specified direction...
This module defines variable data types.
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains the base numerical package type.
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.
This module contains simulation variables.
character(len=linelength) idm_context
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
subroutine, public xt3d_cr(xt3dobj, name_model, inunit, iout, ldispopt)
Create a new xt3d object.
data structure (and helpers) for passing dsp option data