diff --git a/autotest/test_gsflow.py b/autotest/test_gsflow.py deleted file mode 100644 index 414e59e..0000000 --- a/autotest/test_gsflow.py +++ /dev/null @@ -1,83 +0,0 @@ -import os -from pathlib import Path -from platform import system - -import flopy -import pytest - -import pymake - -# set fpth based on current path -if os.path.basename(os.path.normpath(os.getcwd())) == "autotest": - fpth = Path("temp") -else: - fpth = Path("autotest/temp") -fpth = (fpth / "gsflowexamples/gsflowexamples.txt").resolve() -if fpth.is_file(): - with open(fpth) as f: - lines = f.read().splitlines() - sim_dirs = [line for line in lines if len(line) > 0] -else: - sim_dirs = [] - - -@pytest.fixture(scope="module") -def target(module_tmpdir) -> Path: - name = "gsflow" - ext = ".exe" if system() == "Windows" else "" - return module_tmpdir / f"{name}{ext}" - - -@pytest.fixture(scope="module") -def prog_data(target) -> dict: - return pymake.usgs_program_data.get_target(target.name) - - -@pytest.fixture(scope="module") -def workspace(module_tmpdir, prog_data) -> Path: - return module_tmpdir / prog_data.dirname - - -@pytest.fixture(scope="module") -def pm(module_tmpdir, target) -> pymake.Pymake: - pm = pymake.Pymake(verbose=True) - pm.target = str(target) - pm.appdir = module_tmpdir - pm.makefile = True - pm.makeclean = True - pm.makefiledir = module_tmpdir - pm.inplace = True - pm.networkx = True - pm.verbose = True - yield pm - pm.finalize() - - -@pytest.mark.dependency(name="download") -@pytest.mark.base -def test_download(pm, module_tmpdir, target): - pm.download_target(target, download_path=module_tmpdir) - assert pm.download, f"could not download {target} distribution" - - -@pytest.mark.dependency(name="build", depends=["download"]) -@pytest.mark.base -def test_compile(pm, target): - assert pm.build() == 0, f"could not compile {target}" - - -@pytest.mark.dependency(name="test", depends=["build"]) -@pytest.mark.regression -@pytest.mark.parametrize("ws", sim_dirs) -def test_gsflow(ws, target): - success, _ = flopy.run_model( - target, - "gsflow.control", - model_ws=ws, - silent=False, - normal_msg=[ - "normal termination", - "Normal completion of GSFLOW", - ], - ) - assert success, f"could not run {ws}" diff --git a/docs/build_apps.md b/docs/build_apps.md index 820c0ce..f5c329a 100644 --- a/docs/build_apps.md +++ b/docs/build_apps.md @@ -7,23 +7,14 @@ and options can be determined by executing: ```console $ make-program --help -usage: make-program [-h] [-fc {ifort,mpiifort,gfortran,none}] - [-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}] - [-dbl] [-dr] [-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v] - [--keep] [--zip ZIP] [--meson] +usage: make-program [-h] [-fc {ifort,mpiifort,gfortran,none}] [-cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none}] [-dbl] [-dr] [-ff FFLAGS] [-cf CFLAGS] [-ad APPDIR] [-v] [--keep] [--zip ZIP] [--meson] 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, - mfusg_gsi, mp6, mp7, mt3dms, mt3dusgs, sutra, swtv4, - triangle, vs2dt, zbud6, zonbud3, zonbudusg, :. - Specifying the target to be ':' will build all of the - programs. Multiple targets can be specified by - separating individual targets by a comma (i.e., - mf6,zbud6). + targets Program(s) to build. Options: crt, gridgen, 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. Multiple targets can be specified by separating individual targets by a comma (i.e., mf6,zbud6). options: -h, --help show this help message and exit @@ -32,23 +23,15 @@ options: -cc {gcc,clang,clang++,icc,icl,mpiicc,g++,cl,none} C/C++ compiler to use. (default is gcc) -dbl, --double Force double precision. (default is False) - -dr, --dryrun Do not actually compile. Files will be deleted, if - --makeclean is used. Does not work yet for ifort. - (default is False) + -dr, --dryrun Do not actually compile. Files will be deleted, if --makeclean is used. Does not work yet for ifort. (default is False) -ff FFLAGS, --fflags FFLAGS - Additional Fortran compiler flags. Fortran compiler - flags should be enclosed in quotes and start with a - blank space or separated from the name (-ff or - --fflags) with a equal sign (-ff='-O3'). (default is - None) + Additional Fortran compiler flags. Fortran compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-ff or --fflags) with a equal sign + (-ff='-O3'). (default is None) -cf CFLAGS, --cflags CFLAGS - Additional C/C++ compiler flags. C/C++ compiler flags - should be enclosed in quotes and start with a blank - space or separated from the name (-cf or --cflags) - with a equal sign (-cf='-O3'). (default is None) + Additional C/C++ compiler flags. C/C++ compiler flags should be enclosed in quotes and start with a blank space or separated from the name (-cf or --cflags) with a equal sign + (-cf='-O3'). (default is None) -ad APPDIR, --appdir APPDIR - Target path that overides path defined target path - (default is None) + Target path that overides path defined target path (default is None) -v, --verbose Verbose output to terminal. (default is False) --keep Keep existing executable. (default is False) --zip ZIP Zip built executable. (default is None) diff --git a/docs/index.rst b/docs/index.rst index 2e520c8..9fa2d6d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,7 +17,7 @@ programs released by the USGS. pymake includes example scripts for building MODFLOW 6, MODFLOW-2005, MODFLOW-NWT, MODFLOW-USG, MODFLOW-LGR, MODFLOW-2000, MODPATH 6, MODPATH 7, -GSFLOW, VS2DT, MT3DMS, MT3D-USGS, SEAWAT, and SUTRA. Example scripts for +VS2DT, MT3DMS, MT3D-USGS, SEAWAT, and SUTRA. Example scripts for creating the utility programs CRT, Triangle, and GRIDGEN are also included. The scripts download the distribution file from the USGS (and other organizations) and compile the source into a binary executable. diff --git a/pymake/pymake.py b/pymake/pymake.py index b715a96..31d9829 100644 --- a/pymake/pymake.py +++ b/pymake/pymake.py @@ -503,8 +503,6 @@ def _set_include_subdirs(self): "libmf6", "gridgen", "mf6beta", - "gsflow", - "prms", ): self.include_subdirs = True else: diff --git a/pymake/pymake_build_apps.py b/pymake/pymake_build_apps.py index 95e48ee..2feb231 100644 --- a/pymake/pymake_build_apps.py +++ b/pymake/pymake_build_apps.py @@ -205,11 +205,6 @@ def build_apps( download_verify = True timeout = 30 - # reset meson - if target in ("prms",): - pmobj.meson = True - pmobj.inplace = True - # set target and srcdir pmobj.target = target.replace("dev", "") pmobj.srcdir = os.path.join( diff --git a/pymake/utils/_compiler_switches.py b/pymake/utils/_compiler_switches.py index 975d862..0b1dfa6 100644 --- a/pymake/utils/_compiler_switches.py +++ b/pymake/utils/_compiler_switches.py @@ -781,25 +781,6 @@ def _set_fflags(target, fc="gfortran", argv=True, osname=None, verbose=False): if target == "mp7": if fc == "gfortran": fflags.append("-ffree-line-length-512") - elif target in ("gsflow", "prms"): - if fc == "ifort": - if osname == "win32": - fflags += [ - "-fp:source", - "-names:lowercase", - "-assume:underscore", - ] - else: - pass - elif fc == "gfortran": - fflags += ["-O1", "-fno-second-underscore"] - opt = "-fallow-argument-mismatch" - if _check_gnu_switch_available( - opt, compiler=fc, verbose=verbose - ): - fflags += [ - opt, - ] elif target in ( "mf2000", "mt3dms", @@ -899,17 +880,6 @@ def _set_cflags(target, cc="gcc", argv=True, osname=None, verbose=False): cflags += ["-lm"] else: cflags += ["-DNO_TIMER"] - elif target in ( - "gsflow", - "prms", - ): - if cc in ["icc", "icpl", "icl"]: - if osname == "win32": - cflags += ["-D_CRT_SECURE_NO_WARNINGS"] - else: - cflags += ["-D_UF"] - elif cc == "gcc": - cflags += ["-O1"] # add additional cflags from the command line if argv: @@ -1013,10 +983,6 @@ def _set_syslibs( lcc = True if lfc and lcc: syslibs += ["-lm"] - elif target in ("gsflow", "prms"): - if "win32" not in osname: - if "ifort" in fc: - syslibs += ["-nofor_main"] # add additional syslibs from the command line if argv: diff --git a/pymake/utils/_usgs_src_update.py b/pymake/utils/_usgs_src_update.py index 989efd5..fbd1752 100644 --- a/pymake/utils/_usgs_src_update.py +++ b/pymake/utils/_usgs_src_update.py @@ -468,114 +468,6 @@ def _update_mfnwt_files(srcdir, fc, cc, arch, double): _update_swi(srcdir, double) -def _update_prms_files(srcdir, fc, cc, arch, double): - """Update PRMS source files - - Parameters - ---------- - srcdir : str - path to directory with source files - fc : str - fortran compiler - cc : str - c/c++ compiler - arch : str - architecture - double : bool - boolean indicating if compiler switches are used to build a - double precision target - - Returns - ------- - - """ - # remove existing *.mod, *.o, and *.a (if any are left) files - dpths = [ - os.path.join(srcdir, o) - for o in os.listdir(srcdir) - if os.path.isdir(os.path.join(srcdir, o)) - ] - - for dpth in dpths: - for f in os.listdir(dpth): - ext = os.path.splitext(f)[1] - fpth = os.path.join(dpth, f) - if ext in [".mod", ".o", ".a"]: - os.remove(fpth) - - # remove specific files - fpths = ( - os.path.join(srcdir, "prms", "gsflow_module.f90"), - os.path.join(srcdir, "prms", "gsflow_prms.f90"), - ) - for fpth in fpths: - if os.path.isfile(fpth): - os.remove(fpth) - - return - - -def _update_gsflow_files(srcdir, fc, cc, arch, double): - """Update GSFLOW source files - - Parameters - ---------- - srcdir : str - path to directory with source files - fc : str - fortran compiler - cc : str - c/c++ compiler - arch : str - architecture - double : bool - boolean indicating if compiler switches are used to build a - double precision target - - Returns - ------- - - """ - # update utl7.f - _update_utl7(srcdir) - - # update gwf2swt7.f - _update_swt(srcdir) - - # update gwf2swi27.f or gwf2swi27.fpp - _update_swi(srcdir, double) - - # remove merge and lib directories - pths = [os.path.join(srcdir, "merge"), os.path.join(srcdir, "lib")] - for pth in pths: - if os.path.isdir(pth): - shutil.rmtree(pth) - - # remove existing *.mod, *.o, and *.a (if any are left) files - dpths = [ - os.path.join(srcdir, o) - for o in os.listdir(srcdir) - if os.path.isdir(os.path.join(srcdir, o)) - ] - - for dpth in dpths: - for f in os.listdir(dpth): - ext = os.path.splitext(f)[1] - fpth = os.path.join(dpth, f) - if ext in [".mod", ".o", ".a"]: - os.remove(fpth) - - # remove specific files - fpths = [ - os.path.join(srcdir, "modflow", "gwf2ag1_NWT_rsr.f"), - ] - for fpth in fpths: - if os.path.isfile(fpth): - os.remove(fpth) - - return - - def _update_mf2000_files(srcdir, fc, cc, arch, double): """Update MODFLOW-2000 source files diff --git a/pymake/utils/usgsprograms.txt b/pymake/utils/usgsprograms.txt index a4414d3..a1ae40a 100644 --- a/pymake/utils/usgsprograms.txt +++ b/pymake/utils/usgsprograms.txt @@ -21,7 +21,6 @@ zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , False , False mfusg_gsi , 2.2.2 , True , https://www.gsienv.com/wp-content/uploads/2023/11/USG-Transport_Version-2.2.2.zip , USGT-v2-2-2-Source , . , True , False , False -gsflow , 2.2.1 , True , https://water.usgs.gov/water-resources/software/gsflow/gsflow_2.2.1_linux.zip , gsflow_2.2.1 , src , True , False , False mf6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , src , True , False , False zbud6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , utils/zonebudget/src, True , False , False libmf6dev , 6.6.0.dev0 , False , https://github.com/MODFLOW-USGS/modflow6/archive/refs/heads/develop.zip , modflow6-develop , srcbmi , True , False , True \ No newline at end of file