Skip to content

Commit

Permalink
fix(gwe-est): add error checks for user-specified values of 0.0 (#1982)
Browse files Browse the repository at this point in the history
* fix(gwe-est): add error checks for user-specified values of 0.0

* Clean up error messages

* lower-casing some other error messages
  • Loading branch information
emorway-usgs authored Aug 8, 2024
1 parent b4deb96 commit 97757fa
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 23 deletions.
1 change: 1 addition & 0 deletions doc/ReleaseNotes/develop.tex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
\item When using SFT in a model where some of the stream reaches are not connected to an active GWF cell (the cellid parameter is set equal to either 0 or NONE) memory access violations were occurring. The program was fixed by setting the correct number of reaches connected to GWF cells. The program was tested using a new example with a DISU grid type and multiple GWF cells deactivated (idomain equals 0) that host SFR reaches.
\item Support for temperature observations was missing in the Observation (OBS) utility for a GWE model and has been added.
\item UZF was not writing a message to the GWF listing file when it had finished reading the PACKAGEDATA block. An appropriate message is now written to the GWF listing file.
\item Error checking was added to the EST package to ensure that the inputs HEAT\_CAPACITY\_WATER and DENSITY\_WATER are not 0.0. Values of 0.0 for either parameter result in a divide by zero error.

% \item xxx
\end{itemize}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterEnergy/gwe-cnd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ subroutine source_griddata(this)
if (this%idisp > 0) then
if (.not. (found%alh .and. found%ath1)) then
write (errmsg, '(1x,a)') &
'if dispersivities are specified then ALH and ATH1 are required.'
'If dispersivities are specified then ALH and ATH1 are required.'
call store_error(errmsg)
end if
! -- If alv not specified then point it to alh
Expand Down
50 changes: 32 additions & 18 deletions src/Model/GroundWaterEnergy/gwe-est.f90
Original file line number Diff line number Diff line change
Expand Up @@ -680,21 +680,35 @@ subroutine read_options(this)
write (this%iout, fmtidcy2)
case ('HEAT_CAPACITY_WATER')
this%cpw = this%parser%GetDouble()
write (this%iout, '(4x,a,1pg15.6)') &
'Heat capacity of the water has been set to: ', &
this%cpw
if (this%cpw <= 0.0) then
write (errmsg, '(a)') 'Specified value for the heat capacity of &
&water must be greater than 0.0.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
else
write (this%iout, '(4x,a,1pg15.6)') &
'Heat capacity of the water has been set to: ', &
this%cpw
end if
case ('DENSITY_WATER')
this%rhow = this%parser%GetDouble()
write (this%iout, '(4x,a,1pg15.6)') &
'Density of the water has been set to: ', &
this%rhow
if (this%rhow <= 0.0) then
write (errmsg, '(a)') 'Specified value for the density of &
&water must be greater than 0.0.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
else
write (this%iout, '(4x,a,1pg15.6)') &
'Density of the water has been set to: ', &
this%rhow
end if
case ('LATENT_HEAT_VAPORIZATION')
this%latheatvap = this%parser%GetDouble()
write (this%iout, '(4x,a,1pg15.6)') &
'Latent heat of vaporization of the water has been set to: ', &
this%latheatvap
case default
write (errmsg, '(a,a)') 'UNKNOWN EST OPTION: ', trim(keyword)
write (errmsg, '(a,a)') 'Unknown EST option: ', trim(keyword)
call store_error(errmsg)
call this%parser%StoreErrorUnit()
end select
Expand Down Expand Up @@ -769,45 +783,45 @@ subroutine read_data(this)
aname(4))
lname(4) = .true.
case default
write (errmsg, '(a,a)') 'UNKNOWN GRIDDATA TAG: ', trim(keyword)
write (errmsg, '(a,a)') 'Unknown griddata tag: ', trim(keyword)
call store_error(errmsg)
call this%parser%StoreErrorUnit()
end select
end do
write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA'
else
write (errmsg, '(a)') 'REQUIRED GRIDDATA BLOCK NOT FOUND.'
write (errmsg, '(a)') 'Required griddata block not found.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
end if
!
! -- Check for required porosity
if (.not. lname(1)) then
write (errmsg, '(a)') 'POROSITY NOT SPECIFIED IN GRIDDATA BLOCK.'
write (errmsg, '(a)') 'Porosity not specified in griddata block.'
call store_error(errmsg)
end if
if (.not. lname(3)) then
write (errmsg, '(a)') 'CPS NOT SPECIFIED IN GRIDDATA BLOCK.'
write (errmsg, '(a)') 'CPS not specified in griddata block.'
call store_error(errmsg)
end if
if (.not. lname(4)) then
write (errmsg, '(a)') 'RHOS NOT SPECIFIED IN GRIDDATA BLOCK.'
write (errmsg, '(a)') 'RHOS not specified in griddata block.'
call store_error(errmsg)
end if
!
! -- Check for required decay/production rate coefficients
if (this%idcy > 0) then
if (.not. lname(2)) then
write (errmsg, '(a)') 'FIRST OR ZERO ORDER DECAY IS &
&ACTIVE BUT THE FIRST RATE COEFFICIENT IS NOT SPECIFIED. DECAY &
&MUST BE SPECIFIED IN GRIDDATA BLOCK.'
write (errmsg, '(a)') 'First or zero order decay is &
&active but the first rate coefficient is not specified. Decay &
&must be specified in griddata block.'
call store_error(errmsg)
end if
else
if (lname(2)) then
write (warnmsg, '(a)') 'FIRST OR ZERO ORER DECAY &
&IS NOT ACTIVE BUT DECAY WAS SPECIFIED. DECAY WILL &
&HAVE NO AFFECT ON SIMULATION RESULTS.'
write (warnmsg, '(a)') 'First or zero orer decay &
&is not active but decay was specified. Decay will &
&have no affect on simulation results.'
call store_warning(warnmsg)
write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
end if
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterEnergy/gwe-lke.f90
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ subroutine find_lke_package(this)
!
! -- Error if flow package not found
if (.not. found) then
write (errmsg, '(a)') 'COULD NOT FIND FLOW PACKAGE WITH NAME '&
write (errmsg, '(a)') 'Could not find flow package with name '&
&//trim(adjustl(this%flowpackagename))//'.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterEnergy/gwe-mwe.f90
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ subroutine find_mwe_package(this)
!
! -- Error if flow package not found
if (.not. found) then
write (errmsg, '(a)') 'COULD NOT FIND FLOW PACKAGE WITH NAME '&
write (errmsg, '(a)') 'Could not find flow package with name '&
&//trim(adjustl(this%flowpackagename))//'.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterEnergy/gwe-sfe.f90
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ subroutine find_sfe_package(this)
!
! -- Error if flow package not found
if (.not. found) then
write (errmsg, '(a)') 'COULD NOT FIND FLOW PACKAGE WITH NAME '&
write (errmsg, '(a)') 'Could not find flow package with name '&
&//trim(adjustl(this%flowpackagename))//'.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
Expand Down
2 changes: 1 addition & 1 deletion src/Model/GroundWaterEnergy/gwe-uze.f90
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ subroutine find_uze_package(this)
!
! -- Error if flow package not found
if (.not. found) then
write (errmsg, '(a)') 'COULD NOT FIND FLOW PACKAGE WITH NAME '&
write (errmsg, '(a)') 'Could not find flow package with name '&
&//trim(adjustl(this%flowpackagename))//'.'
call store_error(errmsg)
call this%parser%StoreErrorUnit()
Expand Down

0 comments on commit 97757fa

Please sign in to comment.