summaryrefslogtreecommitdiff
path: root/gnu/packages/simulation.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/simulation.scm')
-rw-r--r--gnu/packages/simulation.scm112
1 files changed, 93 insertions, 19 deletions
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 26e26b351e..f5fe3fcf1d 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -43,6 +43,7 @@
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-science)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
#:use-module (gnu packages tls)
@@ -50,6 +51,7 @@
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix svn-download)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
@@ -821,33 +823,29 @@ tools and a collection of Python modules for programmatic use.")
(define-public python-pygmsh
(package
(name "python-pygmsh")
- (version "7.1.9")
+ (version "7.1.11")
(source
(origin
- (method url-fetch)
- (uri (pypi-uri "pygmsh" version))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nschloe/pygmsh")
+ (commit version)))
+ (file-name (git-file-name name version))
(sha256
(base32
- "1q7nr0cq581wlif537y6awj7vz9jywxg14c8znmsx5ip8x24754j"))
+ "0g4yllmxks7yb50vild5xi1cma0yl16vsq6rfvdwmqaj4hwxcabk"))
(modules '((guix build utils)))
(snippet
'(begin
(let ((file (open-file "setup.py" "a")))
(display "from setuptools import setup\nsetup()" file)
(close-port file))
- ;; setuptools is supplied by the build system. An extra
- ;; reference in the original configuration file triggers
- ;; an attempt to download the package again. This fails.
- ;; The extra reference is unnecessary and is removed.
+ ;; A reference to setuptools in the configuration file
+ ;; triggers an attempt to download the package from pypi.
+ ;; The reference is not needed since the package is
+ ;; provided by the build system.
(substitute* "setup.cfg"
(("^[[:blank:]]+setuptools>=42\n") ""))
- ;; FIXME: gmsh version 4.7.0 introduces new field option
- ;; names. See gmsh commit 6eab8028. pygmsh needs to use
- ;; one of the old option names for compatibility with gmsh
- ;; version 4.6.0.
- (with-directory-excursion "pygmsh/common"
- (substitute* "size_field.py"
- (("NumPointsPerCurve") "NNodesByEdge")))
#t))))
(build-system python-build-system)
(native-inputs
@@ -865,10 +863,7 @@ tools and a collection of Python modules for programmatic use.")
(lambda* (#:key inputs outputs tests? #:allow-other-keys)
(when tests?
(add-installed-pythonpath inputs outputs)
- ;; The readme test is skipped. It requires the exdown
- ;; module which is not available.
- (invoke "python" "-m" "pytest" "-v" "test"
- "--ignore" "test/test_readme.py"))
+ (invoke "python" "-m" "pytest" "-v" "tests"))
#t)))))
(home-page "https://github.com/nschloe/pygmsh")
(synopsis "Python frontend for Gmsh")
@@ -879,3 +874,82 @@ way the meshing of complex geometries using high-level abstractions is
made possible. The package provides a Python library together with a
command-line utility for mesh optimisation.")
(license license:lgpl3)))
+
+(define-public python-dolfin-adjoint
+ (package
+ (name "python-dolfin-adjoint")
+ (version "2019.1.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dolfin-adjoint/pyadjoint")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0xhy76a5f33hz94wc9g2mc5qmwkxfccbbc6yxl7psm130afp8lhn"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; One of the migration tests attempts to call openmpi
+ ;; recursively and fails. See
+ ;; https://bitbucket.org/mpi4py/mpi4py/issues/95. Run the
+ ;; test sequentially instead.
+ (with-directory-excursion "tests/migration/optimal_control_mms"
+ (substitute* "test_optimal_control_mms.py"
+ (("\\\"mpirun\\\", \\\"-n\\\", \\\"2\\\", ") "")))
+ ;; Result files are regenerated in the check phase.
+ (delete-file-recursively
+ "tests/migration/viscoelasticity/test-results")
+ #t))))
+ (build-system python-build-system)
+ (inputs
+ `(("fenics" ,fenics)
+ ("openmpi" ,openmpi)
+ ("pybind11" ,pybind11)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("python-coverage" ,python-coverage)
+ ("python-decorator" ,python-decorator)
+ ("python-flake8" ,python-flake8)
+ ("python-pkgconfig" ,python-pkgconfig)
+ ("python-pytest" ,python-pytest)))
+ (propagated-inputs
+ `(("scipy" ,python-scipy)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'build 'mpi-setup
+ ,%openmpi-setup)
+ (add-after 'install 'install-doc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((doc (string-append (assoc-ref outputs "out")
+ "/share/doc/" ,name "-"
+ ,version))
+ (examples (string-append doc "/examples")))
+ (mkdir-p examples)
+ (copy-recursively "examples" examples))
+ #t))
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (add-installed-pythonpath inputs outputs)
+ (setenv "HOME" (getcwd))
+ (and (invoke "py.test" "-v" "tests/fenics_adjoint")
+ (invoke "py.test" "-v" "tests/migration")
+ (invoke "py.test" "-v" "tests/pyadjoint")))
+ #t)))))
+ (home-page "http://www.dolfin-adjoint.org")
+ (synopsis "Automatic differentiation library")
+ (description "@code{python-dolfin-adjoint} is a solver of
+differential equations associated with a governing system and a
+functional of interest. Working from the forward model the solver
+automatically derives the discrete adjoint and tangent linear models.
+These additional models are key ingredients in many algorithms such as
+data assimilation, optimal control, sensitivity analysis, design
+optimisation and error estimation. The dolfin-adjoint project
+provides the necessary tools and data structures for cases where the
+forward model is implemented in @code{fenics} or
+@url{https://firedrakeproject.org,firedrake}.")
+ (license license:lgpl3)))