20 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
23 real(dp),
dimension(:),
pointer,
contiguous :: porosity => null()
24 real(dp),
dimension(:),
pointer,
contiguous :: alh => null()
25 real(dp),
dimension(:),
pointer,
contiguous :: alv => null()
26 real(dp),
dimension(:),
pointer,
contiguous :: ath1 => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: ath2 => null()
28 real(dp),
dimension(:),
pointer,
contiguous :: atv => null()
29 real(dp),
dimension(:),
pointer,
contiguous :: ktw => null()
30 real(dp),
dimension(:),
pointer,
contiguous :: kts => null()
31 integer(I4B),
pointer :: idisp => null()
32 integer(I4B),
pointer :: ialh => null()
33 integer(I4B),
pointer :: ialv => null()
34 integer(I4B),
pointer :: iath1 => null()
35 integer(I4B),
pointer :: iath2 => null()
36 integer(I4B),
pointer :: iatv => null()
37 integer(I4B),
pointer :: ixt3doff => null()
38 integer(I4B),
pointer :: ixt3drhs => null()
39 integer(I4B),
pointer :: iktw => null()
40 integer(I4B),
pointer :: ikts => null()
41 integer(I4B),
pointer :: ixt3d => null()
43 real(dp),
dimension(:),
pointer,
contiguous :: dispcoef => null()
44 integer(I4B),
pointer :: id22 => null()
45 integer(I4B),
pointer :: id33 => null()
46 real(dp),
dimension(:),
pointer,
contiguous :: d11 => null()
47 real(dp),
dimension(:),
pointer,
contiguous :: d22 => null()
48 real(dp),
dimension(:),
pointer,
contiguous :: d33 => null()
49 real(dp),
dimension(:),
pointer,
contiguous :: angle1 => null()
50 real(dp),
dimension(:),
pointer,
contiguous :: angle2 => null()
51 real(dp),
dimension(:),
pointer,
contiguous :: angle3 => null()
52 integer(I4B),
pointer :: iangle1 => null()
53 integer(I4B),
pointer :: iangle2 => null()
54 integer(I4B),
pointer :: iangle3 => null()
55 real(dp),
pointer :: eqnsclfac => null()
84 subroutine cnd_cr(cndobj, name_model, input_mempath, inunit, iout, fmi, &
91 character(len=*),
intent(in) :: name_model
92 character(len=*),
intent(in) :: input_mempath
93 integer(I4B),
intent(in) :: inunit
94 integer(I4B),
intent(in) :: iout
96 real(dp),
intent(in),
pointer :: eqnsclfac
99 character(len=*),
parameter :: fmtcnd = &
100 "(1x,/1x,'CND-- THERMAL CONDUCTION AND DISPERSION PACKAGE, VERSION 1, ', &
101 &'01/01/2024, INPUT READ FROM MEMPATH ', A, //)"
107 call cndobj%set_names(1, name_model,
'CND',
'CND', input_mempath)
110 call cndobj%allocate_scalars()
113 cndobj%inunit = inunit
116 cndobj%eqnsclfac => eqnsclfac
117 if (
present(gwecommon))
then
118 cndobj%gwecommon => gwecommon
121 if (cndobj%inunit > 0)
then
124 if (cndobj%iout > 0)
then
125 write (cndobj%iout, fmtcnd) input_mempath
148 if (
present(cndoptions))
then
149 this%ixt3d = cndoptions%ixt3d
152 call this%allocate_arrays(this%dis%nodes)
156 call this%source_options()
157 call this%allocate_arrays(this%dis%nodes)
160 call this%source_griddata()
164 if (this%ixt3d > 0)
then
165 call xt3d_cr(this%xt3d, this%name_model, this%inunit, this%iout, &
167 this%xt3d%ixt3d = this%ixt3d
168 call this%xt3d%xt3d_df(dis)
182 integer(I4B),
intent(in) :: moffset
186 if (this%ixt3d > 0)
call this%xt3d%xt3d_ac(moffset, sparse)
193 subroutine cnd_mc(this, moffset, matrix_sln)
198 integer(I4B),
intent(in) :: moffset
202 if (this%ixt3d > 0)
call this%xt3d%xt3d_mc(moffset, matrix_sln)
209 subroutine cnd_ar(this, ibound, porosity)
213 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
214 real(DP),
dimension(:),
pointer,
contiguous :: porosity
217 character(len=*),
parameter :: fmtcnd = &
218 "(1x,/1x,'CND-- THERMAL CONDUCTION AND DISPERSION PACKAGE, VERSION 1, ', &
219 &'5/01/2023, INPUT READ FROM UNIT ', i0, //)"
222 this%ibound => ibound
223 this%porosity => porosity
238 if (this%ixt3d > 0)
then
239 call this%xt3d%xt3d_ar(this%fmi%ibdgwfsat0, this%d11, this%id33, &
240 this%d33, this%fmi%gwfsat, this%id22, this%d22, &
241 this%iangle1, this%iangle2, this%iangle3, &
242 this%angle1, this%angle2, this%angle3)
247 call this%calcdispellipse()
250 if (this%fmi%iflowsupdated == 1)
then
251 if (this%ixt3d == 0)
then
252 call this%calcdispcoef()
253 else if (this%ixt3d > 0)
then
254 call this%xt3d%xt3d_fcpc(this%dis%nodes, .true.)
263 subroutine cnd_fc(this, kiter, nodes, nja, matrix_sln, idxglo, rhs, cnew)
266 integer(I4B) :: kiter
267 integer(I4B),
intent(in) :: nodes
268 integer(I4B),
intent(in) :: nja
270 integer(I4B),
intent(in),
dimension(nja) :: idxglo
271 real(DP),
intent(inout),
dimension(nodes) :: rhs
272 real(DP),
intent(inout),
dimension(nodes) :: cnew
274 integer(I4B) :: n, m, idiag, idiagm, ipos, isympos, isymcon
277 if (this%ixt3d > 0)
then
278 call this%xt3d%xt3d_fc(kiter, matrix_sln, idxglo, rhs, cnew)
281 if (this%fmi%ibdgwfsat0(n) == 0) cycle
282 idiag = this%dis%con%ia(n)
283 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
284 if (this%dis%con%mask(ipos) == 0) cycle
285 m = this%dis%con%ja(ipos)
287 if (this%fmi%ibdgwfsat0(m) == 0) cycle
288 isympos = this%dis%con%jas(ipos)
289 dnm = this%dispcoef(isympos)
292 call matrix_sln%add_value_pos(idxglo(ipos), dnm)
293 call matrix_sln%add_value_pos(idxglo(idiag), -dnm)
296 idiagm = this%dis%con%ia(m)
297 isymcon = this%dis%con%isym(ipos)
298 call matrix_sln%add_value_pos(idxglo(isymcon), dnm)
299 call matrix_sln%add_value_pos(idxglo(idiagm), -dnm)
313 real(DP),
intent(inout),
dimension(:) :: cnew
314 real(DP),
intent(inout),
dimension(:) :: flowja
316 integer(I4B) :: n, m, ipos, isympos
320 if (this%ixt3d > 0)
then
321 call this%xt3d%xt3d_flowja(cnew, flowja)
323 do n = 1, this%dis%nodes
324 if (this%fmi%ibdgwfsat0(n) == 0) cycle
325 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
326 m = this%dis%con%ja(ipos)
327 if (this%fmi%ibdgwfsat0(m) == 0) cycle
328 isympos = this%dis%con%jas(ipos)
329 dnm = this%dispcoef(isympos)
331 qnm = dnm * (cnew(m) - cnew(n))
332 flowja(ipos) = flowja(ipos) + qnm
350 call this%NumericalPackageType%allocate_scalars()
359 call mem_allocate(this%ixt3doff,
'IXT3DOFF', this%memoryPath)
360 call mem_allocate(this%ixt3drhs,
'IXT3DRHS', this%memoryPath)
364 call mem_allocate(this%iangle1,
'IANGLE1', this%memoryPath)
365 call mem_allocate(this%iangle2,
'IANGLE2', this%memoryPath)
366 call mem_allocate(this%iangle3,
'IANGLE3', this%memoryPath)
399 integer(I4B),
intent(in) :: nodes
402 call mem_allocate(this%alh, nodes,
'ALH', trim(this%memoryPath))
403 call mem_allocate(this%alv, nodes,
'ALV', trim(this%memoryPath))
404 call mem_allocate(this%ath1, nodes,
'ATH1', trim(this%memoryPath))
405 call mem_allocate(this%ath2, nodes,
'ATH2', trim(this%memoryPath))
406 call mem_allocate(this%atv, nodes,
'ATV', trim(this%memoryPath))
407 call mem_allocate(this%d11, nodes,
'D11', trim(this%memoryPath))
408 call mem_allocate(this%d22, nodes,
'D22', trim(this%memoryPath))
409 call mem_allocate(this%d33, nodes,
'D33', trim(this%memoryPath))
410 call mem_allocate(this%angle1, nodes,
'ANGLE1', trim(this%memoryPath))
411 call mem_allocate(this%angle2, nodes,
'ANGLE2', trim(this%memoryPath))
412 call mem_allocate(this%angle3, nodes,
'ANGLE3', trim(this%memoryPath))
413 call mem_allocate(this%ktw, nodes,
'KTW', trim(this%memoryPath))
414 call mem_allocate(this%kts, nodes,
'KTS', trim(this%memoryPath))
417 if (this%ixt3d == 0)
then
418 call mem_allocate(this%dispcoef, this%dis%njas,
'DISPCOEF', &
419 trim(this%memoryPath))
421 call mem_allocate(this%dispcoef, 0,
'DISPCOEF', trim(this%memoryPath))
442 if (this%inunit /= 0)
then
457 if (this%ixt3d > 0)
call this%xt3d%xt3d_da()
461 if (this%ixt3d > 0)
deallocate (this%xt3d)
462 nullify (this%gwecommon)
483 call this%NumericalPackageType%da()
493 write (this%iout,
'(1x,a)')
'Setting CND Options'
494 write (this%iout,
'(4x,a,i0)')
'XT3D formulation [0=INACTIVE, 1=ACTIVE, &
495 &3=ACTIVE RHS] set to: ', this%ixt3d
496 write (this%iout,
'(1x,a,/)')
'End Setting CND Options'
511 call mem_set_value(this%ixt3doff,
'XT3D_OFF', this%input_mempath, &
513 call mem_set_value(this%ixt3drhs,
'XT3D_RHS', this%input_mempath, &
517 if (found%xt3d_off) this%ixt3d = 0
518 if (found%xt3d_rhs) this%ixt3d = 2
521 if (this%iout > 0)
then
522 call this%log_options(found)
533 write (this%iout,
'(1x,a)')
'Setting CND Griddata'
536 write (this%iout,
'(4x,a)')
'ALH set from input file'
540 write (this%iout,
'(4x,a)')
'ALV set from input file'
544 write (this%iout,
'(4x,a)')
'ATH1 set from input file'
548 write (this%iout,
'(4x,a)')
'ATH2 set from input file'
552 write (this%iout,
'(4x,a)')
'ATV set from input file'
556 write (this%iout,
'(4x,a)')
'KTW set from input file'
560 write (this%iout,
'(4x,a)')
'KTS set from input file'
563 write (this%iout,
'(1x,a,/)')
'End Setting CND Griddata'
578 character(len=LINELENGTH) :: errmsg
580 integer(I4B),
dimension(:),
pointer,
contiguous :: map
585 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
588 call mem_set_value(this%alh,
'ALH', this%input_mempath, map, found%alh)
589 call mem_set_value(this%alv,
'ALV', this%input_mempath, map, found%alv)
590 call mem_set_value(this%ath1,
'ATH1', this%input_mempath, map, found%ath1)
591 call mem_set_value(this%ath2,
'ATH2', this%input_mempath, map, found%ath2)
592 call mem_set_value(this%atv,
'ATV', this%input_mempath, map, found%atv)
593 call mem_set_value(this%ktw,
'KTW', this%input_mempath, map, found%ktw)
594 call mem_set_value(this%kts,
'KTS', this%input_mempath, map, found%kts)
597 if (found%alh) this%ialh = 1
598 if (found%alv) this%ialv = 1
599 if (found%ath1) this%iath1 = 1
600 if (found%ath2) this%iath2 = 1
601 if (found%atv) this%iatv = 1
602 if (found%ktw) this%iktw = 1
603 if (found%kts) this%ikts = 1
606 if (found%alh) this%idisp = this%idisp + 1
607 if (found%alv) this%idisp = this%idisp + 1
608 if (found%ath1) this%idisp = this%idisp + 1
609 if (found%ath2) this%idisp = this%idisp + 1
612 if (this%idisp > 0)
then
613 if (.not. (found%alh .and. found%ath1))
then
614 write (errmsg,
'(1x,a)') &
615 'If dispersivities are specified then ALH and ATH1 are required.'
619 if (.not. found%alv) &
621 'ALH', trim(this%memoryPath))
623 if (.not. found%ath2) &
625 'ATH1', trim(this%memoryPath))
627 if (.not. found%atv) &
629 'ATH2', trim(this%memoryPath))
639 if (this%iout > 0)
then
640 call this%log_griddata(found)
651 integer(I4B) :: nodes, n
652 real(DP) :: q, qx, qy, qz
653 real(DP) :: alh, alv, ath1, ath2, atv, a
654 real(DP) :: al, at1, at2
655 real(DP) :: qzoqsquared
661 nodes =
size(this%d11)
668 this%angle1(n) =
dzero
669 this%angle2(n) =
dzero
670 this%angle3(n) =
dzero
671 if (this%fmi%ibdgwfsat0(n) == 0) cycle
678 qx = this%fmi%gwfspdis(1, n)
679 qy = this%fmi%gwfspdis(2, n)
680 qz = this%fmi%gwfspdis(3, n)
681 q = qx**2 + qy**2 + qz**2
682 if (q >
dzero) q = sqrt(q)
690 if (this%idisp > 0)
then
700 if (this%iktw > 0) ktbulk = ktbulk + this%porosity(n) * this%ktw(n) * &
702 if (this%ikts > 0) ktbulk = ktbulk + (
done - this%porosity(n)) * this%kts(n)
710 dstar = ktbulk / (this%gwecommon%gwecpw * this%gwecommon%gwerhow)
717 qzoqsquared = (qz / q)**2
718 al = alh * (
done - qzoqsquared) + alv * qzoqsquared
719 at1 = ath1 * (
done - qzoqsquared) + atv * qzoqsquared
720 at2 = ath2 * (
done - qzoqsquared) + atv * qzoqsquared
724 qsw = q * this%fmi%gwfsat(n) * this%eqnsclfac
725 this%d11(n) = al * qsw + ktbulk
726 this%d22(n) = at1 * qsw + ktbulk
727 this%d33(n) = at2 * qsw + ktbulk
730 if (this%idisp > 0)
then
733 this%angle3(n) =
dzero
737 if (q >
dzero) a = qz / q
738 this%angle2(n) = asin(a)
741 a = q * cos(this%angle2(n))
751 elseif (a >=
done)
then
752 this%angle1(n) =
dzero
754 this%angle1(n) = acos(a)
770 integer(I4B) :: nodes, n, m, idiag, ipos
771 real(DP) :: clnm, clmn, dn, dm
772 real(DP) :: vg1, vg2, vg3
773 integer(I4B) :: ihc, isympos
774 integer(I4B) :: iavgmeth
775 real(DP) :: satn, satm, topn, topm, botn, botm
776 real(DP) :: hwva, cond, cn, cm, denom
777 real(DP) :: anm, amn, thksatn, thksatm
783 nodes =
size(this%d11)
785 if (this%fmi%ibdgwfsat0(n) == 0) cycle
786 idiag = this%dis%con%ia(n)
787 do ipos = this%dis%con%ia(n) + 1, this%dis%con%ia(n + 1) - 1
790 m = this%dis%con%ja(ipos)
794 isympos = this%dis%con%jas(ipos)
795 this%dispcoef(isympos) =
dzero
796 if (this%fmi%ibdgwfsat0(m) == 0) cycle
799 hwva = this%dis%con%hwva(isympos)
800 clnm = this%dis%con%cl1(isympos)
801 clmn = this%dis%con%cl2(isympos)
802 ihc = this%dis%con%ihc(isympos)
803 topn = this%dis%top(n)
804 topm = this%dis%top(m)
805 botn = this%dis%bot(n)
806 botm = this%dis%bot(m)
809 satn = this%fmi%ibdgwfsat0(n)
810 satm = this%fmi%ibdgwfsat0(m)
815 call this%dis%connection_normal(n, m, ihc, vg1, vg2, vg3, ipos)
816 dn =
hyeff(this%d11(n), this%d22(n), this%d33(n), &
817 this%angle1(n), this%angle2(n), this%angle3(n), &
818 vg1, vg2, vg3, iavgmeth)
819 dm =
hyeff(this%d11(m), this%d22(m), this%d33(m), &
820 this%angle1(m), this%angle2(m), this%angle3(m), &
821 vg1, vg2, vg3, iavgmeth)
826 clnm = satn * (topn - botn) *
dhalf
827 clmn = satm * (topm - botm) *
dhalf
831 if (satn ==
dzero)
then
833 else if (n > m .and. satn <
done)
then
838 if (satm ==
dzero)
then
840 else if (m > n .and. satm <
done)
then
856 thksatn = (topn - botn) * satn
857 thksatm = (topm - botm) * satm
874 if (clnm >
dzero) cn = dn * anm / clnm
876 if (clmn >
dzero) cm = dm * amn / clmn
878 if (denom >
dzero)
then
879 cond = cn * cm / denom
885 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
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
subroutine cnd_df(this, dis, cndOptions)
Define CND object.
subroutine cnd_ad(this)
Advance method for the package.
subroutine source_griddata(this)
Update CND simulation data from input mempath.
subroutine cnd_fc(this, kiter, nodes, nja, matrix_sln, idxglo, rhs, cnew)
Fill coefficient method for package.
subroutine, public cnd_cr(cndobj, name_model, input_mempath, inunit, iout, fmi, eqnsclfac, gwecommon)
Create a new CND object.
subroutine cnd_ar(this, ibound, porosity)
Allocate and read method for package.
subroutine calcdispellipse(this)
Calculate dispersion coefficients.
subroutine calcdispcoef(this)
Calculate dispersion coefficients.
subroutine cnd_ac(this, moffset, sparse)
Add connections to CND.
subroutine cnd_da(this)
@ brief Deallocate memory
subroutine allocate_arrays(this, nodes)
@ brief Allocate arrays for package
subroutine allocate_scalars(this)
@ brief Allocate scalar variables for package
subroutine source_options(this)
Update simulation mempath options.
subroutine cnd_mc(this, moffset, matrix_sln)
Map CND connections.
subroutine log_griddata(this, found)
Write dimensions to list file.
subroutine cnd_cq(this, cnew, flowja)
@ brief Calculate flows for package
subroutine log_options(this, found)
Write user options to list file.
This module contains stateless conductance functions.
real(dp) function, public staggered_thkfrac(top, bot, sat, topc, botc)
Calculate the thickness fraction for staggered grids.
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 cnd option data