Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{cae}[foss/2021a] OpenFOAM v9 #13767

Merged
merged 3 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 301 additions & 0 deletions easybuild/easyconfigs/o/OpenFOAM/OpenFOAM-9-cleanup.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
# This patch removes all need for the ThirdParty files of OpenFOAM:
# we use EB dependencies for everything. It adjusts the paths, variables, etc
# We also let the install dir, compiler, etc be set by EB.
# Lastly, we also fix a small compile issue in 'ptscotchDecomp.C'
# by Jiri Furst <[email protected]>, based on patch for OpenFOAM 5.0 and 4.1 by
# Kenneth Hoste (HPC-UGent) and Ward Poelmans <[email protected]>
diff -ru OpenFOAM-9.orig/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-9/applications/utilities/mesh/manipulation/setSet/Allwmake
--- OpenFOAM-9.orig/applications/utilities/mesh/manipulation/setSet/Allwmake 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/applications/utilities/mesh/manipulation/setSet/Allwmake 2021-08-17 15:25:23.776492000 +0200
@@ -7,19 +7,12 @@
unset COMP_FLAGS LINK_FLAGS

# Use readline if available
-if [ -f /usr/include/readline/readline.h ]
+if [ -f $EBROOTLIBREADLINE/include/readline/readline.h ]
then
echo " found <readline/readline.h> -- enabling readline support."
export COMP_FLAGS="-DHAS_READLINE"

- # readline may require ncurses
- if [ -f /usr/include/ncurses/ncurses.h ]
- then
- echo " found <ncurses/ncurses.h> -- maybe required by readline."
- export LINK_FLAGS="-lreadline -lncurses"
- else
- export LINK_FLAGS="-lreadline"
- fi
+ export LINK_FLAGS="-L$EBROOTLIBREADLINE/lib -lreadline -L$EBROOTNCURSES -lncurses"
fi

wmake $targetType
diff -ru OpenFOAM-9.orig/applications/utilities/postProcessing/graphics/PVReaders/Allwmake OpenFOAM-9/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
--- OpenFOAM-9.orig/applications/utilities/postProcessing/graphics/PVReaders/Allwmake 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/applications/utilities/postProcessing/graphics/PVReaders/Allwmake 2021-08-17 15:25:23.778422000 +0200
@@ -17,8 +17,8 @@
fi

# Ensure CMake gets the correct C/C++ compilers
-[ -n "$WM_CC" ] && export CC="$WM_CC"
-[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
+#[ -n "$WM_CC" ] && export CC="$WM_CC"
+#[ -n "$WM_CXX" ] && export CXX="$WM_CXX"

wmake $targetType vtkPVblockMesh
wmake $targetType vtkPVFoam
diff -ru OpenFOAM-9.orig/applications/utilities/postProcessing/graphics/PVReaders/CMakeLists.txt OpenFOAM-9/applications/utilities/postProcessing/graphics/PVReaders/CMakeLists.txt
--- OpenFOAM-9.orig/applications/utilities/postProcessing/graphics/PVReaders/CMakeLists.txt 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/applications/utilities/postProcessing/graphics/PVReaders/CMakeLists.txt 2021-08-17 15:25:23.779287000 +0200
@@ -2,6 +2,8 @@

PROJECT(PVReaders)

+FIND_PACKAGE(MPI REQUIRED)
+
FIND_PACKAGE(ParaView REQUIRED)

INCLUDE(GNUInstallDirs)
diff -ru OpenFOAM-9.orig/etc/bashrc OpenFOAM-9/etc/bashrc
--- OpenFOAM-9.orig/etc/bashrc 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/bashrc 2021-08-17 15:25:23.781332000 +0200
@@ -43,8 +43,9 @@
# Please set to the appropriate path if the default is not correct.
#
[ "$BASH" -o "$ZSH_NAME" ] && \
-export FOAM_INST_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../.. && pwd -P) || \
-export FOAM_INST_DIR=$HOME/$WM_PROJECT
+#export FOAM_INST_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../.. && pwd -P) || \
+#export FOAM_INST_DIR=$HOME/$WM_PROJECT
+# For Easybuild: set by the module
# export FOAM_INST_DIR=~$WM_PROJECT
# export FOAM_INST_DIR=/opt/$WM_PROJECT
# export FOAM_INST_DIR=/usr/local/$WM_PROJECT
diff -ru OpenFOAM-9.orig/etc/config.sh/CGAL OpenFOAM-9/etc/config.sh/CGAL
--- OpenFOAM-9.orig/etc/config.sh/CGAL 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/CGAL 2021-08-17 15:25:23.783035000 +0200
@@ -39,22 +39,7 @@
#
#------------------------------------------------------------------------------

-boost_version=boost-system
-#boost_version=boost-1.55.0
-#boost_version=boost-1.72.0
-
-cgal_version=cgal-system
-#cgal_version=CGAL-4.10
-#cgal_version=CGAL-5.0.2
-
-if [ "$boost_version" != "boost-system" ]
-then
- export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/$boost_version
-fi
-
-if [ "$cgal_version" != "cgal-system" ]
-then
- export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/$cgal_version
-fi
+export CGAL_ARCH_PATH=$EBROOTCGAL
+export BOOST_ARCH_PATH=$EBROOTBOOST

#------------------------------------------------------------------------------
diff -ru OpenFOAM-9.orig/etc/config.sh/gperftools OpenFOAM-9/etc/config.sh/gperftools
--- OpenFOAM-9.orig/etc/config.sh/gperftools 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/gperftools 2021-08-17 15:25:23.783947000 +0200
@@ -29,13 +29,7 @@
#
#------------------------------------------------------------------------------

-version=svn
-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
-
-GPERFTOOLS_VERSION=gperftools-$version
-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION
-
-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH
+GPERFTOOLS_VERSION=gperftools-$EBVERSIONGPERFTOOLS
+GPERFTOOLS_ARCH_PATH=$EBROOTGPERFTOOLS

#------------------------------------------------------------------------------
diff -ru OpenFOAM-9.orig/etc/config.sh/metis OpenFOAM-9/etc/config.sh/metis
--- OpenFOAM-9.orig/etc/config.sh/metis 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/metis 2021-08-17 15:25:23.784897000 +0200
@@ -34,7 +34,7 @@
#
#------------------------------------------------------------------------------

-export METIS_VERSION=metis-5.1.0
-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
+export METIS_VERSION=metis-$EBVERSIONMETIS
+export METIS_ARCH_PATH=$EBROOTMETIS

#------------------------------------------------------------------------------
diff -ru OpenFOAM-9.orig/etc/config.sh/mpi OpenFOAM-9/etc/config.sh/mpi
--- OpenFOAM-9.orig/etc/config.sh/mpi 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/mpi 2021-08-17 15:25:23.786292744 +0200
@@ -254,6 +254,9 @@
_foamAddPath $MPI_ARCH_PATH/bin64
_foamAddLib $MPI_ARCH_PATH/lib/release
;;
+EASYBUILDMPI)
+ export FOAM_MPI=mpi
+ ;;
*)
export FOAM_MPI=dummy
;;
diff -ru OpenFOAM-9.orig/etc/config.sh/paraview OpenFOAM-9/etc/config.sh/paraview
--- OpenFOAM-9.orig/etc/config.sh/paraview 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/paraview 2021-08-17 15:28:54.926163000 +0200
@@ -41,25 +41,6 @@
) \
&& PATH="$cleaned"

-# Determine the cmake to be used. Take the most recent.
-unset CMAKE_HOME CMAKE_ROOT
-for cmake in $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-*
-do
- if [ -d $cmake ]
- then
- if [ -z $CMAKE_HOME ] || \
- $WM_PROJECT_DIR/bin/tools/foamVersionCompare $CMAKE_HOME lt $cmake
- then
- export CMAKE_HOME=$cmake
- export CMAKE_ROOT=$cmake
- fi
- fi
-done
-if [ -n $CMAKE_HOME ]
-then
- export PATH=$cmake/bin:$PATH
-fi
-
#- ParaView version, automatically determine major version
#export ParaView_VERSION=4.0.1
#export ParaView_VERSION=4.1.0
@@ -69,7 +50,8 @@
#export ParaView_VERSION=5.0.1
#export ParaView_VERSION=5.4.0
#export ParaView_VERSION=5.5.0
-export ParaView_VERSION=5.6.3
+#export ParaView_VERSION=5.6.3
+export ParaView_VERSION=$EBVERSIONPARAVIEW
export ParaView_MAJOR=detect

#export ParaView_GL=system
@@ -109,7 +91,8 @@
export ParaView_VERSION ParaView_MAJOR

# Set the binary and source directories
-export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION
+# export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION
+export ParaView_DIR=$EBROOTPARAVIEW
paraviewSrcDir=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION

# Set paths if binaries or source are present
@@ -129,8 +112,6 @@
fi
export ParaView_LIB_DIR=$ParaView_DIR/lib$paraviewArch$paraviewLibSubDir

- export PATH=$ParaView_DIR/bin:$PATH
- export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$LD_LIBRARY_PATH
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR

if [ "$FOAM_VERBOSE" -a "$PS1" ]
@@ -142,18 +123,6 @@
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
fi

- # Add in python libraries if required
- paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
- if [ -r $paraviewPython ]
- then
- if [ "$PYTHONPATH" ]
- then
- export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR
- else
- export PYTHONPATH=$paraviewPython:$ParaView_LIB_DIR
- fi
- fi
-
# Alias paraview to launch with mesa if necessary
if [ "$ParaView_GL" = mesa ]
then
diff -ru OpenFOAM-9.orig/etc/config.sh/scotch OpenFOAM-9/etc/config.sh/scotch
--- OpenFOAM-9.orig/etc/config.sh/scotch 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/scotch 2021-08-17 15:25:23.789570000 +0200
@@ -37,7 +37,7 @@
#
#------------------------------------------------------------------------------

-export SCOTCH_VERSION=scotch_6.0.9
-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
+export SCOTCH_VERSION=scotch_$EBVERSIONSCOTCH
+export SCOTCH_ARCH_PATH=$EBROOTSCOTCH

#------------------------------------------------------------------------------
diff -ru OpenFOAM-9.orig/etc/config.sh/settings OpenFOAM-9/etc/config.sh/settings
--- OpenFOAM-9.orig/etc/config.sh/settings 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/etc/config.sh/settings 2021-08-17 15:25:23.790563432 +0200
@@ -61,11 +61,11 @@
64)
WM_ARCH=linux64
export WM_COMPILER_LIB_ARCH=64
- export WM_CC='gcc'
- export WM_CXX='g++'
- export WM_CFLAGS='-m64 -fPIC'
- export WM_CXXFLAGS='-m64 -fPIC -std=c++0x'
- export WM_LDFLAGS='-m64'
+ export WM_CC=$CC
+ export WM_CXX=$CXX
+ export WM_CFLAGS=$CFLAGS
+ export WM_CXXFLAGS=$CXXFLAGS
+ export WM_LDFLAGS=$LDFLAGS
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\
diff -ru OpenFOAM-9.orig/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-9/src/parallel/decompose/ptscotchDecomp/Make/options
--- OpenFOAM-9.orig/src/parallel/decompose/ptscotchDecomp/Make/options 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/src/parallel/decompose/ptscotchDecomp/Make/options 2021-08-17 15:25:23.793413000 +0200
@@ -4,14 +4,7 @@
$(PFLAGS) $(PINC) \
-I$(FOAM_SRC)/Pstream/mpi/lnInclude \
-I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
- -I$(SCOTCH_ARCH_PATH)/include \
- -I/usr/include/scotch \
-I../decompositionMethods/lnInclude

LIB_LIBS = \
- -L$(SCOTCH_ARCH_PATH)/lib \
- -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \
- -lptscotch \
- -lptscotcherrexit \
- -lscotch \
- -lrt
+ -L$(SCOTCH_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt
diff -ru OpenFOAM-9.orig/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C OpenFOAM-9/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C
--- OpenFOAM-9.orig/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C 2021-08-17 15:25:23.794849806 +0200
@@ -31,10 +31,11 @@
#include "SubField.H"
#include "PstreamGlobals.H"

+#include <mpi.h>
+
extern "C"
{
#include <stdio.h>
- #include <mpi.h>
#include "ptscotch.h"
}

diff -ru OpenFOAM-9.orig/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-9/src/parallel/decompose/scotchDecomp/Make/options
--- OpenFOAM-9.orig/src/parallel/decompose/scotchDecomp/Make/options 2021-07-15 16:07:54.000000000 +0200
+++ OpenFOAM-9/src/parallel/decompose/scotchDecomp/Make/options 2021-08-17 15:25:23.796687000 +0200
@@ -6,7 +6,6 @@
EXE_INC = \
$(PFLAGS) $(PINC) \
-I$(SCOTCH_ARCH_PATH)/include \
- -I/usr/include/scotch \
-I../decompositionMethods/lnInclude

LIB_LIBS = \
38 changes: 38 additions & 0 deletions easybuild/easyconfigs/o/OpenFOAM/OpenFOAM-9-foss-2021a.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name = 'OpenFOAM'
version = '9'

homepage = 'https://www.openfoam.org/'
description = """OpenFOAM is a free, open source CFD software package.
OpenFOAM has an extensive range of features to solve anything from complex fluid flows
involving chemical reactions, turbulence and heat transfer,
to solid dynamics and electromagnetics."""

toolchain = {'name': 'foss', 'version': '2021a'}
# toolchainopts = {'cstd': 'c++11'}
branfosj marked this conversation as resolved.
Show resolved Hide resolved

source_urls = ['https://github.com/OpenFOAM/OpenFOAM-%(version_major)s/archive']
sources = ['version-%(version)s.tar.gz']
patches = ['OpenFOAM-%(version)s-cleanup.patch']
boegel marked this conversation as resolved.
Show resolved Hide resolved
checksums = [
'0c48fb56e2fbb4dd534112811364d3b2dc12106e670a6486b361e4f864b435ee', # version-9.tar.gz
'4b638891f32badde1a5b1b364bc3bd5e0eda180b9d9a8afdf797d5818b8b494e', # OpenFOAM-9-cleanup.patch
]

builddependencies = [
('Bison', '3.7.6'),
('CMake', '3.20.1'),
('flex', '2.6.4'),
]

dependencies = [
('libreadline', '8.1'),
('ncurses', '6.2'),
# OpenFOAM requires 64 bit METIS using 32 bit indexes (array indexes)
('METIS', '5.1.0'),
('SCOTCH', '6.1.0'),
('CGAL', '4.14.3'),
('ParaView', '5.9.1', '-mpi'),
('gnuplot', '5.4.2'),
]

moduleclass = 'cae'