Newer
Older
## OpenFOAM® Quick Build Guide
Ensure that the [system requirements][link openfoam-require] are satisfied as described here,
and make sure to source the correct OpenFOAM environment. For example,
for the OpenFOAM-v1906 version:
```
source /installation/path/OpenFOAM-v1906/etc/bashrc
```
## Preliminaries
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
[readme][link third-readme] and additional information about
[requirements][link third-require] and a more detailed
[build guide][link third-build].
Some known build issues related to specific compiler and VTK library versions
can be found in the [$WM_PROJECT_DIR/BuildIssues.txt][link openfoam-issues] file.
If you need to change the default versions for third-party libraries,
or use system libraries for some components, please some additional
information about the [config structure][link openfoam-config].
## Compile OpenFOAM
The compilation process is self-contained and will compile and install
all OpenFOAM code and dependencies.
- Test the system readiness (optional)
```
foamSystemCheck
```
- Change to the main OpenFOAM directory ($WM_PROJECT_DIR).
If this fails, the environment is not correctly configured.
```
foam
```
- Compile OpenFOAM
```
./Allwmake -s -l
```
- In case you need to stop the compilation, continue later by running
`./Allwmake` again.
## Compile OpenFOAM faster
For faster compilation, users should take advantage of multi-processor
machines when building the code. This is supported directly by `wmake`
and the `Allwmake` scripts. For example,
```
wmake -j # Use all cores
wmake -j 8 # Use specified number of cores
```
It can also be helpful to use the builtin queuing (the `-queue`
option), which collects subdirectories and dispatches to make in
larger chunks.
The following compilation sequence can be useful:
```
./Allwmake -j -s -q -l
```
This compiles with all cores (-j), reduced output (-s, -silent), with
queuing (-q, -queue) and logs (-l, -log) the output to a file such as
`log.linux64GccDPInt32Opt` for later inspection.
If you use the `-k` option (`-keep-going` = ignore errors) to compile
as much as possible on the first pass, be certain to follow that with
second pass (without the `-k` option) at a later stage to ensure that
you haven't missed any error messages.
## Post-compilation steps
- Open a new shell and source the OpenFOAM environment to see all
changes (refer to top of page).
- Validate the build by running
```
foamInstallationTest
```
- Create the user `run` directory:
```
mkdir -p $FOAM_RUN
```
- Test the installation with a simple tutorial:
```
run
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily ./
cd pitzDaily
blockMesh
simpleFoam
```
### ParaView
OpenFOAM ships with ParaView sources for post-processing OpenFOAM
field results. However, the paraview version distributed with
the operating system or a [binary package][download ParaView]
will be sufficient, and avoids additional compilation complexity.
If do you wish to compile ParaView from sources, it is recommended
that you do so *after* completing an initial compilation of OpenFOAM.
This gets the process started much more quickly. At a later stage,
OpenFOAM can be updated to compile with paraview. Only the affected
applications will be compiled (eg, the blockMesh reader module) and the
balance of the OpenFOAM installation will not affected.
If you decide to compiling in two passes, you only need to execute the
top-level `Allwmake` a second time. Do **not** use `wclean` to force a
complete rebuild! This is unnecessary.
More details in the [ThirdParty build guide][link third-build].
------------
<!-- Links -->
[page ParaView]: http://www.paraview.org/
[download ParaView]: https://www.paraview.org/download/
<!-- OpenFOAM -->
[repo openfoam]: https://develop.openfoam.com/Development/OpenFOAM-plus/
[repo third]: https://develop.openfoam.com/Development/ThirdParty-plus/
[link openfoam-issues]: https://develop.openfoam.com/Development/OpenFOAM-plus/blob/develop/BuildIssues.txt
[link openfoam-config]: https://develop.openfoam.com/Development/OpenFOAM-plus/blob/develop/etc/README.md
[link openfoam-build]: https://develop.openfoam.com/Development/OpenFOAM-plus/blob/develop/doc/Build.md
[link openfoam-require]: https://develop.openfoam.com/Development/OpenFOAM-plus/blob/develop/doc/Requirements.md
[link third-readme]: https://develop.openfoam.com/Development/ThirdParty-plus/blob/develop/README.md
[link third-build]: https://develop.openfoam.com/Development/ThirdParty-plus/blob/develop/BUILD.md
[link third-require]: https://develop.openfoam.com/Development/ThirdParty-plus/blob/develop/Requirements.md
---
Copyright 2019 OpenCFD Ltd