Skip to content

Commit

Permalink
release(1.2.8): update mf6 version
Browse files Browse the repository at this point in the history
Also added latest version of gsflow (v 2.3.0) and mfusg_gsi (v2.1.1).
  • Loading branch information
jdhughes-usgs committed Jun 30, 2023
1 parent 897c4da commit 5e3c840
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 39 deletions.
51 changes: 29 additions & 22 deletions autotest/test_mfusg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
for idx, namefile in enumerate(name_files):
name_files[idx] = os.path.join(expth, namefile)

run_parameters = []
for ep in (epth, epth_gsi):
for nf in name_files:
run_parameters.append((ep, nf))

pm = pymake.Pymake(verbose=True)
pm.target = target
pm.appdir = dstpth
Expand All @@ -50,6 +55,11 @@
pm_gsi.target = target_gsi
pm_gsi.appdir = dstpth

usg_versions = (
(0, pm),
(1, pm_gsi),
)


def edit_namefile(namefile):
# read existing namefile
Expand Down Expand Up @@ -106,32 +116,29 @@ def run_mfusg(fn, exe):


@pytest.mark.base
def test_download():
# Remove the existing mf2005 directory if it exists
if os.path.isdir(mfusgpth):
shutil.rmtree(mfusgpth)
@pytest.mark.parametrize("idx,pmobj", usg_versions)
def test_download(idx, pmobj):
# Remove the existing mfusg directory if it exists
if idx == 0:
if os.path.isdir(mfusgpth):
shutil.rmtree(mfusgpth)

# download the modflow-usg release
pm.download_target(target, download_path=dstpth)
assert pm.download, f"could not download {target}"

# download the gsi version of modflow-usg
pm_gsi.download_target(target_gsi, download_path=dstpth)
assert pm_gsi.download, f"could not download {target_gsi}"
pmobj.download_target(pmobj.target, download_path=dstpth)
assert pmobj.download, f"could not download {pmobj.target}"


@pytest.mark.base
def test_compile():
assert pm.build() == 0, f"could not compile {target}"
assert pm_gsi.build() == 0, f"could not compile {target_gsi}"
@pytest.mark.parametrize("idx,pmobj", usg_versions)
def test_compile(idx, pmobj):
assert pmobj.build() == 0, f"could not compile {pmobj.target}"
return


@pytest.mark.regression
@pytest.mark.parametrize("fn", name_files)
def test_mfusg(fn):
run_mfusg(fn, epth)
run_mfusg(fn, epth_gsi)
@pytest.mark.parametrize("usg_path,fn", run_parameters)
def test_mfusg(usg_path, fn):
run_mfusg(fn, usg_path)


@pytest.mark.base
Expand All @@ -140,13 +147,13 @@ def test_clean_up():


if __name__ == "__main__":
test_download()

test_compile()
for idx, pmobj in usg_versions:
test_download(idx, pmobj)
test_compile(idx, pmobj)

# run models
for namefile in name_files:
run_mfusg(namefile)
for usg_exe, namefile in run_parameters:
run_mfusg(usg_exe, namefile)

# clean up
test_clean_up()
20 changes: 11 additions & 9 deletions docs/build_apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ and options can be determined by executing:
$ make-program --help
usage: make-program [-h] [--release_precision]
[-fc {ifort,mpiifort,gfortran,ftn,none}]
[-cc {gcc,clang,clang++,icc,icx,icl,mpiicc,g++,cl,none}]
[-dr] [-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v] [--keep]
[--zip ZIP]
[-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}] [-dr]
[-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v] [--keep]
[--zip ZIP] [--mb]
targets

Download and build USGS MODFLOW and related programs.

positional arguments:
targets Program(s) to build. Options: crt, gridgen, gsflow,
libmf6, mf2000, mf2005, mf6, mflgr, mfnwt, mfusg, mp6,
mp7, mt3dms, mt3dusgs, prms, sutra, swtv4, triangle,
vs2dt, zbud6, zonbud3, zonbudusg, :. Specifying the
target to be ':' will build all of the programs.
libmf6, mf2000, mf2005, mf6, mflgr, mfnwt, mfusg,
mfusg_gsi, mp6, mp7, mt3dms, mt3dusgs, sutra, swtv4,
triangle, vs2dt, zbud6, zonbud3, zonbudusg, :.
Specifying the target to be ':' will build all of the
programs.

optional arguments:
-h, --help show this help message and exit
Expand All @@ -31,7 +32,7 @@ optional arguments:
usgsprograms.txt is True. default is True.
-fc {ifort,mpiifort,gfortran,ftn,none}
Fortran compiler to use. (default is gfortran)
-cc {gcc,clang,clang++,icc,icx,icl,mpiicc,g++,cl,none}
-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}
C/C++ compiler to use. (default is gcc)
-dr, --dryrun Do not actually compile. Files will be deleted, if
--makeclean is used. Does not work yet for ifort.
Expand All @@ -53,6 +54,7 @@ optional arguments:
-v, --verbose Verbose output to terminal. (default is False)
--keep Keep existing executable. (default is False)
--zip ZIP Zip built executable. (default is False)
--mb, --meson-build Use meson to build executable. (default is False)

Examples:

Expand All @@ -67,7 +69,7 @@ Examples:
```

`make-program` can be used to build MODFLOW 6, MODFLOW-2005, MODFLOW-NWT, MODFLOW-USG, MODFLOW-LGR, MODFLOW-2000,
MODPATH 6, MODPATH 7, GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, GSFLOW, PRMS, and SUTRA. Utility programs CRT, Triangle,
MODPATH 6, MODPATH 7, GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, GSFLOW, and SUTRA. Utility programs CRT, Triangle,
and GRIDGEN can also be built. `make-program` downloads the distribution file from the USGS (requires internet
connection), unzips the distribution file, sets the pymake settings required to build the program, and compiles the
source files to build the program. MT3DMS will be downloaded from the University of Alabama and Triangle will be
Expand Down
12 changes: 4 additions & 8 deletions pymake/pymake_build_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def build_apps(
meson=False,
mesondir=".",
clean=True,
mb=None,
**kwargs,
):
"""Build all current targets or a subset of targets.
Expand All @@ -61,7 +61,7 @@ def build_apps(
target path
release_precision : bool
boolean indicating if only the release precision version should be
build. If release_precision is False, then the release precision
built. If release_precision is False, then the release precision
version will be compiled along with a double precision version of
the program for programs where the standard_switch and double_switch
in usgsprograms.txt is True. default is True.
Expand All @@ -72,10 +72,6 @@ def build_apps(
Main meson.build file path
clean : bool
boolean determining of final download should be removed
mb : bool
parser variable from cli that represents the boolean indicating that
the executable should be built using the meson build system.
(default is None)
Returns
-------
Expand All @@ -91,11 +87,11 @@ def build_apps(
if targets == ":":
targets = None

mb = kwargs.pop("mb", None)
if mb is not None:
if meson:
raise ValueError(f"PROGRAM ERROR: meson={meson} and mb={mb}")
else:
meson = mb
meson = mb

# set targets
if targets is None:
Expand Down

0 comments on commit 5e3c840

Please sign in to comment.