MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
disutilsmodule Module Reference

Functions/Subroutines

integer(i4b) function, public number_connected_faces (dis, n)
 Returns the number of connected faces for a given cell.
real(dp) function, dimension(3), public node_distance (dis, n, m)
 Returns the vector distance from cell n to cell m.
real(dp) function, dimension(3), public cell_center (dis, n)
 Returns the center coordinates of a given cell.

Function/Subroutine Documentation

◆ cell_center()

real(dp) function, dimension(3), public disutilsmodule::cell_center ( class(disbasetype), intent(in) dis,
integer(i4b), intent(in) n )

This function computes the center of cell n in the discretization. The center is returned as a 3-element vector containing the x, y, and z coordinates. The x and y coordinates are taken directly from the cell center arrays, while the z coordinate is computed as the average of the cell's top and bottom elevations.

Definition at line 89 of file DisUtils.f90.

90 ! -- dummy
91 class(DisBaseType), intent(in) :: dis
92 integer(I4B), intent(in) :: n
93 real(DP), dimension(3) :: center
94
95 center(1) = dis%xc(n)
96 center(2) = dis%yc(n)
97 center(3) = (dis%top(n) + dis%bot(n)) / 2.0_dp
Here is the caller graph for this function:

◆ node_distance()

real(dp) function, dimension(3), public disutilsmodule::node_distance ( class(disbasetype), intent(in) dis,
integer(i4b), intent(in) n,
integer(i4b), intent(in) m )

This function computes the vector from the center of cell n to the center of cell m in the discretization. If the cells are directly connected, the vector is computed along the connection direction, taking into account cell geometry and, if available, cell saturation. If the cells are not directly connected (e.g., when using an extended stencil such as neighbors-of-neighbors), the vector is simply the difference between their centroids: d = centroid(m) - centroid(n). The returned vector always points from cell n to cell m.

Definition at line 38 of file DisUtils.f90.

39 !-- modules
40 use tspfmimodule, only: tspfmitype
41 ! -- return
42 real(DP), dimension(3) :: d
43 ! -- dummy
44 class(DisBaseType), intent(in) :: dis
45 integer(I4B), intent(in) :: n, m
46 ! -- local
47 real(DP) :: x_dir, y_dir, z_dir, length
48 integer(I4B) :: ipos, isympos, ihc
49 real(DP), dimension(3) :: xn, xm
50
51 ! -- Find the connection position (isympos) between cell n and cell m
52 isympos = -1
53 do ipos = dis%con%ia(n) + 1, dis%con%ia(n + 1) - 1
54 if (dis%con%ja(ipos) == m) then
55 isympos = dis%con%jas(ipos)
56 exit
57 end if
58 end do
59
60 ! -- if the connection is not found, then return the distance between the two nodes
61 ! -- This can happen when using an extended stencil (neighbours-of-neigbhours) to compute the gradients
62 if (isympos == -1) then
63 xn = cell_center(dis, n)
64 xm = cell_center(dis, m)
65
66 d = xm - xn
67 return
68 end if
69
70 ! -- Get the connection direction and length
71 ihc = dis%con%ihc(isympos)
72 call dis%connection_vector(n, m, .false., done, done, ihc, x_dir, &
73 y_dir, z_dir, length)
74
75 ! -- Compute the distance vector
76 d(1) = x_dir * length
77 d(2) = y_dir * length
78 d(3) = z_dir * length
79
Here is the call graph for this function:
Here is the caller graph for this function:

◆ number_connected_faces()

integer(i4b) function, public disutilsmodule::number_connected_faces ( class(disbasetype), intent(in) dis,
integer(i4b), intent(in) n )

This function computes the number of faces of cell n that are connected to neighboring cells in the discretization. The value is determined from the connectivity information in the connection arrays, and does not include boundary faces (faces not connected to another cell).

Definition at line 21 of file DisUtils.f90.

22 class(DisBaseType), intent(in) :: dis
23 integer(I4B), intent(in) :: n
24 integer(I4B) :: connected_faces_count
25
26 connected_faces_count = dis%con%ia(n + 1) - dis%con%ia(n) - 1
Here is the caller graph for this function: