MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
Disv1dGeom.f90
Go to the documentation of this file.
2
3 use kindmodule, only: dp, i4b
4 implicit none
5 private
7
8contains
9
10 !> @brief Calculate distance between two vertices
11 !<
12 function calcdist(vertices, ivert1, ivert2) result(dist)
13 ! -- dummy
14 real(dp), dimension(:, :), intent(in) :: vertices
15 integer(I4B), intent(in) :: ivert1
16 integer(I4B), intent(in) :: ivert2
17 real(dp) :: dist, xdist, ydist
18 ! -- local
19 !
20 ! -- calc distance
21 xdist = abs(vertices(1, ivert1) - vertices(1, ivert2))
22 ydist = abs(vertices(2, ivert1) - vertices(2, ivert2))
23 dist = sqrt(xdist * xdist + ydist * ydist)
24 end function calcdist
25
26 !> @brief Calculate distance between two vertices
27 !!
28 !! Calculate the vector components (xcomp, ycomp, and zcomp)
29 !! for a line defined by two points, (x0, y0, z0), (x1, y1, z1). Also
30 !! return the magnitude of the original vector, vmag.
31 !!
32 !<
33 subroutine line_unit_vector(x0, y0, x1, y1, &
34 xcomp, ycomp, vmag)
35 real(dp), intent(in) :: x0
36 real(dp), intent(in) :: y0
37 real(dp), intent(in) :: x1
38 real(dp), intent(in) :: y1
39 real(dp), intent(out) :: xcomp
40 real(dp), intent(out) :: ycomp
41 real(dp) :: dx, dy, vmag
42 !
43 dx = x1 - x0
44 dy = y1 - y0
45 vmag = sqrt(dx**2 + dy**2)
46 xcomp = dx / vmag
47 ycomp = dy / vmag
48 end subroutine line_unit_vector
49
50end module disv1dgeom
real(dp) function, public calcdist(vertices, ivert1, ivert2)
Calculate distance between two vertices.
subroutine, public line_unit_vector(x0, y0, x1, y1, xcomp, ycomp, vmag)
Calculate distance between two vertices.
This module defines variable data types.
Definition kind.f90:8