Skip to content

smdogroup/a2d-multiphysics

Repository files navigation

A2D - a PDE discretization library using almost automatic differentiation

A toolkit for almost automatic differentiation of vector and matrix expressions.

This code relies heavily on the approach for deriving auto-diff expressions by M. B. Giles, "Collected matrix derivative results for forward and reverse mode AD".

A2D is a header only c++ templated library.

Install

A2D is currently header-only so no need to build itself. The following command can be used to build examples and unit tests:

# You must start from the root directory of a2d
mkdir build &&
cd build &&
cmake .. -DCMAKE_BUILD_TYPE=[Debug,Release] -DA2D_KOKKOS_DIR=<your Kokkos install dir> -DA2D_METIS_DIR=<your metis install dir> -DA2D_BUILD_EXAMPLES=ON -DA2D_BUILD_UNIT_TESTS=ON &&
make -j # parallel make using maximum number of processors

Note: metis and Kokkos are assumed to be installed in a2d/installs/metis and a2d/installs/kokkos if corresponding CMake variables are not specified. See CMake variables for a complete list of A2D CMake variables and defaults. See Install Kokkos and Install METIS for instructions on installing Kokkos and METIS.

CMake variables

Below is the complete table of CMake variables that A2D accepts to control the compilation.

Recall that to give the variable VARIABLE value VAL, use the following syntax int the command line:

cmake ... -DVARIABLE=VAL ...
Variable Description Default Choices
CMAKE_BUILD_TYPE whether this is a release (optimized) build or debug (containing debug info) build No default Debug/Release
A2D_KOKKOS_DIR directory of kokkos installation a2d/installs/kokkos a valid path
A2D_METIS_DIR directory of metis installation a2d/installs/metis a valid path
A2D_BUILD_EXAMPLES build examples if set to ON ON ON/OFF
A2D_BUILD_UNIT_TESTS build unit tests if set to ON OFF ON/OFF

Theory

So, how does A2D solve PDEs?

Dependencies

A2D requires following dependencies

Install Kokkos

To build Kokkos with OpenMP and CUDA backend, use the following commands:

# You must start from the root directory of a2d
cd extern &&
git clone https://github.com/kokkos/kokkos.git &&
cd kokkos &&
mkdir build &&
cd build &&
cmake .. -DCMAKE_INSTALL_PREFIX=../../../installs/kokkos -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_CUDA_LAMBDA=ON -G Ninja &&
ninja install

For a complete instruction on installing Kokkos, see Kokkos documentation.

Install METIS

Obtain the tarball from here. The following commands can be used to download METIS to a2d/extern/ and install it in a2d/installs/metis/:

# You must start from the root directory of a2d
METIS_SOURCE_DIR=$(pwd)/extern &&
METIS_INSTALL_DIR=$(pwd)/installs/metis &&
cd $METIS_SOURCE_DIR &&
wget https://src.fedoraproject.org/lookaside/pkgs/metis/metis-5.1.0.tar.gz/5465e67079419a69e0116de24fce58fe/metis-5.1.0.tar.gz &&
tar -zxvf metis-5.1.0.tar.gz &&
cd metis-5.1.0 &&
make config prefix=$METIS_INSTALL_DIR &&
make &&
make install

Testing

Unit tests are implemented using Google Test framework, which is automatically downloaded when building tests.

CTest (bundled with CMake) is used to execute tests, simply go to<build dir>/tests and execute

ctest

Coding style

clangFormat is used as the auto-formatter, with style --style=Google. If you would like to contribute to the project, please make sure you set up the auto-formatter accordingly.

About

A multi-physics finite element code that uses A2D.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages