Skip to content

Commit

Permalink
perf(GwfModule): improvements to ptc (#53)
Browse files Browse the repository at this point in the history
Small improvements to ptc to reduce the ptcdel value loaded on the
diagonal.
  • Loading branch information
jdhughes-usgs authored Oct 30, 2018
1 parent 7d103aa commit df05c2e
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 54 deletions.
9 changes: 3 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ from the main (upstream) repository:
## <a name="rules"></a> Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
* All features or bug fixes **must be tested** by one or more specs (unit-tests and/or integration/regression-tests).
## <a name="commit"></a> Commit Message Guidelines
Expand Down Expand Up @@ -175,7 +175,7 @@ If the commit reverts a previous commit, it should begin with `revert: `, follow
### Type
Must be one of the following:
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis)
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
Expand All @@ -185,13 +185,10 @@ Must be one of the following:
* **test**: Adding missing tests or correcting existing tests
### Scope
The scope should be the name of the MODFLOW 6 module/class affected (as perceived by the person reading the changelog generated from commit messages.
The scope should be the name of the MODFLOW 6 module/class affected (as perceived by the person reading the changelog generated from commit messages).
There are currently a few exceptions to the "use module/class name" rule:
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g.
public path changes, package.json changes done to all packages, d.ts file/format changes, changes
to bundles, etc.
* **releasenotes**: used for updating the release notes
* **readme**: used for updating the release notes in README.md
* **changelog**: used for updating the release notes in CHANGELOG.md
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

## Automated Testing Status on Travis-CI

### Version 6.0.3 develop &mdash; build 25
[![Build Status](https://travis-ci.org/MODFLOW-USGS/modflow6.svg?branch=develop)](https://travis-ci.org/MODFLOW-USGS/modflow6)
### Version 6.0.3 feat-ptcdist &mdash; build 30
[![Build Status](https://travis-ci.org/MODFLOW-USGS/modflow6.svg?branch=feat-ptcdist)](https://travis-ci.org/MODFLOW-USGS/modflow6)

## Introduction

Expand All @@ -31,7 +31,7 @@ MODFLOW 6 is the latest core version of MODFLOW. It synthesizes many of the capa

#### ***Software/Code citation for MODFLOW 6:***

[Langevin, C.D., Hughes, J.D., Banta, E.R., Provost, A.M., Niswonger, R.G., and Panday, Sorab, 2018, MODFLOW 6 Modular Hydrologic Model version 6.0.3 &mdash; develop: U.S. Geological Survey Software Release, 14 October 2018, https://doi.org/10.5066/F76Q1VQV](https://doi.org/10.5066/F76Q1VQV)
[Langevin, C.D., Hughes, J.D., Banta, E.R., Provost, A.M., Niswonger, R.G., and Panday, Sorab, 2018, MODFLOW 6 Modular Hydrologic Model version 6.0.3 &mdash; feat-ptcdist: U.S. Geological Survey Software Release, 29 October 2018, https://doi.org/10.5066/F76Q1VQV](https://doi.org/10.5066/F76Q1VQV)


## Instructions for building definition files for new packages
Expand Down
40 changes: 20 additions & 20 deletions code.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
[
{
"status": "Release Candidate",
"status": "Release Candidate",
"languages": [
"Fortran2008"
],
"repositoryURL": "https://code.usgs.gov/usgs/modflow/modflow6.git",
"disclaimerURL": "https://code.usgs.gov/usgs/modflow/modflow6/blob/master/DISCLAIMER.md",
],
"repositoryURL": "https://code.usgs.gov/usgs/modflow/modflow6.git",
"disclaimerURL": "https://code.usgs.gov/usgs/modflow/modflow6/blob/master/DISCLAIMER.md",
"tags": [
"MODFLOW",
"MODFLOW",
"groundwater model"
],
"vcs": "git",
"name": "modflow6",
"downloadURL": "https://code.usgs.gov/usgs/modflow/modflow6/archive/master.zip",
],
"vcs": "git",
"name": "modflow6",
"downloadURL": "https://code.usgs.gov/usgs/modflow/modflow6/archive/master.zip",
"contact": {
"name": "Christian D. Langevin",
"name": "Christian D. Langevin",
"email": "langevin@usgs.gov"
},
"laborHours": -1,
"version": "6.0.3.25",
},
"laborHours": -1,
"version": "6.0.3.30",
"date": {
"metadataLastUpdated": "2018-10-14"
},
"organization": "U.S. Geological Survey",
"metadataLastUpdated": "2018-10-29"
},
"organization": "U.S. Geological Survey",
"permissions": {
"licenses": [
{
"URL": "https://code.usgs.gov/usgs/modflow/modflow6/blob/master/LICENSE.md",
"URL": "https://code.usgs.gov/usgs/modflow/modflow6/blob/master/LICENSE.md",
"name": "Public Domain, CC0-1.0"
}
],
],
"usageType": "openSource"
},
"homepageURL": "https://code.usgs.gov/usgs/modflow/modflow6/",
},
"homepageURL": "https://code.usgs.gov/usgs/modflow/modflow6/",
"description": "MODFLOW is the USGS's modular hydrologic model. MODFLOW is considered an international standard for simulating and predicting groundwater conditions and groundwater/surface-water interactions."
}
]
4 changes: 2 additions & 2 deletions doc/version.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
\newcommand{\modflowversion}{mf6.0.3.25}
\newcommand{\modflowdate}{October 14, 2018}
\newcommand{\modflowversion}{mf6.0.3.30}
\newcommand{\modflowdate}{October 29, 2018}
\newcommand{\currentmodflowversion}{Version \modflowversion---\modflowdate}
49 changes: 33 additions & 16 deletions src/Model/GroundWaterFlow/gwf3.f90
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ end subroutine gwf_cc

subroutine gwf_ptcchk(this, iptc)
! ******************************************************************************
! gwf_ptc -- check if pseudo-transient continuation factor should be used
! gwf_ptcchk -- check if pseudo-transient continuation factor should be used
! Subroutine: (1) Check if pseudo-transient continuation factor should be used
! ******************************************************************************
!
Expand Down Expand Up @@ -743,7 +743,8 @@ subroutine gwf_ptc(this, kiter, neqsln, njasln, ia, ja, &
integer(I4B) :: jcol
integer(I4B) :: j, jj
real(DP) :: v
real(DP) :: q
real(DP) :: resid
real(DP) :: ptcdelem1
real(DP) :: diag
real(DP) :: diagcnt
real(DP) :: diagmin
Expand All @@ -770,19 +771,28 @@ subroutine gwf_ptc(this, kiter, neqsln, njasln, ia, ja, &
do n = 1, this%dis%nodes
if (this%npf%ibound(n) < 1) cycle
jcol = n + this%moffset
v = this%dis%get_cell_volume(n, x(jcol))
if (v > DZERO) then
q = DZERO
do j = ia(jcol), ia(jcol+1)-1
jj = ja(j)
q = q + amatsln(j) * x(jcol)
end do
q = q - rhs(jcol)
else
cycle
end if
q = q / v
if (abs(q) > ptcf) ptcf = abs(q)
!
! get the maximum volume of the cell (head at top of cell)
v = this%dis%get_cell_volume(n, this%dis%top(n))
!
! -- calculate the residual for the cell
resid = DZERO
do j = ia(jcol), ia(jcol+1)-1
jj = ja(j)
resid = resid + amatsln(j) * x(jcol)
end do
resid = resid - rhs(jcol)
!
! -- calculate the reciprocal of the pseudo-time step
! resid [L3/T] / volume [L3] = [1/T]
ptcdelem1 = abs(resid) / v
!
! -- set ptcf if the reciprocal of the pseudo-time step
! exceeds the current value (equivalent to using the
! smallest pseudo-time step)
if (ptcdelem1 > ptcf) ptcf = ptcdelem1
!
! -- determine minimum and maximum diagonal entries
j = ia(jcol)
diag = abs(amatsln(j))
diagcnt = diagcnt + DONE
Expand All @@ -791,9 +801,16 @@ subroutine gwf_ptc(this, kiter, neqsln, njasln, ia, ja, &
if (diag > diagmax) diagmax = diag
end if
end do
!
! -- set the reciprocal of the pseudo-time step
! to a fraction of the minimum or maximum
! diagonal entry to prevent excessively small
! or large values
if (diagcnt > DZERO) then
diagmin = diagmin * DEM1
diagmax = diagmax * DEM1
if (ptcf < diagmin) ptcf = diagmin
if (ptcf > diagmax) ptcf = diagmin
if (ptcf > diagmax) ptcf = diagmax
end if
end if

Expand Down
8 changes: 5 additions & 3 deletions src/Solution/NumericalSolution.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@ subroutine sln_ls(this, kiter, kstp, kper, in_iter, itersum, iptc, ptcf)
this%ptcdel = this%ptcdel0
else
if (this%iptcopt == 0) then
this%ptcdel = done / ptcf
!
! -- ptcf is the reciprocal of the pseudo-time step
this%ptcdel = DONE / ptcf
else
bnorm = DZERO
do n = 1, this%neq
Expand All @@ -1944,9 +1946,9 @@ subroutine sln_ls(this, kiter, kstp, kper, in_iter, itersum, iptc, ptcf)
end if
end if
if (this%ptcdel > DZERO) then
ptcval = done / this%ptcdel
ptcval = DONE / this%ptcdel
else
ptcval = done
ptcval = DONE
end if
diagmin = DEP20
bnorm = DZERO
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/version.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module VersionModule
public
! -- modflow 6 version
integer(I4B), parameter :: IDEVELOPMODE = 1
character(len=40), parameter :: VERSION = '6.0.3.25 10/14/2018'
character(len=40), parameter :: VERSION = '6.0.3.30 10/29/2018'
character(len=10), parameter :: MFVNAM = ' 6'
character(len=*), parameter :: MFTITLE = &
'U.S. GEOLOGICAL SURVEY MODULAR HYDROLOGIC MODEL'
Expand Down
6 changes: 3 additions & 3 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# MODFLOW 6 version file automatically created using...pre-commit.py
# created on...October 14, 2018 14:53:51
# created on...October 29, 2018 17:42:30

# add some comments on how this version file
# should be manually updated and used

major = 6
minor = 0
micro = 3
build = 25
commit = 126
build = 30
commit = 131

0 comments on commit df05c2e

Please sign in to comment.