NeoPZ
NeoPZ is an open-source, cross-platform, finite element library written in C++ with support for many advanced finite element techniques.
The documentation is available here.
Features
- Discontinuous, H1, H(div) and H(curl) conforming approximation spaces
- Multiphysics support
- hp-adaptivity
- Non-uniform meshes with support for hanging nodes
- Non-linear geometrical mappings (curved elements with exact representation)
- Run-time defined geometrical refinement patterns
- Forward automatic differentiation
And much more!
Requirements
- A C++ 17 compiler
- CMake 3.13.0+
Optional external libraries
- Paraview is recommended for display of VTK output files.
The usage of NeoPZ can be improved by linking against the following libraries:
- log4cxx, for logging information for debugging purposes.
- Intel MKL, for enabling sparse matrices solvers (in-house algorithms for skyline matrices are available, among other matrix storage formats).
- METIS for (experimental) support of the BDDC technique.
- TBB, also used for experimental techniques such as BDDC
- blaze, needed for projects using SBFEM
- LAPACK, for eigenvalues computations in full or banded matrices. If enabled, it is also internally used replacing in-house linear algebra algorithms with BLAS functions.
- Boost, for experimental techniques.
- Catch2, for Unit Testing.
Configuration and Install
The NeoPZ library uses CMake for configuring and installing the library. As a simple example, on UNIX systems, this could be done as:
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DUSING_LOG4CXX=ON -DUSING_MKL=ON ..
make -j && sudo make install
where some CMake options were given as an illustration. The following CMake options are available:
REAL_TYPE
: which floating point type to use for real data types (geometry). It can be set asfloat
,double
,long double
,pzfpcounter
(last option is for internal usage). Default value:double
.STATE_TYPE
: which floating point type to use for the Finite Element matrices. It can be set asfloat
,double
,long double
. Complex matrices will be created usingstd::complex<STATE>
, which is aliased toCSTATE
. Default value:double
.CMAKE_INSTALL_PREFIX
: where to install the NeoPZ library. Defaulted to/opt/neopz
on UNIX systems.USING_BLAZE
: Enable blaze library supportUSING_BOOST
: Enable Boost libraries (Boost::date_time
,Boost::graph
andBoost::unit_test_framework
) supportUSING_LAPACK
: Enable LAPACK library supportUSING_MKL
: Enable MKL library support. It will also enable usage of LAPACK functions.USING_LOG4CXX
: Enable logging information through log4cxx support.USING_METIS
: Enable Metis library support.CMAKE_BUILD_TYPE
:Release
,Debug
andRelWithDebugInfo
BUILD_UNITTESTING
: this option will include the Unit Test suite. It automatically downloadsCatch2
if needed.BUILD_PROJECTS
: this option will include the examples from NeoPZExamples in the build tree.BUILD_PLASTICITY_MATERIALS
: to include support for classes modelling plastic materials.BUILD_DOCS
: build documentation using Doxygen. It requires Doxygen and Graphviz.BUILD_SPHINX_DOCS
: use Breathe for generating Sphinx from the Doxygen output.
Note: MKL has recently changed how they distribute their libraries, using the oneAPI programming model. See here how to set up oneAPI MKL for usage with NeoPZ. In UNIX systems, adding the
source /opt/intel/oneapi/setvars.sh intel64
command to your shell startup file (~/.bashrc_profile
, ~/.zshenv
, etc) should suffice.
For older MKL distributions, the script is located in:
source MKL_DIR/bin/compilervars.sh intel64
Internal options/deprecated options
The remaining USING_XXX
CMake options are for internal usage only.
The following options are listed for completeness:
BUILD_PERF_TESTS
: for building a few performance tests. The tests are in need of a revision.BUILD_PUBLICATIONS
: build legacy projects with code used to generate results that were published.
Should any problems arise during the installation of NeoPZ library, please contact us on neopz@googlegroups.com.
Using NeoPZ in your C++ project
The installation of NeoPZ will provide the add_pz_target
function to be used in the CMake files of your project. A minimal example of the CMakeLists.txt
files for a project using the NeoPZ library follows:
proj_root/CMakelists.txt
cmake_minimum_required(VERSION 3.13)
project (MySuperProject LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Finding the pz package
find_package(NeoPZ REQUIRED)
# Finding other packages
# Let us assume that the following call will define
# OtherDep::OtherDep
# OTHERDEP_INCLUDE_DIRS
find_package(OtherDep REQUIRED)
add_subdirectory(MySubDirectory)
proj_root/MySubDirectory/CMakeLists.txt
add_pz_target(
NAME MyTarget
SOURCES MySources.cpp
FILES file_to_be_copied_to_binary_dir.abc
REQUIRED PZ_USING_MKL)
target_link_libraries(MyTarget PRIVATE OtherDep::OtherDep)
target_include_directories(MyTarget PRIVATE ${OTHERDEP_INCLUDE_DIRS})
Note: If you don't want to use the function add_pz_target()
, the PZ library target is available under the alias NeoPZ::pz
. It can still be linked through CMake's target_link_libraries(my_target <PRIVATE|PUBLIC> NeoPZ::pz)
The CMake options defined when configuring NeoPZ will be available to the external targets with the PZ
prefix (USING_MKL
becomes PZ_USING_MKL
). So, if a certain option is needed in an external project, the REQUIRED
field in add_pz_targets
can be used. Note: PZ_LOG
is used both internally and externally for identifying if there is support for logging.
Note: NeoPZ will be installed in UNIX systems in /opt/neopz
by default. If /opt
or /opt/bin
is not on your PATH
, the CMake variable NEOPZ_DIR
can be used in your project using NeoPZ:
mkdir build && cd build
cmake -DNEOPZ_DIR=pz_install_dir ..
or, if you prefer, the following line
export PATH=pz_install_dir:$PATH
can be added to a startup file of your shell. In both examples, pz_install_dir
is /opt/neopz
.
NeoPZ documentation
A Doxygen documentation can be found here.
How to cite NeoPZ
Devloo, P.R. B., 1997. PZ: An object oriented environment for scientific programming. Computer Methods in Applied Mechanics and Engineering 150, 133–153. https://doi.org/10.1016/s0045-7825(97)00097-2
@article{neopz97,
author = {Devloo, Philippe Remy Bernard},
year = {1997},
month = {12},
pages = {},
title = {PZ: An object oriented environment for scientific programming},
volume = {150},
booktitle = {Computer Methods in Applied Mechanics and Engineering},
doi = {https://doi.org/10.1016/s0045-7825(97)00097-2}
}