MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
xt3dmodule Module Reference

Data Types

type  xt3dtype
 

Functions/Subroutines

subroutine, public xt3d_cr (xt3dobj, name_model, inunit, iout, ldispopt)
 Create a new xt3d object. More...
 
subroutine xt3d_df (this, dis)
 Define the xt3d object. More...
 
subroutine xt3d_ac (this, moffset, sparse)
 Add connections for extended neighbors to the sparse matrix. More...
 
subroutine xt3d_mc (this, moffset, matrix_sln)
 Map connections and construct iax, jax, and idxglox. More...
 
subroutine xt3d_ar (this, ibound, k11, ik33, k33, sat, ik22, k22, iangle1, iangle2, iangle3, angle1, angle2, angle3, inewton, icelltype)
 Allocate and Read. More...
 
subroutine xt3d_fc (this, kiter, matrix_sln, idxglo, rhs, hnew)
 Formulate. More...
 
subroutine xt3d_fcpc (this, nodes, lsat)
 Formulate for permanently confined connections and save in amatpc and amatpcx. More...
 
subroutine xt3d_fhfb (this, kiter, nodes, nja, matrix_sln, idxglo, rhs, hnew, n, m, condhfb)
 Formulate HFB correction. More...
 
subroutine xt3d_fn (this, kiter, nodes, nja, matrix_sln, idxglo, rhs, hnew)
 Fill Newton terms for xt3d. More...
 
subroutine xt3d_flowja (this, hnew, flowja)
 Budget. More...
 
subroutine xt3d_flowjahfb (this, n, m, hnew, flowja, condhfb)
 hfb contribution to flowja when xt3d is used More...
 
subroutine xt3d_da (this)
 Deallocate variables. More...
 
subroutine allocate_scalars (this)
 Allocate scalar pointer variables. More...
 
subroutine allocate_arrays (this)
 Allocate xt3d arrays. More...
 
subroutine xt3d_iallpc (this)
 Allocate and populate iallpc array. Set lamatsaved. More...
 
subroutine xt3d_indices (this, n, m, il0, ii01, jjs01, il01, il10, ii00, ii11, ii10)
 Set various indices for XT3D. More...
 
subroutine xt3d_load (this, nodes, n, nnbr, inbr, vc, vn, dl, dln, ck, allhc)
 Load conductivity and connection info for a cell into arrays used by XT3D. More...
 
subroutine xt3d_load_inbr (this, n, nnbr, inbr)
 Load neighbor list for a cell. More...
 
subroutine xt3d_areas (this, nodes, n, m, jjs01, lsat, ar01, ar10, hnew)
 Compute interfacial areas. More...
 
subroutine xt3d_amat_nbrs (this, nodes, n, idiag, nnbr, nja, matrix_sln, inbr, idxglo, chat)
 Add contributions from neighbors to amat. More...
 
subroutine xt3d_amat_nbrnbrs (this, nodes, n, m, ii01, nnbr, nja, matrix_sln, inbr, idxglo, chat)
 Add contributions from neighbors of neighbor to amat. More...
 
subroutine xt3d_amatpc_nbrs (this, nodes, n, idiag, nnbr, inbr, chat)
 Add contributions from neighbors to amatpc. More...
 
subroutine xt3d_amatpcx_nbrnbrs (this, nodes, n, m, ii01, nnbr, inbr, chat)
 Add contributions from neighbors of neighbor to amatpc and amatpcx. More...
 
subroutine xt3d_get_iinm (this, n, m, iinm)
 Get position of n-m connection in ja array (return 0 if not connected) More...
 
subroutine xt3d_get_iinmx (this, n, m, iinmx)
 Get position of n-m "extended connection" in jax array (return 0 if not connected) More...
 
subroutine xt3d_rhs (this, nodes, n, m, nnbr, inbr, chat, hnew, rhs)
 Add contributions to rhs. More...
 
subroutine xt3d_qnbrs (this, nodes, n, m, nnbr, inbr, chat, hnew, qnbrs)
 Add contributions to flow from neighbors. More...
 
subroutine xt3d_fillrmatck (this, n)
 Fill rmat array for cell n. More...
 

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine xt3dmodule::allocate_arrays ( class(xt3dtype this)

Definition at line 1088 of file Xt3dInterface.f90.

1089  ! -- modules
1091  ! -- dummy
1092  class(Xt3dType) :: this
1093  ! -- local
1094  integer(I4B) :: njax
1095  integer(I4B) :: n
1096  !
1097  ! -- Allocate Newton-dependent arrays
1098  if (this%inewton /= 0) then
1099  call mem_allocate(this%qsat, this%dis%nja, 'QSAT', this%memoryPath)
1100  else
1101  call mem_allocate(this%qsat, 0, 'QSAT', this%memoryPath)
1102  end if
1103  !
1104  ! -- If dispersion, set iallpc to 1 otherwise call xt3d_iallpc to go through
1105  ! each connection and mark cells that are permanenntly confined and can
1106  ! have their coefficients precalculated
1107  if (this%ldispersion) then
1108  !
1109  ! -- xt3d is being used for dispersion; all matrix terms are precalculated
1110  ! and used repeatedly until flows change
1111  this%lamatsaved = .true.
1112  call mem_allocate(this%iallpc, this%dis%nodes, 'IALLPC', this%memoryPath)
1113  do n = 1, this%dis%nodes
1114  this%iallpc(n) = 1
1115  end do
1116  else
1117  !
1118  ! -- xt3d is being used for flow so find where connections are
1119  ! permanently confined and precalculate matrix terms case where
1120  ! conductances do not depend on head
1121  call this%xt3d_iallpc()
1122  end if
1123  !
1124  ! -- Allocate space for precalculated matrix terms
1125  if (this%lamatsaved) then
1126  call mem_allocate(this%amatpc, this%dis%nja, 'AMATPC', this%memoryPath)
1127  njax = this%numextnbrs ! + 1
1128  call mem_allocate(this%amatpcx, njax, 'AMATPCX', this%memoryPath)
1129  else
1130  call mem_allocate(this%amatpc, 0, 'AMATPC', this%memoryPath)
1131  call mem_allocate(this%amatpcx, 0, 'AMATPCX', this%memoryPath)
1132  end if
1133  !
1134  ! -- Allocate work arrays
1135  call mem_allocate(this%rmatck, 3, 3, 'RMATCK', this%memoryPath)
1136  !
1137  ! -- Initialize arrays to zero
1138  this%rmatck = dzero
1139  if (this%inewton /= 0) then
1140  this%qsat = dzero
1141  else if (this%lamatsaved) then
1142  this%amatpc = dzero
1143  this%amatpcx = dzero
1144  end if
1145  !
1146  ! -- Return
1147  return

◆ allocate_scalars()

subroutine xt3dmodule::allocate_scalars ( class(xt3dtype this)

Definition at line 1052 of file Xt3dInterface.f90.

1053  ! -- modules
1055  ! -- dummy
1056  class(Xt3dType) :: this
1057  !
1058  ! -- Allocate scalars
1059  call mem_allocate(this%ixt3d, 'IXT3D', this%memoryPath)
1060  call mem_allocate(this%nbrmax, 'NBRMAX', this%memoryPath)
1061  call mem_allocate(this%inunit, 'INUNIT', this%memoryPath)
1062  call mem_allocate(this%iout, 'IOUT', this%memoryPath)
1063  call mem_allocate(this%inewton, 'INEWTON', this%memoryPath)
1064  call mem_allocate(this%numextnbrs, 'NUMEXTNBRS', this%memoryPath)
1065  call mem_allocate(this%nozee, 'NOZEE', this%memoryPath)
1066  call mem_allocate(this%vcthresh, 'VCTHRESH', this%memoryPath)
1067  call mem_allocate(this%lamatsaved, 'LAMATSAVED', this%memoryPath)
1068  call mem_allocate(this%ldispersion, 'LDISPERSION', this%memoryPath)
1069  !
1070  ! -- Initialize value
1071  this%ixt3d = 0
1072  this%nbrmax = 0
1073  this%inunit = 0
1074  this%iout = 0
1075  this%inewton = 0
1076  this%numextnbrs = 0
1077  this%nozee = .false.
1078  this%vcthresh = 1.d-10
1079  this%lamatsaved = .false.
1080  this%ldispersion = .false.
1081  !
1082  ! -- Return
1083  return

◆ xt3d_ac()

subroutine xt3dmodule::xt3d_ac ( class(xt3dtype this,
integer(i4b), intent(in)  moffset,
type(sparsematrix), intent(inout)  sparse 
)

Definition at line 130 of file Xt3dInterface.f90.

131  ! -- modules
132  use sparsemodule, only: sparsematrix
134  ! -- dummy
135  class(Xt3dType) :: this
136  integer(I4B), intent(in) :: moffset
137  type(sparsematrix), intent(inout) :: sparse
138  ! -- local
139  type(sparsematrix) :: sparse_xt3d
140  integer(I4B) :: i, j, k, jj, kk, iglo, kglo, iadded
141  integer(I4B) :: nnz
142  integer(I4B) :: ierror
143  !
144  ! -- If not rhs, add connections
145  if (this%ixt3d == 1) then
146  ! -- Assume nnz is 19, which is an approximate value
147  ! based on a 3d structured grid
148  nnz = 19
149  call sparse_xt3d%init(this%dis%nodes, this%dis%nodes, nnz)
150  !
151  ! -- Loop over nodes and store extended xt3d neighbors
152  ! temporarily in sparse_xt3d; this will be converted to
153  ! ia_xt3d and ja_xt3d next
154  do i = 1, this%dis%nodes
155  iglo = i + moffset
156  ! -- loop over neighbors
157  do jj = this%dis%con%ia(i) + 1, this%dis%con%ia(i + 1) - 1
158  j = this%dis%con%ja(jj)
159  ! -- loop over neighbors of neighbors
160  do kk = this%dis%con%ia(j) + 1, this%dis%con%ia(j + 1) - 1
161  k = this%dis%con%ja(kk)
162  kglo = k + moffset
163  call sparse_xt3d%addconnection(i, k, 1)
164  end do
165  end do
166  end do
167  !
168  ! -- calculate ia_xt3d and ja_xt3d from sparse_xt3d and
169  ! then destroy sparse
170  call mem_allocate(this%ia_xt3d, this%dis%nodes + 1, 'IA_XT3D', &
171  trim(this%memoryPath))
172  call mem_allocate(this%ja_xt3d, sparse_xt3d%nnz, 'JA_XT3D', &
173  trim(this%memoryPath))
174  call sparse_xt3d%filliaja(this%ia_xt3d, this%ja_xt3d, ierror)
175  call sparse_xt3d%destroy()
176  !
177  ! -- add extended neighbors to sparse and count number of
178  ! extended neighbors
179  do i = 1, this%dis%nodes
180  iglo = i + moffset
181  do kk = this%ia_xt3d(i), this%ia_xt3d(i + 1) - 1
182  k = this%ja_xt3d(kk)
183  kglo = k + moffset
184  call sparse%addconnection(iglo, kglo, 1, iadded)
185  this%numextnbrs = this%numextnbrs + 1
186  end do
187  end do
188  else
189  ! -- Arrays not needed; set to size zero
190  call mem_allocate(this%ia_xt3d, 0, 'IA_XT3D', trim(this%memoryPath))
191  call mem_allocate(this%ja_xt3d, 0, 'JA_XT3D', trim(this%memoryPath))
192  end if
193  !
194  ! -- Return
195  return

◆ xt3d_amat_nbrnbrs()

subroutine xt3dmodule::xt3d_amat_nbrnbrs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  ii01,
integer(i4b)  nnbr,
integer(i4b)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(this%nbrmax)  inbr,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(this%nbrmax)  chat 
)

Definition at line 1465 of file Xt3dInterface.f90.

1467  ! -- dummy
1468  class(Xt3dType) :: this
1469  integer(I4B), intent(in) :: nodes
1470  integer(I4B) :: n, m, ii01, nnbr, nja
1471  class(MatrixBaseType), pointer :: matrix_sln
1472  integer(I4B), dimension(this%nbrmax) :: inbr
1473  integer(I4B), intent(in), dimension(nja) :: idxglo
1474  real(DP), dimension(this%nbrmax) :: chat
1475  ! -- local
1476  integer(I4B) :: iil, iii, jjj, iixjjj, iijjj
1477  !
1478  do iil = 1, nnbr
1479  if (inbr(iil) .ne. 0) then
1480  call matrix_sln%add_value_pos(idxglo(ii01), chat(iil))
1481  iii = this%dis%con%ia(m) + iil
1482  jjj = this%dis%con%ja(iii)
1483  call this%xt3d_get_iinmx(n, jjj, iixjjj)
1484  if (iixjjj .ne. 0) then
1485  call matrix_sln%add_value_pos(this%idxglox(iixjjj), -chat(iil))
1486  else
1487  call this%xt3d_get_iinm(n, jjj, iijjj)
1488  call matrix_sln%add_value_pos(idxglo(iijjj), -chat(iil))
1489  end if
1490  end if
1491  end do
1492  !
1493  ! -- Return
1494  return

◆ xt3d_amat_nbrs()

subroutine xt3dmodule::xt3d_amat_nbrs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  idiag,
integer(i4b)  nnbr,
integer(i4b)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(this%nbrmax)  inbr,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(this%nbrmax)  chat 
)

Definition at line 1438 of file Xt3dInterface.f90.

1440  ! -- dummy
1441  class(Xt3dType) :: this
1442  integer(I4B), intent(in) :: nodes
1443  integer(I4B) :: n, idiag, nnbr, nja
1444  class(MatrixBaseType), pointer :: matrix_sln
1445  integer(I4B), dimension(this%nbrmax) :: inbr
1446  integer(I4B), intent(in), dimension(nja) :: idxglo
1447  real(DP), dimension(this%nbrmax) :: chat
1448  ! -- local
1449  integer(I4B) :: iil, iii
1450  !
1451  do iil = 1, nnbr
1452  if (inbr(iil) .ne. 0) then
1453  iii = this%dis%con%ia(n) + iil
1454  call matrix_sln%add_value_pos(idxglo(idiag), -chat(iil))
1455  call matrix_sln%add_value_pos(idxglo(iii), chat(iil))
1456  end if
1457  end do
1458  !
1459  ! -- Return
1460  return

◆ xt3d_amatpc_nbrs()

subroutine xt3dmodule::xt3d_amatpc_nbrs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  idiag,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr,
real(dp), dimension(this%nbrmax)  chat 
)

Definition at line 1499 of file Xt3dInterface.f90.

1500  ! -- dummy
1501  class(Xt3dType) :: this
1502  integer(I4B), intent(in) :: nodes
1503  integer(I4B) :: n, idiag, nnbr
1504  integer(I4B), dimension(this%nbrmax) :: inbr
1505  real(DP), dimension(this%nbrmax) :: chat
1506  ! -- local
1507  integer(I4B) :: iil, iii
1508  !
1509  do iil = 1, nnbr
1510  iii = this%dis%con%ia(n) + iil
1511  this%amatpc(idiag) = this%amatpc(idiag) - chat(iil)
1512  this%amatpc(iii) = this%amatpc(iii) + chat(iil)
1513  end do
1514  !
1515  ! -- Return
1516  return

◆ xt3d_amatpcx_nbrnbrs()

subroutine xt3dmodule::xt3d_amatpcx_nbrnbrs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  ii01,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr,
real(dp), dimension(this%nbrmax)  chat 
)

Definition at line 1521 of file Xt3dInterface.f90.

1522  ! -- dummy
1523  class(Xt3dType) :: this
1524  integer(I4B), intent(in) :: nodes
1525  integer(I4B) :: n, m, ii01, nnbr
1526  integer(I4B), dimension(this%nbrmax) :: inbr
1527  real(DP), dimension(this%nbrmax) :: chat
1528  ! -- local
1529  integer(I4B) :: iil, iii, jjj, iixjjj, iijjj
1530  !
1531  do iil = 1, nnbr
1532  this%amatpc(ii01) = this%amatpc(ii01) + chat(iil)
1533  iii = this%dis%con%ia(m) + iil
1534  jjj = this%dis%con%ja(iii)
1535  call this%xt3d_get_iinmx(n, jjj, iixjjj)
1536  if (iixjjj .ne. 0) then
1537  this%amatpcx(iixjjj) = this%amatpcx(iixjjj) - chat(iil)
1538  else
1539  call this%xt3d_get_iinm(n, jjj, iijjj)
1540  this%amatpc(iijjj) = this%amatpc(iijjj) - chat(iil)
1541  end if
1542  end do
1543  !
1544  ! -- Return
1545  return

◆ xt3d_ar()

subroutine xt3dmodule::xt3d_ar ( class(xt3dtype this,
integer(i4b), dimension(:), intent(inout), pointer, contiguous  ibound,
real(dp), dimension(:), intent(in), pointer, contiguous  k11,
integer(i4b), intent(in), pointer  ik33,
real(dp), dimension(:), intent(in), pointer, contiguous  k33,
real(dp), dimension(:), intent(in), pointer, contiguous  sat,
integer(i4b), intent(in), pointer  ik22,
real(dp), dimension(:), intent(in), pointer, contiguous  k22,
integer(i4b), intent(in), pointer  iangle1,
integer(i4b), intent(in), pointer  iangle2,
integer(i4b), intent(in), pointer  iangle3,
real(dp), dimension(:), intent(in), pointer, contiguous  angle1,
real(dp), dimension(:), intent(in), pointer, contiguous  angle2,
real(dp), dimension(:), intent(in), pointer, contiguous  angle3,
integer(i4b), intent(in), optional, pointer  inewton,
integer(i4b), dimension(:), intent(in), optional, pointer, contiguous  icelltype 
)

Definition at line 287 of file Xt3dInterface.f90.

289  ! -- modules
290  use simmodule, only: store_error
291  ! -- dummy
292  class(Xt3dType) :: this
293  integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: ibound
294  real(DP), dimension(:), intent(in), pointer, contiguous :: k11
295  integer(I4B), intent(in), pointer :: ik33
296  real(DP), dimension(:), intent(in), pointer, contiguous :: k33
297  real(DP), dimension(:), intent(in), pointer, contiguous :: sat
298  integer(I4B), intent(in), pointer :: ik22
299  real(DP), dimension(:), intent(in), pointer, contiguous :: k22
300  integer(I4B), intent(in), pointer :: iangle1
301  integer(I4B), intent(in), pointer :: iangle2
302  integer(I4B), intent(in), pointer :: iangle3
303  real(DP), dimension(:), intent(in), pointer, contiguous :: angle1
304  real(DP), dimension(:), intent(in), pointer, contiguous :: angle2
305  real(DP), dimension(:), intent(in), pointer, contiguous :: angle3
306  integer(I4B), intent(in), pointer, optional :: inewton
307  integer(I4B), dimension(:), intent(in), pointer, &
308  contiguous, optional :: icelltype
309  ! -- local
310  integer(I4B) :: n, nnbrs
311  ! -- formats
312  character(len=*), parameter :: fmtheader = &
313  "(1x, /1x, 'XT3D is active.'//)"
314  !
315  ! -- Print a message identifying the xt3d module.
316  if (this%iout > 0) then
317  write (this%iout, fmtheader)
318  end if
319  !
320  ! -- Store pointers to arguments that were passed in
321  this%ibound => ibound
322  this%k11 => k11
323  this%ik33 => ik33
324  this%k33 => k33
325  this%sat => sat
326  this%ik22 => ik22
327  this%k22 => k22
328  this%iangle1 => iangle1
329  this%iangle2 => iangle2
330  this%iangle3 => iangle3
331  this%angle1 => angle1
332  this%angle2 => angle2
333  this%angle3 => angle3
334  !
335  if (present(inewton)) then
336  ! -- inewton is not needed for transport so it's optional.
337  this%inewton = inewton
338  end if
339  if (present(icelltype)) then
340  ! -- icelltype is not needed for transport, so it's optional.
341  ! It is only needed to determine if cell connections are permanently
342  ! confined, which means that some matrix terms can be precalculated
343  this%icelltype => icelltype
344  end if
345  !
346  ! -- If angle1 and angle2 were not specified, then there is no z
347  ! component in the xt3d formulation for horizontal connections.
348  if (this%iangle2 == 0) this%nozee = .true.
349  !
350  ! -- Determine the maximum number of neighbors for any cell.
351  this%nbrmax = 0
352  do n = 1, this%dis%nodes
353  nnbrs = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
354  this%nbrmax = max(nnbrs, this%nbrmax)
355  end do
356  !
357  ! -- Check to make sure dis package can calculate connection direction info
358  if (this%dis%icondir == 0) then
359  call store_error('Vertices not specified for discretization package, '// &
360  'but XT3D is active: '//trim(adjustl(this%memoryPath))// &
361  '. Vertices must be specified in discretization '// &
362  'package in order to use XT3D.', terminate=.true.)
363  end if
364  !
365  ! -- Check to make sure ANGLEDEGX is available for interface normals
366  if (this%dis%con%ianglex == 0) then
367  call store_error('ANGLDEGX is not specified in the DIS package, '// &
368  'but XT3D is active: '//trim(adjustl(this%memoryPath))// &
369  '. ANGLDEGX must be provided in discretization '// &
370  'package in order to use XT3D.', terminate=.true.)
371  end if
372  !
373  ! -- allocate arrays
374  call this%allocate_arrays()
375  !
376  ! -- If not Newton and not rhs, precalculate amatpc and amatpcx for
377  ! -- permanently confined connections
378  if (this%lamatsaved .and. .not. this%ldispersion) &
379  call this%xt3d_fcpc(this%dis%nodes, .true.)
380  !
381  ! -- Return
382  return
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
Here is the call graph for this function:

◆ xt3d_areas()

subroutine xt3dmodule::xt3d_areas ( class(xt3dtype this,
integer(i4b)  nodes,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  jjs01,
logical  lsat,
real(dp)  ar01,
real(dp)  ar10,
real(dp), dimension(:), intent(inout), optional  hnew 
)

Definition at line 1353 of file Xt3dInterface.f90.

1354  ! -- dummy
1355  class(Xt3dType) :: this
1356  logical :: lsat
1357  integer(I4B) :: nodes, n, m, jjs01
1358  real(DP) :: ar01, ar10
1359  real(DP), intent(inout), dimension(:), optional :: hnew
1360  ! -- local
1361  real(DP) :: topn, botn, topm, botm, thksatn, thksatm
1362  real(DP) :: sill_top, sill_bot, tpn, tpm
1363  real(DP) :: satups
1364  !
1365  ! -- Compute area depending on connection type
1366  if (this%dis%con%ihc(jjs01) == 0) then
1367  !
1368  ! -- Vertical connection
1369  ar01 = this%dis%con%hwva(jjs01)
1370  ar10 = ar01
1371  else if (this%inewton /= 0) then
1372  !
1373  ! -- If Newton horizontal connection
1374  if (lsat) then
1375  !
1376  ! -- lsat true means use full saturation
1377  topn = this%dis%top(n)
1378  botn = this%dis%bot(n)
1379  topm = this%dis%top(m)
1380  botm = this%dis%bot(m)
1381  thksatn = topn - botn
1382  thksatm = topm - botm
1383  if (this%dis%con%ihc(jjs01) .eq. 2) then
1384  ! -- Vertically staggered
1385  sill_top = min(topn, topm)
1386  sill_bot = max(botn, botm)
1387  tpn = botn + thksatn
1388  tpm = botm + thksatm
1389  thksatn = max(min(tpn, sill_top) - sill_bot, dzero)
1390  thksatm = max(min(tpm, sill_top) - sill_bot, dzero)
1391  end if
1392  ar01 = this%dis%con%hwva(jjs01) * dhalf * (thksatn + thksatm)
1393  else
1394  ! -- If Newton and lsat=.false., it is assumed that the fully saturated
1395  ! areas have already been calculated and are being passed in through
1396  ! ar01 and ar10. The actual areas are obtained simply by scaling by
1397  ! the upstream saturation.
1398  if (hnew(m) < hnew(n)) then
1399  satups = this%sat(n)
1400  else
1401  satups = this%sat(m)
1402  end if
1403  ar01 = ar01 * satups
1404  end if
1405  ar10 = ar01
1406  else
1407  !
1408  ! -- Non-Newton horizontal connection
1409  topn = this%dis%top(n)
1410  botn = this%dis%bot(n)
1411  topm = this%dis%top(m)
1412  botm = this%dis%bot(m)
1413  thksatn = topn - botn
1414  thksatm = topm - botm
1415  if (.not. lsat) then
1416  thksatn = this%sat(n) * thksatn
1417  thksatm = this%sat(m) * thksatm
1418  end if
1419  if (this%dis%con%ihc(jjs01) == 2) then
1420  ! -- Vertically staggered
1421  sill_top = min(topn, topm)
1422  sill_bot = max(botn, botm)
1423  tpn = botn + thksatn
1424  tpm = botm + thksatm
1425  thksatn = max(min(tpn, sill_top) - sill_bot, dzero)
1426  thksatm = max(min(tpm, sill_top) - sill_bot, dzero)
1427  end if
1428  ar01 = this%dis%con%hwva(jjs01) * thksatn
1429  ar10 = this%dis%con%hwva(jjs01) * thksatm
1430  end if
1431  !
1432  ! -- Return
1433  return

◆ xt3d_cr()

subroutine, public xt3dmodule::xt3d_cr ( type(xt3dtype), pointer  xt3dobj,
character(len=*), intent(in)  name_model,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
logical, intent(in), optional  ldispopt 
)

Definition at line 89 of file Xt3dInterface.f90.

90  ! -- dummy
91  type(Xt3dType), pointer :: xt3dobj
92  character(len=*), intent(in) :: name_model
93  integer(I4B), intent(in) :: inunit
94  integer(I4B), intent(in) :: iout
95  logical, optional, intent(in) :: ldispopt
96  !
97  ! -- Create the object
98  allocate (xt3dobj)
99  !
100  ! -- Assign the memory path
101  xt3dobj%memoryPath = create_mem_path(name_model, 'XT3D')
102  !
103  ! -- Allocate scalars
104  call xt3dobj%allocate_scalars()
105  !
106  ! -- Set variables
107  xt3dobj%inunit = inunit
108  xt3dobj%iout = iout
109  if (present(ldispopt)) xt3dobj%ldispersion = ldispopt
110  !
111  ! -- Return
112  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt3d_da()

subroutine xt3dmodule::xt3d_da ( class(xt3dtype this)

Definition at line 1014 of file Xt3dInterface.f90.

1015  ! -- modules
1017  ! -- dummy
1018  class(Xt3dType) :: this
1019  !
1020  ! -- Deallocate arrays
1021  if (this%ixt3d /= 0) then
1022  call mem_deallocate(this%iax)
1023  call mem_deallocate(this%jax)
1024  call mem_deallocate(this%idxglox)
1025  call mem_deallocate(this%ia_xt3d)
1026  call mem_deallocate(this%ja_xt3d)
1027  call mem_deallocate(this%rmatck)
1028  call mem_deallocate(this%qsat)
1029  call mem_deallocate(this%amatpc)
1030  call mem_deallocate(this%amatpcx)
1031  call mem_deallocate(this%iallpc)
1032  end if
1033  !
1034  ! -- Scalars
1035  call mem_deallocate(this%ixt3d)
1036  call mem_deallocate(this%inunit)
1037  call mem_deallocate(this%iout)
1038  call mem_deallocate(this%inewton)
1039  call mem_deallocate(this%numextnbrs)
1040  call mem_deallocate(this%nozee)
1041  call mem_deallocate(this%vcthresh)
1042  call mem_deallocate(this%lamatsaved)
1043  call mem_deallocate(this%nbrmax)
1044  call mem_deallocate(this%ldispersion)
1045  !
1046  ! -- Return
1047  return

◆ xt3d_df()

subroutine xt3dmodule::xt3d_df ( class(xt3dtype this,
class(disbasetype), intent(inout), pointer  dis 
)

Definition at line 117 of file Xt3dInterface.f90.

118  ! -- dummy
119  class(Xt3dType) :: this
120  class(DisBaseType), pointer, intent(inout) :: dis
121  !
122  this%dis => dis
123  !
124  ! -- Return
125  return

◆ xt3d_fc()

subroutine xt3dmodule::xt3d_fc ( class(xt3dtype this,
integer(i4b)  kiter,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs,
real(dp), dimension(:), intent(inout)  hnew 
)

Definition at line 386 of file Xt3dInterface.f90.

387  ! -- modules
388  use constantsmodule, only: done
389  use xt3dalgorithmmodule, only: qconds
390  ! -- dummy
391  class(Xt3dType) :: this
392  integer(I4B) :: kiter
393  class(MatrixBaseType), pointer :: matrix_sln
394  integer(I4B), intent(in), dimension(:) :: idxglo
395  real(DP), intent(inout), dimension(:) :: rhs
396  real(DP), intent(inout), dimension(:) :: hnew
397  ! -- local
398  integer(I4B) :: nodes, nja
399  integer(I4B) :: n, m, ipos
400  logical :: allhc0, allhc1
401  integer(I4B) :: nnbr0, nnbr1
402  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10
403  integer(I4B) :: i
404  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
405  real(DP) :: ar01, ar10
406  real(DP), dimension(this%nbrmax, 3) :: vc0, vn0, vc1, vn1
407  real(DP), dimension(this%nbrmax) :: dl0, dl0n, dl1, dl1n
408  real(DP), dimension(3, 3) :: ck0, ck1
409  real(DP) :: chat01
410  real(DP), dimension(this%nbrmax) :: chati0, chat1j
411  real(DP) :: qnm, qnbrs
412  !
413  ! -- Calculate xt3d conductance-like coefficients and put into amat and rhs
414  ! -- as appropriate
415  !
416  nodes = this%dis%nodes
417  nja = this%dis%con%nja
418  if (this%lamatsaved) then
419  do i = 1, this%dis%con%nja
420  call matrix_sln%add_value_pos(idxglo(i), this%amatpc(i))
421  end do
422  do i = 1, this%numextnbrs
423  call matrix_sln%add_value_pos(this%idxglox(i), this%amatpcx(i))
424  end do
425  end if
426  !
427  do n = 1, nodes
428  ! -- Skip if inactive.
429  if (this%ibound(n) .eq. 0) cycle
430  ! -- Skip if all connections are permanently confined
431  if (this%lamatsaved) then
432  if (this%iallpc(n) == 1) cycle
433  end if
434  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
435  ! -- Load conductivity and connection info for cell 0.
436  call this%xt3d_load(nodes, n, nnbr0, inbr0, vc0, vn0, dl0, dl0n, &
437  ck0, allhc0)
438  ! -- Loop over active neighbors of cell 0 that have a higher
439  ! cell number (taking advantage of reciprocity).
440  do il0 = 1, nnbr0
441  ipos = this%dis%con%ia(n) + il0
442  if (this%dis%con%mask(ipos) == 0) cycle
443 
444  m = inbr0(il0)
445  ! -- Skip if neighbor is inactive or has lower cell number.
446  if ((m .eq. 0) .or. (m .lt. n)) cycle
447  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
448  ! -- Load conductivity and connection info for cell 1.
449  call this%xt3d_load(nodes, m, nnbr1, inbr1, vc1, vn1, dl1, dl1n, &
450  ck1, allhc1)
451  ! -- Set various indices.
452  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
453  ii00, ii11, ii10)
454  ! -- Compute areas.
455  if (this%inewton /= 0) then
456  ar01 = done
457  ar10 = done
458  else
459  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
460  end if
461  ! -- Compute "conductances" for interface between
462  ! cells 0 and 1.
463  call qconds(this%nbrmax, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, ck0, &
464  nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, &
465  this%vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
466  ! -- If Newton, compute and save saturated flow, then scale
467  ! conductance-like coefficients by the actual area for
468  ! subsequent amat and rhs assembly.
469  if (this%inewton /= 0) then
470  ! -- Contribution to flow from primary connection.
471  qnm = chat01 * (hnew(m) - hnew(n))
472  ! -- Contribution from immediate neighbors of node 0.
473  call this%xt3d_qnbrs(nodes, n, m, nnbr0, inbr0, chati0, hnew, qnbrs)
474  qnm = qnm + qnbrs
475  ! -- Contribution from immediate neighbors of node 1.
476  call this%xt3d_qnbrs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, qnbrs)
477  qnm = qnm - qnbrs
478  ! -- Multiply by saturated area and save in qsat.
479  call this%xt3d_areas(nodes, n, m, jjs01, .true., ar01, ar10, hnew)
480  this%qsat(ii01) = qnm * ar01
481  ! -- Scale coefficients by actual area.
482  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
483  chat01 = chat01 * ar01
484  chati0 = chati0 * ar01
485  chat1j = chat1j * ar01
486  end if
487  !
488  ! -- Contribute to rows for cells 0 and 1.
489  call matrix_sln%add_value_pos(idxglo(ii00), -chat01)
490  call matrix_sln%add_value_pos(idxglo(ii01), chat01)
491  call matrix_sln%add_value_pos(idxglo(ii11), -chat01)
492  call matrix_sln%add_value_pos(idxglo(ii10), chat01)
493  if (this%ixt3d == 1) then
494  call this%xt3d_amat_nbrs(nodes, n, ii00, nnbr0, nja, matrix_sln, &
495  inbr0, idxglo, chati0)
496  call this%xt3d_amat_nbrnbrs(nodes, n, m, ii01, nnbr1, nja, matrix_sln, &
497  inbr1, idxglo, chat1j)
498  call this%xt3d_amat_nbrs(nodes, m, ii11, nnbr1, nja, matrix_sln, &
499  inbr1, idxglo, chat1j)
500  call this%xt3d_amat_nbrnbrs(nodes, m, n, ii10, nnbr0, nja, matrix_sln, &
501  inbr0, idxglo, chati0)
502  else
503  call this%xt3d_rhs(nodes, n, m, nnbr0, inbr0, chati0, hnew, rhs)
504  call this%xt3d_rhs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, rhs)
505  end if
506  !
507  end do
508  end do
509  !
510  ! -- Return
511  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter done
real constant 1
Definition: Constants.f90:75
subroutine qconds(nnbrmx, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, ck0, nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
Compute the "conductances" in the normal-flux expression for an interface (modflow-usg version)....
Here is the call graph for this function:

◆ xt3d_fcpc()

subroutine xt3dmodule::xt3d_fcpc ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
logical, intent(in)  lsat 
)
Parameters
[in]lsatif true, then calculations made with saturated areas (should be false for solute dispersion; should be true for heat)

Definition at line 517 of file Xt3dInterface.f90.

518  ! -- modules
519  use xt3dalgorithmmodule, only: qconds
520  ! -- dummy
521  class(Xt3dType) :: this
522  integer(I4B), intent(in) :: nodes
523  logical, intent(in) :: lsat !< if true, then calculations made with saturated areas (should be false for solute dispersion; should be true for heat)
524  ! -- local
525  integer(I4B) :: n, m, ipos
526  !
527  logical :: allhc0, allhc1
528  integer(I4B) :: nnbr0, nnbr1
529  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10
530  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
531  real(DP) :: ar01, ar10
532  real(DP), dimension(this%nbrmax, 3) :: vc0, vn0, vc1, vn1
533  real(DP), dimension(this%nbrmax) :: dl0, dl0n, dl1, dl1n
534  real(DP), dimension(3, 3) :: ck0, ck1
535  real(DP) :: chat01
536  real(DP), dimension(this%nbrmax) :: chati0, chat1j
537  !
538  ! -- Initialize amatpc and amatpcx to zero
539  do n = 1, size(this%amatpc)
540  this%amatpc(n) = dzero
541  end do
542  do n = 1, size(this%amatpcx)
543  this%amatpcx(n) = dzero
544  end do
545  !
546  ! -- Calculate xt3d conductance-like coefficients for permanently confined
547  ! -- connections and put into amatpc and amatpcx as appropriate
548  do n = 1, nodes
549  ! -- Skip if not iallpc.
550  if (this%iallpc(n) == 0) cycle
551  if (this%ibound(n) == 0) cycle
552  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
553  ! -- Load conductivity and connection info for cell 0.
554  call this%xt3d_load(nodes, n, nnbr0, inbr0, vc0, vn0, dl0, dl0n, &
555  ck0, allhc0)
556  ! -- Loop over active neighbors of cell 0 that have a higher
557  ! -- cell number (taking advantage of reciprocity).
558  do il0 = 1, nnbr0
559  ipos = this%dis%con%ia(n) + il0
560  if (this%dis%con%mask(ipos) == 0) cycle
561 
562  m = inbr0(il0)
563  ! -- Skip if neighbor has lower cell number.
564  if (m .lt. n) cycle
565  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
566  ! -- Load conductivity and connection info for cell 1.
567  call this%xt3d_load(nodes, m, nnbr1, inbr1, vc1, vn1, dl1, dl1n, &
568  ck1, allhc1)
569  ! -- Set various indices.
570  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
571  ii00, ii11, ii10)
572  ! -- Compute confined areas.
573  call this%xt3d_areas(nodes, n, m, jjs01, lsat, ar01, ar10)
574  ! -- Compute "conductances" for interface between
575  ! -- cells 0 and 1.
576  call qconds(this%nbrmax, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, ck0, &
577  nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, &
578  this%vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
579  ! -- Contribute to rows for cells 0 and 1.
580  this%amatpc(ii00) = this%amatpc(ii00) - chat01
581  this%amatpc(ii01) = this%amatpc(ii01) + chat01
582  this%amatpc(ii11) = this%amatpc(ii11) - chat01
583  this%amatpc(ii10) = this%amatpc(ii10) + chat01
584  call this%xt3d_amatpc_nbrs(nodes, n, ii00, nnbr0, inbr0, chati0)
585  call this%xt3d_amatpcx_nbrnbrs(nodes, n, m, ii01, nnbr1, inbr1, chat1j)
586  call this%xt3d_amatpc_nbrs(nodes, m, ii11, nnbr1, inbr1, chat1j)
587  call this%xt3d_amatpcx_nbrnbrs(nodes, m, n, ii10, nnbr0, inbr0, chati0)
588  end do
589  end do
590  !
591  ! -- Return
592  return
Here is the call graph for this function:

◆ xt3d_fhfb()

subroutine xt3dmodule::xt3d_fhfb ( class(xt3dtype this,
integer(i4b)  kiter,
integer(i4b), intent(in)  nodes,
integer(i4b), intent(in)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(nodes), intent(inout)  rhs,
real(dp), dimension(nodes), intent(inout)  hnew,
integer(i4b)  n,
integer(i4b)  m,
real(dp)  condhfb 
)

Definition at line 597 of file Xt3dInterface.f90.

599  ! -- modules
600  use constantsmodule, only: done
601  use xt3dalgorithmmodule, only: qconds
602  ! -- dummy
603  class(Xt3dType) :: this
604  integer(I4B) :: kiter
605  integer(I4B), intent(in) :: nodes
606  integer(I4B), intent(in) :: nja
607  class(MatrixBaseType), pointer :: matrix_sln
608  integer(I4B) :: n, m
609  integer(I4B), intent(in), dimension(nja) :: idxglo
610  real(DP), intent(inout), dimension(nodes) :: rhs
611  real(DP), intent(inout), dimension(nodes) :: hnew
612  real(DP) :: condhfb
613  ! -- local
614  logical :: allhc0, allhc1
615  integer(I4B) :: nnbr0, nnbr1
616  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10, il
617  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
618  real(DP) :: ar01, ar10
619  real(DP), dimension(this%nbrmax, 3) :: vc0, vn0, vc1, vn1
620  real(DP), dimension(this%nbrmax) :: dl0, dl0n, dl1, dl1n
621  real(DP), dimension(3, 3) :: ck0, ck1
622  real(DP) :: chat01
623  real(DP), dimension(this%nbrmax) :: chati0, chat1j
624  real(DP) :: qnm, qnbrs
625  real(DP) :: term
626  !
627  ! -- Calculate hfb corrections to xt3d conductance-like coefficients and
628  ! put into amat and rhs as appropriate
629  !
630  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
631  ! -- Load conductivity and connection info for cell 0.
632  call this%xt3d_load(nodes, n, nnbr0, inbr0, vc0, vn0, dl0, dl0n, &
633  ck0, allhc0)
634  ! -- Find local neighbor number of cell 1.
635  do il = 1, nnbr0
636  if (inbr0(il) .eq. m) then
637  il0 = il
638  exit
639  end if
640  end do
641  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
642  ! -- Load conductivity and connection info for cell 1.
643  call this%xt3d_load(nodes, m, nnbr1, inbr1, vc1, vn1, dl1, dl1n, &
644  ck1, allhc1)
645  ! -- Set various indices.
646  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
647  ii00, ii11, ii10)
648  ! -- Compute areas.
649  if (this%inewton /= 0) then
650  ar01 = done
651  ar10 = done
652  else
653  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
654  end if
655  !
656  ! -- Compute "conductances" for interface between
657  ! cells 0 and 1.
658  call qconds(this%nbrmax, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, &
659  ck0, nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, &
660  this%vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
661  !
662  ! -- Apply scale factor to compute "conductances" for hfb correction
663  if (condhfb > dzero) then
664  term = chat01 / (chat01 + condhfb)
665  else
666  term = -condhfb
667  end if
668  chat01 = -chat01 * term
669  chati0 = -chati0 * term
670  chat1j = -chat1j * term
671  !
672  ! -- If Newton, compute and save saturated flow, then scale conductance-like
673  ! coefficients by the actual area for subsequent amat and rhs assembly.
674  if (this%inewton /= 0) then
675  ! -- Contribution to flow from primary connection.
676  qnm = chat01 * (hnew(m) - hnew(n))
677  ! -- Contribution from immediate neighbors of node 0.
678  call this%xt3d_qnbrs(nodes, n, m, nnbr0, inbr0, chati0, hnew, qnbrs)
679  qnm = qnm + qnbrs
680  ! -- Contribution from immediate neighbors of node 1.
681  call this%xt3d_qnbrs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, qnbrs)
682  qnm = qnm - qnbrs
683  ! -- Multiply by saturated area and add correction to qsat.
684  call this%xt3d_areas(nodes, n, m, jjs01, .true., ar01, ar10, hnew)
685  this%qsat(ii01) = this%qsat(ii01) + qnm * ar01
686  ! -- Scale coefficients by actual area.
687  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
688  chat01 = chat01 * ar01
689  chati0 = chati0 * ar01
690  chat1j = chat1j * ar01
691  end if
692  !
693  ! -- Contribute to rows for cells 0 and 1.
694  call matrix_sln%add_value_pos(idxglo(ii00), -chat01)
695  call matrix_sln%add_value_pos(idxglo(ii01), chat01)
696  call matrix_sln%add_value_pos(idxglo(ii11), -chat01)
697  call matrix_sln%add_value_pos(idxglo(ii10), chat01)
698  if (this%ixt3d == 1) then
699  call this%xt3d_amat_nbrs(nodes, n, ii00, nnbr0, nja, matrix_sln, &
700  inbr0, idxglo, chati0)
701  call this%xt3d_amat_nbrnbrs(nodes, n, m, ii01, nnbr1, nja, matrix_sln, &
702  inbr1, idxglo, chat1j)
703  call this%xt3d_amat_nbrs(nodes, m, ii11, nnbr1, nja, matrix_sln, &
704  inbr1, idxglo, chat1j)
705  call this%xt3d_amat_nbrnbrs(nodes, m, n, ii10, nnbr0, nja, matrix_sln, &
706  inbr0, idxglo, chati0)
707  else
708  call this%xt3d_rhs(nodes, n, m, nnbr0, inbr0, chati0, hnew, rhs)
709  call this%xt3d_rhs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, rhs)
710  end if
711  !
712  ! -- Return
713  return
Here is the call graph for this function:

◆ xt3d_fillrmatck()

subroutine xt3dmodule::xt3d_fillrmatck ( class(xt3dtype this,
integer(i4b), intent(in)  n 
)

angle1, 2, and 3 must be in radians.

Definition at line 1657 of file Xt3dInterface.f90.

1658  ! -- dummy
1659  class(Xt3dType) :: this
1660  integer(I4B), intent(in) :: n
1661  ! -- local
1662  real(DP) :: ang1, ang2, ang3, ang2d, ang3d
1663  real(DP) :: s1, c1, s2, c2, s3, c3
1664  !
1665  if (this%nozee) then
1666  ang2d = 0d0
1667  ang3d = 0d0
1668  ang1 = this%angle1(n)
1669  ang2 = 0d0
1670  ang3 = 0d0
1671  else
1672  ang1 = this%angle1(n)
1673  ang2 = this%angle2(n)
1674  ang3 = this%angle3(n)
1675  end if
1676  s1 = sin(ang1)
1677  c1 = cos(ang1)
1678  s2 = sin(ang2)
1679  c2 = cos(ang2)
1680  s3 = sin(ang3)
1681  c3 = cos(ang3)
1682  this%rmatck(1, 1) = c1 * c2
1683  this%rmatck(1, 2) = c1 * s2 * s3 - s1 * c3
1684  this%rmatck(1, 3) = -c1 * s2 * c3 - s1 * s3
1685  this%rmatck(2, 1) = s1 * c2
1686  this%rmatck(2, 2) = s1 * s2 * s3 + c1 * c3
1687  this%rmatck(2, 3) = -s1 * s2 * c3 + c1 * s3
1688  this%rmatck(3, 1) = s2
1689  this%rmatck(3, 2) = -c2 * s3
1690  this%rmatck(3, 3) = c2 * c3
1691  !
1692  ! -- Return
1693  return

◆ xt3d_flowja()

subroutine xt3dmodule::xt3d_flowja ( class(xt3dtype this,
real(dp), dimension(:), intent(inout)  hnew,
real(dp), dimension(:), intent(inout)  flowja 
)

Definition at line 824 of file Xt3dInterface.f90.

825  ! -- modules
826  use xt3dalgorithmmodule, only: qconds
827  ! -- dummy
828  class(Xt3dType) :: this
829  real(DP), intent(inout), dimension(:) :: hnew
830  real(DP), intent(inout), dimension(:) :: flowja
831  ! -- local
832  integer(I4B) :: n, ipos, m, nodes
833  real(DP) :: qnm, qnbrs
834  logical :: allhc0, allhc1
835  integer(I4B) :: nnbr0, nnbr1
836  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10
837  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
838  real(DP) :: ar01, ar10
839  real(DP), dimension(this%nbrmax, 3) :: vc0, vn0, vc1, vn1
840  real(DP), dimension(this%nbrmax) :: dl0, dl0n, dl1, dl1n
841  real(DP), dimension(3, 3) :: ck0, ck1
842  real(DP) :: chat01
843  real(DP), dimension(this%nbrmax) :: chati0, chat1j
844  !
845  ! -- Calculate the flow across each cell face and store in flowja
846  nodes = this%dis%nodes
847  do n = 1, nodes
848  !
849  ! -- Skip if inactive.
850  if (this%ibound(n) .eq. 0) cycle
851  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
852  !
853  ! -- Load conductivity and connection info for cell 0.
854  call this%xt3d_load(nodes, n, nnbr0, inbr0, vc0, vn0, dl0, dl0n, &
855  ck0, allhc0)
856  !
857  ! -- Loop over active neighbors of cell 0 that have a higher
858  ! cell number (taking advantage of reciprocity).
859  do il0 = 1, nnbr0
860  m = inbr0(il0)
861  !
862  ! -- Skip if neighbor is inactive or has lower cell number.
863  if ((inbr0(il0) .eq. 0) .or. (m .lt. n)) cycle
864  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
865  !
866  ! -- Load conductivity and connection info for cell 1.
867  call this%xt3d_load(nodes, m, nnbr1, inbr1, vc1, vn1, dl1, dl1n, &
868  ck1, allhc1)
869  !
870  ! -- Set various indices.
871  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
872  ii00, ii11, ii10)
873  !
874  ! -- Compute areas.
875  if (this%inewton /= 0) &
876  call this%xt3d_areas(nodes, n, m, jjs01, .true., ar01, ar10, hnew)
877  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
878  !
879  ! -- Compute "conductances" for interface between
880  ! cells 0 and 1.
881  call qconds(this%nbrmax, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, ck0, &
882  nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, &
883  this%vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
884  !
885  ! -- Contribution to flow from primary connection.
886  qnm = chat01 * (hnew(m) - hnew(n))
887  !
888  ! -- Contribution from immediate neighbors of node 0.
889  call this%xt3d_qnbrs(nodes, n, m, nnbr0, inbr0, chati0, hnew, qnbrs)
890  qnm = qnm + qnbrs
891  !
892  ! -- Contribution from immediate neighbors of node 1.
893  call this%xt3d_qnbrs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, qnbrs)
894  qnm = qnm - qnbrs
895  ipos = ii01
896  flowja(ipos) = flowja(ipos) + qnm
897  flowja(this%dis%con%isym(ipos)) = flowja(this%dis%con%isym(ipos)) - qnm
898  end do
899  end do
900  !
901  ! -- Return
902  return
Here is the call graph for this function:

◆ xt3d_flowjahfb()

subroutine xt3dmodule::xt3d_flowjahfb ( class(xt3dtype this,
integer(i4b)  n,
integer(i4b)  m,
real(dp), dimension(:), intent(inout)  hnew,
real(dp), dimension(:), intent(inout)  flowja,
real(dp)  condhfb 
)

Definition at line 907 of file Xt3dInterface.f90.

908  ! -- modules
909  use constantsmodule, only: done
910  use xt3dalgorithmmodule, only: qconds
911  ! -- dummy
912  class(Xt3dType) :: this
913  integer(I4B) :: n, m
914  real(DP), intent(inout), dimension(:) :: hnew
915  real(DP), intent(inout), dimension(:) :: flowja
916  real(DP) :: condhfb
917  ! -- local
918  integer(I4B) :: nodes
919  logical :: allhc0, allhc1
920  ! integer(I4B), parameter :: nbrmax = 10
921  integer(I4B) :: nnbr0, nnbr1
922  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10, il
923  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
924  integer(I4B) :: ipos
925  real(DP) :: ar01, ar10
926  real(DP), dimension(this%nbrmax, 3) :: vc0, vn0, vc1, vn1
927  real(DP), dimension(this%nbrmax) :: dl0, dl0n, dl1, dl1n
928  real(DP), dimension(3, 3) :: ck0, ck1
929  real(DP) :: chat01
930  real(DP), dimension(this%nbrmax) :: chati0, chat1j
931  real(DP) :: qnm, qnbrs
932  real(DP) :: term
933  !
934  ! -- Calculate hfb corrections to xt3d conductance-like coefficients and
935  ! put into amat and rhs as appropriate
936  nodes = this%dis%nodes
937  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
938  !
939  ! -- Load conductivity and connection info for cell 0.
940  call this%xt3d_load(nodes, n, nnbr0, inbr0, vc0, vn0, dl0, dl0n, &
941  ck0, allhc0)
942  !
943  ! -- Find local neighbor number of cell 1.
944  do il = 1, nnbr0
945  if (inbr0(il) .eq. m) then
946  il0 = il
947  exit
948  end if
949  end do
950  !
951  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
952  !
953  ! -- Load conductivity and connection info for cell 1.
954  call this%xt3d_load(nodes, m, nnbr1, inbr1, vc1, vn1, dl1, dl1n, &
955  ck1, allhc1)
956  !
957  ! -- Set various indices.
958  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
959  ii00, ii11, ii10)
960  !
961  ! -- Compute areas.
962  if (this%inewton /= 0) then
963  ar01 = done
964  ar10 = done
965  else
966  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
967  end if
968  !
969  ! -- Compute "conductances" for interface between
970  ! cells 0 and 1.
971  call qconds(this%nbrmax, nnbr0, inbr0, il01, vc0, vn0, dl0, dl0n, &
972  ck0, nnbr1, inbr1, il10, vc1, vn1, dl1, dl1n, ck1, ar01, ar10, &
973  this%vcthresh, allhc0, allhc1, chat01, chati0, chat1j)
974  !
975  ! -- Apply scale factor to compute "conductances" for hfb correction
976  if (condhfb > dzero) then
977  term = chat01 / (chat01 + condhfb)
978  else
979  term = -condhfb
980  end if
981  chat01 = -chat01 * term
982  chati0 = -chati0 * term
983  chat1j = -chat1j * term
984  !
985  ! -- Contribution to flow from primary connection.
986  qnm = chat01 * (hnew(m) - hnew(n))
987  !
988  ! -- Contribution from immediate neighbors of node 0.
989  call this%xt3d_qnbrs(nodes, n, m, nnbr0, inbr0, chati0, hnew, qnbrs)
990  qnm = qnm + qnbrs
991  !
992  ! -- Contribution from immediate neighbors of node 1.
993  call this%xt3d_qnbrs(nodes, m, n, nnbr1, inbr1, chat1j, hnew, qnbrs)
994  qnm = qnm - qnbrs
995  !
996  ! -- If Newton, scale conductance-like coefficients by the
997  ! actual area.
998  if (this%inewton /= 0) then
999  call this%xt3d_areas(nodes, n, m, jjs01, .true., ar01, ar10, hnew)
1000  call this%xt3d_areas(nodes, n, m, jjs01, .false., ar01, ar10, hnew)
1001  qnm = qnm * ar01
1002  end if
1003  !
1004  ipos = ii01
1005  flowja(ipos) = flowja(ipos) + qnm
1006  flowja(this%dis%con%isym(ipos)) = flowja(this%dis%con%isym(ipos)) - qnm
1007  !
1008  ! -- Return
1009  return
Here is the call graph for this function:

◆ xt3d_fn()

subroutine xt3dmodule::xt3d_fn ( class(xt3dtype this,
integer(i4b)  kiter,
integer(i4b), intent(in)  nodes,
integer(i4b), intent(in)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(nodes), intent(inout)  rhs,
real(dp), dimension(nodes), intent(inout)  hnew 
)

Definition at line 717 of file Xt3dInterface.f90.

718  ! -- modules
719  use constantsmodule, only: done
721  ! -- dummy
722  class(Xt3dType) :: this
723  integer(I4B) :: kiter
724  integer(I4B), intent(in) :: nodes
725  integer(I4B), intent(in) :: nja
726  class(MatrixBaseType), pointer :: matrix_sln
727  integer(I4B), intent(in), dimension(nja) :: idxglo
728  real(DP), intent(inout), dimension(nodes) :: rhs
729  real(DP), intent(inout), dimension(nodes) :: hnew
730  ! -- local
731  integer(I4B) :: n, m, ipos
732  integer(I4B) :: nnbr0
733  integer(I4B) :: il0, ii01, jjs01, il01, il10, ii00, ii11, ii10
734  integer(I4B), dimension(this%nbrmax) :: inbr0
735  integer(I4B) :: iups, idn
736  real(DP) :: topup, botup, derv, term
737  !
738  ! -- Update amat and rhs with Newton terms
739  do n = 1, nodes
740  !
741  ! -- Skip if inactive.
742  if (this%ibound(n) .eq. 0) cycle
743  !
744  ! -- No Newton correction if amat saved (which implies no rhs option)
745  ! and all connections for the cell are permanently confined.
746  if (this%lamatsaved) then
747  if (this%iallpc(n) == 1) cycle
748  end if
749  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
750  !
751  ! -- Load neighbors of cell. Set cell numbers for inactive
752  ! neighbors to zero.
753  call this%xt3d_load_inbr(n, nnbr0, inbr0)
754  !
755  ! -- Loop over active neighbors of cell 0 that have a higher
756  ! cell number (taking advantage of reciprocity).
757  do il0 = 1, nnbr0
758  ipos = this%dis%con%ia(n) + il0
759  if (this%dis%con%mask(ipos) == 0) cycle
760  !
761  m = inbr0(il0)
762  !
763  ! -- Skip if neighbor is inactive or has lower cell number.
764  if ((inbr0(il0) .eq. 0) .or. (m .lt. n)) cycle
765  !
766  ! -- Set various indices.
767  call this%xt3d_indices(n, m, il0, ii01, jjs01, il01, il10, &
768  ii00, ii11, ii10)
769  !
770  ! -- Determine upstream node
771  iups = m
772  if (hnew(m) < hnew(n)) iups = n
773  idn = n
774  if (iups == n) idn = m
775  !
776  ! -- No Newton terms if upstream cell is confined and no rhs option
777  if ((this%icelltype(iups) == 0) .and. (this%ixt3d .eq. 1)) cycle
778  !
779  ! -- Set the upstream top and bot, and then recalculate for a
780  ! vertically staggered horizontal connection
781  topup = this%dis%top(iups)
782  botup = this%dis%bot(iups)
783  if (this%dis%con%ihc(jjs01) == 2) then
784  topup = min(this%dis%top(n), this%dis%top(m))
785  botup = max(this%dis%bot(n), this%dis%bot(m))
786  end if
787  !
788  ! -- Derivative term
789  derv = squadraticsaturationderivative(topup, botup, hnew(iups))
790  term = this%qsat(ii01) * derv
791  !
792  ! -- Fill Jacobian for n being the upstream node
793  if (iups == n) then
794  !
795  ! -- Fill in row of n
796  call matrix_sln%add_value_pos(idxglo(ii00), term)
797  rhs(n) = rhs(n) + term * hnew(n)
798  !
799  ! -- Fill in row of m
800  call matrix_sln%add_value_pos(idxglo(ii10), -term)
801  rhs(m) = rhs(m) - term * hnew(n)
802  !
803  ! -- Fill Jacobian for m being the upstream node
804  else
805  !
806  ! -- Fill in row of n
807  call matrix_sln%add_value_pos(idxglo(ii01), term)
808  rhs(n) = rhs(n) + term * hnew(m)
809  !
810  ! -- Fill in row of m
811  call matrix_sln%add_value_pos(idxglo(ii11), -term)
812  rhs(m) = rhs(m) - term * hnew(m)
813  !
814  end if
815  end do
816  end do
817  !
818  ! -- Return
819  return
real(dp) function squadraticsaturationderivative(top, bot, x, eps)
@ brief Derivative of the quadratic saturation function
Here is the call graph for this function:

◆ xt3d_get_iinm()

subroutine xt3dmodule::xt3d_get_iinm ( class(xt3dtype this,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  iinm 
)

Definition at line 1551 of file Xt3dInterface.f90.

1552  ! -- dummy
1553  class(Xt3dType) :: this
1554  integer(I4B) :: n, m, iinm
1555  ! -- local
1556  integer(I4B) :: ii, jj
1557  !
1558  iinm = 0
1559  do ii = this%dis%con%ia(n), this%dis%con%ia(n + 1) - 1
1560  jj = this%dis%con%ja(ii)
1561  if (jj .eq. m) then
1562  iinm = ii
1563  exit
1564  end if
1565  end do
1566  !
1567  ! -- Return
1568  return

◆ xt3d_get_iinmx()

subroutine xt3dmodule::xt3d_get_iinmx ( class(xt3dtype this,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  iinmx 
)

Definition at line 1574 of file Xt3dInterface.f90.

1575  ! -- dummy
1576  class(Xt3dType) :: this
1577  integer(I4B) :: n, m, iinmx
1578  ! -- local
1579  integer(I4B) :: iix, jjx
1580  !
1581  iinmx = 0
1582  do iix = this%iax(n), this%iax(n + 1) - 1
1583  jjx = this%jax(iix)
1584  if (jjx .eq. m) then
1585  iinmx = iix
1586  exit
1587  end if
1588  end do
1589  !
1590  ! -- Return
1591  return

◆ xt3d_iallpc()

subroutine xt3dmodule::xt3d_iallpc ( class(xt3dtype this)

Definition at line 1151 of file Xt3dInterface.f90.

1152  ! -- modules
1154  ! -- dummy
1155  class(Xt3dType) :: this
1156  ! -- local
1157  integer(I4B) :: n, m, mm, il0, il1
1158  integer(I4B) :: nnbr0, nnbr1
1159  integer(I4B), dimension(this%nbrmax) :: inbr0, inbr1
1160  !
1161  if (this%ixt3d == 2) then
1162  this%lamatsaved = .false.
1163  call mem_allocate(this%iallpc, 0, 'IALLPC', this%memoryPath)
1164  else
1165  !
1166  ! -- allocate memory for iallpc and initialize to 1
1167  call mem_allocate(this%iallpc, this%dis%nodes, 'IALLPC', this%memoryPath)
1168  do n = 1, this%dis%nodes
1169  this%iallpc(n) = 1
1170  end do
1171  !
1172  ! -- Go through cells and connections and set iallpc to 0 if any
1173  ! connected cell is not confined
1174  do n = 1, this%dis%nodes
1175  if (this%icelltype(n) /= 0) then
1176  this%iallpc(n) = 0
1177  cycle
1178  end if
1179  nnbr0 = this%dis%con%ia(n + 1) - this%dis%con%ia(n) - 1
1180  call this%xt3d_load_inbr(n, nnbr0, inbr0)
1181  do il0 = 1, nnbr0
1182  m = inbr0(il0)
1183  if (m .lt. n) cycle
1184  if (this%icelltype(m) /= 0) then
1185  this%iallpc(n) = 0
1186  this%iallpc(m) = 0
1187  cycle
1188  end if
1189  nnbr1 = this%dis%con%ia(m + 1) - this%dis%con%ia(m) - 1
1190  call this%xt3d_load_inbr(m, nnbr1, inbr1)
1191  do il1 = 1, nnbr1
1192  mm = inbr1(il1)
1193  if (this%icelltype(mm) /= 0) then
1194  this%iallpc(n) = 0
1195  this%iallpc(m) = 0
1196  this%iallpc(mm) = 0
1197  end if
1198  end do
1199  end do
1200  end do
1201  !
1202  ! -- If any cells have all permanently confined connections then
1203  ! performance can be improved by precalculating coefficients
1204  ! so set lamatsaved to true.
1205  this%lamatsaved = .false.
1206  do n = 1, this%dis%nodes
1207  if (this%iallpc(n) == 1) then
1208  this%lamatsaved = .true.
1209  exit
1210  end if
1211  end do
1212  end if
1213  !
1214  if (.not. this%lamatsaved) then
1215  call mem_deallocate(this%iallpc)
1216  call mem_allocate(this%iallpc, 0, 'IALLPC', this%memoryPath)
1217  end if
1218  !
1219  ! -- Return
1220  return

◆ xt3d_indices()

subroutine xt3dmodule::xt3d_indices ( class(xt3dtype this,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  il0,
integer(i4b)  ii01,
integer(i4b)  jjs01,
integer(i4b)  il01,
integer(i4b)  il10,
integer(i4b)  ii00,
integer(i4b)  ii11,
integer(i4b)  ii10 
)

Definition at line 1225 of file Xt3dInterface.f90.

1227  ! -- dummy
1228  class(Xt3dType) :: this
1229  integer(I4B) :: n, m, il0, ii01, jjs01, il01, il10, ii00, ii11, ii10
1230  ! -- local
1231  integer(I4B) :: iinm
1232  !
1233  ! -- Set local number of node 0-1 connection (local cell number of cell 1
1234  ! in cell 0's neighbor list).
1235  il01 = il0
1236  ! -- Set local number of node 1-0 connection (local cell number of cell 0
1237  ! in cell 1's neighbor list).
1238  call this%xt3d_get_iinm(m, n, iinm)
1239  il10 = iinm - this%dis%con%ia(m)
1240  ! -- Set index of node 0 diagonal in the ja array.
1241  ii00 = this%dis%con%ia(n)
1242  ! -- Set index of node 0-1 connection in the ja array.
1243  ii01 = ii00 + il01
1244  ! -- Set symmetric index of node 0-1 connection.
1245  jjs01 = this%dis%con%jas(ii01)
1246  ! -- Set index of node 1 diagonal in the ja array.
1247  ii11 = this%dis%con%ia(m)
1248  ! -- Set index of node 1-0 connection in the ja array.
1249  ii10 = ii11 + il10
1250  !
1251  ! -- Return
1252  return

◆ xt3d_load()

subroutine xt3dmodule::xt3d_load ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr,
real(dp), dimension(this%nbrmax, 3)  vc,
real(dp), dimension(this%nbrmax, 3)  vn,
real(dp), dimension(this%nbrmax)  dl,
real(dp), dimension(this%nbrmax)  dln,
real(dp), dimension(3, 3)  ck,
logical  allhc 
)

Definition at line 1258 of file Xt3dInterface.f90.

1259  ! -- module
1260  use constantsmodule, only: dzero, dhalf, done
1261  ! -- dummy
1262  class(Xt3dType) :: this
1263  logical :: allhc
1264  integer(I4B), intent(in) :: nodes
1265  integer(I4B) :: n, nnbr
1266  integer(I4B), dimension(this%nbrmax) :: inbr
1267  real(DP), dimension(this%nbrmax, 3) :: vc, vn
1268  real(DP), dimension(this%nbrmax) :: dl, dln
1269  real(DP), dimension(3, 3) :: ck
1270  ! -- local
1271  integer(I4B) :: il, ii, jj, jjs
1272  integer(I4B) :: ihcnjj
1273  real(DP) :: satn, satjj
1274  real(DP) :: cl1njj, cl2njj, dltot, ooclsum
1275  !
1276  ! -- Set conductivity tensor for cell.
1277  ck = dzero
1278  ck(1, 1) = this%k11(n)
1279  ck(2, 2) = this%k22(n)
1280  ck(3, 3) = this%k33(n)
1281  call this%xt3d_fillrmatck(n)
1282  ck = matmul(this%rmatck, ck)
1283  ck = matmul(ck, transpose(this%rmatck))
1284  !
1285  ! -- Load neighbors of cell. Set cell numbers for inactive neighbors to
1286  ! zero so xt3d knows to ignore them. Compute direct connection lengths
1287  ! from perpendicular connection lengths. Also determine if all active
1288  ! connections are horizontal.
1289  allhc = .true.
1290  do il = 1, nnbr
1291  ii = il + this%dis%con%ia(n)
1292  jj = this%dis%con%ja(ii)
1293  jjs = this%dis%con%jas(ii)
1294  if (this%ibound(jj) .ne. 0) then
1295  inbr(il) = jj
1296  satn = this%sat(n)
1297  satjj = this%sat(jj)
1298  !
1299  ! -- DISV and DIS
1300  ihcnjj = this%dis%con%ihc(jjs)
1301  call this%dis%connection_normal(n, jj, ihcnjj, vn(il, 1), vn(il, 2), &
1302  vn(il, 3), ii)
1303  call this%dis%connection_vector(n, jj, this%nozee, satn, satjj, ihcnjj, &
1304  vc(il, 1), vc(il, 2), vc(il, 3), dltot)
1305  if (jj > n) then
1306  cl1njj = this%dis%con%cl1(jjs)
1307  cl2njj = this%dis%con%cl2(jjs)
1308  else
1309  cl1njj = this%dis%con%cl2(jjs)
1310  cl2njj = this%dis%con%cl1(jjs)
1311  end if
1312  ooclsum = 1d0 / (cl1njj + cl2njj)
1313  dl(il) = dltot * cl1njj * ooclsum
1314  dln(il) = dltot * cl2njj * ooclsum
1315  if (this%dis%con%ihc(jjs) .eq. 0) allhc = .false.
1316  else
1317  inbr(il) = 0
1318  end if
1319  end do
1320  !
1321  ! -- Return
1322  return
real(dp), parameter dhalf
real constant 1/2
Definition: Constants.f90:67
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64

◆ xt3d_load_inbr()

subroutine xt3dmodule::xt3d_load_inbr ( class(xt3dtype this,
integer(i4b)  n,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr 
)

Definition at line 1327 of file Xt3dInterface.f90.

1328  ! -- dummy
1329  class(Xt3dType) :: this
1330  integer(I4B) :: n, nnbr
1331  integer(I4B), dimension(this%nbrmax) :: inbr
1332  ! -- local
1333  integer(I4B) :: il, ii, jj
1334  !
1335  ! -- Load neighbors of cell. Set cell numbers for inactive
1336  ! neighbors to zero so xt3d knows to ignore them.
1337  do il = 1, nnbr
1338  ii = il + this%dis%con%ia(n)
1339  jj = this%dis%con%ja(ii)
1340  if (this%ibound(jj) .ne. 0) then
1341  inbr(il) = jj
1342  else
1343  inbr(il) = 0
1344  end if
1345  end do
1346  !
1347  ! -- Return
1348  return

◆ xt3d_mc()

subroutine xt3dmodule::xt3d_mc ( class(xt3dtype this,
integer(i4b), intent(in)  moffset,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 200 of file Xt3dInterface.f90.

201  ! -- modules
203  ! -- dummy
204  class(Xt3dType) :: this
205  integer(I4B), intent(in) :: moffset
206  class(MatrixBaseType), pointer :: matrix_sln
207  ! -- local
208  integer(I4B) :: i, j, iglo, jglo, niax, njax, ipos
209  integer(I4B) :: ipos_sln, icol_first, icol_last
210  integer(I4B) :: jj_xt3d
211  integer(I4B) :: igfirstnod, iglastnod
212  logical :: isextnbr
213  !
214  ! -- If not rhs, map connections for extended neighbors and construct iax,
215  ! -- jax, and idxglox
216  if (this%ixt3d == 1) then
217  !
218  ! -- calculate the first node for the model and the last node in global
219  ! numbers
220  igfirstnod = moffset + 1
221  iglastnod = moffset + this%dis%nodes
222  !
223  ! -- allocate iax, jax, and idxglox
224  niax = this%dis%nodes + 1
225  njax = this%numextnbrs ! + 1
226  call mem_allocate(this%iax, niax, 'IAX', trim(this%memoryPath))
227  call mem_allocate(this%jax, njax, 'JAX', trim(this%memoryPath))
228  call mem_allocate(this%idxglox, njax, 'IDXGLOX', trim(this%memoryPath))
229  !
230  ! -- load first iax entry
231  ipos = 1
232  this%iax(1) = ipos
233  !
234  ! -- loop over nodes
235  do i = 1, this%dis%nodes
236  !
237  ! -- calculate global node number
238  iglo = i + moffset
239  icol_first = matrix_sln%get_first_col_pos(iglo)
240  icol_last = matrix_sln%get_last_col_pos(iglo)
241  do ipos_sln = icol_first, icol_last
242  !
243  ! -- if jglo is in a different model, then it cannot be an extended
244  ! neighbor, so skip over it
245  jglo = matrix_sln%get_column(ipos_sln)
246  if (jglo < igfirstnod .or. jglo > iglastnod) then
247  cycle
248  end if
249  !
250  ! -- Check to see if this local connection was added by
251  ! xt3d. If not, then this connection was added by
252  ! something else, such as an interface model.
253  j = jglo - moffset
254  isextnbr = .false.
255  do jj_xt3d = this%ia_xt3d(i), this%ia_xt3d(i + 1) - 1
256  if (j == this%ja_xt3d(jj_xt3d)) then
257  isextnbr = .true.
258  exit
259  end if
260  end do
261  !
262  ! -- if an extended neighbor, add it to jax and idxglox
263  if (isextnbr) then
264  this%jax(ipos) = matrix_sln%get_column(ipos_sln) - moffset
265  this%idxglox(ipos) = ipos_sln
266  ipos = ipos + 1
267  end if
268  end do
269  ! -- load next iax entry
270  this%iax(i + 1) = ipos
271  end do
272  !
273  else
274  !
275  call mem_allocate(this%iax, 0, 'IAX', trim(this%memoryPath))
276  call mem_allocate(this%jax, 0, 'JAX', trim(this%memoryPath))
277  call mem_allocate(this%idxglox, 0, 'IDXGLOX', trim(this%memoryPath))
278  !
279  end if
280  !
281  ! -- Return
282  return

◆ xt3d_qnbrs()

subroutine xt3dmodule::xt3d_qnbrs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr,
real(dp), dimension(this%nbrmax)  chat,
real(dp), dimension(nodes), intent(inout)  hnew,
real(dp)  qnbrs 
)

Definition at line 1625 of file Xt3dInterface.f90.

1627  ! -- dummy
1628  class(Xt3dType) :: this
1629  integer(I4B), intent(in) :: nodes
1630  integer(I4B) :: n, m, nnbr
1631  integer(I4B), dimension(this%nbrmax) :: inbr
1632  real(DP) :: qnbrs
1633  real(DP), dimension(this%nbrmax) :: chat
1634  real(DP), intent(inout), dimension(nodes) :: hnew
1635  ! -- local
1636  integer(I4B) :: iil, iii, jjj
1637  real(DP) :: term
1638  !
1639  qnbrs = 0d0
1640  do iil = 1, nnbr
1641  if (inbr(iil) .ne. 0) then
1642  iii = iil + this%dis%con%ia(n)
1643  jjj = this%dis%con%ja(iii)
1644  term = chat(iil) * (hnew(jjj) - hnew(n))
1645  qnbrs = qnbrs + term
1646  end if
1647  end do
1648  !
1649  ! -- Return
1650  return

◆ xt3d_rhs()

subroutine xt3dmodule::xt3d_rhs ( class(xt3dtype this,
integer(i4b), intent(in)  nodes,
integer(i4b)  n,
integer(i4b)  m,
integer(i4b)  nnbr,
integer(i4b), dimension(this%nbrmax)  inbr,
real(dp), dimension(this%nbrmax)  chat,
real(dp), dimension(nodes), intent(inout)  hnew,
real(dp), dimension(nodes), intent(inout)  rhs 
)

Definition at line 1596 of file Xt3dInterface.f90.

1598  ! -- dummy
1599  class(Xt3dType) :: this
1600  integer(I4B), intent(in) :: nodes
1601  integer(I4B) :: n, m, nnbr
1602  integer(I4B), dimension(this%nbrmax) :: inbr
1603  real(DP), dimension(this%nbrmax) :: chat
1604  real(DP), intent(inout), dimension(nodes) :: hnew, rhs
1605  ! -- local
1606  integer(I4B) :: iil, iii, jjj
1607  real(DP) :: term
1608  !
1609  do iil = 1, nnbr
1610  if (inbr(iil) .ne. 0) then
1611  iii = iil + this%dis%con%ia(n)
1612  jjj = this%dis%con%ja(iii)
1613  term = chat(iil) * (hnew(jjj) - hnew(n))
1614  rhs(n) = rhs(n) - term
1615  rhs(m) = rhs(m) + term
1616  end if
1617  end do
1618  !
1619  ! -- Return
1620  return