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.
Before proceeding with the installation, ensure that your system has the necessary dependencies. The prerequisites of FANS can be installed using Spack for a streamlined setup on high-performance computing systems, or through traditional package management for personal use.
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 large clusters or supercomputers.
-
Install Spack: If you don’t have Spack installed, you can set it up with the following commands:
git clone https://github.com/spack/spack.git cd spack/bin source ./spack
-
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
You can also use alternative and optimized FFTW implementations depending on your system's architecture like amdfftw (For AMD systems) or cray-fftw (For Cray systems) or fujitsu-fftw (For Fujitsu systems).
-
Load Dependencies Once dependencies are installed, you can load them before building:
spack load cmake mpi hdf5 eigen fftw
If you're setting up FANS on a personal computer or in a non-HPC environment, follow these instructions:
Please ensure you have the following dependencies installed on your system:
- CMake (version 3.0 or higher)
- MPI (mpicc and mpic++)
- HDF5 with parallel support
- Eigen3
- FFTW3 with MPI support
Specifically, to run FANS, you at least need the following packages:
openmpi-bin libc6 libfftw3-double3 libfftw3-mpi3 libgcc-s1 libgomp1 libhdf5-103 libopenmpi3 libstdc++6
To build fans, you additionally need these packages:
libhdf5-dev libopenmpi-dev libeigen3-dev libfftw3-dev libfftw3-mpi-dev
If for some reason you are unable to install these packages directly on your host machine, have a look at the set of Docker images to create and work with FANS within an isolated environment.
-
Clone the repository:
git clone https://github.tik.uni-stuttgart.de/DAE/FANS.git cd FANS
-
Configure the project using CMake:
mkdir build cd build cmake ..
-
Compile the project:
cmake --build . -j
The compilation will symlink the generated FANS
binary into the test/
directory for convenience.
This project supports the following CMake build options:
-
CMAKE_BUILD_TYPE
: Sets the build type. Common values are Debug, Release, RelWithDebInfo, and MinSizeRel. -
FANS_BUILD_STATIC
: Build static library instead of shared library.- Default: OFF
- Usage:
-DFANS_BUILD_STATIC=ON
-
CMAKE_INTERPROCEDURAL_OPTIMIZATION
: Enable interprocedural optimization (IPO) for all targets.- Default: ON (if supported)
- Usage:
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
- Note: When you run the configure step for the first time, IPO support is automatically checked and enabled if available. A status message will indicate whether IPO is activated or not supported.
After compiling, you can install FANS (system-wide) using the following options:
-
Using CMake (sudo required if --prefix is omitted):
cmake --install . [--prefix <install-dir>]
-
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
To run the FANS solver, you need to provide a JSON input file specifying the problem parameters.
The input file is in JSON format and contains several fields to define the problem settings:
ms_filename
: Path to the microstructure file (HDF5 format).ms_datasetname
: Path to the dataset inside the HDF5 file.ms_L
: List defining the domain size.matmodel
: Material model (e.g.,ThermalLinear
,MechLinear
,HyperElastic
).material_properties
: Material properties relevant to the chosen material model.problem_type
: Type of the problem (thermal
ormechanical
).method
: Solution method (fp
for fixed point orcg
for conjugate gradient).TOL
: Tolerance for the solver.n_it
: Maximum number of iterations.g0
: Macroscale loading vector.
To run a linear elastic mechanical homogenization problem for a single load case on a microstructure image of size 256 x 256 x 256
with a single spherical inclusion,
mpiexec -n 1 ./FANS input_files/sphere_mech.json
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).