MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
RectangularGeometry.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b
4  use constantsmodule, only: dzero
5  implicit none
6  private
8 
10  real(dp) :: height = dzero
11  real(dp) :: width = dzero
12 
13  contains
14 
15  procedure :: area_sat
16  procedure :: perimeter_sat
17  procedure :: area_wet
18  procedure :: perimeter_wet
19  procedure :: set_attribute
20  procedure :: print_attributes
22 
23 contains
24 
25  !> @brief Return saturated area
26  !<
27  function area_sat(this)
28  ! -- modules
29  use constantsmodule, only: dtwo, dpi
30  ! -- return
31  real(dp) :: area_sat
32  ! -- dummy
33  class(rectangulargeometrytype) :: this
34  !
35  ! -- Calculate area
36  area_sat = this%height * this%width
37  !
38  ! -- Return
39  return
40  end function area_sat
41 
42  !> @brief Return saturated perimeter
43  !<
44  function perimeter_sat(this)
45  ! -- modules
46  use constantsmodule, only: dtwo, dpi
47  ! -- return
48  real(dp) :: perimeter_sat
49  ! -- dummy
50  class(rectangulargeometrytype) :: this
51  !
52  ! -- Calculate area
53  perimeter_sat = dtwo * (this%height + this%width)
54  !
55  ! -- Return
56  return
57  end function perimeter_sat
58 
59  !> @brief Return wetted area
60  !<
61  function area_wet(this, depth)
62  ! -- modules
63  use constantsmodule, only: dtwo, dpi, dzero
64  ! -- return
65  real(dp) :: area_wet
66  ! -- dummy
67  class(rectangulargeometrytype) :: this
68  real(dp), intent(in) :: depth
69  !
70  ! -- Calculate area
71  if (depth <= dzero) then
72  area_wet = dzero
73  elseif (depth <= this%height) then
74  area_wet = depth * this%width
75  else
76  area_wet = this%width * this%height
77  end if
78  !
79  ! -- Return
80  return
81  end function area_wet
82 
83  !> @brief Return wetted perimeter
84  !<
85  function perimeter_wet(this, depth)
86  ! -- modules
87  use constantsmodule, only: dtwo, dpi
88  ! -- return
89  real(dp) :: perimeter_wet
90  ! -- dummy
91  class(rectangulargeometrytype) :: this
92  real(dp), intent(in) :: depth
93  !
94  ! -- Calculate area
95  if (depth <= dzero) then
96  perimeter_wet = dzero
97  elseif (depth <= this%height) then
98  perimeter_wet = dtwo * (depth + this%width)
99  else
100  perimeter_wet = dtwo * (this%height + this%width)
101  end if
102  !
103  ! -- Return
104  return
105  end function perimeter_wet
106 
107  !> @brief Set a parameter for this rectangular object
108  !<
109  subroutine set_attribute(this, line)
110  ! -- module
111  use inputoutputmodule, only: urword
112  use constantsmodule, only: linelength
114  ! -- dummy
115  class(rectangulargeometrytype) :: this
116  character(len=LINELENGTH) :: errmsg
117  character(len=*), intent(inout) :: line
118  ! -- local
119  integer(I4B) :: lloc, istart, istop, ival
120  real(DP) :: rval
121  !
122  ! -- should change this and set id if uninitialized or store it
123  lloc = 1
124  call urword(line, lloc, istart, istop, 2, ival, rval, 0, 0)
125  this%id = ival
126  !
127  ! -- Parse the attribute
128  call urword(line, lloc, istart, istop, 1, ival, rval, 0, 0)
129  select case (line(istart:istop))
130  case ('NAME')
131  call urword(line, lloc, istart, istop, 1, ival, rval, 0, 0)
132  this%name = line(istart:istop)
133  case ('HEIGHT')
134  call urword(line, lloc, istart, istop, 3, ival, rval, 0, 0)
135  this%height = rval
136  case ('WIDTH')
137  call urword(line, lloc, istart, istop, 3, ival, rval, 0, 0)
138  this%width = rval
139  case default
140  write (errmsg, '(a,a)') &
141  'Unknown rectangular geometry attribute: ', line(istart:istop)
142  call store_error(errmsg, terminate=.true.)
143  end select
144  !
145  ! -- Return
146  return
147  end subroutine set_attribute
148 
149  !> @brief Print the attributes for this object
150  !<
151  subroutine print_attributes(this, iout)
152  ! -- dummy
153  class(rectangulargeometrytype) :: this
154  ! -- local
155  integer(I4B), intent(in) :: iout
156  ! -- formats
157  character(len=*), parameter :: fmtnm = "(4x,a,a)"
158  character(len=*), parameter :: fmttd = "(4x,a,1(1PG15.6))"
159  !
160  ! -- call parent to print parent attributes
161  call this%BaseGeometryType%print_attributes(iout)
162  !
163  ! -- Print specifics of this geometry type
164  write (iout, fmttd) 'HEIGHT = ', this%height
165  write (iout, fmttd) 'WIDTH = ', this%width
166  write (iout, fmttd) 'SATURATED AREA = ', this%area_sat()
167  write (iout, fmttd) 'SATURATED WETTED PERIMETER = ', this%perimeter_sat()
168  !
169  ! -- Return
170  return
171  end subroutine print_attributes
172 
173 end module rectangulargeometrymodule
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
real(dp), parameter dpi
real constant
Definition: Constants.f90:127
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64
real(dp), parameter dtwo
real constant 2
Definition: Constants.f90:78
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
This module defines variable data types.
Definition: kind.f90:8
real(dp) function perimeter_sat(this)
Return saturated perimeter.
real(dp) function perimeter_wet(this, depth)
Return wetted perimeter.
subroutine set_attribute(this, line)
Set a parameter for this rectangular object.
subroutine print_attributes(this, iout)
Print the attributes for this object.
real(dp) function area_sat(this)
Return saturated area.
real(dp) function area_wet(this, depth)
Return wetted area.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59