Toggle diff (402 lines)
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index ab4f7c124f..4dc8c9e30e 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -88,334 +88,6 @@ (define-module (gnu packages simulation)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1))
-(define-public openfoam-org
- (package
- (name "openfoam-org")
- (version "10.20230119")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url (string-append "https://github.com/OpenFOAM/OpenFOAM-"
- (version-major version)))
- (commit (second (string-split version #\.)))))
- (sha256
- (base32
- "0icvwg7s6vnkgmdiczivia9pbrgx8nanw9a4j080fzfvdv9vxhzp"))
- (file-name (git-file-name name version))
- (modules '((guix build utils)))
- (snippet `(begin
- ;; patch shell paths
- (substitute* (list "wmake/src/Makefile"
- "wmake/makefiles/general")
- (("/bin/sh")
- "sh"))
- (substitute* "etc/bashrc"
- ;; only go back one folder level
- (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
- "$(dirname ${BASH_SOURCE:-$0})/..")
- ;; do not use openfoam folder convention
- (("^export WM_PROJECT_DIR=.*$")
- (string-append
- "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR\n"))
- ;; do not source bash_completion (gives error)
- (("^.*bash_completion.*$" all)
- (string-append "#" all))
- ;; set same version as guix package
- (("^export WM_PROJECT_VERSION=.*$")
- (string-append "export WM_PROJECT_VERSION="
- ,version "\n")))
- ;; add expand flag to RunFunctions
- (substitute* "bin/tools/RunFunctions"
- (("foamDictionary (.*)" all args)
- (string-append "foamDictionary -expand " args)))
- ;; disable failing test
- (substitute* "test/postProcessing/channel/Allrun"
- (("^.*getApplication.*$" all)
- (string-append "#" all "\n")))))))
- (build-system gnu-build-system)
- (inputs (list boost
- cgal
- git
- gmp
- libxt
- metis
- mpfr
- ncurses
- openmpi
- openssh
- paraview
- pt-scotch32
- readline
- zlib))
- (native-inputs (list bison
- flex
- ;; paraview plugin dependencies
- cli11
- cmake-minimal
- cgns
- curl
- double-conversion
- eigen
- expat
- ffmpeg
- fmt
- freetype
- gdal
- gl2ps
- glew
- gmsh
- hdf5
- jsoncpp
- libjpeg-turbo
- libogg
- libpng
- libharu
- libtheora
- libtiff
- libx11
- libxml2
- lz4
- netcdf
- nlohmann-json
- proj
- protobuf
- pugixml
- python
- python-mpi4py
- qtbase-5
- qtsvg-5
- qttools-5
- qtwebengine-5
- qtxmlpatterns
- utfcpp
- vtk
- xz))
- (propagated-inputs (list gnuplot))
- (outputs '("debug" ;~60MB
- "out"))
- (arguments
- (list
- ;; Executable files and shared libraries are located in the 'platforms'
- ;; subdirectory.
- #:strip-directories
- #~(list "share/OpenFOAM/platforms/linux64GccDPInt32Opt/bin"
- "share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib")
-
- #:modules
- '((ice-9 ftw)
- (ice-9 regex)
- (ice-9 string-fun)
- (srfi srfi-1)
- (guix build gnu-build-system)
- (guix build utils))
-
- #:phases
- #~(modify-phases %standard-phases
- (add-before 'build 'patch-HOME-path
- (lambda _
- (setenv "HOME" "/tmp")))
- (add-before 'build 'rename-self
- (lambda _
- ;; The script 'bin/foamEtcFile' derives the version name based
- ;; on the current directory name (!), so make sure to follow the
- ;; expected naming convention.
- (let ((here (canonicalize-path "."))
- (target #$(string-append
- "OpenFOAM-"
- (string-map (match-lambda
- (#\. #\-)
- (chr chr))
- (package-version this-package)))))
- (chdir "..")
- (format #t "renaming '~a' to '~a'~%"
- here target)
- (rename-file here target)
- (chdir target))))
- (add-before 'build 'patch-scotch
- (lambda _
- (substitute* "etc/config.sh/scotch"
- (("^export SCOTCH_VERSION=scotch_.*$")
- (string-append "export SCOTCH_VERSION=scotch_"
- #$(package-version pt-scotch32) "\n"))
- (("^export SCOTCH_ARCH_PATH=.*$")
- (string-append "export SCOTCH_ARCH_PATH="
- (assoc-ref %build-inputs "pt-scotch32")
- "\n"))) #t))
- (add-before 'build 'patch-mpi
- (lambda _
- (let* ((mpi-path (assoc-ref %build-inputs "openmpi"))
- (mpi-version #$(package-version openmpi)))
- ;; specify openmpi type
- (substitute* "etc/bashrc"
- (("WM_MPLIB=SYSTEMOPENMPI")
- "WM_MPLIB=OPENMPI"))
- (substitute* "etc/config.sh/mpi"
- (("export FOAM_MPI=openmpi-.*$")
- (string-append "export FOAM_MPI=openmpi-"
- mpi-version "\n"))
- (("export MPI_ARCH_PATH=.*\\$FOAM_MPI.*$")
- (string-append "export MPI_ARCH_PATH=" mpi-path
- "\n")))) #t))
- (add-before 'build 'patch-paraview
- (lambda _
- (substitute* "etc/config.sh/paraview"
- (("^export ParaView_VERSION=.*$")
- (string-append "export ParaView_VERSION="
- #$(package-version paraview) "\n"))
- (("^export ParaView_DIR=.*$")
- (string-append "export ParaView_DIR="
- (assoc-ref %build-inputs "paraview")
- "\n"))) #t))
- (add-before 'build 'add-rpaths
- (lambda _
- (letrec* ((libraries '("boost" "cgal"
- "gmp"
- "metis"
- "mpfr"
- "pt-scotch32"
- "openmpi"
- "zlib"
- "paraview"))
- (rpaths
- (fold-right (lambda (library rpaths)
- (string-append rpaths
- "-rpath="
- (assoc-ref
- %build-inputs library)
- "/lib,")) "" libraries))
- (openfoam-lib
- (string-append #$output
- "/share/OpenFOAM/platforms/linux64GccDPInt32Opt/lib"))
- (ldflags
- (string-append "-Wl,"
- rpaths
- "-rpath="
- openfoam-lib
- ","
- "-rpath="
- openfoam-lib
- "/dummy,"
- "-rpath="
- openfoam-lib
- "/paraview-"
- #$(version-major+minor (package-version
- paraview)))))
- (substitute* "wmake/rules/linux64Gcc/c++"
- (("\\$\\(LIB_HEADER_DIRS\\) -fPIC" all)
- (string-append all " " ldflags)))) #t))
- (add-before 'build 'add-vtk-include-path
- (lambda _
- (let* ((vtk-version #$(version-major+minor
- (package-version vtk)))
- (vtk-root (assoc-ref %build-inputs "vtk"))
- (vtk-inc (string-append vtk-root "/include/vtk-" vtk-version))
- (vtk-inc-flag (string-append "-I" vtk-inc)))
- (substitute* "wmake/rules/linux64Gcc/c++"
- (("\\$\\(LIB_HEADER_DIRS\\)" all)
- (string-append all " " vtk-inc-flag " "))))
- #t))
- (delete 'configure) ;no configure phase
- (replace 'build
- (lambda _
- ;; compile OpenFOAM libraries and applications
- (invoke "bash" "-c"
- (format #f
- "source ./etc/bashrc && ./Allwmake -j~a"
- (parallel-job-count)))))
- (add-after 'build 'cleanup
- ;; Avoid unnecessary, voluminous object and dep files.
- (lambda _
- (when (file-exists? "platforms/linux64GccDPInt32Opt/src")
- (delete-file-recursively
- "platforms/linux64GccDPInt32Opt/src"))
- (when (file-exists?
- "platforms/linux64GccDPInt32OptOPENMPI")
- (delete-file-recursively
- "platforms/linux64GccDPInt32OptOPENMPI"))
- (for-each delete-file
- (find-files "." "\\.o$")) #t))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (when (file-exists? "test")
- (with-directory-excursion "test"
- (invoke "bash" "-c"
- (format #f
- "source ../etc/bashrc && ./Allrun -j~a"
- (parallel-job-count)))))
- ;; too many tutorials are failing
- ;; (with-directory-excursion "tutorials"
- ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest"))
- ) #t))
- (replace 'install
- (lambda _
- (let ((install-dir (string-append #$output
- "/share/OpenFOAM")))
- (mkdir-p install-dir) ;create install directory
- ;; move contents of build directory to install directory
- (copy-recursively "." install-dir))))
- (add-after 'install 'add-symbolic-link
- (lambda _
- (let* ((bin (string-append #$output "/bin"))
- (lib (string-append #$output "/lib"))
- (openfoam (string-append #$output
- "/share/OpenFOAM"))
- (build-bin (string-append openfoam
- "/platforms/linux64GccDPInt32Opt/bin"))
- (build-lib (string-append openfoam
- "/platforms/linux64GccDPInt32Opt/lib"))
- (foam-bin (string-append openfoam "/bin")))
- ;; add symbolic links in standard 'bin' directory
- (mkdir-p bin)
- (for-each (lambda (file)
- (unless (member file
- '("." ".."))
- (symlink (string-append build-bin "/"
- file)
- (string-append bin "/" file))))
- (scandir build-bin))
- (for-each (lambda (file)
- (unless (member file
- '("." ".."))
- (symlink (string-append foam-bin "/"
- file)
- (string-append bin "/" file))))
- (scandir foam-bin))
- ;; add symbolic link for standard 'lib' directory
- (symlink build-lib lib)) #t)))))
- (native-search-paths
- (list (search-path-specification
- (variable "WM_PROJECT_DIR")
- (separator #f)
- (files '("share/OpenFOAM")))))
- ;; 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 $(dirname $(which blockMesh))/../../../etc/bashrc
- ;; $ mkdir -p $FOAM_RUN
- ;; $ cd $FOAM_RUN
- ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
- ;; $ cd pitzDaily
- ;; $ chmod -R u+w .
- ;; $ blockMesh
- (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")))
-
-(define-public openfoam
- (deprecated-package "openfoam" openfoam-org))
-
(define-public openfoam-com
;; This is a fork of 'openfoam-org', maintained separately.
(package
@@ -745,6 +417,60 @@ (define* (openfoam-package source version name home-page synopsis)
(license license:gpl3+)
(home-page home-page))))
+(define-public openfoam-org
+ (let* ((version "11")
+ (name "openfoam-org")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/OpenFOAM/OpenFOAM-"
+ (version-major version)
+ "/archive/"
+ "version-"
+ (version-major version)
+ ".tar.gz"))
+ (sha256 (base32
+ "1h70a5ni2psx7bcx2xg6aqraj2kkbfn8mflh2akbp6k9mmpgih7b"))
+ (modules '((guix build utils)))
+ (snippet `(begin
+ ;; patch shell paths
+ (substitute* (list "wmake/src/Makefile"
+ "wmake/makefiles/general")
+ (("/bin/sh")
+ "sh"))
+ (substitute* "etc/bashrc"
+ ;; only go back one folder level
+ (("\\$\\(dirname \\$\\{BASH_SOURCE:-\\$0\\}\\)/../..")
+ "$(dirname ${BASH_SOURCE:-$0})/..")
+ ;; do not use openfoam folder convention
+ (("^export WM_PROJECT_DIR=.*$")
+ (string-append
+ "export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR
+"))
+ ;; do not source bash_completion (gives error)
+ (("^.*bash_completion.*$" all)
+ (string-append "#" all))
+ ;; set same version as guix package
+ (("^export WM_PROJECT_VERSION=.*$")
+ (string-append "export WM_PROJECT_VERSION="
+ ,version "\n")))
+ ;; add expand flag to RunFunctions
+ (substitute* "bin/tools/RunFunctions"
+ (("foamDictionary (.*)" all args)
+ (string-append "foamDictionary -expand "
+ args)))
+ ;; disable failing test
+ (substitute* "test/postProcessing/channel/Allrun"
+ (("^.*getApplication.*$" all)
+ (string-append "#" all "\n")))))))
+ (home-page "https://openfoam.org")
+ (synopsis "Framework for numerical simulation of fluid flow")
+ (template (openfoam-package source version name home-page synopsis)))
+ (package
+ (inherit template))))
+
+(define-public openfoam
+ (deprecated-package "openfoam" openfoam-org))
+
(define-public open-simulation-interface
(package
(name "open-simulation-interface")
--
2.41.0