How to use Armadillo in OpenFOAM

From OpenFOAMWiki


This page is dedicated to explaining how to use Armadillo in OpenFOAM.

When Armadillo installed you have to make following modifications.

File Make/options

    -lfiniteVolume \
    -llapack \
    -lblas \

Add inclusion of Armadillo to solver's main C++ file

#include "fvCFD.H"
#include "OFstream.H"
#include <armadillo>
#include "complex.H"
#include <math.h>

Armadillo function could be called for example like this

arma::mat Ar = arma::zeros<arma::mat>(p.size(),p.size());
scalar x = arma::det(Ar);

Then compile your solver ($ wmake). That's it.

For details - example of Armadillo+OpenFOAM made from potentialFoam solver: