Search This Blog

Saturday, October 29, 2016

How to install OpenFOAM3+ on Ubuntu 16


  1. Compilers (default): gcc and openmpi
  2. Go to home directory and make "OpenFOAM" directory
    • cd
    • mkdir -p OpenFOAM
    • cd OpenFOAM
  3. Download: OpenFOAM-v3.0+.tgz HERE
  4. Unzip
    • tar -xzf OpenFOAM-v3.0+.tgz
    • cd OpenFOAM-v3.0+
  5. Disable graphics compiling part
    1. Open
      • vi src/postProcessing/functionObjects/Allwmake
    2. Comment out the last line
      • # ./graphics/Allwmake
  6. Take care of conflict due to flex++ version
    1. Open the following files
      1. $WM_PROJECT_DIR/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
      2. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
      3. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
      4. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
      5. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
    2. Make change
      • from
        • #if YY_FLEX_SUBMINOR_VERSION < 34
        • extern "C" int yywrap()
        • #else
        • int yyFlexLexer::yywrap()
        • #endif
      • to
        • // #if YY_FLEX_SUBMINOR_VERSION < 34
        • // extern "C" int yywrap()
        • // #else
        • int yyFlexLexer::yywrap()
        • // #endif
  7. Set up compiling environment
    • source OpenFOAM/OpenFOAM-v3.0+/etc/bashrc
    • echo " alias of30plus='source OpenFOAM/OpenFOAM-v3.0+/etc/bashrc'" >> $HOME/.bahsrc
  8. Compile
    • ./Allwmake

Labels