This page describes how to install libMesh/MAST on Ubuntu 18.04 (Eoan Ermine) using dependencies from the standard package manager.
It is written for someone who has limited experience compiling software on Linux and contains details a more advanced user likely won't need.
Installing libMesh/MAST on Ubuntu 18.04 (Bionic Beaver) is relatively simple if you are able to use Ubuntu's Advanced Packaging Tool (APT) since all of the dependencies are provided in the standard package repositories. To do so we assume you have sudo
privileges on your system and it is connected to the internet. If you are not a privileged user, ask an administrator to install these dependencies or consider manually compiling/installing the dependencies in your home directory.
To install all of the dependencies, simply execute the following commands in the terminal/shell. Some of the packages will install a number of required sub-dependencies.
We utilize some newer features in CMake and require a more recent version (3.13) than is included in the default APT repositories (3.10) for Ubuntu 18.04. The following code adds Kitware's (CMake maintainers) APT repository and installs the most recent version of CMake.
When using dependencies from Ubuntu 19.10's standard package repository, only a recent version of libMesh can be built. Any official libMesh "release" up to and include v1.5.1 will fail to build with linking errors related to a conflict between the Ubuntu apt
provided metis
(which the provided PETSc package requires) and the metis
that libMesh builds itself. This issue was resolved in libMesh repository commit df1e2b7
by adding the ability for libMesh to properly use an external metis
. The MAST developers currently provide a version of libMesh v1.5.1 that have the fixes for the build patched in.
As a result, we need to build libMesh from the v1.5.1_with_build_updates
branch of jdeaton's fork of the official libMesh repository. To do this we first clone the forked repository from GitHub, then checkout the appropriate branch of the code. From the directory where you want to build libMesh, execute the following in the terminal/shell, which will clone libMesh into a new directory libmesh
:
libMesh compilation/installation follows the common Makefile-based configure
, make
, make install
process that is common on Linux/Unix systems. Before beginning, we set a few environment variables by executing the following commands from inside the libmesh
directory in the terminal/shell. libMesh_INSTALL_DIR
specifies where the products of the libMesh build process will be installed. By default, text below specifies a directory that will be alongside libmesh
named libmesh_install
. You may change this if you wish. NP
specifies the number of parallel jobs to use during compilation.
We recommend compiling libMesh in a dedicated build directory to keep from cluttering the main libMesh repository. From inside the libmesh
directory, create a build directory and navigate into it with:
We can now configure the libMesh build by pasting the entire contents of the following snippet into the shell/terminal. By default, libMesh will configure optimized, development, and debug versions of the library.
If the configuration was successful, you should have the following output under Optional Packages
:
We can now compile the libMesh binaries by executing in the terminal/shell, which will take some time:
Optionally, you can now test compiled libraries by executing make check
in the terminal/shell. This will compile and run a number of example cases provided in the libMesh source. Note that this will take a long time and since you are using standard, well-maintained dependencies it is probably not necessary.
Finally, we will install the products of the libMesh compilation by simply executing the following, which will place all of the necessary libMesh files for MAST into the directory specified above with libMesh_INSTALL_DIR
. Optionally, after this is complete, you can test the installed binaries using make checkinstall
. Again, this takes quite a while and is likely not necessary with this standard installation.
The important directories from the installed contents are:
${libMesh_INSTALL_DIR}/bin
- libMesh utility programs${libMesh_INSTALL_DIR}/contrib
- third-party utility programs bundled with libMesh${libMesh_INSTALL_DIR}/examples
- source code for libMesh examples and wrapper scripts to run them${libMesh_INSTALL_DIR}/include
- development headers for libMesh and bundled third-party packages${libMesh_INSTALL_DIR}/lib
- libraries for libMesh and bundled third-party packages${libMesh_INSTALL_DIR}/share
- single element reference meshesThe following instructions describe how to configure and compile the MAST library, some example programs, and the unit tests. In this guide, we don't build support for Cython, the pyNastran interface, interfaces to commercial/licensed optimizers (DOT, SNOPT, GCMMA) or the documentation.
Since MAST is in a state of ongoing development, we will build it from the master
branch on the GitHub repository so we have the most up-to-date changes. If you have forked MAST, substitute the remote URL for you fork in the git clone
line.
We begin by cloning the repository from inside the directory of your choice:
We again recommend building in a dedicated build directory to keep from cluttering the main repository. From inside the mast-multiphysics
directory, create a build directory and navigate into it with:
The build process for MAST differs slightly from libMesh since we utilize CMake to generate Makefiles rather than a configure
script. This is done by executing the following commands in the terminal/shell from inside the build
directory. CMake will perform some inspections of your system, locate dependencies, and create the Makefile
s necessary to build MAST in the build
directory.
Note that the above commands create a Debug
version of the MAST library (using the *_dbg
versions of libMesh). This is required if you want to utilize a C++ debugger (such as gdb) and includes a significant amount of diagnostic/debug output. For more performance, an optimized/Release version can be built by changing the -DCMAKE_BUILD_TYPE
CMake variable to Release
.
After CMake configuration completes, you can build the MAST library (libmast
), several example problems, and unit tests by simply executing the following in the terminal/shell.
Contact libMesh developers to resolve inability of libMesh configuration process to find Ubuntu repository provided HDF5 headers/libraries (openmpi/serial).
Update page with next release of libMesh after v1.5.1 that will incorporate changes to deal with metis conflicts.
Update the guide to include building support for pyNastran, Cython, and generating the documentation locally.