diff --git a/.travis.yml b/.travis.yml index 0a997b61b4..7b05487ea9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gfortran-6 - - g++-6 + - gfortran-8 + - g++-8 - python-pip - libhdf5-serial-dev - netcdf-bin @@ -47,12 +47,12 @@ install: mkdir "$HOME/.local/bin"; fi - export PATH="$HOME/.local/bin:$PATH" - - ln -fs /usr/bin/gfortran-6 "$HOME/.local/bin/gfortran" && gfortran --version - - ls -l /usr/bin/gfortran-6 - - ln -fs /usr/bin/gcc-6 "$HOME/.local/bin/gcc" && gcc --version - - ls -l /usr/bin/gcc-6 - - ln -fs /usr/bin/g++-6 "$HOME/.local/bin/g++" && g++ --version - - ls -l /usr/bin/g++-6 + - ln -fs /usr/bin/gfortran-8 "$HOME/.local/bin/gfortran" && gfortran --version + - ls -l /usr/bin/gfortran-8 + - ln -fs /usr/bin/gcc-8 "$HOME/.local/bin/gcc" && gcc --version + - ls -l /usr/bin/gcc-8 + - ln -fs /usr/bin/g++-8 "$HOME/.local/bin/g++" && g++ --version + - ls -l /usr/bin/g++-8 - export CXX="g++" - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install -r requirements27.travis.txt; diff --git a/autotest/build_exes.py b/autotest/build_exes.py index 6b7cf7a8ed..27ff8d2625 100644 --- a/autotest/build_exes.py +++ b/autotest/build_exes.py @@ -47,6 +47,20 @@ def update_mt3dfiles(srcdir): shutil.move(os.path.join(srcdir, 'mt3dms5.for.tmp'), os.path.join(srcdir, 'mt3dms5.for')) + # Need to initialize the V array in SADV5B + # see here: https://github.com/MODFLOW-USGS/mt3d-usgs/pull/46 + f1 = open(os.path.join(srcdir, 'mt_adv5.for'), 'r') + f2 = open(os.path.join(srcdir, 'mt_adv5.for.tmp'), 'w') + sfind = 'C--SET DT TO NEGATIVE FOR BACKWARD TRACKING' + sreplace = 'C--INITIALIZE\n V(:)=0.\nC\n' + sfind + for line in f1: + f2.write(line.replace(sfind, sreplace)) + f1.close() + f2.close() + os.remove(os.path.join(srcdir, 'mt_adv5.for')) + shutil.move(os.path.join(srcdir, 'mt_adv5.for.tmp'), + os.path.join(srcdir, 'mt_adv5.for')) + # Replace filespec with standard fortran l = ''' CHARACTER*20 ACCESS,FORM,ACTION(2) @@ -138,7 +152,31 @@ def update_mp7files(srcdir): f.close() -def test_build_modflow(): +def run_cmdlist(cmdlist, cwd='.'): + proc = subprocess.Popen(cmdlist, shell=False, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + cwd=cwd) + stdout_data, stderr_data = proc.communicate() + if proc.returncode != 0: + if isinstance(stdout_data, bytes): + stdout_data = stdout_data.decode('utf-8') + if isinstance(stderr_data, bytes): + stderr_data = stderr_data.decode('utf-8') + msg = '{} failed\n'.format(cmdlist) + \ + 'status code:\n{}\n'.format(proc.returncode) + \ + 'stdout:\n{}\n'.format(stdout_data) + \ + 'stderr:\n{}\n'.format(stderr_data) + assert False, msg + else: + if isinstance(stdout_data, bytes): + stdout_data = stdout_data.decode('utf-8') + print(stdout_data) + + return + + +def test_build_mf2005(): if pymake is None: return starget = 'MODFLOW-2005' @@ -164,31 +202,7 @@ def test_build_mfnwt(): return -def run_cmdlist(cmdlist, cwd='.'): - proc = subprocess.Popen(cmdlist, shell=False, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - cwd=cwd) - stdout_data, stderr_data = proc.communicate() - if proc.returncode != 0: - if isinstance(stdout_data, bytes): - stdout_data = stdout_data.decode('utf-8') - if isinstance(stderr_data, bytes): - stderr_data = stderr_data.decode('utf-8') - msg = '{} failed\n'.format(cmdlist) + \ - 'status code:\n{}\n'.format(proc.returncode) + \ - 'stdout:\n{}\n'.format(stdout_data) + \ - 'stderr:\n{}\n'.format(stderr_data) - assert False, msg - else: - if isinstance(stdout_data, bytes): - stdout_data = stdout_data.decode('utf-8') - print(stdout_data) - - return - - -def test_build_usg(): +def test_build_mfusg(): if pymake is None: return starget = 'MODFLOW-USG' @@ -205,14 +219,14 @@ def test_build_mf6(): return starget = 'MODFLOW6' exe_name = 'mf6' - dirname = 'mf6.0.3' - url = 'https://water.usgs.gov/ogw/modflow/{0}.zip'.format(dirname) + dirname = 'mf6.0.4' + url = 'https://water.usgs.gov/water-resources/software/MODFLOW-6/{0}.zip'.format(dirname) build_target(starget, exe_name, url, dirname, include_subdirs=True) return -def test_build_lgr(): +def test_build_mflgr(): if pymake is None: return starget = 'MODFLOW-LGR' @@ -242,8 +256,8 @@ def test_build_mt3dusgs(): return starget = 'MT3D-USGS' exe_name = 'mt3dusgs' - dirname = 'mt3d-usgs_Distribution' - url = "https://water.usgs.gov/ogw/mt3d-usgs/mt3d-usgs_1.0.zip" + dirname = 'mt3dusgs1.0.1' + url = 'https://water.usgs.gov/water-resources/software/MT3D-USGS/mt3dusgs1.0.1.zip' build_target(starget, exe_name, url, dirname) return @@ -502,7 +516,9 @@ def build_target(starget, exe_name, url, dirname, srcname='src', replace_function(srcdir) # compile code - print('compiling...{}'.format(os.path.relpath(target))) + print('compiling... {}'.format(target)) + print(' relative path: {}'.format(os.path.relpath(target))) + print(' absolute path: {}'.format(os.path.abspath(target))) pymake.main(srcdir, target, fct, cct, makeclean=True, expedite=False, dryrun=False, double=dble, debug=False, include_subdirs=include_subdirs) @@ -522,12 +538,15 @@ def build_target(starget, exe_name, url, dirname, srcname='src', if __name__ == '__main__': - # test_build_mf6() - # test_build_modflow() - # test_build_mfnwt() - # test_build_usg() - # test_build_mt3dms() - # test_build_seawat() - # test_build_gridgen() - # test_build_triangle() + test_build_mf6() + test_build_mf2005() + test_build_mfnwt() + test_build_mfusg() + test_build_mflgr() + test_build_mt3dms() + test_build_mt3dusgs() + test_build_seawat() + test_build_gridgen() + test_build_triangle() + test_build_modpath6() test_build_modpath7() diff --git a/autotest/t012_test.py b/autotest/t012_test.py index eb5e84de84..8583cefd66 100644 --- a/autotest/t012_test.py +++ b/autotest/t012_test.py @@ -356,7 +356,7 @@ def test_mfnwt_LKT(): return -def test_mfnwt_keat_uzf(): +def deactivated_mfnwt_keat_uzf(): pth = os.path.join(pthNWT, 'keat_uzf') namefile = 'Keat_UZF_mf.nam' mf = flopy.modflow.Modflow.load(namefile, model_ws=pth, @@ -397,6 +397,6 @@ def test_mfnwt_keat_uzf(): #test_mf2000_SState() #test_mf2000_tob() #test_mf2000_zeroth() - test_mfnwt_CrnkNic() + #test_mfnwt_CrnkNic() #test_mfnwt_LKT() - #test_mfnwt_keat_uzf() + deactivated_mfnwt_keat_uzf() diff --git a/autotest/t504_test.py b/autotest/t504_test.py index 9dd09878a4..60fe626e28 100644 --- a/autotest/t504_test.py +++ b/autotest/t504_test.py @@ -444,7 +444,10 @@ def test045_lake1ss_table(): # compare output to expected results head_file = os.path.join(os.getcwd(), expected_head_file_a) head_new = os.path.join(run_folder, 'lakeex1b.hds') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new) + outfile = os.path.join(run_folder, 'headcompare_a.txt') + success = pymake.compare_heads(None, None, files1=head_file, + files2=head_new, outfile=outfile) + assert success # change some settings model = sim.get_model(model_name) @@ -464,7 +467,10 @@ def test045_lake1ss_table(): # compare output to expected results head_file = os.path.join(os.getcwd(), expected_head_file_b) head_new = os.path.join(save_folder, 'lakeex1b.hds') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new) + outfile = os.path.join(run_folder, 'headcompare_b.txt') + success = pymake.compare_heads(None, None, files1=head_file, + files2=head_new, outfile=outfile) + assert success # clean up sim.delete_output_files() diff --git a/autotest/t505_test.py b/autotest/t505_test.py index 38c005688a..88e94b4bfd 100644 --- a/autotest/t505_test.py +++ b/autotest/t505_test.py @@ -226,27 +226,28 @@ def np001(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # get expected results - budget_file = os.path.join(os.getcwd(), expected_cbc_file) - budget_obj = bf.CellBudgetFile(budget_file, precision='double') - budget_frf_valid = np.array( - budget_obj.get_data(text='FLOW-JA-FACE', full3D=True)) + # get expected results + budget_file = os.path.join(os.getcwd(), expected_cbc_file) + budget_obj = bf.CellBudgetFile(budget_file, precision='double') + budget_frf_valid = np.array( + budget_obj.get_data(text='FLOW-JA-FACE', full3D=True)) - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'np001_mod.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'np001_mod.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - budget_frf = sim.simulation_data.mfdata[ - (model_name, 'CBC', 'FLOW-JA-FACE')] - assert array_util.array_comp(budget_frf_valid, budget_frf) + budget_frf = sim.simulation_data.mfdata[ + (model_name, 'CBC', 'FLOW-JA-FACE')] + assert array_util.array_comp(budget_frf_valid, budget_frf) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -917,17 +918,18 @@ def test004_bcfss(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'bcf2ss.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'bcf2ss.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -1010,17 +1012,18 @@ def test035_fhb(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'fhb2015_fhb.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'fhb2015_fhb.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -1133,22 +1136,23 @@ def test006_gwf3_disv(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'flow.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'flow.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # export to netcdf - temporarily disabled - #model.export(os.path.join(run_folder, "test006_gwf3.nc")) - # export to shape file - model.export(os.path.join(run_folder, "test006_gwf3.shp")) + # export to netcdf - temporarily disabled + #model.export(os.path.join(run_folder, "test006_gwf3.nc")) + # export to shape file + model.export(os.path.join(run_folder, "test006_gwf3.shp")) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -1288,24 +1292,25 @@ def test006_2models_gnc(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file_1) - head_new = os.path.join(run_folder, 'model1.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file_1) + head_new = os.path.join(run_folder, 'model1.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file_2) - head_new = os.path.join(run_folder, 'model2.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file_2) + head_new = os.path.join(run_folder, 'model2.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -1372,17 +1377,18 @@ def test050_circle_island(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'ci.output.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'ci.output.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return @@ -1546,17 +1552,18 @@ def test028_sfr(): sim.write_simulation() # run simulation - sim.run_simulation() + if run: + sim.run_simulation() - # compare output to expected results - head_file = os.path.join(os.getcwd(), expected_head_file) - head_new = os.path.join(run_folder, 'test1tr.hds') - outfile = os.path.join(run_folder, 'head_compare.dat') - assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, - outfile=outfile) + # compare output to expected results + head_file = os.path.join(os.getcwd(), expected_head_file) + head_new = os.path.join(run_folder, 'test1tr.hds') + outfile = os.path.join(run_folder, 'head_compare.dat') + assert pymake.compare_heads(None, None, files1=head_file, files2=head_new, + outfile=outfile) - # clean up - sim.delete_output_files() + # clean up + sim.delete_output_files() return diff --git a/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_adj.hds b/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_adj.hds index 062ef1f413..8938f4cded 100644 Binary files a/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_adj.hds and b/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_adj.hds differ diff --git a/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_unch.hds b/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_unch.hds index 062ef1f413..8938f4cded 100644 Binary files a/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_unch.hds and b/examples/data/mf6/test045_lake1ss_table/expected_output/lakeex1b_unch.hds differ