Rate This Document
Findability
Accuracy
Completeness
Readability

Compilation and Installation

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Go to the OpenFOAM installation package directory.
    cd /path/to/OpenFOAM
  3. Decompress the OpenFOAM installation package.
    tar -xvf OpenFOAM-v1906.tgz
    tar -xvf ThirdParty-v1906.tgz
  4. Go to the directory generated after the decompression.
    cd OpenFOAM-v1906
  5. Create a List.H.patch file and edit it.
    1. Create a List.H.patch file.
      vi List.H.patch
    2. Press i to enter the insert mode and type the following content:
      --- ./src/OpenFOAM/containers/Lists/List/List.H 2019-11-08 01:12:53.000000000 +0800
      +++ ../OpenFOAM-v1912/src/OpenFOAM/containers/Lists/List/List.H 2019-12-23 17:49:24.000000000 +0800
      @@ -57,7 +56,6 @@
      {
      // Forward declarations
      -
      class Istream;
      class Ostream;
      @@ -114,6 +112,12 @@
      public:
      +    // Related types
      +
      +        //- Declare type of subList
      +        typedef SubList<T> subList;
      +
      +
      // Static Member Functions
      //- Return a null List
      @@ -201,12 +205,6 @@
      ~List();
      -    // Related types
      -
      -        //- Declare type of subList
      -        typedef SubList<T> subList;
      -
      -
      // Member Functions
      // Edit
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Create an IListStream.H.patch file and edit it.
    1. Create an IListStream.H.patch file.
      vi IListStream.H.patch
    2. Press i to enter the insert mode and type the following content:
      --- ./src/OpenFOAM/db/IOstreams/memory/IListStream.H    2019-11-08 01:12:53.000000000 +0800
      +++ ../OpenFOAM-v1912/src/OpenFOAM/db/IOstreams/memory/IListStream.H    2019-12-23 17:49:24.000000000 +0800
      @@ -115,7 +115,7 @@
      reset_gbuffer();
      }
      -        //- Transfer contents to other list
      +        //- Transfer contents to other List
      inline void swap(List<char>& list)
      {
      List<char>::swap(list);
      @@ -128,7 +128,7 @@
      /*---------------------------------------------------------------------------*\
      Class IListStream Declaration
      -\*----------------------------------------------d-----------------------------*/
      +\*---------------------------------------------------------------------------*/
      //- An ISstream with internal List storage
      class IListStream
      @@ -158,7 +158,7 @@
      //- Move construct from List
      IListStream
      (
      -            List<char>&& buffer,
      +            ::Foam::List<char>&& buffer,  // Fully qualify (issue #1521)
      streamFormat format=ASCII,
      versionNumber version=currentVersion,
      const Foam::string& name="input"
      @@ -184,7 +184,7 @@
      {}
      -    // Member functions
      +    // Member Functions
      //- The current get position in the buffer
      using allocator_type::size;
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Apply the patch.
    patch -p1 < List.H.patch
    patch -p1 < IListStream.H.patch
  8. Modify the compiler and MPI settings in the OpenFOAM installation configuration file.

    Change export WM_COMPILER=/path/to/clang to export WM_COMPILER=Clang.

    Change /path/to/clang to the clang file path of the BiSheng Compiler.

  9. Modify the compilation parameters.
    sed -i 's/\-O3/\-O3 \-march=armv8-a/g' /path/to/OpenFOAM/OpenFOAM-v1906/wmake/rules/linuxARM64Clang/c++Opt
    sed -i 's/\-O3/\-O3 \-march=armv8-a/g' /path/to/OpenFOAM/OpenFOAM-v1906/wmake/rules/linuxARM64Clang/cOpt
  10. Make the OpenFOAM configuration file bashrc take effect.
    source etc/bashrc
  11. Perform the compilation and installation.
    ./Allwmake -j -k