From 751771dcb3f64b7ad5383906bbfa6e4b24d2c757 Mon Sep 17 00:00:00 2001 From: Lukas Gradl Date: Sat, 23 Apr 2016 01:40:16 -0500 Subject: [PATCH] gnu: Add sparta-dsmc. * gnu/packages/maths.scm (sparta-dsmc): New variable. --- gnu/packages/maths.scm | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 7ea4ca3..241a010 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2119,3 +2119,66 @@ are built. It can generate many different fractal types such as the Mandelbrot set.") (home-page "http://www.gnu.org/software/xaos/") (license license:gpl2+))) + + +(define-public sparta-dsmc + (package + (name "sparta-dsmc") + (version "20160331") + (source + (origin + (method url-fetch) + (uri + (string-append "https://archive.org/download/sparta-" + version ".tar/sparta-" version ".tar.gz")) + (sha256 + (base32 + "0w0sdiharqrw6x4msbq01havky15cq7ylkk2y6v59xyy7vnxpnss")))) + (build-system gnu-build-system) + (inputs `(("openmpi" ,openmpi) + ("libjpeg" ,libjpeg) + ("python" ,python-2))) + (arguments + `(#:tests? #f ; there is no "check" target nor any other tests + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'patch-generated-file-shebangs 'chdir-to-src + (lambda _ + (chdir "src"))) + (add-after 'chdir-to-src + 'patch-makefile-shell + (lambda _ + (substitute* (list "MAKE/Makefile.mpi" + "MAKE/Makefile.serial") + (("/bin/sh") (which "bash"))))) + (replace 'build + (lambda _ + (and + (zero? (system* "make" + (format #f "-j~a" (parallel-job-count)) + "mpi")) + (zero? (system* "make" + (format #f "-j~a" (parallel-job-count)) + "serial"))))) + (replace 'install + (lambda _ + (let* ((out (assoc-ref %outputs "out")) + (bin (string-append out "/bin")) + (doc (string-append out "/share/doc/sparta-dsmc")) + (examples (string-append doc "/examples"))) + (install-file "spa_mpi" bin) + (install-file "spa_serial" bin) + (copy-recursively "../examples" examples) + (copy-recursively "../doc" doc))))))) + (synopsis "Direct Simulation Monte Carlo (DSMC) simulator") + (description "SPARTA is a parallel DSMC code for performing +simulations of low-density gases in 2d or 3d. Particles advect +through a hierarchical Cartesian grid that overlays the simulation +box. The grid is used to group particles by grid cell for purposes of +performing collisions and chemistry. Physical objects with +triangulated surfaces can be embedded in the grid, creating cut and +split grid cells. The grid is also used to efficiently find +particle/surface collisions.") + (home-page "http://sparta.sandia.gov/") + (license license:gpl2))) -- 2.7.4