guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: Add python-dolfin-adjoint.


From: guix-commits
Subject: branch master updated: gnu: Add python-dolfin-adjoint.
Date: Thu, 22 Jul 2021 05:09:11 -0400

This is an automated email from the git hooks/post-receive script.

pgarlick pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new b05a1eb  gnu: Add python-dolfin-adjoint.
b05a1eb is described below

commit b05a1eb5e36e4259fa89a75412eb4e5cc75ef21e
Author: Paul Garlick <pgarlick@tourbillion-technology.com>
AuthorDate: Thu Jul 22 09:42:37 2021 +0100

    gnu: Add python-dolfin-adjoint.
    
    * gnu/packages/simulation.scm (python-dolfin-adjoint): New variable.
---
 gnu/packages/simulation.scm | 81 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 14e91c8..96928df 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -42,6 +42,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)
@@ -49,6 +50,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)
@@ -899,3 +901,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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]