MODFLOW 6  version 6.7.0.dev0
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, inunit, iout)
30  ! -- dummy
31  type(swfoctype), pointer :: ocobj !< SwfOcType object
32  character(len=*), intent(in) :: name_model !< name of the model
33  integer(I4B), intent(in) :: inunit !< unit number for input
34  integer(I4B), intent(in) :: iout !< unit number for output
35  !
36  ! -- Create the object
37  allocate (ocobj)
38  !
39  ! -- Allocate scalars
40  call ocobj%allocate_scalars(name_model)
41  !
42  ! -- Save unit numbers
43  ocobj%inunit = inunit
44  ocobj%iout = iout
45  !
46  ! -- Initialize block parser
47  call ocobj%parser%Initialize(inunit, iout)
48  end subroutine oc_cr
49 
50  !> @ brief Allocate and read SwfOcType
51  !!
52  !! Setup head and budget as output control variables.
53  !!
54  !<
55  subroutine oc_ar(this, name, datavec, dis, dnodata)
56  ! -- dummy
57  class(swfoctype) :: this !< SwfOcType object
58  character(len=*), intent(in) :: name
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  !
67  ! -- Initialize variables
68  inodata = 0
69  nocdobj = 2
70  allocate (this%ocds(nocdobj))
71  do i = 1, nocdobj
72  call ocd_cr(ocdobjptr)
73  select case (i)
74  case (1)
75  call ocdobjptr%init_dbl('BUDGET', nullvec, dis, 'PRINT LAST ', &
76  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
77  this%iout, dnodata)
78  case (2)
79  call ocdobjptr%init_dbl(name, datavec, dis, 'PRINT LAST ', &
80  'COLUMNS 10 WIDTH 11 DIGITS 4 GENERAL ', &
81  this%iout, dnodata)
82  end select
83  this%ocds(i) = ocdobjptr
84  deallocate (ocdobjptr)
85  end do
86  !
87  ! -- Read options or set defaults if this package not on
88  if (this%inunit > 0) then
89  call this%read_options()
90  end if
91  end subroutine oc_ar
92 
93 end module swfocmodule
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 oc_ar(this, name, datavec, dis, dnodata)
@ brief Allocate and read SwfOcType
Definition: swf-oc.f90:56
subroutine, public oc_cr(ocobj, name_model, inunit, iout)
@ brief Create SwfOcType
Definition: swf-oc.f90:30
@ brief Controls model output. Overridden for each model type.
@ brief Output control
Definition: swf-oc.f90:16