unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 3446d72c6bd1b395f239a452f47c61a8124e7880 8863 bytes (raw)
name: gnu/packages/simulation.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages simulation)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages graphics)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages m4)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages mpi)
  #:use-module (gnu packages multiprecision)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages xorg)
  #:use-module (guix download)
  #:use-module (guix build utils)
  #:use-module (guix build-system gnu)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (ice-9 ftw)
  #:use-module (ice-9 regex)
  #:use-module (srfi srfi-1))

(define-public openfoam
  (package
    (name "openfoam")
    (version "4.1")
    (source
     (origin
      (method url-fetch)
      (uri (string-append
             "http://dl.openfoam.org/source/"
             (string-map (lambda (x) (if (eq? x #\.) #\- x)) version)))
      (file-name (string-append name "-" version ".tar.gz"))
      (sha256
       (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3"))
      (patches (search-patches "openfoam-4.1-cleanup.patch"))))
    (build-system gnu-build-system)
    (inputs
     `(("boost" ,boost)
       ("cgal" ,cgal)
       ("flex" ,flex)
       ("git" ,git)
       ("gmp" ,gmp)
       ("libxt" ,libxt)
       ("metis" ,metis)
       ("mpfr" ,mpfr)
       ("ncurses" ,ncurses)
       ("readline" ,readline)
       ("scotch" ,pt-scotch32)
       ("zlib" ,zlib)))
    (native-inputs
     `(("bison" ,bison)))
    (propagated-inputs
     `(("gzip" ,gzip)
       ("gnuplot" ,gnuplot)
       ("openmpi" ,openmpi)))
    (arguments
     `(#:strip-directories (list (string-append
                                  "OpenFOAM-" ,version
                                  "/platforms/linux64GccDPInt32Opt/bin")
                                 (string-append
                                  "OpenFOAM-" ,version
                                  "/platforms/linux64GccDPInt32Opt/lib"))
                              ; executable files and shared libraries are
                              ; located in the 'platforms' subdirectory
       #:validate-runpath? #f ; '#:elf-directories' is not recognised here
       #:tests? #f            ; no tests to run
       #:phases (modify-phases %standard-phases
        (add-after 'unpack 'rename-build-directory
          (lambda _
            (use-modules (ice-9 ftw))
            (use-modules (ice-9 regex))
            (chdir "..")
            ;; use 'OpenFOAM-version' convention to match pathname expectations
            ;; in the build phase
            (let ((unpack-dir (string-append
                               (getcwd) "/"
                               (list-ref (scandir (getcwd) (lambda (name)
                                 (string-match "^OpenFOAM" name))) 0)))
                  (build-dir (string-append
                              (getcwd) "/OpenFOAM-" ,version)))
             (rename-file unpack-dir build-dir) ; re-name build directory
             (chdir (basename build-dir)))      ; move to build directory
            #t))
        (add-after 'patch-source-shebangs 'set-environment-variables
          (lambda _
            (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch")))
             ;; set variables to define store paths
             (for-each (lambda (library)
                        (setenv (string-append
                                 (string-upcase library) "_ROOT")
                                (assoc-ref %build-inputs library))) libraries))
            ;; set variables to define package versions
            (setenv "SCOTCHVERSION" ,(package-version scotch))
            (setenv "METISVERSION" ,(package-version metis))
            #t))
        (delete 'configure) ; no configure phase
        (replace 'build
          (lambda _
            ;; compile OpenFOAM libraries and applications
            (zero? (system (format #f
                             "source ./etc/bashrc && ./Allwmake -j~a"
                                (parallel-job-count))))))
        (add-after 'build 'update-configuration-files
          (lambda _
            ;; record store paths and package versions in configuration files
            (substitute* "etc/config.sh/CGAL"
                       (("$BOOST_ROOT") (getenv "BOOST_ROOT")))
            (substitute* "etc/config.sh/CGAL"
                       (("$CGAL_ROOT") (getenv "CGAL_ROOT")))
            (substitute* "etc/config.sh/metis"
                       (("$METIS_ROOT") (getenv "METIS_ROOT")))
            (substitute* "etc/config.sh/metis"
                       (("$METISVERSION") (getenv "METISVERSION")))
            (substitute* "etc/config.sh/scotch"
                       (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT")))
            (substitute* "etc/config.sh/scotch"
                       (("$SCOTCHVERSION") (getenv "SCOTCHVERSION")))
            (substitute* "etc/config.sh/settings"
                       (("$GMP_ROOT") (getenv "GMP_ROOT")))
            (substitute* "etc/config.sh/settings"
                       (("$MPFR_ROOT") (getenv "MPFR_ROOT")))
            ;; reset lockDir variable to refer to write-enabled directory
            (substitute* "wmake/wmake"
                       (("        lockDir=.*$")
                         "        lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
            (substitute* "wmake/wmakeScheduler"
                       (("lockDir=.*$")
                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
            (substitute* "wmake/wmakeSchedulerUptime"
                       (("lockDir=.*$")
                         "lockDir=$HOME/.$WM_PROJECT/.wmake\n"))
            #t))
        (replace 'install
          (lambda _
            ;; use 'OpenFOAM-version' convention
            (let ((install-dir (string-append
                                %output "/OpenFOAM-" ,version)))
              (mkdir-p install-dir) ; create install directory
              ;; move contents of build directory to install directory
              (copy-recursively "." install-dir)))))))
        ;; Note: tutorial files are installed read-only in /gnu/store.
        ;; To allow write permissions on files copied from the store a
        ;; 'chmod' step is needed before running the applications.  For
        ;; example, from a user's login:
        ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc
        ;; $ mkdir -p $FOAM_RUN
        ;; $ cd $FOAM_RUN
        ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily .
        ;; $ cd pitzdaily
        ;; $ chmod -R u+w .
        ;; $ blockMesh
    (native-search-paths
     ;; define the FOAM_INST_DIR variable
     (list (search-path-specification
            (variable "FOAM_INST_DIR")
            (files '(".")))))
    (synopsis "Framework for numerical simulation of fluid flow")
    (description "OpenFOAM provides a set of solvers and methods for tackling
problems in the field of Computational Fluid Dynamics (CFD).  It is written in
C++.  Governing equations such as the Navier-Stokes equations can be solved in
integral form.  Physical processes such as phase change, droplet transport and
chemical reaction can be modelled.  Numerical methods are included to deal with
sharp gradients, such as those encountered in flows with shock waves and flows
with gas/liquid interfaces.  Large problems may be split into smaller, connected
problems for efficient solution on parallel systems")
    (license license:gpl3+)
    (home-page "https://openfoam.org")))

debug log:

solving 3446d72c6 ...
found 3446d72c6 in https://yhetil.org/guix-patches/20170906212801.4311-1-pgarlick@tourbillion-technology.com/

applying [1/1] https://yhetil.org/guix-patches/20170906212801.4311-1-pgarlick@tourbillion-technology.com/
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
new file mode 100644
index 000000000..3446d72c6

Checking patch gnu/packages/simulation.scm...
Applied patch gnu/packages/simulation.scm cleanly.

index at:
100644 3446d72c6bd1b395f239a452f47c61a8124e7880	gnu/packages/simulation.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).