From 1d07fe22dc75fb2330a786b100fd05912ee03506 Mon Sep 17 00:00:00 2001 From: "Langevin, Christian D" Date: Wed, 11 May 2022 07:52:01 -0500 Subject: [PATCH 1/3] fix(evt): add check to ensure pxdp is specified correctly * implementation assumes user specifies pxdp in order from low to high and that values are between zero and 1.0. * Addresses #938 and #930 --- doc/mf6io/mf6ivar/dfn/gwf-evt.dfn | 6 +- doc/mf6io/mf6ivar/md/mf6ivar.md | 7 +-- doc/mf6io/mf6ivar/tex/gwf-evt-desc.tex | 6 +- doc/mf6io/mf6ivar/tex/gwf-maw-desc.tex | 2 - src/Model/GroundWaterFlow/gwf3evt8.f90 | 80 +++++++++++++++++++++++++- 5 files changed, 86 insertions(+), 15 deletions(-) diff --git a/doc/mf6io/mf6ivar/dfn/gwf-evt.dfn b/doc/mf6io/mf6ivar/dfn/gwf-evt.dfn index 874114955c1..b66f62301c8 100644 --- a/doc/mf6io/mf6ivar/dfn/gwf-evt.dfn +++ b/doc/mf6io/mf6ivar/dfn/gwf-evt.dfn @@ -160,7 +160,7 @@ type integer reader urword optional false longname number of ET segments -description number of ET segments. Default is one. When NSEG is greater than 1, PXDP and PETM arrays must be specified NSEG - 1 times each, in order from the uppermost segment down. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. +description number of ET segments. Default is one. When NSEG is greater than 1, the PXDP and PETM arrays must be of size NSEG - 1 and be listed in order from the uppermost segment down. Values for PXDP must be listed first followed by the values for PETM. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. # --------------------- gwf evt period --------------------- @@ -237,7 +237,7 @@ in_record true reader urword time_series true longname proportion of ET extinction depth -description is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. +description is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). pxdp is an array of size (nseg - 1). Values in pxdp must be greater than 0.0 and less than 1.0. pxdp values for a cell must increase monotonically. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. block period name petm @@ -248,7 +248,7 @@ in_record true reader urword time_series true longname proportion of maximum ET rate -description is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. +description is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). petm is an array of size (nseg - 1). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. block period name petm0 diff --git a/doc/mf6io/mf6ivar/md/mf6ivar.md b/doc/mf6io/mf6ivar/md/mf6ivar.md index 2e41b162700..0efa3140384 100644 --- a/doc/mf6io/mf6ivar/md/mf6ivar.md +++ b/doc/mf6io/mf6ivar/md/mf6ivar.md @@ -449,14 +449,14 @@ | GWF | EVT | OPTIONS | OBS6_FILENAME | STRING | name of input file to define observations for the Evapotranspiration package. See the ``Observation utility'' section for instructions for preparing observation input files. Tables \ref{table:gwf-obstypetable} and \ref{table:gwt-obstypetable} lists observation type(s) supported by the Evapotranspiration package. | | GWF | EVT | OPTIONS | SURF_RATE_SPECIFIED | KEYWORD | indicates that the proportion of the evapotranspiration rate at the ET surface will be specified as PETM0 in list input. | | GWF | EVT | DIMENSIONS | MAXBOUND | INTEGER | integer value specifying the maximum number of evapotranspiration cells cells that will be specified for use during any stress period. | -| GWF | EVT | DIMENSIONS | NSEG | INTEGER | number of ET segments. Default is one. When NSEG is greater than 1, PXDP and PETM arrays must be specified NSEG - 1 times each, in order from the uppermost segment down. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. | +| GWF | EVT | DIMENSIONS | NSEG | INTEGER | number of ET segments. Default is one. When NSEG is greater than 1, the PXDP and PETM arrays must be of size NSEG - 1 and be listed in order from the uppermost segment down. Values for PXDP must be listed first followed by the values for PETM. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. | | GWF | EVT | PERIOD | IPER | INTEGER | integer value specifying the starting stress period number for which the data specified in the PERIOD block apply. IPER must be less than or equal to NPER in the TDIS Package and greater than zero. The IPER value assigned to a stress period block must be greater than the IPER value assigned for the previous PERIOD block. The information specified in the PERIOD block will continue to apply for all subsequent stress periods, unless the program encounters another PERIOD block. | | GWF | EVT | PERIOD | CELLID | INTEGER (NCELLDIM) | is the cell identifier, and depends on the type of grid that is used for the simulation. For a structured grid that uses the DIS input file, CELLID is the layer, row, and column. For a grid that uses the DISV input file, CELLID is the layer and CELL2D number. If the model uses the unstructured discretization (DISU) input file, CELLID is the node number for the cell. | | GWF | EVT | PERIOD | SURFACE | DOUBLE PRECISION | is the elevation of the ET surface ($L$). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | | GWF | EVT | PERIOD | RATE | DOUBLE PRECISION | is the maximum ET flux rate ($LT^{-1}$). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | | GWF | EVT | PERIOD | DEPTH | DOUBLE PRECISION | is the ET extinction depth ($L$). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | -| GWF | EVT | PERIOD | PXDP | DOUBLE PRECISION (NSEG-1) | is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | -| GWF | EVT | PERIOD | PETM | DOUBLE PRECISION (NSEG-1) | is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | +| GWF | EVT | PERIOD | PXDP | DOUBLE PRECISION (NSEG-1) | is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). pxdp is an array of size (nseg - 1). Values in pxdp must be greater than 0.0 and less than 1.0. pxdp values for a cell must increase monotonically. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | +| GWF | EVT | PERIOD | PETM | DOUBLE PRECISION (NSEG-1) | is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). petm is an array of size (nseg - 1). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | | GWF | EVT | PERIOD | PETM0 | DOUBLE PRECISION | is the proportion of the maximum ET flux rate that will apply when head is at or above the ET surface (dimensionless). PETM0 is read only when the SURF\_RATE\_SPECIFIED option is used. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | | GWF | EVT | PERIOD | AUX | DOUBLE PRECISION (NAUX) | represents the values of the auxiliary variables for each evapotranspiration. The values of auxiliary variables must be present for each evapotranspiration. The values must be specified in the order of the auxiliary variables specified in the OPTIONS block. If the package supports time series and the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value. | | GWF | EVT | PERIOD | BOUNDNAME | STRING | name of the evapotranspiration cell. BOUNDNAME is an ASCII character variable that can contain as many as 40 characters. If BOUNDNAME contains spaces in it, then the entire name must be enclosed within single quotes. | @@ -497,7 +497,6 @@ | GWF | MAW | OPTIONS | SHUTDOWN_THETA | DOUBLE PRECISION | value that defines the weight applied to discharge rate for wells that limit the water level in a discharging well (defined using the HEAD\_LIMIT keyword in the stress period data). SHUTDOWN\_THETA is used to control discharge rate oscillations when the flow rate from the aquifer is less than the specified flow rate from the aquifer to the well. Values range between 0.0 and 1.0, and larger values increase the weight (decrease under-relaxation) applied to the well discharge rate. The HEAD\_LIMIT option has been included to facilitate backward compatibility with previous versions of MODFLOW but use of the RATE\_SCALING option instead of the HEAD\_LIMIT option is recommended. By default, SHUTDOWN\_THETA is 0.7. | | GWF | MAW | OPTIONS | SHUTDOWN_KAPPA | DOUBLE PRECISION | value that defines the weight applied to discharge rate for wells that limit the water level in a discharging well (defined using the HEAD\_LIMIT keyword in the stress period data). SHUTDOWN\_KAPPA is used to control discharge rate oscillations when the flow rate from the aquifer is less than the specified flow rate from the aquifer to the well. Values range between 0.0 and 1.0, and larger values increase the weight applied to the well discharge rate. The HEAD\_LIMIT option has been included to facilitate backward compatibility with previous versions of MODFLOW but use of the RATE\_SCALING option instead of the HEAD\_LIMIT option is recommended. By default, SHUTDOWN\_KAPPA is 0.0001. | | GWF | MAW | OPTIONS | MAW_FLOW_REDUCE_CSV | KEYWORD | keyword to specify that record corresponds to the output option in which a new record is written for each multi-aquifer well and for each time step in which the user-requested extraction or injection rate is reduced by the program. | -| GWF | MAW | OPTIONS | FILEOUT | KEYWORD | keyword to specify that an output filename is expected next. | | GWF | MAW | OPTIONS | MFRCSVFILE | STRING | name of the comma-separated value (CSV) output file to write information about multi-aquifer well extraction or injection rates that have been reduced by the program. Entries are only written if the extraction or injection rates are reduced. | | GWF | MAW | OPTIONS | TS6 | KEYWORD | keyword to specify that record corresponds to a time-series file. | | GWF | MAW | OPTIONS | FILEIN | KEYWORD | keyword to specify that an input filename is expected next. | diff --git a/doc/mf6io/mf6ivar/tex/gwf-evt-desc.tex b/doc/mf6io/mf6ivar/tex/gwf-evt-desc.tex index 04810c568df..036cc53ff2b 100644 --- a/doc/mf6io/mf6ivar/tex/gwf-evt-desc.tex +++ b/doc/mf6io/mf6ivar/tex/gwf-evt-desc.tex @@ -35,7 +35,7 @@ \begin{description} \item \texttt{maxbound}---integer value specifying the maximum number of evapotranspiration cells cells that will be specified for use during any stress period. -\item \texttt{nseg}---number of ET segments. Default is one. When NSEG is greater than 1, PXDP and PETM arrays must be specified NSEG - 1 times each, in order from the uppermost segment down. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. +\item \texttt{nseg}---number of ET segments. Default is one. When NSEG is greater than 1, the PXDP and PETM arrays must be of size NSEG - 1 and be listed in order from the uppermost segment down. Values for PXDP must be listed first followed by the values for PETM. PXDP defines the extinction-depth proportion at the bottom of a segment. PETM defines the proportion of the maximum ET flux rate at the bottom of a segment. \end{description} \item \textbf{Block: PERIOD} @@ -51,9 +51,9 @@ \item \textcolor{blue}{\texttt{depth}---is the ET extinction depth ($L$). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} -\item \textcolor{blue}{\texttt{pxdp}---is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} +\item \textcolor{blue}{\texttt{pxdp}---is the proportion of the ET extinction depth at the bottom of a segment (dimensionless). pxdp is an array of size (nseg - 1). Values in pxdp must be greater than 0.0 and less than 1.0. pxdp values for a cell must increase monotonically. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} -\item \textcolor{blue}{\texttt{petm}---is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} +\item \textcolor{blue}{\texttt{petm}---is the proportion of the maximum ET flux rate at the bottom of a segment (dimensionless). petm is an array of size (nseg - 1). If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} \item \textcolor{blue}{\texttt{petm0}---is the proportion of the maximum ET flux rate that will apply when head is at or above the ET surface (dimensionless). PETM0 is read only when the SURF\_RATE\_SPECIFIED option is used. If the Options block includes a TIMESERIESFILE entry (see the ``Time-Variable Input'' section), values can be obtained from a time series by entering the time-series name in place of a numeric value.} diff --git a/doc/mf6io/mf6ivar/tex/gwf-maw-desc.tex b/doc/mf6io/mf6ivar/tex/gwf-maw-desc.tex index 325af30df0a..abb1023e655 100644 --- a/doc/mf6io/mf6ivar/tex/gwf-maw-desc.tex +++ b/doc/mf6io/mf6ivar/tex/gwf-maw-desc.tex @@ -41,8 +41,6 @@ \item \texttt{MAW\_FLOW\_REDUCE\_CSV}---keyword to specify that record corresponds to the output option in which a new record is written for each multi-aquifer well and for each time step in which the user-requested extraction or injection rate is reduced by the program. -\item \texttt{FILEOUT}---keyword to specify that an output filename is expected next. - \item \texttt{mfrcsvfile}---name of the comma-separated value (CSV) output file to write information about multi-aquifer well extraction or injection rates that have been reduced by the program. Entries are only written if the extraction or injection rates are reduced. \item \texttt{TS6}---keyword to specify that record corresponds to a time-series file. diff --git a/src/Model/GroundWaterFlow/gwf3evt8.f90 b/src/Model/GroundWaterFlow/gwf3evt8.f90 index 08c243fb644..f77838db432 100644 --- a/src/Model/GroundWaterFlow/gwf3evt8.f90 +++ b/src/Model/GroundWaterFlow/gwf3evt8.f90 @@ -4,7 +4,8 @@ module EvtModule use ConstantsModule, only: DZERO, DONE, LENFTYPE, LENPACKAGENAME, MAXCHARLEN use MemoryHelperModule, only: create_mem_path use BndModule, only: BndType - use SimModule, only: store_error, store_error_unit + use SimModule, only: store_error, store_error_unit, count_errors + use SimVariablesModule, only: errmsg use ObsModule, only: DefaultObsIdProcessor use TimeArraySeriesLinkModule, only: TimeArraySeriesLinkType use TimeSeriesLinkModule, only: TimeSeriesLinkType, & @@ -45,6 +46,7 @@ module EvtModule procedure, private :: evt_rp_array procedure, private :: evt_rp_list procedure, private :: default_nodelist + procedure, private :: check_pxdp ! -- for observations procedure, public :: bnd_obs_supported => evt_obs_supported procedure, public :: bnd_df_obs => evt_df_obs @@ -234,7 +236,7 @@ subroutine evt_read_dimensions(this) ! -- dummy class(EvtType),intent(inout) :: this ! -- local - character(len=LINELENGTH) :: errmsg, keyword + character(len=LINELENGTH) :: keyword integer(I4B) :: ierr logical :: isfound, endOfBlock ! -- format @@ -363,7 +365,7 @@ subroutine evt_rp(this) integer(I4B) :: inievt, inrate, insurf, indepth integer(I4B) :: kpxdp, kpetm logical :: isfound, supportopenclose - character(len=LINELENGTH) :: line, msg, errmsg + character(len=LINELENGTH) :: line, msg ! -- formats character(len=*),parameter :: fmtblkerr = & "('Error. Looking for BEGIN PERIOD iper. Found ', a, ' instead.')" @@ -462,11 +464,83 @@ subroutine evt_rp(this) this%bound(2, n) = this%bound(2, n) * this%dis%get_area(node) end if enddo + ! + ! -- ensure pxdp is monotonically increasing + if (this%nseg > 1) then + call this%check_pxdp() + end if endif ! ! -- return return end subroutine evt_rp + + !> @brief Subroutine to check pxdp + !! + !! If the number of EVT segments (nseg) is greater than one, then + !! pxdp must be monotically increasing from zero to one. Check + !! to make sure this is the case. + !! + !< + subroutine check_pxdp(this) + ! -- dummy + class(EvtType),intent(inout) :: this !< EvtType + ! -- local + integer(I4B) :: n + integer(I4B) :: node + integer(I4B) :: i + integer(I4B) :: ierrmono + real(DP) :: pxdp1 + real(DP) :: pxdp2 + character(len=15) :: nodestr + ! -- formats + character(len=*), parameter :: fmtpxdp0 = & + "('PXDP must be between 0 and 1. Found ', G0, ' for cell ', A)" + character(len=*), parameter :: fmtpxdp = & + "('PXDP is not monotonically increasing for cell ', A)" + ! + ! -- check and make sure that pxdp is monotonically increasing and + ! that pxdp values are between 0 and 1 + do n = 1, this%nbound + node = this%nodelist(n) + pxdp1 = DZERO + ierrmono = 0 + segloop: do i = 1, this%nseg + ! + ! -- set and check pxdp2 + if (i < this%nseg) then + pxdp2 = this%bound(i + 3, n) + if (pxdp2 <= DZERO .or. pxdp2 >= DONE) then + call this%dis%noder_to_string(node, nodestr) + write(errmsg, fmtpxdp0) pxdp2, trim(nodestr) + call store_error(errmsg) + end if + else + pxdp2 = DONE + end if + ! + ! -- check for monotonically increasing condition + if (pxdp2 - pxdp1 < DZERO) then + if (ierrmono == 0) then + ! -- only store mono error once for each node + call this%dis%noder_to_string(node, nodestr) + write(errmsg, fmtpxdp) trim(nodestr) + call store_error(errmsg) + end if + ierrmono = 1 + end if + pxdp1 = pxdp2 + end do segloop + end do + ! + ! -- terminate if errors encountered + if (count_errors() > 0) then + call this%parser%StoreErrorUnit() + end if + ! + ! -- return + return + end subroutine check_pxdp subroutine set_nodesontop(this) ! ****************************************************************************** From d399ee64e8d13f3dab10bb09571e14e8e071b873 Mon Sep 17 00:00:00 2001 From: "Langevin, Christian D" Date: Wed, 11 May 2022 08:58:56 -0500 Subject: [PATCH 2/3] fix duplication of final error message upon termination --- src/Utilities/Sim.f90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Utilities/Sim.f90 b/src/Utilities/Sim.f90 index 7a344ec2983..7ee1ec9458a 100644 --- a/src/Utilities/Sim.f90 +++ b/src/Utilities/Sim.f90 @@ -417,11 +417,6 @@ subroutine print_final_message(stopmess, ioutlocal) ! -- determine if an error condition has occurred if (sim_errors%count_message() > 0) then ireturnerr = 2 - if (iout > 0) then - call sim_message(stopmess, fmt=fmt, iunit=iout) - end if - call sim_message(stopmess, fmt=fmt) - if (present(ioutlocal)) then if (ioutlocal > 0 .and. ioutlocal /= iout) write(ioutlocal,fmt) msg endif From 5b161bbc8d502014e8b7a1ab5c4edd5d8db775c3 Mon Sep 17 00:00:00 2001 From: "Langevin, Christian D" Date: Wed, 11 May 2022 09:25:02 -0500 Subject: [PATCH 3/3] update release notes --- doc/ReleaseNotes/ReleaseNotes.tex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/ReleaseNotes/ReleaseNotes.tex b/doc/ReleaseNotes/ReleaseNotes.tex index a053ef43330..389de6f2b07 100644 --- a/doc/ReleaseNotes/ReleaseNotes.tex +++ b/doc/ReleaseNotes/ReleaseNotes.tex @@ -208,7 +208,7 @@ \section{Changes Introduced in this Release} \underline{BASIC FUNCTIONALITY} \begin{itemize} \item Corrected programming error in XT3D functionality that could occur when running coupled flow models or transport models. The XT3D code would result in a memory access error when a child model with a much larger level of refinement was coupled to a coarser parent model. The XT3D code was generalized to handle this situation. - % \item xxx + \item Corrected a programming error in which the final message would be written twice to the screen and twice to mfsim.lst when the simulation terminated prematurely. % \item xxx \end{itemize} @@ -219,12 +219,12 @@ \section{Changes Introduced in this Release} % \item xxx %\end{itemize} - %\underline{STRESS PACKAGES} - %\begin{itemize} - % \item xxx + \underline{STRESS PACKAGES} + \begin{itemize} + \item The Evapotranspiration (EVT) Package was modified to include a new error check if the segmented evapotranspiration capability is active. If the number of ET segments is greater than 1, then the user must specify values for PXDP (as well as PETM). For a cell, PXDP is a one-dimensional array of size NSEG - 1. Values in this array must be greater than zero and less than one. Furthermore, the values in PXDP must increase monotonically. The program now checks for these conditions and terminates with an error if these conditions are not met. The segmented ET capability can used be used for list-based EVT Package input. Provided that the PXDP conditions are met, this new error check should have no effect on simulation results. % \item xxx % \item xxx - %\end{itemize} + \end{itemize} %\underline{ADVANCED STRESS PACKAGES} %\begin{itemize}