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>
This commit is contained in:
		
							
								
								
									
										47
									
								
								var/spack/repos/builtin/packages/funwave/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								var/spack/repos/builtin/packages/funwave/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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") | ||||||
| @@ -3,6 +3,8 @@ | |||||||
| # | # | ||||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||||
| 
 | 
 | ||||||
|  | import re | ||||||
|  | 
 | ||||||
| from spack.package import * | from spack.package import * | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @@ -14,22 +16,38 @@ class Swan(MakefilePackage): | |||||||
|     features. This list reflects on the scientific relevance of |     features. This list reflects on the scientific relevance of | ||||||
|     the development of SWAN.""" |     the development of SWAN.""" | ||||||
| 
 | 
 | ||||||
|     homepage = "http://swanmodel.sourceforge.net/" |     homepage = "https://swanmodel.sourceforge.net/" | ||||||
|     url = "https://cfhcable.dl.sourceforge.net/project/swanmodel/swan/41.31/swan4131.tar.gz" |     url = "https://swanmodel.sourceforge.io/download/zip/swan4145.tar.gz" | ||||||
| 
 | 
 | ||||||
|     maintainers("lhxone") |     maintainers("lhxone", "stevenrbrandt") | ||||||
| 
 | 
 | ||||||
|     version("4131", sha256="cd3ba1f0d79123f1b7d42a43169f07575b59b01e604c5e66fbc09769e227432e") |     # This is very important | ||||||
|  |     parallel = False | ||||||
|  | 
 | ||||||
|  |     version( | ||||||
|  |         "4145", | ||||||
|  |         preferred=True, | ||||||
|  |         sha256="4cced2250f11f5cff3417d1f541f5e3cdd09fa1bc4fd986e0d0917bfb88b1e2a", | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     version("4141", sha256="5d411e6602bd4ef764f6c7d23e5e25b588e955cb21a606d6d8a7bc4c9393aa0a") | ||||||
| 
 | 
 | ||||||
|     depends_on("mpi") |     depends_on("mpi") | ||||||
|     depends_on("netcdf-fortran") |     depends_on("netcdf-fortran") | ||||||
|     depends_on("libfabric") |     depends_on("perl", type="build") | ||||||
| 
 | 
 | ||||||
|     def edit(self, spec, prefix): |     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 = FileFilter("platform.pl") | ||||||
|         m.filter("F90_MPI = .*", 'F90_MPI = mpifort\\n";') |         m.filter("F90_MPI = .*", "F90_MPI = " + mpifc + '\\n";') | ||||||
|         m.filter("NETCDFROOT =", "NETCDFROOT = {0}" + spec["netcdf-fortran"].prefix) |         m.filter("NETCDFROOT =", "NETCDFROOT = " + spec["netcdf-fortran"].prefix) | ||||||
|  |         m.filter(r"-lnetcdf\b", "") | ||||||
| 
 | 
 | ||||||
|     def build(self, spec, prefix): |     def build(self, spec, prefix): | ||||||
|         make("config") |         make("config") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Steven R. Brandt
					Steven R. Brandt