Material models of solids, to be used for example in FEM programs
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
develop
docs
python
src
.gitignore
LICENSE
README.md

README.md

GooseMaterial

This library includes several material models of solids, to be used for example in FEM programs. The idea is that each material model is included in a separate header-only C++ library, which is completely independent. As a rule of principle the different material model follow the same structure and use <cppmat/tensor.h> and/or <cppmat/tensor3.h> as tensor library, but the details may vary from material to material.

Contents

Disclaimer

This library is free to use under the GPLv3 license. Any additions are very much appreciated, in terms of suggested functionality, code, documentation, testimonials, word of mouth advertisement, .... Bug reports or feature requests can be filed on GitHub. As always, the code comes with no guarantee. None of the developers can be held responsible for possible mistakes.

Download: .zip file | .tar.gz file.

(c - GPLv3) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/GooseMaterial

Materials

The following materials have been implemented:

Installation

This library is header only, so in principle one does not need to install anything to be able to use it in C++. However it might be a good idea to copy the header to the appropriate location on the system, and to configure pkg-config. The steps to follow are identical to those of cppmat. The most common thing to do is:

# create a build directory if needed
mkdir /path/to/GooseMaterial/src/build

# proceed to build directory
cd /path/to/GooseMaterial/src/build

# modify ".." to your need, e.g. "/path/to/GooseMaterial/src"
cmake ..

# 'install' the header configuration files (just copying of files)
make install

C++

The use of the header-only C++ library can be illustrated using an example:

#include <GooseMaterial/Metal/LinearStrain/Elastic.h>

using GM = GooseMaterial::Metal::LinearStrain::Elastic;

include main()
{
  ...

  // elastic parameters
  double E  = 1.0;
  double nu = 0.3;
  double K,G;

  // convert elastic parameters to the pair required by "GooseMaterial::Metal::LinearStrain::Elastic"
  std::tie(K,G) = GM::ConvertParameters("E,nu",E,nu,"K,G");

  // linear elastic material
  GM::Cartesian3d::Material mat = GM::Cartesian3d::Material(K,G);

  ...
}

Whereby in the case of an inhomogeneous solid one wants to have many material definitions. For example one per finite element:

#include <vector>
#include <GooseMaterial/Metal/LinearStrain/Elastic.h>

using GM = GooseMaterial::Metal::LinearStrain::Elastic::::Cartesian3d;

int main()
{

  ...

  std::vector<GM::Material> mat( nelem );

  for ( size_t i = 0 ; i < nelem ; ++i )
  {
    double K = ...
    double G = ...

    GM::Material emat = GM::Material(K,G);

    mat.push_back( emat );
  }

  ...
}

Compilation is easy, since the library is header only. Provided that pkg-config is setup on can use:

clang++ `pkg-config --cflags cppmat GooseMaterial` -std=c++14 -o example example_name.cpp

Or one can use

clang++ -I/path/to/cppmat -I/path/to/GooseMaterial -std=c++14 -o example example_name.cpp

To compile with CMake, include the following lines in your CMakeLists.txt

find_package(PkgConfig)

pkg_check_modules(GOOSEMATERIAL REQUIRED GooseMaterial)
include_directories(${GOOSEMATERIAL_INCLUDE_DIRS})

Python

The materials also have a Python interface. To use it just run

cd /path/to/GooseMaterial/python

python3 setup.py build
python3 setup.py install

where one has to replace the executable python3 with ones favorite Python version (e.g. python). Note that the latter commands copies the relevant files to the correct location, where Python can find them.