MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
outputcontroldatamodule Module Reference

Output control data module.

Data Types

type  outputcontroldatatype
 Output control data type. More...
 

Functions/Subroutines

subroutine, public ocd_cr (ocdobj)
 @ brief Create a new output control data type. More...
 
subroutine ocd_rp_check (this, input_fname)
 @ brief Check the output control data type for consistency. More...
 
subroutine ocd_ot (this, ipflg, kstp, endofperiod, iout, iprint_opt, isav_opt)
 Write to list file and/or save to binary file, depending on settings. More...
 
subroutine ocd_da (this)
 Deallocate the output control data type. More...
 
subroutine init_dbl (this, cname, dblvec, dis, cdefpsm, cdeffmp, iout, dnodata)
 Initialize the output control data type for double precision data. More...
 
subroutine init_int (this, cname, intvec, dis, cdefpsm, cdeffmp, iout, inodata)
 @ brief Initialize the output control data type for integer data. More...
 
subroutine allocate (this)
 @ brief Allocate scalar variables More...
 
subroutine set_prnfmt (this, prnfmt, inunit)
 @ brief Set PRINT_FORMAT based on an input string. More...
 
subroutine set_ocfile (this, ocfile, iout)
 

Function/Subroutine Documentation

◆ allocate()

subroutine outputcontroldatamodule::allocate ( class(outputcontroldatatype this)
private
Parameters
thisOutputControlDataType object

Definition at line 195 of file OutputControlData.f90.

196  ! modules
197  use constantsmodule, only: dzero
198  ! dummy
199  class(OutputControlDataType) :: this !< OutputControlDataType object
200 
201  allocate (this%cname)
202  allocate (this%cdatafmp)
203  allocate (this%idataun)
204  allocate (this%editdesc)
205  allocate (this%nvaluesp)
206  allocate (this%nwidthp)
207  allocate (this%dnodata)
208  allocate (this%inodata)
209 
210  this%cname = ''
211  this%cdatafmp = ''
212  this%idataun = 0
213  this%editdesc = ''
214  this%nvaluesp = 0
215  this%nwidthp = 0
216  this%dnodata = dzero
217  this%inodata = 0
218  this%psm => create_psm()
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
Here is the call graph for this function:

◆ init_dbl()

subroutine outputcontroldatamodule::init_dbl ( class(outputcontroldatatype this,
character(len=*), intent(in)  cname,
real(dp), dimension(:), intent(in), pointer, contiguous  dblvec,
class(disbasetype), intent(in), pointer  dis,
character(len=*), intent(in)  cdefpsm,
character(len=*), intent(in)  cdeffmp,
integer(i4b), intent(in)  iout,
real(dp), intent(in)  dnodata 
)
private
Parameters
thisOutputControlDataType object
[in]cnameName of variable
[in]dblvecData array that will be managed by this object
[in]disDiscretization package
[in]cdefpsmString for defining the print/save manager
[in]cdeffmpString for print format
[in]ioutUnit number for output
[in]dnodataNo data value

Definition at line 152 of file OutputControlData.f90.

154  class(OutputControlDataType) :: this !< OutputControlDataType object
155  character(len=*), intent(in) :: cname !< Name of variable
156  real(DP), dimension(:), pointer, contiguous, intent(in) :: dblvec !< Data array that will be managed by this object
157  class(DisBaseType), pointer, intent(in) :: dis !< Discretization package
158  character(len=*), intent(in) :: cdefpsm !< String for defining the print/save manager
159  character(len=*), intent(in) :: cdeffmp !< String for print format
160  integer(I4B), intent(in) :: iout !< Unit number for output
161  real(DP), intent(in) :: dnodata !< No data value
162 
163  this%cname = cname
164  this%dbldata => dblvec
165  this%dis => dis
166  this%dnodata = dnodata
167  if (cdefpsm /= '') call this%psm%read(cdefpsm, iout)
168  call print_format(cdeffmp, this%cdatafmp, &
169  this%editdesc, this%nvaluesp, this%nwidthp, 0)
Here is the call graph for this function:

◆ init_int()

subroutine outputcontroldatamodule::init_int ( class(outputcontroldatatype this,
character(len=*), intent(in)  cname,
integer(i4b), dimension(:), intent(in), pointer, contiguous  intvec,
class(disbasetype), intent(in), pointer  dis,
character(len=*), intent(in)  cdefpsm,
character(len=*), intent(in)  cdeffmp,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  inodata 
)
private
Parameters
thisOutputControlDataType object
[in]cnameName of variable
[in]intvecData array that will be managed by this object
[in]disDiscretization package
[in]cdefpsmString for defining the print/save manager
[in]cdeffmpString for print format
[in]ioutUnit number for output
[in]inodataNo data value

Definition at line 173 of file OutputControlData.f90.

175  class(OutputControlDataType) :: this !< OutputControlDataType object
176  character(len=*), intent(in) :: cname !< Name of variable
177  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: intvec !< Data array that will be managed by this object
178  class(DisBaseType), pointer, intent(in) :: dis !< Discretization package
179  character(len=*), intent(in) :: cdefpsm !< String for defining the print/save manager
180  character(len=*), intent(in) :: cdeffmp !< String for print format
181  integer(I4B), intent(in) :: iout !< Unit number for output
182  integer(I4B), intent(in) :: inodata !< No data value
183 
184  this%cname = cname
185  this%intdata => intvec
186  this%dis => dis
187  this%inodata = inodata
188  this%editdesc = 'I'
189  if (cdefpsm /= '') call this%psm%read(cdefpsm, iout)
190  call print_format(cdeffmp, this%cdatafmp, this%editdesc, this%nvaluesp, &
191  this%nwidthp, 0)
Here is the call graph for this function:

◆ ocd_cr()

subroutine, public outputcontroldatamodule::ocd_cr ( type(outputcontroldatatype), pointer  ocdobj)
Parameters
ocdobjthis instance

Definition at line 46 of file OutputControlData.f90.

47  type(OutputControlDataType), pointer :: ocdobj !< this instance
48  allocate (ocdobj)
49  call ocdobj%allocate_scalars()
Here is the caller graph for this function:

◆ ocd_da()

subroutine outputcontroldatamodule::ocd_da ( class(outputcontroldatatype this)
private

Definition at line 138 of file OutputControlData.f90.

139  class(OutputControlDataType) :: this
140 
141  deallocate (this%cname)
142  deallocate (this%cdatafmp)
143  deallocate (this%idataun)
144  deallocate (this%editdesc)
145  deallocate (this%nvaluesp)
146  deallocate (this%nwidthp)
147  deallocate (this%dnodata)
148  deallocate (this%inodata)

◆ ocd_ot()

subroutine outputcontroldatamodule::ocd_ot ( class(outputcontroldatatype this,
integer(i4b), intent(inout)  ipflg,
integer(i4b), intent(in)  kstp,
logical(lgp), intent(in)  endofperiod,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in), optional  iprint_opt,
integer(i4b), intent(in), optional  isav_opt 
)
Parameters
thisOutputControlDataType object
[in,out]ipflgFlag indicating if something was printed
[in]kstpCurrent time step
[in]endofperiodEnd of period logical flag
[in]ioutUnit number for output
[in]iprint_optOptional print flag override
[in]isav_optOptional save flag override

Definition at line 83 of file OutputControlData.f90.

84  ! dummy
85  class(OutputControlDataType) :: this !< OutputControlDataType object
86  integer(I4B), intent(inout) :: ipflg !< Flag indicating if something was printed
87  integer(I4B), intent(in) :: kstp !< Current time step
88  logical(LGP), intent(in) :: endofperiod !< End of period logical flag
89  integer(I4B), intent(in) :: iout !< Unit number for output
90  integer(I4B), optional, intent(in) :: iprint_opt !< Optional print flag override
91  integer(I4B), optional, intent(in) :: isav_opt !< Optional save flag override
92  ! local
93  integer(I4B) :: iprint
94  integer(I4B) :: idataun
95 
96  ! Initialize
97  iprint = 0
98  ipflg = 0
99  idataun = 0
100 
101  ! Determine whether or not to print the array. The present
102  ! check allows a caller to override the print/save manager
103  if (present(iprint_opt)) then
104  if (iprint_opt /= 0) then
105  iprint = 1
106  ipflg = 1
107  end if
108  else
109  if (this%psm%should_print(kstp, endofperiod)) then
110  iprint = 1
111  ipflg = 1
112  end if
113  end if
114 
115  ! Determine whether to save the array to a file
116  if (present(isav_opt)) then
117  if (isav_opt /= 0) then
118  idataun = this%idataun
119  end if
120  else
121  if (this%psm%should_save(kstp, endofperiod)) idataun = this%idataun
122  end if
123 
124  ! Record double precision array
125  if (associated(this%dbldata)) &
126  call this%dis%record_array(this%dbldata, iout, iprint, idataun, &
127  this%cname, this%cdatafmp, this%nvaluesp, &
128  this%nwidthp, this%editdesc, this%dnodata)
129 
130  ! Record integer array (not supported yet)
131  !if(associated(this%intvec)) &
132  !call this%dis%record_array(this%intvec, iout, iprint, idataun, &
133  ! this%cname, this%cdatafmp, this%nvaluesp, &
134  ! this%nwidthp, this%editdesc, this%inodata)

◆ ocd_rp_check()

subroutine outputcontroldatamodule::ocd_rp_check ( class(outputcontroldatatype this,
character(len=*)  input_fname 
)
private
Parameters
thisthis instance

Definition at line 53 of file OutputControlData.f90.

54  ! modules
55  use constantsmodule, only: linelength
57  ! dummy
58  class(OutputControlDataType) :: this !< this instance
59  character(len=*) :: input_fname
60  ! locals
61  character(len=LINELENGTH) :: errmsg
62  ! formats
63  character(len=*), parameter :: fmtocsaveerr = &
64  "(1X,'REQUESTING TO SAVE ',A,' BUT ',A,' SAVE FILE NOT SPECIFIED. ', &
65  &A,' SAVE FILE MUST BE SPECIFIED IN OUTPUT CONTROL OPTIONS.')"
66 
67  ! If saving is enabled, make sure an output file was specified
68  if (this%psm%save_steps%any()) then
69  if (this%idataun == 0) then
70  write (errmsg, fmtocsaveerr) trim(adjustl(this%cname)), &
71  trim(adjustl(this%cname)), &
72  trim(adjustl(this%cname))
73  call store_error(errmsg)
74  end if
75  end if
76 
77  if (count_errors() > 0) then
78  call store_error_filename(input_fname)
79  end if
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
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
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:203
Here is the call graph for this function:

◆ set_ocfile()

subroutine outputcontroldatamodule::set_ocfile ( class(outputcontroldatatype this,
character(len=*), intent(in)  ocfile,
integer(i4b), intent(in)  iout 
)
Parameters
thisOutputControlDataType object
[in]ocfileOC output filename
[in]ioutUnit number for output

Definition at line 234 of file OutputControlData.f90.

235  use constantsmodule, only: mnormal
236  use openspecmodule, only: access, form
238  ! dummy
239  class(OutputControlDataType) :: this !< OutputControlDataType object
240  character(len=*), intent(in) :: ocfile !< OC output filename
241  integer(I4B), intent(in) :: iout !< Unit number for output
242  ! format
243  character(len=*), parameter :: fmtocsave = &
244  "(4X,A,' INFORMATION WILL BE WRITTEN TO:', &
245  &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
246  this%idataun = getunit()
247  write (iout, fmtocsave) trim(adjustl(this%cname)), this%idataun, &
248  trim(ocfile)
249  call openfile(this%idataun, iout, ocfile, 'DATA(BINARY)', &
250  form, access, 'REPLACE', mnormal)
@ mnormal
normal output mode
Definition: Constants.f90:206
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Here is the call graph for this function:

◆ set_prnfmt()

subroutine outputcontroldatamodule::set_prnfmt ( class(outputcontroldatatype this,
character(len=*), intent(in)  prnfmt,
integer(i4b), intent(in)  inunit 
)
Parameters
thisOutputControlDataType object
[in]inunitUnit number for input

Definition at line 222 of file OutputControlData.f90.

223  ! modules
225  ! dummy
226  class(OutputControlDataType) :: this !< OutputControlDataType object
227  character(len=*), intent(in) :: prnfmt
228  integer(I4B), intent(in) :: inunit !< Unit number for input
229  ! local
230  call print_format(prnfmt, this%cdatafmp, this%editdesc, &
231  this%nvaluesp, this%nwidthp, inunit)
subroutine, public print_format(linein, cdatafmp, editdesc, nvaluesp, nwidthp, inunit)
Define the print or save format.
Here is the call graph for this function: