forked from Aalto-CFD/DLBFoam
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Allwmake
executable file
·150 lines (120 loc) · 3.61 KB
/
Allwmake
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
#!/bin/bash
cd ${0%/*} || exit 1 # run from this directory
set -e # Any subsequent(*) commands which fail will cause the shell script to exit immediately
# The supported OpenFOAM version
OF_VER="12"
check_openfoam()
{
if [ -z ${WM_PROJECT} ]; then
echo "OpenFOAM environment not set."
exit 1
fi
if [[ ! "$WM_PROJECT_VERSION" == "$OF_VER" ]]; then
echo "Error: OpenFOAM-$WM_PROJECT_VERSION not supported."
echo " See other git branches for potential support."
exit 1
fi
}
check_mkl()
{
if [ -d "$MKLROOT" ]; then
echo "Utilising Intel MKL version from path: ${MKLROOT}"
else
echo "Error: MKLROOT=${MKLROOT} not found."
exit 1
fi
}
check_openblas()
{
if [ -d "$OPENBLAS_INSTALL_ROOT" ]; then
echo "Utilising OpenBLAS from path: ${OPENBLAS_INSTALL_ROOT}"
else
echo "Error: OPENBLAS_INSTALL_ROOT=${OPENBLAS_INSTALL_ROOT} not found."
exit 1
fi
}
check_cmake()
{
if ! command -v cmake &> /dev/null
then
echo "Error: cmake could not be found. Required for compiling the pyJac C-library."
exit 1
fi
}
how_to()
{
echo "Error: Correct platform syntax ./Allwmake --platform MKL/OPENBLAS/STANDALONE"
}
PLATFORM=NOT_DEFINED
CLEAN_ALL=false
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--clean)
CLEAN_ALL=true
shift # past argument
;;
--platform)
PLATFORM="$2"
shift # past argument
shift # past value
;;
*)
how_to
exit 1
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
check_openfoam
check_cmake
if [ $PLATFORM == MKL ]; then
check_mkl
cp src/ODE_DLB/Make/options.mkl src/ODE_DLB/Make/options
elif [ $PLATFORM == OPENBLAS ]; then
check_openblas
cp src/ODE_DLB/Make/options.openblas src/ODE_DLB/Make/options
elif [ $PLATFORM == STANDALONE ]; then
cp src/ODE_DLB/Make/options.standalone src/ODE_DLB/Make/options
else
how_to
exit 1
fi
if [ $CLEAN_ALL == true ]; then
./Allwclean
fi
wmake libso src/thermophysicalModels/chemistryModel
cp -r src/thermophysicalModels/chemistryModel/pyJacInclude src/thermophysicalModels/chemistryModel/lnInclude
wmake libso src/ODE_DLB
# copy files needed for dynamic compilation of chemistry models and solvers
DLB_ETC_DC=etc/codeTemplates/dynamicCode
USER_ETC_DC=${HOME}/.OpenFOAM/${WM_PROJECT_VERSION}/codeTemplates/dynamicCode
cp $DLB_ETC_DC/basicChemistryModel.orig \
$DLB_ETC_DC/basicChemistryModel
sed -i "s|%MY_DLBFOAM_PATH%|${PWD}|g" \
$DLB_ETC_DC/basicChemistryModel
mkdir --parents $USER_ETC_DC
cp $DLB_ETC_DC/basicChemistryModel $USER_ETC_DC
cp $DLB_ETC_DC/basicChemistryModelTemplate.C $USER_ETC_DC
pushd tests/validation/pyjacTests/pyjacTestMechanism/lib > /dev/null
./runCmake.sh
popd > /dev/null
wmake tests/unittests
wmake tests/validation/pyjacTests/PSRTest
pushd tests/unittests > /dev/null
./test.sh
popd > /dev/null
pushd tests/validation/pyjacTests/PSRTest > /dev/null
./runTests.sh
popd > /dev/null
pushd tests/validation/isatTests > /dev/null
./test.sh
popd > /dev/null
cp -r utilities/mechanisms/yao tutorials/multicomponentFluid/shearlayer_DLB_pyJac/pyJac
cp utilities/CMakeLists.txt tutorials/multicomponentFluid/shearlayer_DLB_pyJac/pyJac/lib/
cp utilities/runCmake.sh tutorials/multicomponentFluid/shearlayer_DLB_pyJac/pyJac/lib/
cp -r utilities/mechanisms/gri30 tutorials/chemFoam/gri_pyJac/pyJac
cp utilities/CMakeLists.txt tutorials/chemFoam/gri_pyJac/pyJac/lib/
cp utilities/runCmake.sh tutorials/chemFoam/gri_pyJac/pyJac/lib/