1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages simulation)
20 #:use-module (gnu packages)
21 #:use-module (gnu packages algebra)
22 #:use-module (gnu packages admin)
23 #:use-module (gnu packages base)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages bison)
26 #:use-module (gnu packages boost)
27 #:use-module (gnu packages check)
28 #:use-module (gnu packages cmake)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages flex)
31 #:use-module (gnu packages gettext)
32 #:use-module (gnu packages gcc)
33 #:use-module (gnu packages gl)
34 #:use-module (gnu packages graphics)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages m4)
38 #:use-module (gnu packages maths)
39 #:use-module (gnu packages mpi)
40 #:use-module (gnu packages multiprecision)
41 #:use-module (gnu packages ncurses)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages readline)
46 #:use-module (gnu packages tls)
47 #:use-module (gnu packages version-control)
48 #:use-module (gnu packages xml)
49 #:use-module (gnu packages xorg)
50 #:use-module (guix download)
51 #:use-module (guix svn-download)
52 #:use-module (guix build-system cmake)
53 #:use-module (guix build-system gnu)
54 #:use-module (guix build-system python)
55 #:use-module ((guix licenses) #:prefix license:)
56 #:use-module (guix packages)
57 #:use-module (guix utils)
58 #:use-module (ice-9 ftw)
59 #:use-module (ice-9 regex)
60 #:use-module (srfi srfi-1))
62 (define-public openfoam
70 "http://dl.openfoam.org/source/"
71 (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
72 (file-name (string-append name "-" version ".tar.gz"))
74 (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d"))
75 (patches (search-patches "openfoam-4.1-cleanup.patch"))
76 (modules '((guix build utils)))
79 ;; Include <sys/sysmacros.h>, which is where glibc >= 2.28 provides
80 ;; 'major' and 'minor'.
81 (substitute* "src/OSspecific/POSIX/fileStat.C"
82 (("#include <unistd\\.h>")
83 "#include <unistd.h>\n#include <sys/sysmacros.h>\n"))
85 (build-system gnu-build-system)
96 ("readline" ,readline)
97 ("scotch" ,pt-scotch32)
104 ("openmpi" ,openmpi)))
105 (outputs '("debug" ;~60MB
108 `( ;; Executable files and shared libraries are located in the 'platforms'
110 #:strip-directories (list (string-append
111 "lib/OpenFOAM-" ,version
112 "/platforms/linux64GccDPInt32Opt/bin")
114 "lib/OpenFOAM-" ,version
115 "/platforms/linux64GccDPInt32Opt/lib"))
116 #:tests? #f ; no tests to run
118 #:modules ((ice-9 ftw)
120 (guix build gnu-build-system)
123 #:phases (modify-phases %standard-phases
124 (add-after 'unpack 'rename-build-directory
127 ;; Use 'OpenFOAM-version' convention to match the file
128 ;; name expectations in the build phase.
129 (let ((unpack-dir (string-append
131 (list-ref (scandir (getcwd) (lambda (name)
132 (string-match "^OpenFOAM" name))) 0)))
133 (build-dir (string-append
134 (getcwd) "/OpenFOAM-" ,version)))
135 (rename-file unpack-dir build-dir) ; rename build directory
136 (chdir (basename build-dir))) ; move to build directory
138 (delete 'configure) ; no configure phase
141 (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
142 ;; set variables to define store paths
143 (for-each (lambda (library)
144 (setenv (string-append
145 (string-upcase library) "_ROOT")
146 (assoc-ref %build-inputs library))) libraries))
147 ;; set variables to define package versions
148 (setenv "SCOTCHVERSION" ,(package-version scotch))
149 (setenv "METISVERSION" ,(package-version metis))
150 ;; set variable to pass extra 'rpath' arguments to linker
154 "-rpath=" %output "/lib/OpenFOAM-" ,version
155 "/platforms/linux64GccDPInt32Opt/lib,"
156 "-rpath=" %output "/lib/OpenFOAM-" ,version
157 "/platforms/linux64GccDPInt32Opt/lib/dummy"))
158 ;; compile OpenFOAM libraries and applications
159 (zero? (system (format #f
160 "source ./etc/bashrc && ./Allwmake -j~a"
161 (parallel-job-count))))))
162 (add-after 'build 'update-configuration-files
164 ;; record store paths and package versions in
165 ;; configuration files
166 (substitute* "etc/config.sh/CGAL"
167 (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
168 (substitute* "etc/config.sh/CGAL"
169 (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
170 (substitute* "etc/config.sh/metis"
171 (("$METIS_ROOT") (getenv "METIS_ROOT")))
172 (substitute* "etc/config.sh/metis"
173 (("$METISVERSION") (getenv "METISVERSION")))
174 (substitute* "etc/config.sh/scotch"
175 (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
176 (substitute* "etc/config.sh/scotch"
177 (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
178 (substitute* "etc/config.sh/settings"
179 (("$GMP_ROOT") (getenv "GMP_ROOT")))
180 (substitute* "etc/config.sh/settings"
181 (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
182 ;; reset lockDir variable to refer to write-enabled
184 (substitute* "wmake/wmake"
186 " lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
187 (substitute* "wmake/wmakeScheduler"
189 "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
190 (substitute* "wmake/wmakeSchedulerUptime"
192 "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
194 (add-after 'build 'cleanup
195 ;; Avoid unncessary, voluminous object and dep files.
197 (delete-file-recursively
198 "platforms/linux64GccDPInt32Opt/src")
199 (delete-file-recursively
200 "platforms/linux64GccDPInt32OptSYSTEMOPENMPI")
201 (for-each delete-file (find-files "." "\\.o$"))
205 ;; use 'OpenFOAM-version' convention
206 (let ((install-dir (string-append
207 %output "/lib/OpenFOAM-" ,version)))
208 (mkdir-p install-dir) ; create install directory
209 ;; move contents of build directory to install directory
210 (copy-recursively "." install-dir))))
211 (add-after 'install 'add-symbolic-link
213 ;; add symbolic link for standard 'bin' directory
215 (string-append "./lib/OpenFOAM-" ,version
216 "/platforms/linux64GccDPInt32Opt/bin")
217 (string-append %output "/bin"))
220 ;; Tutorial files are installed read-only in /gnu/store.
221 ;; To allow write permissions on files copied from the store a
222 ;; 'chmod' step is needed before running the applications. For
223 ;; example, from a user's login:
224 ;; $ source $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc
225 ;; $ mkdir -p $FOAM_RUN
227 ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
231 (synopsis "Framework for numerical simulation of fluid flow")
232 (description "OpenFOAM provides a set of solvers and methods for tackling
233 problems in the field of Computational Fluid Dynamics (CFD). It is written in
234 C++. Governing equations such as the Navier-Stokes equations can be solved in
235 integral form. Physical processes such as phase change, droplet transport and
236 chemical reaction can be modelled. Numerical methods are included to deal with
237 sharp gradients, such as those encountered in flows with shock waves and flows
238 with gas/liquid interfaces. Large problems may be split into smaller, connected
239 problems for efficient solution on parallel systems.")
240 (license license:gpl3+)
241 (home-page "https://openfoam.org")))
243 (define-public python-fenics-dijitso
245 (name "python-fenics-dijitso")
250 (uri (pypi-uri "fenics-dijitso" version))
253 "0lhqsq8ypdak0ahr2jnyvg07yrqp6wicjxi6k56zx24wp3qg60sc"))))
254 (build-system python-build-system)
256 `(("openmpi" ,openmpi)
257 ("python-numpy" ,python-numpy)))
259 `(("python-pytest-cov" ,python-pytest-cov)))
261 `(("python-mpi4py" ,python-mpi4py)))
264 (modify-phases %standard-phases
265 (add-after 'build 'mpi-setup
269 (setenv "HOME" "/tmp")
271 (string-append (getcwd) ":" (getenv "PYTHONPATH")))
272 (with-directory-excursion "test"
273 ;; Disable parallel tests to avoid race condition. See
274 ;; https://github.com/pytest-dev/pytest-cov/issues/237.
275 (substitute* "runtests.sh"
276 (("for p in 1 4 8 16; do")
278 (invoke "./runtests.sh"))
280 (home-page "https://bitbucket.org/fenics-project/dijitso/")
281 (synopsis "Distributed just-in-time building of shared libraries")
283 "Dijitso provides a core component of the @code{FEniCS} framework,
284 namely the just-in-time compilation of C++ code that is generated from
285 Python modules. It is called from within a C++ library, using ctypes
286 to import the dynamic shared library directly.
288 As long as the compiled code can provide a simple factory function to
289 a class implementing a predefined C++ interface, there is no limit to
290 the complexity of that interface. Parallel support depends on the
291 @code{mpi4py} interface.")
292 (license license:lgpl3+)))
294 (define-public python-fenics-ufl
296 (name "python-fenics-ufl")
301 (uri (pypi-uri "fenics-ufl" version))
304 "10dz8x3lm68x2w3kkqcjask38h0zkhhak26jdbkppr8g9y8wny7p"))))
305 (build-system python-build-system)
307 `(("python-numpy" ,python-numpy)))
309 `(("python-pytest" ,python-pytest)))
312 (modify-phases %standard-phases
316 (string-append (getcwd) ":" (getenv "PYTHONPATH")))
317 (with-directory-excursion "test"
320 (home-page "https://bitbucket.org/fenics-project/ufl/")
321 (synopsis "Unified language for form-compilers")
322 (description "The Unified Form Language (UFL) is a domain specific
323 language for declaration of finite element discretizations of
324 variational forms. More precisely, it defines a flexible interface
325 for choosing finite element spaces and defining expressions for weak
326 forms in a notation close to mathematical notation.
328 UFL is part of the FEniCS Project.")
329 (license license:lgpl3+)))
331 (define-public python-fenics-fiat
333 (name "python-fenics-fiat")
338 (uri (pypi-uri "fenics-fiat" version))
341 "13sc7lma3d2mh43an7i4kkdbbk4cmvxjk45wi43xnjd7qc38zg4b"))))
342 (build-system python-build-system)
344 `(("python-pytest" ,python-pytest)))
346 `(("python-numpy" ,python-numpy)
347 ("python-sympy" ,python-sympy)))
350 (modify-phases %standard-phases
354 (string-append (getcwd) ":" (getenv "PYTHONPATH")))
355 (with-directory-excursion "test"
356 ;; FIXME: three FIAT test modules are known to fail
357 ;; with recent versions of pytest (>= 4). These are
358 ;; skipped for FIAT version 2019.1.0 pending an
359 ;; upstream pull request. For details see request #59
360 ;; at https://bitbucket.org/fenics-project/fiat/.
361 (invoke "py.test" "unit/"
362 "--ignore=unit/test_fiat.py"
363 "--ignore=unit/test_quadrature.py"
364 "--ignore=unit/test_reference_element.py"))
366 (home-page "https://bitbucket.org/fenics-project/fiat/")
367 (synopsis "Tabulation of finite element function spaces")
369 "The FInite element Automatic Tabulator (FIAT) supports
370 generation of arbitrary order instances of the Lagrange elements on
371 lines, triangles, and tetrahedra. It is also capable of generating
372 arbitrary order instances of Jacobi-type quadrature rules on the same
373 element shapes. Further, H(div) and H(curl) conforming finite element
374 spaces such as the families of Raviart-Thomas, Brezzi-Douglas-Marini
375 and Nedelec are supported on triangles and tetrahedra. Upcoming
376 versions will also support Hermite and nonconforming elements.
378 FIAT is part of the FEniCS Project.")
379 (license license:lgpl3+)))
381 (define-public python-fenics-ffc
383 (name "python-fenics-ffc")
384 (version "2019.1.0.post0")
388 (uri (pypi-uri "fenics-ffc" version))
391 "1f2a44ha65fg3a1prrbrsz4dgvibsv0j5c3pi2m52zi93bhwwgg9"))))
392 (build-system python-build-system)
394 `(("python-pytest" ,python-pytest)))
396 `(("python-fenics-dijitso" ,python-fenics-dijitso)
397 ("python-fenics-fiat" ,python-fenics-fiat)
398 ("python-fenics-ufl" ,python-fenics-ufl)))
401 (modify-phases %standard-phases
404 (setenv "HOME" (getcwd))
406 (string-append (getcwd) ":" (getenv "PYTHONPATH")))
407 (with-directory-excursion "test"
408 ;; FIXME: the tests in subdirectory
409 ;; 'unit/ufc/finite_element' require the ffc_factory
410 ;; extension module. This module, located in the 'libs'
411 ;; subdirectory, needs to be built and made accessible
412 ;; prior to running the tests.
413 (invoke "py.test" "unit/" "--ignore=unit/ufc/")
414 (with-directory-excursion "uflacs"
415 (invoke "py.test" "unit/")))
417 (home-page "https://bitbucket.org/fenics-project/ffc/")
418 (synopsis "Compiler for finite element variational forms")
419 (description "The FEniCS Form Compiler (FFC) is a compiler for
420 finite element variational forms. From a high-level description of
421 the form, it generates efficient low-level C++ code that can be used
422 to assemble the corresponding discrete operator (tensor). In
423 particular, a bilinear form may be assembled into a matrix and a
424 linear form may be assembled into a vector. FFC may be used either
425 from the command line (by invoking the @code{ffc} command) or as a
426 Python module (@code{import ffc}).
428 FFC is part of the FEniCS Project.")
429 ;; There are two files released with a public domain licence;
430 ;; ufc.h and ufc_geometry.h, in subdirectory 'ffc/backends/ufc'.
431 (license (list license:public-domain license:lgpl3+))))
433 (define-public fenics-dolfin
435 (name "fenics-dolfin")
436 (version "2019.1.0.post0")
441 "https://bitbucket.org/fenics-project/dolfin/get/"
443 (file-name (string-append name "-" version ".tar.gz"))
446 "1m91hwcq5gfj4qqswp8l8kj58nia48f0n4kq13w0xqj4biq7rla0"))
447 (modules '((guix build utils)))
450 ;; Make sure we don't use the bundled test framework.
451 (delete-file-recursively "test/unit/cpp/catch")
452 (substitute* "test/unit/cpp/main.cpp"
453 ;; Use standard search paths for 'catch' header file.
455 "#include <catch.hpp>\n"))
456 (substitute* "test/unit/cpp/CMakeLists.txt"
457 ;; Specify directory to find the header file.
458 (("(^set\\(CATCH_INCLUDE_DIR ).*(/catch\\))" _ front back)
460 "$ENV{CATCH_DIR}/include" back "\n")))
462 (build-system cmake-build-system)
467 ("hdf5" ,hdf5-parallel-openmpi)
472 ("scotch" ,pt-scotch32)
473 ("suitesparse" ,suitesparse)
474 ("sundials" ,sundials-openmpi)
477 `(("catch" ,catch-framework2-1)
478 ("pkg-config" ,pkg-config)))
480 `(("ffc" ,python-fenics-ffc)
481 ("petsc" ,petsc-openmpi)
482 ("slepc" ,slepc-openmpi)))
485 `("-DDOLFIN_ENABLE_DOCS:BOOL=OFF"
486 "-DDOLFIN_ENABLE_HDF5:BOOL=ON"
487 "-DDOLFIN_ENABLE_MPI:BOOL=ON"
488 "-DDOLFIN_ENABLE_PARMETIS:BOOL=OFF"
489 "-DDOLFIN_ENABLE_SCOTCH:BOOL=ON"
490 "-DDOLFIN_ENABLE_SUNDIALS:BOOL=ON"
491 "-DDOLFIN_ENABLE_TRILINOS:BOOL=OFF")
493 (modify-phases %standard-phases
494 (add-after 'patch-usr-bin-file 'mpi-setup
496 (add-after 'patch-source-shebangs 'set-paths
498 ;; Define paths to store locations.
499 (setenv "BLAS_DIR" (assoc-ref %build-inputs "blas"))
500 (setenv "CATCH_DIR" (assoc-ref %build-inputs "catch"))
501 (setenv "LAPACK_DIR" (assoc-ref %build-inputs "lapack"))
502 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
503 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
504 (setenv "SCOTCH_DIR" (assoc-ref %build-inputs "scotch"))
505 (setenv "SUNDIALS_DIR" (assoc-ref %build-inputs "sundials"))
506 (setenv "UMFPACK_DIR" (assoc-ref %build-inputs "suitesparse"))
508 (add-before 'check 'pre-check
510 ;; The Dolfin repository uses git-lfs, whereby web links are
511 ;; substituted for large files. Guix does not currently support
512 ;; git-lfs, so only the links are downloaded. The tests that
513 ;; require the absent meshes cannot run and are skipped.
515 ;; Two other serial tests fail and are skipped.
516 ;; i) demo_stokes-iterative_serial,
517 ;; The MPI_Comm_rank() function was called before MPI_INIT was
519 ;; ii) demo_multimesh-stokes_serial:
520 ;; Warning: Found no facets matching domain for boundary
523 ;; One mpi test fails and is skipped.
524 ;; i) demo_stokes-iterative_mpi:
525 ;; The MPI_Comm_rank() function was called before MPI_INIT was
527 (call-with-output-file "CTestCustom.cmake"
531 "set(CTEST_CUSTOM_TESTS_IGNORE "
534 "demo_eigenvalue_serial "
535 "demo_eigenvalue_mpi "
536 "demo_navier-stokes_serial "
537 "demo_navier-stokes_mpi "
538 "demo_stokes-taylor-hood_serial "
539 "demo_stokes-taylor-hood_mpi "
540 "demo_subdomains_serial "
541 "demo_advection-diffusion_serial "
542 "demo_advection-diffusion_mpi "
543 "demo_auto-adaptive-navier-stokes_serial "
544 "demo_contact-vi-snes_serial "
545 "demo_contact-vi-snes_mpi "
546 "demo_contact-vi-tao_serial "
547 "demo_contact-vi-tao_mpi "
548 "demo_curl-curl_serial "
549 "demo_curl-curl_mpi "
550 "demo_dg-advection-diffusion_serial "
551 "demo_dg-advection-diffusion_mpi "
552 "demo_elasticity_serial "
553 "demo_elasticity_mpi "
554 "demo_elastodynamics_serial "
555 "demo_elastodynamics_mpi "
556 "demo_lift-drag_serial "
557 "demo_lift-drag_mpi "
558 "demo_mesh-quality_serial "
559 "demo_mesh-quality_mpi "
560 "demo_multimesh-stokes_serial "
561 "demo_stokes-iterative_serial "
562 "demo_stokes-iterative_mpi "
567 (and (invoke "make" "unittests")
568 (invoke "make" "demos")
569 (invoke "ctest" "-R" "unittests")
570 (invoke "ctest" "-R" "demo" "-R" "serial")
571 (invoke "ctest" "-R" "demo" "-R" "mpi")))))))
572 (home-page "https://bitbucket.org/fenics-project/dolfin/")
573 (synopsis "Problem solving environment for differential equations")
575 "DOLFIN is a computational framework for finding numerical
576 solutions to problems described by differential equations. Numerical
577 models in DOLFIN are constructed using general families of finite
578 elements. Data structures are provided for discretizing the governing
579 system on a computational mesh. A compact syntax, similar to
580 mathematical notation, is made available for defining function spaces
581 and expressing variational forms. Interfaces to specialized matrix
582 solvers are provided for solving the resultant linear systems.
584 @code{fenics-dolfin} is part of the FEniCS project. It is the C++
585 user interface to the FEniCS core components and external libraries.")
586 ;; The source code for the DOLFIN C++ library is licensed under the
587 ;; GNU Lesser General Public License, version 3 or later, with the
588 ;; following exceptions:
590 ;; public-domain: dolfin/geometry/predicates.cpp
591 ;; dolfin/geometry/predicates.h
593 ;; zlib: dolfin/io/base64.cpp
594 ;; dolfin/io/base64.h
596 ;; expat: dolfin/io/pugiconfig.hpp
597 ;; dolfin/io/pugixml.cpp
598 ;; dolfin/io/pugixml.hpp
599 (license (list license:public-domain
604 (define-public fenics
605 (package (inherit fenics-dolfin)
607 (build-system python-build-system)
609 `(("pybind11" ,pybind11)
610 ("python-matplotlib" ,python-matplotlib)
611 ,@(alist-delete "python" (package-inputs fenics-dolfin))))
613 `(("cmake" ,cmake-minimal)
615 ("pytest" ,python-pytest)
616 ("python-decorator" ,python-decorator)
617 ("python-pkgconfig" ,python-pkgconfig)
618 ,@(package-native-inputs fenics-dolfin)))
620 `(("dolfin" ,fenics-dolfin)
621 ("petsc4py" ,python-petsc4py)
622 ("slepc4py" ,python-slepc4py)))
625 (modify-phases %standard-phases
626 (add-after 'patch-source-shebangs 'set-paths
628 ;; Define paths to store locations.
629 (setenv "PYBIND11_DIR" (assoc-ref %build-inputs "pybind11"))
630 ;; Move to python sub-directory.
633 (add-after 'build 'mpi-setup
635 (add-before 'check 'pre-check
637 ;; Exclude three tests that generate
638 ;; 'NotImplementedError' in matplotlib version 3.1.2.
640 ;; <https://github.com/matplotlib/matplotlib/issues/15382>.
641 ;; Also exclude tests that require meshes supplied by
643 (substitute* "demo/test.py"
644 (("(.*stem !.*)" line)
648 "'built-in-meshes', \n"
649 "'hyperelasticity', \n"
651 "'multimesh-quadrature', \n"
652 "'multimesh-marking', \n"
653 "'mixed-poisson-sphere', \n"
656 "'elastodynamics', \n"
657 "'dg-advection-diffusion', \n"
659 "'contact-vi-tao', \n"
660 "'contact-vi-snes', \n"
661 "'collision-detection', \n"
663 "'auto-adaptive-navier-stokes', \n"
664 "'advection-diffusion', \n"
666 "'stokes-taylor-hood', \n"
668 "'navier-stokes', \n"
671 "d for d in demos if d[0].stem not in "
673 (setenv "HOME" (getcwd))
676 (getcwd) "/build/lib.linux-x86_64-"
677 ,(version-major+minor (package-version python)) ":"
678 (getenv "PYTHONPATH")))
679 ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
680 (setenv "OPENBLAS_NUM_THREADS" "1")
684 (with-directory-excursion "test"
685 ;; Note: The test test_snes_set_from_options() in the file
686 ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
687 (and (invoke "py.test" "unit" "--ignore"
688 "unit/nls/test_PETScSNES_solver.py")
689 (invoke "mpirun" "-np" "3" "python" "-B" "-m"
690 "pytest" "unit" "--ignore"
691 "unit/nls/test_PETScSNES_solver.py")))
692 (with-directory-excursion "demo"
694 (invoke "python" "generate-demo-files.py")
695 (and (invoke "python" "-m" "pytest" "-v" "test.py")
696 (invoke "python" "-m" "pytest" "-v" "test.py"
697 "--mpiexec=mpiexec" "--num-proc=3")))
699 (add-after 'install 'install-demo-files
700 (lambda* (#:key outputs #:allow-other-keys)
701 (let* ((demos (string-append
702 (assoc-ref outputs "out")
703 "/share/python-dolfin/demo")))
705 (with-directory-excursion "demo"
706 (for-each (lambda (file)
707 (let* ((dir (dirname file))
708 (tgt-dir (string-append demos "/" dir)))
709 (unless (equal? "." dir)
711 (install-file file tgt-dir))))
712 (find-files "." ".*\\.(py|gz|xdmf)$"))))
714 (home-page "https://fenicsproject.org/")
715 (synopsis "High-level environment for solving differential equations")
717 "@code{fenics} is a computing platform for solving general classes of
718 problems that involve differential equations. @code{fenics} facilitates
719 access to efficient methods for dealing with ordinary differential
720 equations (ODEs) and partial differential equations (PDEs). Systems of
721 equations such as these are commonly encountered in areas of engineering,
722 mathematics and the physical sciences. It is particularly well-suited to
723 problems that can be solved using the Finite Element Method (FEM).
725 @code{fenics} is the top level of the set of packages that are developed
726 within the FEniCS project. It provides the python user interface to the
727 FEniCS core components and external libraries.")
728 (license license:lgpl3+)))
730 (define-public fullswof-2d
739 (url (string-append "https://subversion.renater.fr/"
740 "anonscm/svn/fullswof-2d/tags/"
742 (revision revision)))
743 (file-name (string-append "fullswof-2d-" version "-checkout"))
746 "16v08dx7h7n4wyddzbwimazwyj74ynis12mpjfkay4243npy44b8"))))
747 (build-system gnu-build-system)
749 `(("inetutils" ,inetutils))) ; for 'hostname', used in the check phase
752 (modify-phases %standard-phases
753 (delete 'configure) ; no configure script
754 (add-after 'build 'build-tools
756 (with-directory-excursion "Tools/ConvertFormat"
757 (invoke "make" "../../bin/asc2xyz")
758 (invoke "make" "../../bin/xyz2asc"))
759 (with-directory-excursion "Tools/ExtractWindow"
760 (invoke "make" "../../bin/cropxyz"))
762 (replace 'check ; no check target
764 (invoke "make" "benchref")))
765 (replace 'install ; no install target
766 (lambda* (#:key outputs #:allow-other-keys)
767 (let* ((out (assoc-ref outputs "out"))
768 (bin (string-append out "/bin"))
770 out "/share/doc/" ,name "-" ,version))
771 (examples (string-append doc "/Examples")))
772 (with-directory-excursion "bin"
773 (for-each (lambda (binary) (install-file binary bin))
774 (list "asc2xyz" "xyz2asc" "cropxyz"
776 (with-directory-excursion "doc"
777 (for-each (lambda (pdf) (install-file pdf doc))
778 (list "Documentation.pdf" "refman.pdf")))
779 (with-directory-excursion "Tools"
780 (for-each (lambda (dir)
782 (string-append dir "/README.txt")
783 (string-append doc "/README_" dir ".txt")))
784 (list "ConvertFormat" "ExtractWindow")))
785 (copy-recursively "Examples" examples)
787 (home-page "https://www.idpoisson.fr/fullswof/")
788 (synopsis "Two dimensional flow solver for flood modelling")
789 (description "@code{FullSWOF_2d} is a numerical tool for solving
790 the shallow water equations on structured grids. The name FullSWOF
791 refers to the Full form of the Shallow Water equations for Overland
792 Flow. The discretized system of equations is solved using the finite
793 volume method. A choice of shock-capturing methods is available to
794 locate the transition boundaries between the wet areas and the dry
795 areas in the model. A semi-implicit method is used to advance the
796 solution in time. The tool is typically applied to the modelling of
798 (license license:cecill))))