MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
outputcontroldatamodule Module Reference

This module contains the OutputControlDataModule. More...

Data Types

type  outputcontroldatatype
 @ brief OutputControlDataType More...
 

Functions/Subroutines

subroutine, public ocd_cr (ocdobj)
 @ brief Create OutputControlDataType More...
 
subroutine ocd_rp_check (this, inunit)
 @ brief Check OutputControlDataType object More...
 
subroutine ocd_ot (this, ipflg, kstp, endofperiod, iout, iprint_opt, isav_opt)
 @ brief Output data More...
 
subroutine ocd_da (this)
 @ brief Deallocate OutputControlDataType More...
 
subroutine init_dbl (this, cname, dblvec, dis, cdefpsm, cdeffmp, iout, dnodata)
 @ brief Initialize this OutputControlDataType as double precision data More...
 
subroutine init_int (this, cname, intvec, dis, cdefpsm, cdeffmp, iout, inodata)
 @ brief Initialize this OutputControlDataType as integer data More...
 
subroutine allocate_scalars (this)
 @ brief Allocate OutputControlDataType members More...
 
subroutine set_option (this, linein, inunit, iout)
 @ brief Set options for this object based on an input string More...
 

Detailed Description

This module defines the OutputControlDataType. This type can be assigned to different model variables, such as head or concentration. The variables are then printed and/or saved in a consistent manner.

Function/Subroutine Documentation

◆ allocate_scalars()

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

Allocate and initialize member variables

Parameters
thisOutputControlDataType object

Definition at line 261 of file OutputControlData.f90.

262  ! -- modules
263  use constantsmodule, only: dzero
264  ! -- dummy
265  class(OutputControlDataType) :: this !< OutputControlDataType object
266  !
267  allocate (this%cname)
268  allocate (this%cdatafmp)
269  allocate (this%idataun)
270  allocate (this%editdesc)
271  allocate (this%nvaluesp)
272  allocate (this%nwidthp)
273  allocate (this%dnodata)
274  allocate (this%inodata)
275  allocate (this%psmobj)
276  !
277  this%cname = ''
278  this%cdatafmp = ''
279  this%idataun = 0
280  this%editdesc = ''
281  this%nvaluesp = 0
282  this%nwidthp = 0
283  this%dnodata = dzero
284  this%inodata = 0
285  !
286  ! -- return
287  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64

◆ 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 
)

Initialize this object as a double precision data type

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 200 of file OutputControlData.f90.

202  ! -- dummy
203  class(OutputControlDataType) :: this !< OutputControlDataType object
204  character(len=*), intent(in) :: cname !< Name of variable
205  real(DP), dimension(:), pointer, contiguous, intent(in) :: dblvec !< Data array that will be managed by this object
206  class(DisBaseType), pointer, intent(in) :: dis !< Discretization package
207  character(len=*), intent(in) :: cdefpsm !< String for defining the print/save manager
208  character(len=*), intent(in) :: cdeffmp !< String for print format
209  integer(I4B), intent(in) :: iout !< Unit number for output
210  real(DP), intent(in) :: dnodata !< No data value
211  !
212  this%cname = cname
213  this%dblvec => dblvec
214  this%dis => dis
215  this%dnodata = dnodata
216  call this%psmobj%init()
217  if (cdefpsm /= '') call this%psmobj%rp(cdefpsm, iout)
218  call print_format(cdeffmp, this%cdatafmp, &
219  this%editdesc, this%nvaluesp, this%nwidthp, 0)
220  !
221  ! -- return
222  return
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

Initialize this object as an integer data type

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 230 of file OutputControlData.f90.

232  ! -- dummy
233  class(OutputControlDataType) :: this !< OutputControlDataType object
234  character(len=*), intent(in) :: cname !< Name of variable
235  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: intvec !< Data array that will be managed by this object
236  class(DisBaseType), pointer, intent(in) :: dis !< Discretization package
237  character(len=*), intent(in) :: cdefpsm !< String for defining the print/save manager
238  character(len=*), intent(in) :: cdeffmp !< String for print format
239  integer(I4B), intent(in) :: iout !< Unit number for output
240  integer(I4B), intent(in) :: inodata !< No data value
241  !
242  this%cname = cname
243  this%intvec => intvec
244  this%dis => dis
245  this%inodata = inodata
246  this%editdesc = 'I'
247  call this%psmobj%init()
248  if (cdefpsm /= '') call this%psmobj%rp(cdefpsm, iout)
249  call print_format(cdeffmp, this%cdatafmp, this%editdesc, this%nvaluesp, &
250  this%nwidthp, 0)
251  !
252  ! -- return
253  return
Here is the call graph for this function:

◆ ocd_cr()

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

Create by allocating a new OutputControlDataType object

Parameters
ocdobjOutputControlDataType object

Definition at line 55 of file OutputControlData.f90.

56  ! -- dummy
57  type(OutputControlDataType), pointer :: ocdobj !< OutputControlDataType object
58  !
59  ! -- Create the object
60  allocate (ocdobj)
61  !
62  ! -- Allocate scalars
63  call ocdobj%allocate_scalars()
64  !
65  ! -- Return
66  return
Here is the caller graph for this function:

◆ ocd_da()

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

Deallocate members of this type

Definition at line 174 of file OutputControlData.f90.

175  ! -- modules
176  use constantsmodule, only: dzero
177  ! -- dummy
178  class(OutputControlDataType) :: this
179  !
180  ! -- deallocate
181  deallocate (this%cname)
182  deallocate (this%cdatafmp)
183  deallocate (this%idataun)
184  deallocate (this%editdesc)
185  deallocate (this%nvaluesp)
186  deallocate (this%nwidthp)
187  deallocate (this%dnodata)
188  deallocate (this%inodata)
189  deallocate (this%psmobj)
190  !
191  ! -- return
192  return

◆ 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 
)

Depending on the settings, print the data to a listing file and/or save the data to a binary file.

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 112 of file OutputControlData.f90.

113  ! -- dummy
114  class(OutputControlDataType) :: this !< OutputControlDataType object
115  integer(I4B), intent(inout) :: ipflg !< Flag indicating if something was printed
116  integer(I4B), intent(in) :: kstp !< Current time step
117  logical(LGP), intent(in) :: endofperiod !< End of period logical flag
118  integer(I4B), intent(in) :: iout !< Unit number for output
119  integer(I4B), optional, intent(in) :: iprint_opt !< Optional print flag override
120  integer(I4B), optional, intent(in) :: isav_opt !< Optional save flag override
121  ! -- local
122  integer(I4B) :: iprint
123  integer(I4B) :: idataun
124  !
125  ! -- initialize
126  iprint = 0
127  ipflg = 0
128  idataun = 0
129  !
130  ! -- Determine whether or not to print the array. The present
131  ! check allows a caller to override the print/save manager
132  if (present(iprint_opt)) then
133  if (iprint_opt /= 0) then
134  iprint = 1
135  ipflg = 1
136  end if
137  else
138  if (this%psmobj%kstp_to_print(kstp, endofperiod)) then
139  iprint = 1
140  ipflg = 1
141  end if
142  end if
143  !
144  ! -- determine whether or not to save the array to a file
145  if (present(isav_opt)) then
146  if (isav_opt /= 0) then
147  idataun = this%idataun
148  end if
149  else
150  if (this%psmobj%kstp_to_save(kstp, endofperiod)) idataun = this%idataun
151  end if
152  !
153  ! -- Record double precision array
154  if (associated(this%dblvec)) &
155  call this%dis%record_array(this%dblvec, iout, iprint, idataun, &
156  this%cname, this%cdatafmp, this%nvaluesp, &
157  this%nwidthp, this%editdesc, this%dnodata)
158  !
159  ! -- Record integer array (not supported yet)
160  !if(associated(this%intvec)) &
161  !call this%dis%record_array(this%intvec, iout, iprint, idataun, &
162  ! this%cname, this%cdatafmp, this%nvaluesp, &
163  ! this%nwidthp, this%editdesc, this%inodata)
164  !
165  ! -- Return
166  return

◆ ocd_rp_check()

subroutine outputcontroldatamodule::ocd_rp_check ( class(outputcontroldatatype this,
integer(i4b), intent(in)  inunit 
)
private

Perform a consistency check

Parameters
thisOutputControlDataType object
[in]inunitUnit number for input

Definition at line 74 of file OutputControlData.f90.

75  ! -- modules
76  use constantsmodule, only: linelength
78  ! -- dummy
79  class(OutputControlDataType) :: this !< OutputControlDataType object
80  integer(I4B), intent(in) :: inunit !< Unit number for input
81  ! -- locals
82  character(len=LINELENGTH) :: errmsg
83  ! -- formats
84  character(len=*), parameter :: fmtocsaveerr = &
85  "(1X,'REQUESTING TO SAVE ',A,' BUT ',A,' SAVE FILE NOT SPECIFIED. ', &
86  &A,' SAVE FILE MUST BE SPECIFIED IN OUTPUT CONTROL OPTIONS.')"
87  !
88  ! -- Check to make sure save file was specified
89  if (this%psmobj%save_detected) then
90  if (this%idataun == 0) then
91  write (errmsg, fmtocsaveerr) trim(adjustl(this%cname)), &
92  trim(adjustl(this%cname)), &
93  trim(adjustl(this%cname))
94  call store_error(errmsg)
95  end if
96  end if
97  !
98  if (count_errors() > 0) then
99  call store_error_unit(inunit)
100  end if
101  !
102  ! -- return
103  return
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
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_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
Here is the call graph for this function:

◆ set_option()

subroutine outputcontroldatamodule::set_option ( class(outputcontroldatatype this,
character(len=*), intent(in)  linein,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)

Set FILEOUT and PRINT_FORMAT options for this object.

Parameters
thisOutputControlDataType object
[in]lineinCharacter string with options
[in]inunitUnit number for input
[in]ioutUnit number for output

Definition at line 295 of file OutputControlData.f90.

296  ! -- modules
297  use constantsmodule, only: mnormal
298  use openspecmodule, only: access, form
301  ! -- dummy
302  class(OutputControlDataType) :: this !< OutputControlDataType object
303  character(len=*), intent(in) :: linein !< Character string with options
304  integer(I4B), intent(in) :: inunit !< Unit number for input
305  integer(I4B), intent(in) :: iout !< Unit number for output
306  ! -- local
307  character(len=len(linein)) :: line
308  integer(I4B) :: lloc, istart, istop, ival
309  real(DP) :: rval
310  ! -- format
311  character(len=*), parameter :: fmtocsave = &
312  "(4X,A,' INFORMATION WILL BE WRITTEN TO:', &
313  &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
314  !
315  line(:) = linein(:)
316  lloc = 1
317  call urword(line, lloc, istart, istop, 1, ival, rval, 0, 0)
318  select case (line(istart:istop))
319  case ('FILEOUT')
320  call urword(line, lloc, istart, istop, 0, ival, rval, 0, 0)
321  this%idataun = getunit()
322  write (iout, fmtocsave) trim(adjustl(this%cname)), this%idataun, &
323  line(istart:istop)
324  call openfile(this%idataun, iout, line(istart:istop), 'DATA(BINARY)', &
325  form, access, 'REPLACE', mnormal)
326  case ('PRINT_FORMAT')
327  call urword(line, lloc, istart, istop, 1, ival, rval, 0, 0)
328  call print_format(line(istart:), this%cdatafmp, this%editdesc, &
329  this%nvaluesp, this%nwidthp, inunit)
330  case default
331  call store_error('Looking for FILEOUT or PRINT_FORMAT. Found:')
332  call store_error(trim(adjustl(line)))
333  call store_error_unit(inunit)
334  end select
335  !
336  ! -- return
337  return
@ mnormal
normal output mode
Definition: Constants.f90:205
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: