MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
Disv1dGeom.f90
Go to the documentation of this file.
1 module disv1dgeom
2 
3  use kindmodule, only: dp, i4b
4  implicit none
5  private
6  public :: calcdist, line_unit_vector
7 
8 contains
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 
25  ! -- return
26  return
27  end function calcdist
28 
29  !> @brief Calculate distance between two vertices
30  !!
31  !! Calculate the vector components (xcomp, ycomp, and zcomp)
32  !! for a line defined by two points, (x0, y0, z0), (x1, y1, z1). Also
33  !! return the magnitude of the original vector, vmag.
34  !!
35  !<
36  subroutine line_unit_vector(x0, y0, x1, y1, &
37  xcomp, ycomp, vmag)
38  real(dp), intent(in) :: x0
39  real(dp), intent(in) :: y0
40  real(dp), intent(in) :: x1
41  real(dp), intent(in) :: y1
42  real(dp), intent(out) :: xcomp
43  real(dp), intent(out) :: ycomp
44  real(dp) :: dx, dy, vmag
45  !
46  dx = x1 - x0
47  dy = y1 - y0
48  vmag = sqrt(dx**2 + dy**2)
49  xcomp = dx / vmag
50  ycomp = dy / vmag
51  return
52  end subroutine line_unit_vector
53 
54 end module disv1dgeom
real(dp) function, public calcdist(vertices, ivert1, ivert2)
Calculate distance between two vertices.
Definition: Disv1dGeom.f90:13
subroutine, public line_unit_vector(x0, y0, x1, y1, xcomp, ycomp, vmag)
Calculate distance between two vertices.
Definition: Disv1dGeom.f90:38
This module defines variable data types.
Definition: kind.f90:8