From patchwork Fri Sep 29 09:39:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: reza X-Patchwork-Id: 54411 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ADD5827BBE2; Fri, 29 Sep 2023 10:41:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6896527BBE9 for ; Fri, 29 Sep 2023 10:41:18 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9zO-0002UD-8z; Fri, 29 Sep 2023 05:40:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm9zM-0002TV-PU for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:48 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm9zM-0000bd-HZ for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9zb-0005TF-7A for guix-patches@gnu.org; Fri, 29 Sep 2023 05:41:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66262] [PATCH v2 1/3] gnu: Add openfoam-package. Resent-From: reza Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66262 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66262@debbugs.gnu.org <66262@debbugs.gnu.org> Cc: reza Received: via spool by 66262-submit@debbugs.gnu.org id=B66262.169598042020910 (code B ref 66262); Fri, 29 Sep 2023 09:41:03 +0000 Received: (at 66262) by debbugs.gnu.org; 29 Sep 2023 09:40:20 +0000 Received: from localhost ([127.0.0.1]:55361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9yt-0005RA-LI for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:20 -0400 Received: from a2-38.smtp-out.eu-west-1.amazonses.com ([54.240.2.38]:33063) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <0102018ae04f07c5-bbef6aff-cee5-4376-a9c3-487aa062960a-000000@mail.housseini.me>) id 1qm9yq-0005Qi-Ed for 66262@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=solmzk3ljecfoypi3q6x2mqs3bucnhjw; d=housseini.me; t=1695980390; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id; bh=684fBUDof0PM9qJRTl1GHPGkcX/MgBpbYqzAIZWc2kc=; b=TvU3uZ7KwxT/dm4JhdO8rN7zUsRZ9X2i2Ub/u6aZPflWNCIKUoqv4aREbR6CXeyP 3eQbEkRPkoR5LWiskzDvowv39g0WT/EZ236X7mC3cNtLBmjl9DGjiM+OLp7t7rFwwZz KYcHY59SpuvH4Q7LDrF6jOVzIJptx4R9RXDQpULI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=shh3fegwg5fppqsuzphvschd53n6ihuv; d=amazonses.com; t=1695980390; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id:Feedback-ID; bh=684fBUDof0PM9qJRTl1GHPGkcX/MgBpbYqzAIZWc2kc=; b=Lrp9/MX6muwpgNsc3lyJjWBfh44xRghxNu69MP6bOYVEhjyWnumnu+FdU6M0YC/n 70LJgjIt7choFgOn/Afj5isBuaRohC9NeV3JbnQAhrGfLWTK27EUMl4bN7FVMsxCJKT 6MDSujDTkQaXuedMIyisDQU7q5EJ3/p+kmYfw+YM= Date: Fri, 29 Sep 2023 09:39:50 +0000 Mime-Version: 1.0 In-Reply-To: References: <8f684396d68f2748f0b5e9ea832e483438cf195d.1695980074.git.reza@housseini.me> X-Mailer: Amazon WorkMail Thread-Index: AQHZ8rjeLcEuk4eZQkmvQkUg1RLw8AAAAWa6 Thread-Topic: [PATCH v2 1/3] gnu: Add openfoam-package. X-Wm-Sent-Timestamp: 1695980389 X-Original-Mailer: git-send-email 2.41.0 Message-ID: <0102018ae04f07c5-bbef6aff-cee5-4376-a9c3-487aa062960a-000000@eu-west-1.amazonses.com> Feedback-ID: 1.eu-west-1.b24dn6frgCi6dh20skzbuMRr7UL8M6Soir/3ogtEjHQ=:AmazonSES X-SES-Outgoing: 2023.09.29-54.240.2.38 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: reza X-ACL-Warn: , reza via Guix-patches X-Patchwork-Original-From: reza via Guix-patches via From: reza Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/simulation.scm (openfoam-package): Add factory function to generate openfoam packages. Improve build tree clean up. --- gnu/packages/simulation.scm | 295 ++++++++++++++++++++++++++++++++++++ 1 file changed, 295 insertions(+) -- 2.41.0 diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm index b2fb123815..ab4f7c124f 100644 --- a/gnu/packages/simulation.scm +++ b/gnu/packages/simulation.scm @@ -450,6 +450,301 @@ (define-public openfoam-com (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)") (home-page "https://www.openfoam.com"))) +(define* (openfoam-package source version name home-page synopsis) + (let* ((install-path (string-append "share/OpenFOAM-" version)) + (paraview-version (version-major+minor (package-version paraview))) + (pv-plugin-path + (string-append install-path + "/platforms/linux64GccDPInt32Opt/lib/paraview-" + paraview-version))) + (package + (name name) + (version version) + (source source) + (build-system gnu-build-system) + (native-search-paths + (list (search-path-specification + (variable "WM_PROJECT_DIR") + (files `(,install-path))) + ;; add PV_PLUGIN_PATH to LD_LIBRARY_PATH so paraview + ;; finds the OpenFOAM PV plugins + (search-path-specification + (variable "LD_LIBRARY_PATH") + (files `(,pv-plugin-path))))) + (inputs (list boost + cgal + git + gmp + libxt + metis + mpfr + ncurses + openmpi + openssh + paraview + pt-scotch32 + readline + scotch + 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 (string-append "OpenFOAM-" #$version "/platforms/linux64GccDPInt32Opt/bin") + (string-append "OpenFOAM-" #$version "/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") #t)) + (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=" #$pt-scotch32 "\n"))) + #t)) + (add-before 'build 'patch-mpi + (lambda _ + (let* ((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=" #$openmpi "\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=" #$paraview "\n")) + (("export ParaView_GL=mesa") "export ParaView_GL=system")) + #t)) + (add-before 'build 'add-rpaths + (lambda _ + (letrec* ((libraries '("boost" + "cgal" + "gmp" + "metis" + "mpfr" + "scotch" + "pt-scotch32" + "openmpi" + "zlib" + "paraview")) + (rpaths + (fold-right (lambda (lib rpaths) + (string-append rpaths + "-rpath=" + (assoc-ref %build-inputs lib) + "/lib,")) "" libraries)) + (openfoam-lib + (string-append #$output + "/share/OpenFOAM-" #$version + "/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-inc (string-append #$vtk "/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$")) + ;; Remove spurious files in src tree + (invoke "bash" "-c" "source ./etc/bashrc && wclean all") + #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))) + ;; cleanup + (invoke "bash" "-c" + "source ../etc/bashrc && ./Allclean"))) + ;; too many tutorials are failing + ;; (with-directory-excursion "tutorials" + ;; (invoke "bash" "-c" "source ../etc/bashrc && ./Alltest")) + ) #t)) + (add-before 'install 'set-paths + (lambda _ + (let ((install-path (string-append #$output + "/share/OpenFOAM-" #$version))) + (substitute* "etc/bashrc" + (("^\\[ \"\\$BASH\".*$") "") + (("^export FOAM_INST_DIR=\\$\\(cd.*$") + (string-append "export FOAM_INST_DIR=" install-path "\n")) + (("^export FOAM_INST_DIR=\\$HOME.*$") ""))) + #t)) + (replace 'install + (lambda* (#:key outputs inputs #:allow-other-keys) + (let ((install-path (string-append #$output + "/share/OpenFOAM-" #$version))) + (mkdir-p install-path) ;create install directory + ;; move contents of build directory to install directory + (copy-recursively "." install-path)))) + (add-after 'install 'add-symbolic-link + (lambda _ + (let* ((bin (string-append #$output "/bin")) + (lib (string-append #$output "/lib")) + (openfoam (string-append #$output + "/share/OpenFOAM-" #$version)) + (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))))) + ;; 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 $WM_PROJECT_DIR/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily . + ;; $ cd pitzDaily + ;; $ chmod -R u+w . + ;; $ blockMesh + (synopsis synopsis) + (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 home-page)))) + (define-public open-simulation-interface (package (name "open-simulation-interface") From patchwork Fri Sep 29 09:39:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: reza X-Patchwork-Id: 54410 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 772F427BBEA; Fri, 29 Sep 2023 10:41:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,PDS_BAD_THREAD_QP_64,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B6E7027BBE2 for ; Fri, 29 Sep 2023 10:41:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9zO-0002UL-IN; Fri, 29 Sep 2023 05:40:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm9zN-0002Tf-6N for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:49 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm9zM-0000bm-V6 for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9zb-0005TN-KP for guix-patches@gnu.org; Fri, 29 Sep 2023 05:41:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66262] [PATCH v2 2/3] gnu: openfoam-org: Update to 11. Resent-From: reza Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66262 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66262@debbugs.gnu.org <66262@debbugs.gnu.org> Cc: reza Received: via spool by 66262-submit@debbugs.gnu.org id=B66262.169598042520927 (code B ref 66262); Fri, 29 Sep 2023 09:41:03 +0000 Received: (at 66262) by debbugs.gnu.org; 29 Sep 2023 09:40:25 +0000 Received: from localhost ([127.0.0.1]:55364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9yy-0005RT-E7 for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:25 -0400 Received: from a50-247.smtp-out.eu-west-1.amazonses.com ([54.240.50.247]:51701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <0102018ae04f1969-8ad09224-8477-4bfa-9a64-bc6caec1edef-000000@mail.housseini.me>) id 1qm9yw-0005Qw-Hk for 66262@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=solmzk3ljecfoypi3q6x2mqs3bucnhjw; d=housseini.me; t=1695980395; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id; bh=GuwCc+3LFfoYPexVUfeb3t8uNvlGFgUiIa5eE/DxFjs=; b=LYY8x1IY7xeigo6B6L6QP3EyKdcnWu/wDSe37kbsu3OgQtNxr4pa7SiPjjOL774C GWMzORhzPjJIg7473cLzLW0J8E/+kw2aPp7kv1AG4Qw/rZhCUaG7Mpoc5kUBTbqEc13 JRKRr/+ClTFX2QnT6gNAky8DDSTRGpD1t70CEduw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=shh3fegwg5fppqsuzphvschd53n6ihuv; d=amazonses.com; t=1695980395; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id:Feedback-ID; bh=GuwCc+3LFfoYPexVUfeb3t8uNvlGFgUiIa5eE/DxFjs=; b=dcLZTB2R96HO6Mhh1QQ0R4TyL0Y17CVbp8uu6C0gkmvAKjyYvATmNRBJJITKTS3m QC0okWcbOaRm0iGmzf3Y7H1l1rOdo7YKbCRcqU9Nn1tm9nwPUvNjxUvzlsxOHqQIUBt 6EighHoi5kG5lTHrWWq9TKf1RfKakEKozrz4ap9Y= Date: Fri, 29 Sep 2023 09:39:54 +0000 Mime-Version: 1.0 In-Reply-To: References: X-Mailer: Amazon WorkMail Thread-Index: AQHZ8rjeLcEuk4eZQkmvQkUg1RLw8AAAAhKM Thread-Topic: [PATCH v2 2/3] gnu: openfoam-org: Update to 11. X-Wm-Sent-Timestamp: 1695980394 X-Original-Mailer: git-send-email 2.41.0 Message-ID: <0102018ae04f1969-8ad09224-8477-4bfa-9a64-bc6caec1edef-000000@eu-west-1.amazonses.com> Feedback-ID: 1.eu-west-1.b24dn6frgCi6dh20skzbuMRr7UL8M6Soir/3ogtEjHQ=:AmazonSES X-SES-Outgoing: 2023.09.29-54.240.50.247 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: reza X-ACL-Warn: , reza via Guix-patches X-Patchwork-Original-From: reza via Guix-patches via From: reza Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/simulation.scm (openfoam-org): Update to 11. Use openfoam-package factory function to create package. --- gnu/packages/simulation.scm | 382 +++++------------------------------- 1 file changed, 54 insertions(+), 328 deletions(-) -- 2.41.0 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") From patchwork Fri Sep 29 09:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: reza X-Patchwork-Id: 54412 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D797427BBEB; Fri, 29 Sep 2023 10:41:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,PDS_BAD_THREAD_QP_64,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F2C0827BBE2 for ; Fri, 29 Sep 2023 10:41:20 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9zP-0002Ui-Q9; Fri, 29 Sep 2023 05:40:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qm9zN-0002U2-Pq for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:49 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm9zN-0000bu-Hn for guix-patches@gnu.org; Fri, 29 Sep 2023 05:40:49 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9zc-0005TV-5U for guix-patches@gnu.org; Fri, 29 Sep 2023 05:41:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66262] [PATCH v2 3/3] gnu: openfoam-com: Update to 2306. Resent-From: reza Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:41:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66262 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66262@debbugs.gnu.org <66262@debbugs.gnu.org> Cc: reza Received: via spool by 66262-submit@debbugs.gnu.org id=B66262.169598043020948 (code B ref 66262); Fri, 29 Sep 2023 09:41:04 +0000 Received: (at 66262) by debbugs.gnu.org; 29 Sep 2023 09:40:30 +0000 Received: from localhost ([127.0.0.1]:55367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9z4-0005Ro-Ck for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:30 -0400 Received: from a2-84.smtp-out.eu-west-1.amazonses.com ([54.240.2.84]:38053) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <0102018ae04f2efe-cfe8b6be-e0a5-4996-a9b9-4da65ceb5dcd-000000@mail.housseini.me>) id 1qm9z0-0005RK-TB for 66262@debbugs.gnu.org; Fri, 29 Sep 2023 05:40:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=solmzk3ljecfoypi3q6x2mqs3bucnhjw; d=housseini.me; t=1695980400; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id; bh=qkNgIy/fwWMl8J1CeOVdJwLnZ9Om6spndHv+i4OPuNw=; b=QpsFlV4/wJVBUfZQcjN3zEp3Z66qNYU+ibitfKNrRvsEKvFT3Gf5CqlRqNPmroL5 6HP2QDUelQdqxsR3DhxHHsKK/ekoURIgXBlR/TwpIBt47WMucFQTP6OrCYF+lvUI5IK MRFBDvXgwqbVQzwsJh8l03mrF/D0oLqCNNGRGMco= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=shh3fegwg5fppqsuzphvschd53n6ihuv; d=amazonses.com; t=1695980400; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References:Message-Id:Feedback-ID; bh=qkNgIy/fwWMl8J1CeOVdJwLnZ9Om6spndHv+i4OPuNw=; b=VXgh6p9/QeYuYDB7fprTtzo4ovLDzmtUgv1GYfyp6GJEignABQtZpeExHY7w86zr JPU+HkN4htJ1nSSbW6/kG8aF5rFTn/xXE56z/PWIupzVgvjszLTEnre4Z87sinYqBoE 9WDdqgH7n/nOn9So6h/lkDEO0t+OklxtJhBZlbpA= Date: Fri, 29 Sep 2023 09:40:00 +0000 Mime-Version: 1.0 In-Reply-To: References: <9141e57d9db9be29442325736da07e61ff3c5420.1695980074.git.reza@housseini.me> X-Mailer: Amazon WorkMail Thread-Index: AQHZ8rjeLcEuk4eZQkmvQkUg1RLw8AAAAuZL Thread-Topic: [PATCH v2 3/3] gnu: openfoam-com: Update to 2306. X-Wm-Sent-Timestamp: 1695980399 X-Original-Mailer: git-send-email 2.41.0 Message-ID: <0102018ae04f2efe-cfe8b6be-e0a5-4996-a9b9-4da65ceb5dcd-000000@eu-west-1.amazonses.com> Feedback-ID: 1.eu-west-1.b24dn6frgCi6dh20skzbuMRr7UL8M6Soir/3ogtEjHQ=:AmazonSES X-SES-Outgoing: 2023.09.29-54.240.2.84 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: reza X-ACL-Warn: , reza via Guix-patches X-Patchwork-Original-From: reza via Guix-patches via From: reza Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/simulation (openfoam-com): Update to 2306. Use openfoam-package factory function to create package. --- gnu/packages/simulation.scm | 70 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) -- 2.41.0 diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm index 4dc8c9e30e..c712693e6e 100644 --- a/gnu/packages/simulation.scm +++ b/gnu/packages/simulation.scm @@ -88,40 +88,6 @@ (define-module (gnu packages simulation) #:use-module (ice-9 regex) #:use-module (srfi srfi-1)) -(define-public openfoam-com - ;; This is a fork of 'openfoam-org', maintained separately. - (package - (inherit openfoam-org) - (name "openfoam-com") - (version "2212") - (source (origin - (method url-fetch) - (uri (string-append "https://develop.openfoam.com" - "/Development/openfoam/-/archive/OpenFOAM-v" - version - "/openfoam-OpenFOAM-v" - version - ".tar.gz")) - (sha256 - (base32 - "0i9039hfz9gvgymkdjhjvvn5500zha3cpdbpqrzfrfi8lbz10is2")) - (modules '((guix build utils))) - (snippet `(begin - (substitute* "etc/bashrc" - ;; set same version as guix package - (("^export WM_PROJECT_VERSION=.*$") - (string-append "export WM_PROJECT_VERSION=" - ,version "\n"))) - ;; patch shell paths - (substitute* (list "src/OSspecific/POSIX/POSIX.C" - "wmake/src/Makefile" - "wmake/makefiles/general" - "wmake/makefiles/info") - (("/bin/sh") - "sh")))))) - (synopsis "Framework for numerical simulation of fluid flow (from openfoam.com)") - (home-page "https://www.openfoam.com"))) - (define* (openfoam-package source version name home-page synopsis) (let* ((install-path (string-append "share/OpenFOAM-" version)) (paraview-version (version-major+minor (package-version paraview))) @@ -471,6 +437,42 @@ (define-public openfoam-org (define-public openfoam (deprecated-package "openfoam" openfoam-org)) +(define-public openfoam-com + ;; This is a fork of 'openfoam-org', maintained separately. + (let* ((version "2306") + (name "openfoam-com") + (source (origin + (method url-fetch) + (uri (string-append "https://develop.openfoam.com" + "/Development/openfoam/-/archive/OpenFOAM-v" + version + "/openfoam-OpenFOAM-v" + version + ".tar.gz")) + (sha256 (base32 + "0zlkp48vygl2a5cyl0mfpj8dsb5bffviq96rg3kws1l6ni40v7jr")) + (modules '((guix build utils))) + (snippet `(begin + (substitute* "etc/bashrc" + ;; set same version as guix package + (("^export WM_PROJECT_VERSION=.*$") + (string-append "export WM_PROJECT_VERSION=" + ,version "\n"))) + ;; patch shell paths + (substitute* (list + "src/OSspecific/POSIX/POSIX.C" + "wmake/src/Makefile" + "wmake/makefiles/general" + "wmake/makefiles/info") + (("/bin/sh") + "sh")))))) + (home-page "https://www.openfoam.com") + (synopsis + "Framework for numerical simulation of fluid flow (from openfoam.com)") + (template (openfoam-package source version name home-page synopsis))) + (package + (inherit template)))) + (define-public open-simulation-interface (package (name "open-simulation-interface")