(ref: openfoamWiki)
-
Download the source code.
-
Change to the root user:
sudo su
-
Source the bashrc, eg. if installed under the
~/OpenFOAM
directorysource ~/OpenFOAM/OpenFOAM-v2006/etc/bashrc
-
Test the system readiness (optional, not supported for cross-compilation)
foamSystemCheck
-
Compile OpenFOAM
./Allwmake -s -l ./Allwmake -j -s -q -l ./Allwmake -j 4 > log.make 2>&1
-
Test the Openfoam, Create the user
run
directory:mkdir -p $FOAM_RUN
Then, run with a simple tutorial:
run cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily ./ cd pitzDaily blockMesh simpleFoam
-
Add source:
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -" sudo add-apt-repository http://dl.openfoam.org/ubuntu
-
update
sudo apt-get update
-
Install
sudo apt-get -y install openfoam7
-
User Configuration
add the following to the end of the file "~/.bashrc"
alias of7="source /opt/openfoam7/etc/bashrc"
-
Search through the turbulenceProperties file in foam tutorials folder, to find one containing the expression kepsilon (case insensitive) :
find $FOAM_TUTORIALS -name "turbulenceProperties" | xargs grep -l -i kepsilon
-
Remove all the timeserises data (folders), a quick way to delete all previous timesteps:
foamListTimes -rm
-
A pseudo way to reconstruct case on slurm cluster:
#SBATCH -J recinstru #SBATCH -p cpu20 #SBATCH --array=0-19 #SBATCH -o output_%j.out #SBATCH -e errors_%j.err NUM=$SLURM_ARRAY_TASK_ID source /opt/OpenFOAM/.OF2012.bashrc # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions t_end=1600 duration=$t_end/20 # 80 reconstructPar -time $(($NUM*80)):$(($NUM*80+80)) >log.reconstructPar$NUM
-
multi-postProcess function, generate and run
va=0 for z in 0 2 4 6 8 do for x in 0 5 10 15 20 do cp sGx0z0 sGx$x-z$z sed -i "s|(0|($x|g" sGx$x-z$z if [ $z != $va ] then sed -i "s|-0.02)|-$z)|g" sGx$x-z$z fi echo sGx$x-z$z done done postProcess -funcs '(sGx0-z0 sGx5-z0 sGx10-z0 sGx15-z0 sGx20-z0 sGx0-z2 sGx5-z2 sGx10-z2 sGx15-z2 sGx20-z2 sGx0-z4 sGx5-z4 sGx10-z4 sGx15-z4 sGx20-z4 sGx0-z6 sGx5-z6 sGx10-z6 sGx15-z6 sGx20-z6 sGx0-z8 sGx5-z8 sGx10-z8 sGx15-z8 sGx20-z8)' -time '550:600'