DataAnalyticsEngineering / FANS

FANS: an open-source, efficient, and parallel FFT-based homogenization solver designed to solve microscale multiphysics problems.
GNU Lesser General Public License v3.0
8 stars 2 forks source link
cpp fast-fourier-transform fft-based-homogenization finite-element-method high-performance-computing homogenization image-based microstructure multi-physics multi-physics-and-multiscale multiscale-simulation nonlinear

Fourier Accelerated Nodal Solvers (FANS)

Fourier Accelerated Nodal Solvers (FANS) is an FFT-based homogenization solver designed to handle microscale multiphysics problems. This repository contains a C++ implementation of FANS, built using CMake and MPI for parallel computations.

Example Image

Table of contents

Dependencies

FANS has the following dependencies:

Installing dependencies

We recommend installing the dependencies using a package manager. For example, using apt, the following commands are run:

apt-get install \
    libhdf5-dev \
    libopenmpi-dev \
    libeigen3-dev \
    libfftw3-dev \
    libfftw3-mpi-dev

Also, we recommend to set up a Python virtual environment for the FANS_Dashboard:

apt-get install \
    time \
    htop \
    python3 \
    python3-pip \
    python3-venv \
    python-is-python3 \
    python3-dev

python -m venv ~/venvs/FANS
source ~/venvs/FANS/bin/activate
python -m pip install h5py lxml

We also provide a set of Docker images to work with FANS within an isolated environment.

Installing dependencies using Spack

Spack is a package manager designed for high-performance computing environments. It simplifies the installation of complex software stacks, making it ideal for setting up FANS on remote systems.

  1. Install Spack: If Spack is not installed, set it up with the following commands:

    git clone https://github.com/spack/spack.git
    cd spack/bin
    source ./spack
  2. Install Dependencies: Once Spack is set up, you can install the required dependencies:

    spack install cmake
    spack install mpi
    spack install hdf5 +cxx +mpi
    spack install eigen
    spack install fftw +mpi

    Alternatively, optimized FFTW implementations can be used depending on your system's architecture, for example amdfftw (For AMD systems) or cray-fftw (For Cray systems) or fujitsu-fftw (For Fujitsu systems).

  3. Load Dependencies Once dependencies are installed, you can load them before building:

    spack load cmake mpi hdf5 eigen fftw

Building

  1. Clone the repository:

    git clone https://github.com/DataAnalyticsEngineering/FANS.git
    cd FANS
  2. Configure the build using CMake:

    mkdir build
    cd build
    cmake ..
  3. Compile:

    cmake --build . -j

The compilation symlinks the generated FANS binary into the test/ directory for convenience.

Configuring a build

The following CMake configuration options exist:

Installing

Install FANS (system-wide) using the following options:

  1. Using CMake (sudo required if --prefix is omitted):

    cmake --install . [--prefix <install-dir>]
  2. Using .deb packages (only debian based distros; sudo required):

    cpack -G "DEB"
    apt install packages/fans_<version>_<architecture>.deb
    apt install packages/fans-dev_<version>_<architecture>.deb

Input File Format

FANS requires a JSON input file specifying the problem parameters. Example input files can be found in the test/input_files directory. It is recommended to use these files as a reference to create your own input file.

Microstructure Definition

"ms_filename": "microstructures/sphere32.h5",
"ms_datasetname": "/sphere/32x32x32/ms",
"ms_L": [1.0, 1.0, 1.0]

Problem Type and Material Model

"matmodel": "LinearElasticIsotropic",
"material_properties": {
    "bulk_modulus": [62.5000, 222.222],
    "shear_modulus": [28.8462, 166.6667]
}

Solver Settings

"method": "cg",
"error_parameters":{
    "measure": "Linfinity",
    "type": "absolute",
    "tolerance": 1e-10
},
"n_it": 100,

Macroscale Loading Conditions

"macroscale_loading":   [
                            [
                                [0.004, -0.002, -0.002, 0, 0, 0],
                                [0.008, -0.004, -0.004, 0, 0, 0],
                                [0.012, -0.006, -0.006, 0, 0, 0],
                                [0.016, -0.008, -0.008, 0, 0, 0],
                            ],
                            [
                                [0, 0, 0, 0.002, 0, 0],
                                [0, 0, 0, 0.004, 0, 0],
                                [0, 0, 0, 0.006, 0, 0],
                                [0, 0, 0, 0.008, 0, 0],
                            ]
                        ],

In the case of path/time-dependent loading as shown, for example as in plasticity problems, the macroscale_loading array can include multiple steps with corresponding loading conditions.

Results Specification

"results": ["stress_average", "strain_average", "absolute_error", "phase_stress_average", "phase_strain_average",
            "microstructure", "displacement", "stress", "strain"]

Examples

Execute the run_tests.sh file to run tests, which are also examples. For example, to run a linear elastic mechanical homogenization problem for a 6 othonormal load cases on a microstructure image of size 32 x 32 x 32 with a single spherical inclusion,

mpiexec -n 2 ./FANS input_files/test_LinearElastic.json test_results.h5

Acknowledgements

Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy - EXC 2075 – 390740016. Contributions by Felix Fritzen are funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) within the Heisenberg program - DFG-FR2702/8 - 406068690; DFG-FR2702/10 - 517847245 and through NFDI-MatWerk - NFDI 38/1 - 460247524. We acknowledge the support by the Stuttgart Center for Simulation Science (SimTech).

Contributors