From 644a10ee35f0ecffe03623737ecc64d9b2870220 Mon Sep 17 00:00:00 2001 From: "Steven R. Brandt" Date: Thu, 11 May 2023 23:57:59 -0500 Subject: Coastal Codes (#37176) * Coastal codes installation * Finished debugging swan. * Fix formatting errors identified by flake8 * Another attempt to fix formatting. * Fixed year in header. * Fixed maintainers syntax and other details from review comments. * Remove redundant url. --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> --- .../repos/builtin/packages/funwave/package.py | 47 ++++++++++++++++++++++ var/spack/repos/builtin/packages/swan/package.py | 34 ++++++++++++---- 2 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 var/spack/repos/builtin/packages/funwave/package.py diff --git a/var/spack/repos/builtin/packages/funwave/package.py b/var/spack/repos/builtin/packages/funwave/package.py new file mode 100644 index 0000000000..6c047ba17d --- /dev/null +++ b/var/spack/repos/builtin/packages/funwave/package.py @@ -0,0 +1,47 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class Funwave(MakefilePackage): + """ + What is FUNWAVE-TVD? + FUNWAVE-TVD is the Total Variation Diminishing (TVD) version of the fully nonlinear Boussinesq + wave model (FUNWAVE) developed by Shi et al. (2012). The FUNWAVE model was initially developed + by Kirby et al. (1998) based on Wei et al. (1995). The development of the present version was + motivated by recent needs for modeling of surfzone--cale optical properties in a Boussinesq + model framework, and modeling of Tsunami waves in both a global/coastal scale for prediction + of coastal inundation and a basin scale for wave propagation. + """ + + homepage = "https://fengyanshi.github.io/build/html/index.html" + git = "https://github.com/fengyanshi/FUNWAVE-TVD" + + maintainers("stevenrbrandt", "fengyanshi") + + version("3.2", tag="v3.2") + version("3.1", tag="v3.1") + version("3.0", tag="v3.0") + + depends_on("mpi") + + parallel = False + + def build(self, spec, prefix): + with working_dir("./src"): + make() + + def install(self, spec, prefix): + bin = os.path.join(prefix, "bin") + os.makedirs(bin, exist_ok=True) + copy("./src/funwave_vessel", os.path.join(bin, "funwave")) + + def edit(self, spec, prefix): + with working_dir("./src"): + makefile = FileFilter("Makefile") + makefile.filter("FLAG_8 = -DCOUPLING", "#FLAG_8 = -DCOUPLING") diff --git a/var/spack/repos/builtin/packages/swan/package.py b/var/spack/repos/builtin/packages/swan/package.py index 174eb7671c..01759af317 100644 --- a/var/spack/repos/builtin/packages/swan/package.py +++ b/var/spack/repos/builtin/packages/swan/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re + from spack.package import * @@ -14,22 +16,38 @@ class Swan(MakefilePackage): features. This list reflects on the scientific relevance of the development of SWAN.""" - homepage = "http://swanmodel.sourceforge.net/" - url = "https://cfhcable.dl.sourceforge.net/project/swanmodel/swan/41.31/swan4131.tar.gz" + homepage = "https://swanmodel.sourceforge.net/" + url = "https://swanmodel.sourceforge.io/download/zip/swan4145.tar.gz" + + maintainers("lhxone", "stevenrbrandt") + + # This is very important + parallel = False - maintainers("lhxone") + version( + "4145", + preferred=True, + sha256="4cced2250f11f5cff3417d1f541f5e3cdd09fa1bc4fd986e0d0917bfb88b1e2a", + ) - version("4131", sha256="cd3ba1f0d79123f1b7d42a43169f07575b59b01e604c5e66fbc09769e227432e") + version("4141", sha256="5d411e6602bd4ef764f6c7d23e5e25b588e955cb21a606d6d8a7bc4c9393aa0a") depends_on("mpi") depends_on("netcdf-fortran") - depends_on("libfabric") + depends_on("perl", type="build") def edit(self, spec, prefix): - env["FC"] = "gfortran" + fc = re.sub(r".*[\\/]", "", env["FC"]) + mpifc = re.sub(r".*[\\/]", "", spec["mpi"].mpifc) + + # Must not be the full path to the compiler or platform.pl gets confused + env["FC"] = fc + env["F90_MPI"] = mpifc + m = FileFilter("platform.pl") - m.filter("F90_MPI = .*", 'F90_MPI = mpifort\\n";') - m.filter("NETCDFROOT =", "NETCDFROOT = {0}" + spec["netcdf-fortran"].prefix) + m.filter("F90_MPI = .*", "F90_MPI = " + mpifc + '\\n";') + m.filter("NETCDFROOT =", "NETCDFROOT = " + spec["netcdf-fortran"].prefix) + m.filter(r"-lnetcdf\b", "") def build(self, spec, prefix): make("config") -- cgit v1.2.3-60-g2f50