Compilation and Installation
Procedure
- Use PuTTY to log in to the server as the root user.
- Go to the OpenFOAM installation package directory.
cd /path/to/OpenFOAM
- Decompress the OpenFOAM installation package.
tar -xvf OpenFOAM-v1906.tgz tar -xvf ThirdParty-v1906.tgz
- Go to the directory generated after the decompression.
cd OpenFOAM-v1906
- Create a List.H.patch file and edit it.
- Create a List.H.patch file.
vi List.H.patch
- 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 - Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a List.H.patch file.
- Create an IListStream.H.patch file and edit it.
- Create an IListStream.H.patch file.
vi IListStream.H.patch
- 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; - Press Esc, type :wq!, and press Enter to save the file and exit.
- Create an IListStream.H.patch file.
- Apply the patch.
patch -p1 < List.H.patch patch -p1 < IListStream.H.patch
- 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.
- 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
- Make the OpenFOAM configuration file bashrc take effect.
source etc/bashrc
- Perform the compilation and installation.
./Allwmake -j -k
Parent topic: OpenFOAM 1906 Porting Guide (openEuler 21.03)