From e49cccb0d90ba9617e44aed8d7741f9a4efcc603 Mon Sep 17 00:00:00 2001
From: Lhxone <lhxone@outlook.com>
Date: Wed, 27 Apr 2022 08:33:36 +0800
Subject: New package: CaNS (#30218)

---
 var/spack/repos/builtin/packages/cans/package.py | 45 ++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 var/spack/repos/builtin/packages/cans/package.py

diff --git a/var/spack/repos/builtin/packages/cans/package.py b/var/spack/repos/builtin/packages/cans/package.py
new file mode 100644
index 0000000000..0ce728b31d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/cans/package.py
@@ -0,0 +1,45 @@
+# Copyright 2013-2022 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)
+
+from spack import *
+
+
+class Cans(MakefilePackage):
+    """CaNS (Canonical Navier-Stokes) is a code for
+    massively-parallel numerical simulations of fluid
+    flows. It aims at solving any fluid flow of an
+    incompressible, Newtonian fluid that can benefit
+    from a FFT-based solver for the second-order
+    finite-difference Poisson equation
+    in a 3D Cartesian grid."""
+
+    homepage = "https://github.com/p-costa/CaNS"
+    url      = "https://github.com/p-costa/CaNS/archive/refs/tags/v1.1.4.tar.gz"
+
+    maintainers = ['lhxone', 'p-costa', 'nscapin', 'GabrieleBoga']
+
+    version('1.1.4', sha256='8334c67810472edc18d5403a0bcb27fd57a620722c1e8c317518db4506867b81')
+    version('1.1.3', sha256='01fa42e51ddcf6161fb63a124a0f2218c67f85ff4cc5236b995a5650d85e7615')
+    version('1.1.2', sha256='31c8d6c1f619fb60b7919922c7a3a64dd614a1a2f89f38560184f75ed0526171')
+    version('1.1.0', sha256='e3fd84902e18715c6476fe780e2395ca04db9e6b0c830b55a7aa9204b1fd0886')
+
+    depends_on('mpi')
+    depends_on('fftw')
+
+    def edit(self, spec, prefix):
+        with working_dir('src'):
+            makefile = FileFilter('Makefile')
+            makefile.filter(
+                'LIBS =.*', 'LIBS = -L{} -lfftw3 -lfftw3_threads'
+                .format(spec['fftw'].prefix.lib))
+
+    def build(self, spec, prefix):
+        with working_dir('src'):
+            make()
+
+    def install(self, spec, prefix):
+        mkdir(prefix.bin)
+        with working_dir('src'):
+            install('cans', prefix.bin)
-- 
cgit v1.2.3-70-g09d2