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 mfusg_gsi (v2.1.1).
  • Loading branch information
jdhughes-usgs committed Jul 5, 2023
1 parent 6a93306 commit a470cd2
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake continuous integration

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake gcc build

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pymake-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake requests

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python package for building MODFLOW-based programs from source files.

### Version 1.2.7
### Version 1.2.8

![pymake continuous integration](https://github.com/modflowpy/pymake/workflows/pymake%20continuous%20integration/badge.svg)
[![codecov](https://codecov.io/gh/modflowpy/pymake/branch/master/graph/badge.svg)](https://codecov.io/gh/modflowpy/pymake)
Expand Down
1 change: 0 additions & 1 deletion autotest/test_cli_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pathlib as pl
import shutil
import subprocess
import sys

import pytest

Expand Down
2 changes: 0 additions & 2 deletions autotest/test_mf6_existing_meson.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import contextlib
import os
import shutil
import sys
import time

import flopy
import pytest
Expand Down
4 changes: 2 additions & 2 deletions pymake/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "Joseph D. Hughes"
__date__ = "December 8, 2022"
__version__ = "1.2.7"
__date__ = "July 5, 2023"
__version__ = "1.2.8"
__maintainer__ = "Joseph D. Hughes"
__email__ = "[email protected]"
__status__ = "Production"
Expand Down
134 changes: 131 additions & 3 deletions pymake/utils/_usgs_src_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shutil
import sys
import types
from typing import Union

from .usgsprograms import usgs_program_data

Expand Down Expand Up @@ -65,8 +66,7 @@ def _build_replace(targets):

# remove exe extension from targets
for idx, target in enumerate(targets):
if ".exe" in target.lower():
targets[idx] = target[:-4]
targets[idx] = pl.Path(target).with_suffix("").name

# get a dictionary of update functions
funcs = _get_function_names(sys.modules[__name__], select_name="_update_")
Expand Down Expand Up @@ -432,6 +432,11 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double):
"FMTARG = 'BINARY'": "FMTARG = 'UNFORMATTED'\n ACCARG = 'STREAM'",
",SHARED,ACCESS='SEQUENTIAL'": ",ACCESS='SEQUENTIAL'",
"FORM=FMTARG,SHARED,": "FORM=FMTARG,",
",BUFFERED='YES',": ",",
", BUFFERED='NO')": ")",
",SHARE = 'DENYNONE'": ",",
", SHARE = 'DENYNONE',": ",",
"FORM='FORMATTED',ACCESS='SEQUENTIAL',": "FORM='FORMATTED',ACCESS='SEQUENTIAL'",
}

fpth = pl.Path(srcdir) / "glo2basu1.f"
Expand All @@ -446,6 +451,20 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double):
f.write(line)
f.close()

tags = {",share='DENYNONE',": ","}

fpth = pl.Path(srcdir) / "UpdtSt.for"
if fpth.exists():
with open(fpth) as f:
lines = f.readlines()
f = open(fpth, "w")
for idx, line in enumerate(lines):
for key, value in tags.items():
if key in line:
line = line.replace(key, value)
f.write(line)
f.close()

tag = "DEALLOCATE(ITHFLG)"
tag2 = "DEALLOCATE(LAYTYP)"
fpth = pl.Path(srcdir) / "gwf2bcf-lpf-u1.f"
Expand Down Expand Up @@ -829,7 +848,116 @@ def _update_vs2dt_files(srcdir, fc, cc, arch, double):
return


def _update_mf6_files(
srcdir: Union[str, os.PathLike],
fc: str,
cc: str,
arch: str,
double: bool,
) -> None:
"""
Update MODFLOW 6 source files to remove files with external dependencies.
This was required for releases >= 6.4.2
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_mf6_external_dependencies(srcdir)
return


def _update_libmf6_files(
srcdir: Union[str, os.PathLike],
fc: str,
cc: str,
arch: str,
double: bool,
) -> None:
"""
Update MODFLOW 6 shared object source files to remove files with external
dependencies. This was required for releases >= 6.4.2
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_mf6_external_dependencies(srcdir, target="libmf6")
return


# common source file replacement functions
def _update_mf6_external_dependencies(
srcdir: Union[str, os.PathLike],
target: str = "mf6",
) -> None:
"""
Remove MODFLOW 6 files with external library dependencies (PETSc, MPI).
Parameters
----------
srcdir : os.PathLike
path to directory with source files
target: str
target to create (Default is mf6)
Returns
-------
None
"""
if not isinstance(srcdir, pl.Path):
srcdir = pl.Path(srcdir)
if target == "libmf6":
srcdir = srcdir.parent / "src"
parallel_files = (
"Utilities/Vector/PetscVector.F90",
"Utilities/Matrix/PetscMatrix.F90",
"Solution/PETSc/PetscSolver.F90",
"Solution/PETSc/PetscConvergence.F90",
"Distributed/MpiMessageBuilder.f90",
"Distributed/MpiRouter.f90",
"Distributed/MpiRunControl.F90",
"Distributed/MpiWorld.f90",
"Solution/ParallelSolution.f90",
)
for file in parallel_files:
path = srcdir / file
if path.is_file():
print(f'Removing..."{path}"')
os.remove(path)
return


def _update_utl7(srcdir):
"""Update utl7.f source file
Expand Down Expand Up @@ -991,4 +1119,4 @@ def _update_pcg(srcdir):
input_str = input_str.replace(find_block, replace_block)
f = open(fpth, "w")
f.write(input_str)
f.close()
f.close()
12 changes: 6 additions & 6 deletions pymake/utils/usgsprograms.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target , version, current, url , dirname , srcdir , standard_switch, double_switch, shared_object
mf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , src , True , False , False
zbud6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , utils/zonebudget/src, True , False , False
libmf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , srcbmi , True , False , True
mf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , src , True , False , False
zbud6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , utils/zonebudget/src, True , False , False
libmf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , srcbmi , True , False , True
mp7 , 7.2.001, True , https://water.usgs.gov/water-resources/software/MODPATH/modpath_7_2_001.zip , modpath_7_2_001 , source , True , False , False
mt3dms , 5.3.0 , True , https://hydro.geo.ua.edu/mt3d/mt3dms_530.exe , mt3dms5.3.0 , src/true-binary , True , False , False
mt3dusgs , 1.1.0 , True , https://water.usgs.gov/water-resources/software/MT3D-USGS/mt3dusgs1.1.0.zip , mt3dusgs1.1.0 , src , True , False , False
Expand All @@ -18,6 +18,6 @@ swtv4 , 4.00.05, True , https://water.usgs.gov/water-resources/software
mp6 , 6.0.1 , True , https://water.usgs.gov/water-resources/software/MODPATH/modpath.6_0_01.zip , modpath.6_0 , src , True , False , False
mflgr , 2.0.0 , True , https://water.usgs.gov/ogw/modflow-lgr/modflow-lgr-v2.0.0/mflgrv2_0_00.zip , mflgr.2_0 , src , True , True , False
zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software/ZONEBUDGET/zonbud3_01.exe , Zonbud.3_01 , Src , True , False , False
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 , True , False
mfusg_gsi , 2.01.0 , True , https://www.gsienv.com/wp-content/uploads/2023/01/USG-Transport-V_2.1.0-1.zip , . , Source , True , True , False
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 , True , False
mfusg_gsi , 2.1.1 , True , https://www.gsienv.com/wp-content/uploads/2023/04/USG-Transport-V_2.1.1.zip , USGT-v2-1-1-source , . , True , False , False

0 comments on commit a470cd2

Please sign in to comment.