105 lines
3.3 KiB
Bash
105 lines
3.3 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Build the OpenFOAM Foundation v14 serial subset needed for AirfRANS-style data generation.
|
||
|
|
# Tools built: foamRun/incompressibleFluid (simpleFoam replacement), simpleFoam wrapper,
|
||
|
|
# gmshToFoam, checkMesh, and foamToVTK.
|
||
|
|
|
||
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||
|
|
OPENFOAM_REPO_URL="${OPENFOAM_REPO_URL:-https://github.com/OpenFOAM/OpenFOAM-14.git}"
|
||
|
|
THIRDPARTY_REPO_URL="${THIRDPARTY_REPO_URL:-https://github.com/OpenFOAM/ThirdParty-14.git}"
|
||
|
|
AIRFRANS_REPO_URL="${AIRFRANS_REPO_URL:-https://github.com/Extrality/AirfRANS.git}"
|
||
|
|
JOBS="${JOBS:-$(nproc)}"
|
||
|
|
|
||
|
|
clone_if_missing() {
|
||
|
|
local url="$1"
|
||
|
|
local dir="$2"
|
||
|
|
|
||
|
|
if [[ -d "${ROOT_DIR}/${dir}/.git" ]]; then
|
||
|
|
printf 'using existing %s\n' "${dir}"
|
||
|
|
else
|
||
|
|
git clone --depth 1 "${url}" "${ROOT_DIR}/${dir}"
|
||
|
|
fi
|
||
|
|
}
|
||
|
|
|
||
|
|
clone_if_missing "${OPENFOAM_REPO_URL}" OpenFOAM-14
|
||
|
|
clone_if_missing "${THIRDPARTY_REPO_URL}" ThirdParty-14
|
||
|
|
clone_if_missing "${AIRFRANS_REPO_URL}" airfrans
|
||
|
|
|
||
|
|
# Dummy MPI keeps this subset serial and avoids requiring mpicc/OpenMPI for p1.
|
||
|
|
# Use SYSTEMOPENMPI instead only after installing a system MPI development package.
|
||
|
|
# OpenFOAM's bashrc probes optional shell variables that may be unset.
|
||
|
|
# shellcheck disable=SC1091
|
||
|
|
set +u
|
||
|
|
source "${ROOT_DIR}/OpenFOAM-14/etc/bashrc" \
|
||
|
|
WM_MPLIB=Dummy \
|
||
|
|
ParaView_TYPE=none \
|
||
|
|
SCOTCH_TYPE=none \
|
||
|
|
ZOLTAN_TYPE=none
|
||
|
|
set -u
|
||
|
|
|
||
|
|
cd "${ROOT_DIR}/OpenFOAM-14"
|
||
|
|
|
||
|
|
(cd wmake/src && make)
|
||
|
|
|
||
|
|
src/Pstream/Allwmake -j "${JOBS}"
|
||
|
|
src/OSspecific/${WM_OSTYPE:-POSIX}/Allwmake -j "${JOBS}"
|
||
|
|
wmake -j "${JOBS}" libso src/OpenFOAM
|
||
|
|
|
||
|
|
for target in \
|
||
|
|
src/fileFormats \
|
||
|
|
src/surfMesh \
|
||
|
|
src/triSurface \
|
||
|
|
src/meshTools \
|
||
|
|
src/finiteVolume \
|
||
|
|
src/ODE \
|
||
|
|
src/physicalProperties \
|
||
|
|
src/tracking \
|
||
|
|
src/lagrangian/basic \
|
||
|
|
src/generic/genericPatches \
|
||
|
|
src/generic/genericFields \
|
||
|
|
src/generic/genericFvPatches \
|
||
|
|
src/generic/genericFvFields \
|
||
|
|
src/sampling \
|
||
|
|
src/meshCheck \
|
||
|
|
src/mesh/extrudeModel \
|
||
|
|
src/polyTopoChange \
|
||
|
|
src/conversion \
|
||
|
|
src/thermophysicalModels/specie \
|
||
|
|
src/thermophysicalModels/thermophysicalProperties \
|
||
|
|
src/thermophysicalModels/basic \
|
||
|
|
src/thermophysicalModels/multicomponentThermo \
|
||
|
|
src/thermophysicalModels/solidThermo \
|
||
|
|
src/MomentumTransportModels/momentumTransportModels \
|
||
|
|
src/MomentumTransportModels/incompressible \
|
||
|
|
src/MomentumTransportModels/compressible \
|
||
|
|
src/ThermophysicalTransportModels/thermophysicalTransportModel \
|
||
|
|
src/ThermophysicalTransportModels/fluid \
|
||
|
|
src/ThermophysicalTransportModels/fluidThermo \
|
||
|
|
src/fvConstraints \
|
||
|
|
src/fvModels/general \
|
||
|
|
applications/modules/basicFluidSolver \
|
||
|
|
applications/modules/incompressibleFluid
|
||
|
|
do
|
||
|
|
wmake -j "${JOBS}" libso "${target}"
|
||
|
|
done
|
||
|
|
|
||
|
|
for app in \
|
||
|
|
applications/solvers/foamRun \
|
||
|
|
applications/utilities/mesh/conversion/gmshToFoam \
|
||
|
|
applications/utilities/mesh/manipulation/checkMesh
|
||
|
|
do
|
||
|
|
wmake -j "${JOBS}" "${app}"
|
||
|
|
done
|
||
|
|
|
||
|
|
applications/utilities/postProcessing/dataConversion/foamToVTK/Allwmake -j "${JOBS}"
|
||
|
|
|
||
|
|
foamRun -help >/dev/null
|
||
|
|
foamRun -solver incompressibleFluid -help >/dev/null
|
||
|
|
gmshToFoam -help >/dev/null
|
||
|
|
checkMesh -help >/dev/null
|
||
|
|
foamToVTK -help >/dev/null
|
||
|
|
simpleFoam -help >/dev/null
|
||
|
|
|
||
|
|
printf 'OpenFOAM v14 AirfRANS subset built and smoke-checked.\n'
|