MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
swf-oc.f90
Go to the documentation of this file.
1 module swfocmodule
2 
3  use basedismodule, only: disbasetype
4  use kindmodule, only: dp, i4b
7 
8  implicit none
9  private
10  public swfoctype, oc_cr
11 
12  !> @ brief Output control
13  !!
14  !! Concrete implementation of OutputControlType
15  !<
16  type, extends(outputcontroltype) :: swfoctype
17  contains
18  procedure :: oc_ar
19  end type swfoctype
20 
21 contains
22 
23  !> @ brief Create SwfOcType
24  !!
25  !! Create by allocating a new SwfOcType object and initializing
26  !! member variables.
27  !!
28  !<
29  subroutine oc_cr(ocobj, name_model, input_mempath, inunit, iout)
30  ! -- dummy
31  type(swfoctype), pointer :: ocobj !< SwfOcType object
32  character(len=*), intent(in) :: name_model !< name of the model
33  character(len=*), intent(in) :: input_mempath !< input mempath of the package
34  integer(I4B), intent(in) :: inunit !< unit number for input
35  integer(I4B), intent(in) :: iout !< unit number for output
36  !
37  ! -- Create the object
38  allocate (ocobj)
39  !
40  ! -- Allocate scalars
41  call ocobj%allocate_scalars(name_model, input_mempath)
42  !
43  ! -- Save unit numbers
44  ocobj%inunit = inunit
45  ocobj%iout = iout
46  end subroutine oc_cr
47 
48  !> @ brief Allocate and read SwfOcType
49  !!
50  !! Setup head and budget as output control variables.
51  !!
52  !<
53  subroutine oc_ar(this, datavec, dis, dnodata)
54  use constantsmodule, only: linelength
57  ! -- dummy
58  class(swfoctype) :: this !< SwfOcType object
59  real(DP), dimension(:), pointer, contiguous, intent(in) :: datavec !< data vector
60  class(disbasetype), pointer, intent(in) :: dis !< model discretization package
61  real(DP), intent(in) :: dnodata !< no data value
62  ! -- local
63  integer(I4B) :: i, nocdobj, inodata
64  type(outputcontroldatatype), pointer :: ocdobjptr
65  real(DP), dimension(:), pointer, contiguous :: nullvec => null()
66  character(len=LINELENGTH) :: stagefile, qoutflowfile
67  type(swfocparamfoundtype) :: found
68  !
69  ! -- Initialize variables
70  inodata = 0
71  nocdobj = 3
72  allocate (this%ocds(nocdobj))
73  do i = 1, nocdobj
74  call ocd_cr(ocdobjptr)
75  select case (i)
76  case (1)
77  call ocdobjptr%init_dbl('BUDGET', nullvec, dis, 'PRINT LAST ', &
78  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
79  this%iout, dnodata)
80  case (2)
81  call ocdobjptr%init_dbl('STAGE', datavec, dis, 'PRINT LAST ', &
82  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
83  this%iout, dnodata)
84  case (3)
85  call ocdobjptr%init_dbl('QOUTFLOW', datavec, dis, 'PRINT LAST ', &
86  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
87  this%iout, dnodata)
88  end select
89  this%ocds(i) = ocdobjptr
90  deallocate (ocdobjptr)
91  end do
92  !
93  ! -- Read options or set defaults if this package not on
94  if (this%input_mempath /= '') then
95  write (this%iout, '(/,1x,a,/)') 'PROCESSING OC OPTIONS'
96  call this%source_options()
97  call mem_set_value(qoutflowfile, 'QOUTFLOWFILE', this%input_mempath, &
98  found%qoutflowfile)
99  call mem_set_value(stagefile, 'STAGEFILE', this%input_mempath, &
100  found%stagefile)
101  if (found%qoutflowfile) then
102  call this%set_ocfile('QOUTFLOW', qoutflowfile, this%iout)
103  end if
104  if (found%stagefile) then
105  call this%set_ocfile('STAGE', stagefile, this%iout)
106  end if
107  write (this%iout, '(1x,a)') 'END OF OC OPTIONS'
108  end if
109  end subroutine oc_ar
110 
111 end module swfocmodule
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
This module defines variable data types.
Definition: kind.f90:8
Output control data module.
subroutine, public ocd_cr(ocdobj)
@ brief Create a new output control data type.
Model output control.
subroutine, public oc_cr(ocobj, name_model, input_mempath, inunit, iout)
@ brief Create SwfOcType
Definition: swf-oc.f90:30
subroutine oc_ar(this, datavec, dis, dnodata)
@ brief Allocate and read SwfOcType
Definition: swf-oc.f90:54
@ brief Controls model output. Overridden for each model type.
@ brief Output control
Definition: swf-oc.f90:16